pgTxr.h

Go to the documentation of this file.
00001 
00002 /*  $Id: pgTxr.h 416 2005-01-24 02:53:15Z terry_teague $    */
00003 
00004 /* Paige Technology, copyright 1993-1995 by DataPak Software, Inc.
00005 This header file defines all the components for the built-in import-export mechanism,
00006 including the generic Import and Export classes and default member functions for file
00007 transfer. */
00008 
00009 #ifndef PGTXR_H
00010 #define PGTXR_H
00011 
00012 #include "PAIGE.H"
00013 
00014 #define MINIMUM_RTF_VERSION     0x00010015 /* Minimum PAIGE version for RTF */
00015 
00016 /* Standard file types supported automatically: */
00017 
00018 enum {
00019     pg_unknown_type,    // Unknown file type
00020     pg_text_type,       // Standard ASCII text
00021     pg_rtf_type,        // RTF format
00022     pg_paige_type       // Standard PAIGE file type
00023 };
00024 
00025 typedef void PG_FAR * c_import_filter;
00026 typedef void PG_FAR * c_export_filter;
00027 
00028 /* Translation filter structure to and from a pg_ref */
00029 
00030 struct pg_translator {
00031     memory_ref          data;               // Data transferred (read) or to-transfer (write)
00032     memory_ref          stylesheet_table;   // Contains list of possible stylesheets
00033     long                bytes_transferred;  // Number of bytes in buffer
00034     long                total_text_read;    // Total transferred to-moment
00035     long                cache_begin;        // Beginning file offset (if cache enabled)
00036     style_info          format;             // Style(s) and character format of text
00037     par_info            par_format;         // Paragraph format(s) of the text
00038     font_info           font;               // Font applied to this text
00039     pg_doc_info         doc_info;           // General document information
00040     unsigned long       flags;              // Attributes of last transfer
00041     pg_boolean          format_changed;     // Set to TRUE if format is different than last txr
00042     pg_boolean          par_format_changed; // Set to TRUE if par format different than last txr
00043     pg_boolean          font_changed;       // Set to TRUE if font different than last txr
00044     pg_boolean          doc_info_changed;   // Set to TRUE if document info changed since last txr
00045 // The following items used only by export class:
00046     long                data_type;          // Type of data being exported (can by pict, etc.)
00047     long                data_param1;        // Additional data for data type */
00048     long                data_param2;        // Additional data for data type */
00049 };
00050 
00051 /* Data types for export: */
00052 
00053 enum {
00054     export_text_type,
00055     export_embed_type
00056 };
00057 
00058 /* Character types out: */
00059 
00060 enum {
00061     ascii_char_out,
00062     delimiter_char_out,
00063     command_char_out
00064 };
00065 
00066 typedef struct pg_translator pg_translator;
00067 typedef pg_translator PG_FAR *pg_translator_ptr;
00068 
00069 /* Stylesheet table record: */
00070 
00071 struct style_table_entry {
00072     pg_char             name[FONT_SIZE];
00073     style_info          style;
00074     font_info           font;
00075     par_info            par;
00076     pg_boolean          has_styles;
00077     pg_boolean          has_par_styles;
00078     pg_boolean          has_font;
00079     short               style_id;
00080 };
00081 
00082 typedef struct style_table_entry style_table_entry;
00083 typedef style_table_entry PG_FAR *style_entry_ptr;
00084 
00085 struct style_table {
00086     short               style_id;
00087     short               rsrv;
00088     long                index;
00089 };
00090 
00091 typedef struct style_table style_table;
00092 typedef style_table PG_FAR *style_table_ptr;
00093 
00094 /* Flag settings for the translator record: */
00095 
00096 #define TRANSFER_NOT_TEXT       0x00000001  /* Data transfer is not text */
00097 #define TRANSFER_PAR_END        0x00000002  /* Ending char ends paragraph */
00098 #define TRANSFER_WAS_DIRECT     0x00000004  /* Data transferred directly (no insert(s) required */
00099 
00100 
00101 /* Import preparation flags: */
00102 
00103 #define IMPORT_TEXT_FLAG                0x00000001  /* Import raw text */
00104 #define IMPORT_TEXT_FORMATS_FLAG        0x00000002  /* Import text formats */
00105 #define IMPORT_PAR_FORMATS_FLAG         0x00000004  /* Import paragraph formats */
00106 #define IMPORT_PAGE_INFO_FLAG           0x00000008  /* Import page info (do not necessarily apply) */
00107 #define IMPORT_CONTAINERS_FLAG          0x00000010  /* Import container boxes */
00108 #define IMPORT_HEADERS_FLAG             0x00000020  /* Import headers */
00109 #define IMPORT_FOOTERS_FLAG             0x00000040  /* Import footers */
00110 #define IMPORT_FOOTNOTES_FLAG           0x00000080  /* Import footnotes */
00111 #define IMPORT_EMBEDDED_OBJECTS_FLAG    0x00000100  /* Import recognized embed_refs */
00112 #define IMPORT_PAGE_GRAPHICS_FLAG       0x00000200  /* Import page-anchored pictures */
00113 #define IMPORT_STYLESHEETS_FLAG         0x00000400  /* Import defined stylesheets */
00114 #define APPLY_PAGE_DIMENSIONS           0x02000000  /* Apply paper and page sizes */
00115 #define IMPORT_CACHE_FLAG               0x04000000  /* Import cache (paging) method */
00116 #define IMPORT_EVERYTHING_FLAG          0x00FFFFFF  /* Import everything you can */
00117 
00118 /* Import capability bits: */
00119 
00120 #define IMPORT_TEXT_FEATURE             0x00000001  /* Can import raw text */
00121 #define IMPORT_TEXT_FORMATS_FEATURE     0x00000002  /* Can import text formats */
00122 #define IMPORT_PAR_FORMATS_FEATURE      0x00000004  /* Can import paragraph formats */
00123 #define IMPORT_PAGE_INFO_FEATURE        0x00000008  /* Can import page dimensions */
00124 #define IMPORT_CONTAINERS_FEATURE       0x00000010  /* Can import containers */
00125 #define IMPORT_HEADERS_FEATURE          0x00000020  /* Can import headers */
00126 #define IMPORT_FOOTERS_FEATURE          0x00000040  /* Can import footers */
00127 #define IMPORT_FOOTNOTES_FEATURE        0x00000080  /* Can import footnotes */
00128 #define IMPORT_EMBEDDED_OBJECTS_FEATURE 0x00000100  /* Can import standard, supported embed_refs */
00129 #define IMPORT_PAGE_GRAPHICS_FEATURE    0x00000200  /* Can import graphics anchored to page */
00130 #define IMPORT_SERIAL_SETUP             0x01000000  /* Setup serial byte read */
00131 #define IMPORT_CACHE_CAPABILITY         0x40000000  /* Can import with "cache" feature */
00132 
00133 /* Export preparation flags: */
00134 
00135 #define EXPORT_TEXT_FLAG                0x00000001  /* Export raw text */
00136 #define EXPORT_TEXT_FORMATS_FLAG        0x00000002  /* Export text formats */
00137 #define EXPORT_PAR_FORMATS_FLAG         0x00000004  /* Export paragraph formats */
00138 #define EXPORT_PAGE_INFO_FLAG           0x00000008  /* Export page info (do not necessarily apply) */
00139 #define EXPORT_CONTAINERS_FLAG          0x00000010  /* Export container boxes */
00140 #define EXPORT_HEADERS_FLAG             0x00000020  /* Export headers */
00141 #define EXPORT_FOOTERS_FLAG             0x00000040  /* Export footers */
00142 #define EXPORT_FOOTNOTES_FLAG           0x00000080  /* Export footnotes */
00143 #define EXPORT_EMBEDDED_OBJECTS_FLAG    0x00000100  /* Export recognized embed_refs */
00144 #define EXPORT_PAGE_GRAPHICS_FLAG       0x00000200  /* Export page-anchored pictures */
00145 #define EXPORT_STYLESHEETS_FLAG         0x00000400  /* Export defined stylesheets */
00146 #define INCLUDE_LF_WITH_CR              0x02000000  /* Add LF with CR if not already */
00147 #define EXPORT_CACHE_FLAG               0x04000000  /* Export cached file */
00148 #define EXPORT_UNICODE_FLAG             0x08000000  /* Write text as UNICODE */
00149 
00150 #define EXPORT_EVERYTHING_FLAG          0x00FFFFFF  /* Export everything you can */
00151 
00152 /* Export capability bits: */
00153 
00154 #define EXPORT_TEXT_FEATURE             0x00000001  /* Can Export raw text */
00155 #define EXPORT_TEXT_FORMATS_FEATURE     0x00000002  /* Can Export text formats */
00156 #define EXPORT_PAR_FORMATS_FEATURE      0x00000004  /* Can Export paragraph formats */
00157 #define EXPORT_PAGE_INFO_FEATURE        0x00000008  /* Can Export page dimensions */
00158 #define EXPORT_CONTAINERS_FEATURE       0x00000010  /* Can Export containers */
00159 #define EXPORT_HEADERS_FEATURE          0x00000020  /* Can Export headers */
00160 #define EXPORT_FOOTERS_FEATURE          0x00000040  /* Can Export footers */
00161 #define EXPORT_FOOTNOTES_FEATURE        0x00000080  /* Can Export footnotes */
00162 #define EXPORT_EMBEDDED_OBJECTS_FEATURE 0x00000100  /* Can Export standard, supported embed_refs */
00163 #define EXPORT_PAGE_GRAPHICS_FEATURE    0x00000200  /* Can Export graphics anchored to page */
00164 #define EXPORT_CACHE_FEATURE            0x00100000  /* Can Export cache method */
00165 #define EXPORT_UNICODE_FEATURE          0x00200000  /* Can export UNICODE */
00166 
00167 #define EXPORT_SERIAL_SETUP             0x01000000  /* Setup serial byte buffer */
00168 
00169 /* Miscellaneous: */
00170 
00171 #define MAX_TEXT_BUFFER                 4096        /* Max buffer used by filter in serial mode */
00172 #define TRANSLATOR_BUFFER_SIZE          4096        /* Default buffer size */
00173 #define UNKNOWN_POSITION                -1          /* Used for unknown file position */
00174 #define PICT_APPEND_SIZE                512         /* Size to append memory_ref when reading pict */
00175 #define HIGH_CHARS_BASE                 128
00176 #define HIGH_CHARS_QTY                  128
00177 #define N_A                             0x00    /* Char not supported */
00178 #define MSWORD_TOPBOTTOM_MARGIN         72      /* Default top and bottom MS Word margins (point) */
00179 #define MSWORD_LEFTRIGHT_MARGIN         90      /* Default left and right MS Word margins (point) */
00180 #define KIND_STR_SIZE                   4       /* Max size of filetype string */
00181 
00182 /* RTF Character Constants: */
00183 
00184 #define RTF_COMMAND_CHAR        0x5C
00185 #define RTF_GROUPBEGIN_CHAR     0x7B
00186 #define RTF_GROUPEND_CHAR       0x7D
00187 #define RTF_HEX_CHAR            0x27
00188 #define RTF_STAR_CHAR           0x2A
00189 #define RTF_COLON               0x3A
00190 
00191 #define TABLE_TERMINATOR        0x3B
00192 #define MAX_COMMAND_BYTES       32      /* Maximum bytes for any command */
00193 
00194 /* Special characters: */
00195 
00196 #define NON_BREAKING_SPACE_CHAR '~'
00197 #define NON_REQUIRED_HYPHEN_CHAR    '-'
00198 #define NON_BREAKING_HYPHEN '_'
00199 #define NEGATIVE_SIGN_CHAR '-'
00200 
00201 /* Internal table tokens (used by me, not in RTF stream): */
00202 
00203 #define TABLE_TERMINATOR_CHAR   0x7C
00204 
00205 /* Import mode record */
00206 
00207 struct pg_import_rec {
00208     long                target_pos;      /* Target import position once done. */
00209     long                t_length;        /* Text length so far */
00210     pg_short_t          last_style_item; /* Last style_info item applied */
00211     pg_short_t          last_par_item;   /* Last paragraph item applied */
00212     short               last_font_index; /* Last font item applied */
00213     memory_ref          t_blocks;        /* Text blocks solely for importing */
00214     memory_ref          t_style_run;     /* Style run used for importing */
00215     memory_ref          par_style_run;   /* Paragraph run used for importing */
00216     memory_ref          previous_import; /* Previous import control, if any (so we can nest) */
00217 };
00218 
00219 typedef struct pg_import_rec pg_import_rec;
00220 typedef pg_import_rec PG_FAR *pg_import_ptr;
00221 
00222 
00223 #ifdef __cplusplus
00224 extern  "C" {
00225 #endif
00226 
00227 extern PG_PASCAL (void) pgInitTranslatorRec (pg_globals_ptr globals, pg_translator_ptr translator_ptr);
00228 extern PG_PASCAL (void) pgDisposeTranslatorRec (pg_translator_ptr translator_ptr);
00229 extern PG_PASCAL (pg_filetype) pgDetermineFileType (pg_file_unit fileref, file_io_proc io_proc,
00230         long starting_position);
00231 extern PG_PASCAL (pg_boolean) pgVerifyRTF (pg_file_unit fileref, file_io_proc io_proc,
00232         long starting_position);
00233 extern PG_PASCAL (short) pgConvertResolution (paige_rec_ptr pg, short pointvalue);
00234 extern PG_PASCAL (short) pgResolutionConvert (paige_rec_ptr pg, short value);
00235 extern PG_PASCAL (pg_error) pgImportFileFromC (pg_ref pg, pg_filetype filetype, long feature_flags,
00236         long file_begin, pg_file_unit f_ref);
00237 extern PG_PASCAL (pg_error) pgExportFileFromC (pg_ref pg, pg_filetype filetype, long feature_flags,
00238         long file_begin, select_pair_ptr output_range, pg_boolean use_selection, pg_file_unit f_ref);
00239 extern PG_PASCAL (void) pgMapCharacters (pg_globals_ptr globals, pg_char_ptr chars, long num_chars,
00240         pg_char_ptr character_table);
00241 extern PG_PASCAL (short) pgCompareFontTable (pg_char_ptr source_font, pg_char_ptr table_font);
00242 
00243 #ifdef __cplusplus
00244     }
00245 #endif
00246 
00247 #endif

Generated on Wed May 31 18:19:59 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6