1 /************************************************************************/ 2 /* */ 3 /* Levels in the Lists of the list table of a document. */ 4 /* */ 5 /* O) Word 7.0 == Word 95 compatibility */ 6 /* */ 7 /************************************************************************/ 8 9 # ifndef DOC_LIST_LEVEL_H 10 # define DOC_LIST_LEVEL_H 11 12 # include <utilPropMask.h> 13 # include <utilMemoryBuffer.h> 14 # include <textAttribute.h> 15 16 # include "docParaProperties.h" 17 18 typedef enum ListLevelAlignment 19 { 20 DOCllaLEFT= 0, 21 DOCllaCENTER, 22 DOCllaRIGHT, 23 24 DOClla_COUNT 25 } ListLevelAlignment; 26 27 typedef enum ListLevelFollow 28 { 29 DOCllfTAB= 0, 30 DOCllfSPACE, 31 DOCllfNONE, 32 33 DOCllf_COUNT 34 } ListLevelFollow; 35 36 /************************************************************************/ 37 /* */ 38 /* Holds the position of placeholders in the format that are replaced */ 39 /* the level numbers in the format string. */ 40 /* Actually there is an extra one that holds the length of the format */ 41 /* string. (In lnOffsetBytes) */ 42 /* */ 43 /************************************************************************/ 44 45 typedef struct LevelNumber 46 { 47 int lnOffsetBytes; /* Offset in llFormatString of the */ 48 /* end of the bytes that precede the */ 49 /* level number. */ 50 int lnConstChars; /* The number of unicode characters */ 51 /* that is encoded in UTF-8 at the */ 52 /* offset in the format string. This */ 53 /* is only used to write RTF. */ 54 int lnLevel; /* The list level that it shows. */ 55 } LevelNumber; 56 57 typedef struct ListLevel 58 { 59 int llStartAt; 60 unsigned char llNumberStyle; 61 unsigned char llJustification; 62 unsigned char llFollow; 63 unsigned char llPrevToDigits; 64 unsigned char llNoRestart; 65 unsigned char llFontBias; 66 short int llPictureNumber; 67 68 MemoryBuffer llFormatString; 69 /************************************************/ 70 /* In memory: */ 71 /* ---------- */ 72 /* A string thet holds the constant pieces of */ 73 /* the format. The level numbers and the length*/ 74 /* are in llLevelNumbers. */ 75 /* In the file: */ 76 /* ------------ */ 77 /* The first position holds the size of the */ 78 /* rest of the string. The rest is a format */ 79 /* string consisting of pieces of constant */ 80 /* string and placeholders for the level */ 81 /* numbers in the paragraph number. The */ 82 /* placeholders have low values that indicate */ 83 /* what level number to substitute. Use */ 84 /* llLevelNumbers to find the placeholders */ 85 /* Though the byte values are a clue, */ 86 /* llLevelNumbers is leading. E.G: */ 87 /* 1.1.1 -> \'06\'00.\'01.\'02 in the file */ 88 /* and ".." in memory. */ 89 /************************************************/ 90 long llTemplateID; 91 LevelNumber * llLevelNumbers; 92 int llLevelNumberCount; 93 /************************************************/ 94 /* In the file: */ 95 /* ------------ */ 96 /* Bytes giving the positions of level place- */ 97 /* holders in llTextFormat. The subscript */ 98 /* does not tell what level to substitute. */ 99 /* The byte in llTextFormat holds the level */ 100 /* number to substitute. As the format starts */ 101 /* with its size, indices start from 1. E.G: */ 102 /* 1.1.1 -> \'01\'03\'05 in the file. */ 103 /* NOTE that the indices are in terms of */ 104 /* characters: As the format string might have */ 105 /* a multi-byte encoding, the indices cannot */ 106 /* be used as byte indices. */ 107 /************************************************/ 108 109 unsigned char llFromOld; /* O */ 110 unsigned char llUsePrevText; /* O */ 111 unsigned char llUsePrevSpace; /* O */ 112 int llIndent; /* O */ 113 int llSpace; /* O */ 114 115 int llTabStopListNumber; 116 int llLeftIndentTwips; 117 int llFirstIndentTwips; 118 PropertyMask llParaPropertyMask; 119 120 TextAttribute llTextAttribute; 121 PropertyMask llTextAttributeMask; 122 } ListLevel; 123 124 typedef enum ListLevelProperty 125 { 126 LLpropSTARTAT, 127 LLpropSTYLE, 128 LLpropJUSTIFY, 129 LLpropFOLLOW, 130 LLpropLEGAL, 131 LLpropNORESTART, 132 LLpropPICTURE, 133 LLpropFBIAS, 134 135 LLpropTEXT, 136 LLpropTEMPLATEID, 137 LLpropNUMBERS, 138 139 LLpropOLD, 140 LLpropPREV, 141 LLpropPREVSPACE, 142 LLpropINDENT, 143 LLpropSPACE, 144 145 LLprop_COUNT 146 } ListLevelProperty; 147 148 /************************************************************************/ 149 /* */ 150 /* Routine declarations. */ 151 /* */ 152 /************************************************************************/ 153 154 extern void docInitDocumentListLevel( ListLevel * ll ); 155 extern void docCleanDocumentListLevel( ListLevel * ll ); 156 157 extern int docCopyDocumentListLevel( ListLevel * to, 158 const ListLevel * from, 159 int copyIds, 160 const int * fontMap, 161 const int * colorMap, 162 const int * rulerMap ); 163 164 extern int docListLevelSetStyle( ListLevel * ll, 165 const PropertyMask * paraMask, 166 const ParagraphProperties * pp, 167 const PropertyMask * textMask, 168 const TextAttribute * ta ); 169 170 extern int docListLevelSetText( int * pChanged, 171 ListLevel * ll, 172 const char * text, 173 int idx ); 174 175 extern int docListLevelGetText( char * to, 176 int maxsize, 177 const ListLevel * ll, 178 int idx ); 179 180 extern int docListLevelSetNumber( int * pChanged, 181 ListLevel * ll, 182 int number, 183 int idx ); 184 185 extern int docListLevelInsertNumber( ListLevel * ll, 186 int number, 187 int idx ); 188 189 extern int docListLevelDeleteNumber( ListLevel * ll, 190 int idx ); 191 192 extern int docListLevelFormatParagraphNumber( char * to, 193 int maxsize, 194 int * offsets, 195 int maxoffsets, 196 int ilvl, 197 const int * numberPath, 198 const int * startPath, 199 const int * formatPath, 200 const ListLevel * ll ); 201 202 extern int docListLevelFormatLevelNumber( 203 char * target, 204 int maxsize, 205 int val, 206 int format ); 207 208 extern int docDefaultListLevel( ListLevel * llTo, 209 int level, 210 int deftab, 211 int levelTemplateID, 212 const PropertyMask * taSetMask, 213 const TextAttribute * taSet ); 214 215 extern int docListLevelGetField( int * pConstOff, 216 int * pConstLen, 217 int * pConstChars, 218 int * pLevel, 219 const ListLevel * ll, 220 int field ); 221 222 extern int docListLevelToRtfStrings( 223 MemoryBuffer * mbtext, 224 MemoryBuffer * mbnumbers, 225 const ListLevel * ll ); 226 227 extern int docListLevelFromRtfStrings( 228 ListLevel * ll, 229 const MemoryBuffer * mbtext, 230 const MemoryBuffer * mbnumbers ); 231 232 extern void docListDocumentListLevel( int n, 233 const ListLevel * ll ); 234 235 extern int docSetListLevelProperty( ListLevel * ll, 236 int prop, 237 int val ); 238 239 extern int docListLevelApplyTextAttribute( 240 ListLevel * ll, 241 const PropertyMask * taSetMask, 242 const TextAttribute * taSet ); 243 244 # endif 245