1 /************************************************************************/ 2 /* */ 3 /* Document Properties. */ 4 /* */ 5 /************************************************************************/ 6 7 # ifndef DOC_DOCUMENT_PROPERTIES_H 8 # define DOC_DOCUMENT_PROPERTIES_H 9 10 # include <time.h> 11 12 # include <utilPropMask.h> 13 # include <utilPalette.h> 14 15 # include <utilDocumentGeometry.h> 16 # include <utilDocFontList.h> 17 # include <utilColor.h> 18 # include <utilMemoryBuffer.h> 19 20 # include "docNotesProperties.h" 21 # include "docListAdmin.h" 22 # include "docDocumentAttributeMap.h" 23 24 typedef enum DocumentProperty 25 { 26 DPpropNONE= -1, 27 28 DPpropSTART_PAGE= DGprop_COUNT, 29 30 DPpropFACING_PAGES, 31 DPpropGUTTER_HORIZONTAL, 32 DPpropWIDOWCTRL, 33 DPpropTWO_ON_ONE, 34 DPpropDOCTEMP, 35 DPpropRTOL, 36 37 DPpropNOTETYPES, /* \fetN */ 38 39 DPpropFOOTNOTE_STARTNR, 40 DPpropFOOTNOTE_JUSTIFICATION, 41 DPpropFOOTNOTE_PLACEMENT, 42 DPpropFOOTNOTE_RESTART, 43 DPpropFOOTNOTE_STYLE, 44 45 DPpropENDNOTE_STARTNR, 46 DPpropENDNOTE_JUSTIFICATION, 47 DPpropENDNOTE_PLACEMENT, 48 DPpropENDNOTE_RESTART, 49 DPpropENDNOTE_STYLE, 50 51 DPpropDEFTAB, 52 DPpropDOC_CHARSET, 53 DPpropANSICPG, 54 DPpropDEFLANG, 55 56 DPpropDEFF, 57 DPpropSTSHFDBCH, 58 DPpropSTSHFLOCH, 59 DPpropSTSHFHICH, 60 DPpropSTSHFBI, 61 62 DPpropGENERATOR, 63 DPpropTITLE, 64 DPpropSUBJECT, 65 DPpropKEYWORDS, 66 DPpropDOCCOMM, 67 DPpropAUTHOR, 68 DPpropCOMPANY, 69 DPpropHLINKBASE, 70 71 DPpropCREATIM, 72 DPpropREVTIM, 73 DPpropPRINTIM, 74 75 DPpropTOP_BORDER, 76 DPpropBOTTOM_BORDER, 77 DPpropLEFT_BORDER, 78 DPpropRIGHT_BORDER, 79 DPpropHEAD_BORDER, 80 DPpropFOOT_BORDER, 81 82 DPpropFONTTABLE, 83 DPpropCOLORTABLE, 84 DPpropSTYLESHEET, 85 DPpropLISTTABLE, 86 DPpropLISTOVERRIDETABLE, 87 88 DPprop_COUNT, 89 90 DPprop_INFO, 91 /****************************************/ 92 DPprop_IGNORED, /* Various document properties that */ 93 /* are ignored, but accepted to avoid */ 94 /* warnings. */ 95 /****************************************/ 96 97 DPprop_FULL_COUNT 98 } DocumentProperty; 99 100 typedef struct DocumentProperties 101 { 102 DocumentGeometry dpGeometry; 103 104 int dpTabIntervalTwips; 105 int dpDefaultColor; 106 int dpDocumentCharset; /* ansi, mac, pc, pca */ 107 int dpAnsiCodepage; 108 int dpDefaultLanguage; 109 110 int dpDefaultFont; 111 int dpDefaultFontDbch; 112 int dpDefaultFontLoch; 113 int dpDefaultFontHich; 114 int dpDefaultFontBi; 115 116 int dpStartPageNumber; 117 118 unsigned char dpHasFacingPages; 119 unsigned char dpGutterHorizontal; 120 unsigned char dpWidowControl; 121 unsigned char dpTwoOnOne; 122 unsigned char dpIsDocumentTemplate; 123 /** 124 * 0: This document will have English-style 125 * pagination (the default) 126 * Text in this document will be displayed from 127 * left to right unless overridden by a more 128 * specific control (the default) 129 * 1: This document will be formatted to have 130 * Arabic-style pagination 131 * Text in this document will be displayed from 132 * right to left unless overridden by a more 133 * specific control 134 */ 135 unsigned char dpRToL; 136 137 unsigned char dpFootEndNoteType; 138 FootEndNotesProperties dpNotesProps; 139 140 /* Owned by the document */ 141 DocumentFontList * dpFontList; 142 ListAdmin * dpListAdmin; 143 ColorPalette * dpColorPalette; 144 145 struct tm dpCreatim; 146 struct tm dpRevtim; 147 struct tm dpPrintim; 148 149 MemoryBuffer dpGeneratorRead; 150 MemoryBuffer dpGeneratorWrite; 151 MemoryBuffer dpTitle; 152 MemoryBuffer dpSubject; 153 MemoryBuffer dpKeywords; 154 MemoryBuffer dpDoccomm; 155 MemoryBuffer dpAuthor; 156 MemoryBuffer dpCompany; 157 MemoryBuffer dpHlinkbase; 158 MemoryBuffer dpFilename; 159 160 int dpTopBorderNumber; 161 int dpBottomBorderNumber; 162 int dpLeftBorderNumber; 163 int dpRightBorderNumber; 164 int dpHeadBorderNumber; 165 int dpFootBorderNumber; 166 167 /** 168 * Only used in Ted's own copy paste to distinguish 169 * between a copy/paste that just holds a text 170 * fragment and one that consists of whole paragraphs 171 */ 172 unsigned char dpHasOpenEnd; 173 /** 174 * Only used in Ted's own copy paste to know that 175 * a pasted document contains tables. 176 */ 177 unsigned char dpContainsTables; 178 } DocumentProperties; 179 180 # define docHasDocumentInfo( dp ) \ 181 ( (dp)->dpTitle.mbSize > 0 || \ 182 (dp)->dpSubject.mbSize > 0 || \ 183 (dp)->dpKeywords.mbSize > 0 || \ 184 (dp)->dpDoccomm.mbSize > 0 || \ 185 (dp)->dpHlinkbase.mbSize > 0 || \ 186 (dp)->dpAuthor.mbSize > 0 || \ 187 (dp)->dpCompany.mbSize > 0 || \ 188 (dp)->dpCreatim.tm_mday != 0 || \ 189 (dp)->dpRevtim.tm_mday != 0 || \ 190 (dp)->dpPrintim.tm_mday != 0 ) 191 192 # define DOCcolorBITS 8 193 # define DOCcolorMAXCOUNT (1<<DOCcolorBITS) 194 195 extern const int DOCdocNOTE_PROP_MAP[FEPprop_COUNT]; 196 197 extern const int * const DOCdocFOOTNOTE_PROP_MAP; 198 extern const int * const DOCdocENDNOTE_PROP_MAP; 199 200 /************************************************************************/ 201 /* */ 202 /* Routine Declarations. */ 203 /* */ 204 /************************************************************************/ 205 206 extern void docInitDocumentProperties( DocumentProperties * dp ); 207 208 extern void docCleanDocumentProperties( DocumentProperties * dp ); 209 210 extern int docCopyDocumentProperties( DocumentProperties * to, 211 const DocumentProperties * from ); 212 213 extern int docUpdDocumentProperties( 214 PropertyMask * pDoneMask, 215 DocumentProperties * dpTo, 216 const PropertyMask * dpSetMask, 217 const DocumentProperties * dpFrom, 218 const DocumentAttributeMap * dam ); 219 220 extern void docDocumentPropertyDifference( 221 PropertyMask * pDifMask, 222 const DocumentProperties * dp1, 223 const PropertyMask * cmpMask, 224 const DocumentProperties * dp2 ); 225 226 extern int docPropertiesSetFilename( DocumentProperties * dp, 227 const MemoryBuffer * filename ); 228 229 extern int docAllocateDocumentColor( DocumentProperties * dp, 230 const RGB8Color * rgb8 ); 231 232 extern int docSetDocumentProperty( DocumentProperties * dp, 233 int prop, 234 int arg ); 235 236 extern int docGetDocumentProperty( const DocumentProperties * dp, 237 int prop ); 238 239 extern struct tm * docGetDocumentPropertyTime( 240 DocumentProperties * dp, 241 int prop ); 242 243 extern MemoryBuffer * docGetDocumentPropertyBuffer( 244 DocumentProperties * dp, 245 int prop ); 246 247 extern int docSetDocumentPropertyString( DocumentProperties * dp, 248 int prop, 249 const char * val, 250 int vallen ); 251 252 extern int docSetDocumentPropertyTime( DocumentProperties * dp, 253 int prop, 254 const struct tm * val ); 255 256 extern void docFillDocFootnoteMask( PropertyMask * dpMask ); 257 extern void docFillDocEndnoteMask( PropertyMask * dpMask ); 258 extern void docFillDocNotesMask( PropertyMask * dpMask ); 259 260 # endif /* DOC_DOCUMENT_PROPERTIES_H */ 261