xref: /trunk/main/sw/source/filter/ww8/dump/ww8struc.hxx (revision 86e1cf34)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _WW8STRUC_HXX
25 #define _WW8STRUC_HXX
26 
27 #include <osl/endian.h>
28 #include <tools/string.hxx>
29 
30 
31 // max. Anzahl der Listen-Level in WW8: 1..9
32 #define nWW8MaxListLevel 9
33 
34 
Get_Byte(sal_uInt8 * & p)35 inline sal_uInt8 Get_Byte( sal_uInt8 *& p )
36 	{ sal_uInt8 n = SVBT8ToByte( *(SVBT8*)p );		p += 1; return n; }
37 
Get_Short(sal_uInt8 * & p)38 inline short Get_Short( sal_uInt8 *& p )
39 	{ short n = SVBT16ToShort( *(SVBT16*)p );	p += 2; return n; }
Get_UShort(sal_uInt8 * & p)40 inline sal_uInt16 Get_UShort( sal_uInt8 *& p )
41 	{ sal_uInt16 n = SVBT16ToShort( *(SVBT16*)p );	p += 2; return n; }
42 
Get_Long(sal_uInt8 * & p)43 inline long Get_Long( sal_uInt8 *& p )
44 	{ long n = SVBT32ToUInt32( *(SVBT32*)p );		p += 4; return n; }
Get_ULong(sal_uInt8 * & p)45 inline sal_uLong Get_ULong( sal_uInt8 *& p )
46 	{ sal_uLong n = SVBT32ToUInt32( *(SVBT32*)p );		p += 4; return n; }
47 
Set_UInt8(sal_uInt8 * & p,sal_uInt8 n)48 inline void Set_UInt8( sal_uInt8 *& p, sal_uInt8 n )
49 	{ ByteToSVBT8( n, *(SVBT8*)p );  p+= 1; }
50 
Set_UInt16(sal_uInt8 * & p,sal_uInt16 n)51 inline void Set_UInt16( sal_uInt8 *& p, sal_uInt16 n )
52 	{ ShortToSVBT16( n, *(SVBT16*)p );  p+= 2; }
53 
Set_UInt32(sal_uInt8 * & p,sal_uInt32 n)54 inline void Set_UInt32( sal_uInt8 *& p, sal_uInt32 n )
55 	{ UInt32ToSVBT32( n, *(SVBT32*)p );  p+= 4; }
56 
57 
58 #if defined  OSL_BIGENDIAN || SAL_TYPES_ALIGNMENT4 > 2 || defined UNX
59 #define __WW8_NEEDS_COPY
60 #else
61 #if defined WNT || defined OS2
62 #define __WW8_NEEDS_PACK
63 #pragma pack(2)
64 #endif
65 #endif
66 
67 typedef sal_Int16 WW8_PN;
68 typedef sal_Int32 WW8_FC;
69 typedef sal_Int32 WW8_CP;
70 
71 // STD: STyle Definition
72 //   The STD contains the entire definition of a style.
73 //   It has two parts, a fixed-length base (cbSTDBase bytes long)
74 //   and a variable length remainder holding the name, and the upx and upe
75 //   arrays (a upx and upe for each type stored in the style, std.cupx)
76 //   Note that new fields can be added to the BASE of the STD without
77 //   invalidating the file format, because the STSHI contains the length
78 //   that is stored in the file.  When reading STDs from an older version,
79 //   new fields will be zero.
80 struct WW8_STD
81 {
82 	// Base part of STD:
83 	sal_uInt16	sti : 12;          // invariant style identifier
84 	sal_uInt16	fScratch : 1;      // spare field for any temporary use,
85 														 // always reset back to zero!
86 	sal_uInt16	fInvalHeight : 1;  // PHEs of all text with this style are wrong
87 	sal_uInt16	fHasUpe : 1;       // UPEs have been generated
88 	sal_uInt16	fMassCopy : 1;     // std has been mass-copied; if unused at
89 														 // save time, style should be deleted
90 	sal_uInt16	sgc : 4;           // style type code
91 	sal_uInt16	istdBase : 12;     // base style
92 	sal_uInt16	cupx : 4;          // # of UPXs (and UPEs)
93 	sal_uInt16	istdNext : 12;     // next style
94 	sal_uInt16	bchUpe;            // offset to end of upx's, start of upe's
95 	//-------- jetzt neu:
96 	// ab Ver8 gibts zwei Felder mehr:
97   sal_uInt16	fAutoRedef : 1;    /* auto redefine style when appropriate */
98   sal_uInt16	fHidden : 1;       /* hidden from UI? */
99   sal_uInt16	: 14;              /* unused bits */
100 
101 	// Variable length part of STD:
102 	//	sal_uInt8	stzName[2];        /* sub-names are separated by chDelimStyle
103 	// char	grupx[];
104 			// the UPEs are not stored on the file; they are a cache of the based-on
105 		// chain
106 	// char	grupe[];
107 };
108 
109 /*
110 	Basis zum Einlesen UND zum Arbeiten (wird jeweils unter
111 	schiedlich beerbt)
112 */
113 struct WW8_FFN_BASE		// Font Descriptor
114 {
115 	// ab Ver6
116 	sal_uInt8	cbFfnM1;		// 	0x0 	total length of FFN - 1.
117 
118 	sal_uInt8	prg: 2;			//	0x1:03	pitch request
119 	sal_uInt8	fTrueType : 1;	//	0x1:04	when 1, font is a TrueType font
120 							//	0x1:08	reserved
121 	sal_uInt8	ff : 3;			//	0x1:70	font family id
122 							//	0x1:80	reserved
123 
124 	short wWeight;			// 	0x2		base weight of font
125 	sal_uInt8	chs;			//  0x4		character set identifier
126 	sal_uInt8	ibszAlt;		//	0x5		index into ffn.szFfn to the name of the alternate font
127 };
128 
129 /*
130 	Hiermit arbeiten wir im Parser (und Dumper)
131 */
132 struct WW8_FFN : public WW8_FFN_BASE
133 {
134 	// ab Ver8 als Unicode
135 	UniString sFontname;// 0x6 bzw. 0x40 ab Ver8 zero terminated string that
136 										// records name of font.
137 										// Maximal size of szFfn is 65 characters.
138 										// Vorsicht: Dieses Array kann auch kleiner sein!!!
139 										// Possibly followed by a second sz which records the
140 										// name of an alternate font to use if the first named
141 										// font does not exist on this system.
142 };
143 
144 
145 
146 struct WW8_BRCVer6	// alter Border Code
147 {
148 	SVBT16 aBits1;
149 //	sal_uInt16 dxpLineWidth : 3;// 0007 When dxpLineWidth is 0, 1, 2, 3, 4, or 5, this field is the width of
150 							//      a single line of border in units of 0.75 points
151 							//      Must be nonzero when brcType is nonzero.
152 							//      6 == dotted, 7 == dashed.
153 //	sal_uInt16 brcType : 2;		// 0018 border type code: 0 == none, 1 == single, 2 == thick, 3 == double
154 //	sal_uInt16 fShadow : 1;		// 0020	when 1, border is drawn with shadow. Must be 0 when BRC is a substructure of the TC
155 //	sal_uInt16 ico : 5;			// 07C0 color code (see chp.ico)
156 //	sal_uInt16 dxpSpace : 5;	// F800	width of space to maintain between border and text within border.
157 							//      Must be 0 when BRC is a substructure of the TC.  Stored in points for Windows.
158 };
159 
160 struct WW8_BRC : public WW8_BRCVer6 // Border Code
161 {
162 	SVBT16 aBits2;
163 //	sal_uInt16 dxpLineWidth : 3;// 0007 When dxpLineWidth is 0, 1, 2, 3, 4, or 5, this field is the width of
164 							//      a single line of border in units of 0.75 points
165 							//      Must be nonzero when brcType is nonzero.
166 							//      6 == dotted, 7 == dashed.
167 //	sal_uInt16 brcType : 2;		// 0018 border type code: 0 == none, 1 == single, 2 == thick, 3 == double
168 //	sal_uInt16 fShadow : 1;		// 0020	when 1, border is drawn with shadow. Must be 0 when BRC is a substructure of the TC
169 //	sal_uInt16 ico : 5;			// 07C0 color code (see chp.ico)
170 //	sal_uInt16 dxpSpace : 5;	// F800	width of space to maintain between border and text within border.
171 							//      Must be 0 when BRC is a substructure of the TC.  Stored in points for Windows.
172 };
173 
174 typedef WW8_BRC WW8_BRC5[5];		// 5 * Border Code
175 
176 #define WW8_TOP 0
177 #define WW8_LEFT 1
178 #define WW8_BOT 2
179 #define WW8_RIGHT 3
180 #define WW8_BETW 4
181 
182 
183 
184 
185 
186 struct WW8_BordersSO			// fuer StarOffice-Border Code
187 {
188 	sal_uInt16 Out;
189 	sal_uInt16 In;
190 	sal_uInt16 Dist;
191 };
192 
193 
194 /*
195 // Linien-Defaults in Twips: fruehere Writer-Defaults,
196 //                           siehe auch <editeng/boxitem.hxx>
197 #define DEF_LINE_WIDTH_0        1
198 #define DEF_LINE_WIDTH_1        20
199 #define DEF_LINE_WIDTH_2        50
200 #define DEF_LINE_WIDTH_3        80
201 #define DEF_LINE_WIDTH_4        100
202 
203 #define DEF_MAX_LINE_WIDHT      DEF_LINE_WIDTH_4
204 #define DEF_MAX_LINE_DIST       DEF_LINE_WIDTH_2
205 
206 #define DEF_DOUBLE_LINE0_OUT    DEF_LINE_WIDTH_0
207 #define DEF_DOUBLE_LINE0_IN     DEF_LINE_WIDTH_0
208 #define DEF_DOUBLE_LINE0_DIST   DEF_LINE_WIDTH_1
209 
210 #define DEF_DOUBLE_LINE1_OUT    DEF_LINE_WIDTH_1
211 #define DEF_DOUBLE_LINE1_IN     DEF_LINE_WIDTH_1
212 #define DEF_DOUBLE_LINE1_DIST   DEF_LINE_WIDTH_1
213 
214 #define DEF_DOUBLE_LINE2_OUT    DEF_LINE_WIDTH_2
215 #define DEF_DOUBLE_LINE2_IN     DEF_LINE_WIDTH_2
216 #define DEF_DOUBLE_LINE2_DIST   DEF_LINE_WIDTH_2
217 
218 #define DEF_DOUBLE_LINE3_OUT    DEF_LINE_WIDTH_2
219 #define DEF_DOUBLE_LINE3_IN     DEF_LINE_WIDTH_1
220 #define DEF_DOUBLE_LINE3_DIST   DEF_LINE_WIDTH_2
221 
222 #define DEF_DOUBLE_LINE4_OUT    DEF_LINE_WIDTH_1
223 #define DEF_DOUBLE_LINE4_IN     DEF_LINE_WIDTH_2
224 #define DEF_DOUBLE_LINE4_DIST   DEF_LINE_WIDTH_1
225 
226 #define DEF_DOUBLE_LINE5_OUT    DEF_LINE_WIDTH_3
227 #define DEF_DOUBLE_LINE5_IN     DEF_LINE_WIDTH_2
228 #define DEF_DOUBLE_LINE5_DIST   DEF_LINE_WIDTH_2
229 
230 #define DEF_DOUBLE_LINE6_OUT    DEF_LINE_WIDTH_2
231 #define DEF_DOUBLE_LINE6_IN     DEF_LINE_WIDTH_3
232 #define DEF_DOUBLE_LINE6_DIST   DEF_LINE_WIDTH_2
233 
234 #define DEF_DOUBLE_LINE7_OUT    DEF_LINE_WIDTH_0
235 #define DEF_DOUBLE_LINE7_IN     DEF_LINE_WIDTH_0
236 #define DEF_DOUBLE_LINE7_DIST   DEF_LINE_WIDTH_2
237 
238 #define DEF_DOUBLE_LINE8_OUT    DEF_LINE_WIDTH_1
239 #define DEF_DOUBLE_LINE8_IN     DEF_LINE_WIDTH_0
240 #define DEF_DOUBLE_LINE8_DIST   DEF_LINE_WIDTH_2
241 
242 #define DEF_DOUBLE_LINE9_OUT    DEF_LINE_WIDTH_2
243 #define DEF_DOUBLE_LINE9_IN     DEF_LINE_WIDTH_0
244 #define DEF_DOUBLE_LINE9_DIST   DEF_LINE_WIDTH_2
245 
246 #define DEF_DOUBLE_LINE10_OUT	DEF_LINE_WIDTH_3
247 #define DEF_DOUBLE_LINE10_IN	DEF_LINE_WIDTH_0
248 #define DEF_DOUBLE_LINE10_DIST	DEF_LINE_WIDTH_2
249 */
250 // Deklarationen gemaess BOXITEM.HXX
251 #define WW8_DECL_LINETAB_ARRAY												 \
252 	static WW8_BordersSO __READONLY_DATA nLineTabVer8[] =					 \
253 	{																		 \
254 /* 0*/	{ DEF_LINE_WIDTH_0, 0, 0 },											 \
255 /* 1*/	{ DEF_LINE_WIDTH_1, 0, 0 },											 \
256 /* 2*/	{ DEF_LINE_WIDTH_2, 0, 0 },											 \
257 /* 3*/	{ DEF_LINE_WIDTH_3, 0, 0 },											 \
258 /* 4*/	{ DEF_LINE_WIDTH_4, 0, 0 },											 \
259 /* 5*/	{ DEF_DOUBLE_LINE0_OUT, DEF_DOUBLE_LINE0_IN, DEF_DOUBLE_LINE0_DIST },\
260 /* 6*/	{ DEF_DOUBLE_LINE1_OUT, DEF_DOUBLE_LINE1_IN, DEF_DOUBLE_LINE1_DIST },\
261 /* 7*/	{ DEF_DOUBLE_LINE2_OUT, DEF_DOUBLE_LINE2_IN, DEF_DOUBLE_LINE2_DIST },\
262 /* 8*/	{ DEF_DOUBLE_LINE3_OUT, DEF_DOUBLE_LINE3_IN, DEF_DOUBLE_LINE3_DIST },\
263 /* 9*/	{ DEF_DOUBLE_LINE4_OUT, DEF_DOUBLE_LINE4_IN, DEF_DOUBLE_LINE4_DIST },\
264 /*10*/	{ DEF_DOUBLE_LINE5_OUT, DEF_DOUBLE_LINE5_IN, DEF_DOUBLE_LINE5_DIST },\
265 /*11*/	{ DEF_DOUBLE_LINE6_OUT, DEF_DOUBLE_LINE6_IN, DEF_DOUBLE_LINE6_DIST },\
266 /*12*/	{ DEF_DOUBLE_LINE7_OUT, DEF_DOUBLE_LINE7_IN, DEF_DOUBLE_LINE7_DIST },\
267 /*13*/	{ DEF_DOUBLE_LINE8_OUT, DEF_DOUBLE_LINE8_IN, DEF_DOUBLE_LINE8_DIST },\
268 /*14*/	{ DEF_DOUBLE_LINE9_OUT, DEF_DOUBLE_LINE9_IN, DEF_DOUBLE_LINE9_DIST },\
269 /*15*/	{ DEF_DOUBLE_LINE10_OUT,DEF_DOUBLE_LINE10_IN,DEF_DOUBLE_LINE10_DIST} \
270 	};
271 
272 #define WW8_DECL_LINETAB_OFS_DOUBLE 5	// Beginn des DOUBLE_LINE Abschnitts in meiner Liste
273 
274 
275 
276 
277 struct WW8_XCHAR	// Hilfs-Konstrukt fuer WW8_DOPTYPOGRAPHY
278 {
279 	sal_Char A;
280 	sal_Char B;
281 };
282 
283 struct WW8_DOPTYPOGRAPHY
284 {	/*
285 		Document Typography Info (DOPTYPOGRAPHY)
286 		These options are Far East only, and are accessible
287 		through the Typography tab of the Tools/Options dialog.
288 	*/
289 
290 
291 
292 	/* a c h t u n g :     es duerfen keine solchen Bitfelder ueber einen eingelesenes Byte-Array
293 							gelegt werden!!
294 							stattdessen ist ein aBits1 darueber zu legen, das mit & auszulesen ist
295 	GRUND: Compiler auf Intel und Sparc sortieren die Bits unterschiedlich
296 	*/
297 
298 
299 
300 	short fKerningPunct  : 1;		// true if we're kerning punctuation
301 	short iJustification : 2;		// Kinsoku method of justification:
302 																//	0 = always expand
303 																//	1 = compress punctuation
304 																//	2 = compress punctuation and kana.
305 	short iLevelOfKinsoku: 2;		// Level of Kinsoku:
306 																//	0 = Level 1
307 																//	1 = Level 2
308 																//	2 = Custom
309 	short f2on1          : 1;		// 2-page-on-1 feature is turned on.
310 	short                :10;		// reserved
311 	short cchFollowingPunct;		// length of rgxchFPunct
312 	short cchLeadingPunct;			// length of rgxchLPunct
313 
314 	WW8_XCHAR rgxchFPunct[101];	// array of characters that should
315 															// never appear at the start of a line
316 	WW8_XCHAR rgxchLPunct[51];  // array of characters that should
317 															// never appear at the end of a line
318 };
319 
320 struct WW8_DOGRID
321 {
322 	short xaGrid;		// x-coord of the upper left-hand corner of the grid
323 	short yaGrid;		// y-coord of the upper left-hand corner of the grid
324 	short dxaGrid;	// width of each grid square
325 	short dyaGrid;	// height of each grid square
326 
327 
328 
329 	/* a c h t u n g :     es duerfen keine solchen Bitfelder ueber einen eingelesenes Byte-Array
330 							gelegt werden!!
331 							stattdessen ist ein aBits1 darueber zu legen, das mit & auszulesen ist
332 	GRUND: Compiler auf Intel und Sparc sortieren die Bits unterschiedlich
333 	*/
334 
335 
336 
337 	short dyGridDisplay:7;	// the number of grid squares (in the y direction)
338 													// between each gridline drawn on the screen. 0 means
339 													// don't display any gridlines in the y direction.
340 	short fTurnItOff   :1;	// suppress display of gridlines
341 	short dxGridDisplay:7;	// the number of grid squares (in the x direction)
342 													// between each gridline drawn on the screen. 0 means
343 													// don't display any gridlines in the y direction.
344 	short fFollowMargins:1;	// if true, the grid will start at the left and top
345 													// margins and ignore xaGrid and yaGrid.
346 };
347 
348 struct WW8_PIC
349 {
350 	sal_Int32 lcb;			// 0x0 number of bytes in the PIC structure plus size of following picture data which may be a Window's metafile, a bitmap, or the filename of a TIFF file.
351 	sal_uInt16 cbHeader;	// 0x4 number of bytes in the PIC (to allow for future expansion).
352 	struct {
353 		sal_Int16 mm;		// 0x6	int
354 		sal_Int16 xExt;		// 0x8	int
355 		sal_Int16 yExt;		// 0xa	int
356 		sal_Int16 hMF;		// 0xc	int
357 	}MFP;
358 //	sal_uInt8 bm[14];		// 0xe	BITMAP(14 bytes)	Window's bitmap structure when PIC describes a BITMAP.
359 	sal_uInt8 rcWinMF[14];	// 0xe	rc (rectangle - 8 bytes) rect for window origin
360 						//		and extents when  metafile is stored -- ignored if 0
361 	sal_Int16 dxaGoal;		// 0x1c	horizontal  measurement in twips of the  rectangle the picture should be imaged within.
362 	sal_Int16 dyaGoal;		// 0x1e	vertical  measurement in twips of the  rectangle the picture should be imaged within.
363 	sal_uInt16 mx;			// 0x20	horizontal scaling factor supplied by user in .1% units.
364 	sal_uInt16 my;			// 0x22	vertical scaling factor supplied by user in .1% units.
365 	sal_Int16 dxaCropLeft;	// 0x24	the amount the picture has been cropped on the left in twips.
366 	sal_Int16 dyaCropTop;	// 0x26	the amount the picture has been cropped on the top in twips.
367 	sal_Int16 dxaCropRight;	// 0x28 the amount the picture has been cropped on the right in twips.
368 	sal_Int16 dyaCropBottom;// 0x2a	the amount the picture has been cropped on the bottom in twips.
369 	sal_Int16 brcl : 4;		// 000F	Obsolete, superseded by brcTop, etc.  In
370 	sal_Int16 fFrameEmpty : 1;	// 0010	picture consists of a single frame
371 	sal_Int16 fBitmap : 1;		// 0020	==1, when picture is just a bitmap
372 	sal_Int16 fDrawHatch : 1;	// 0040	==1, when picture is an active OLE object
373 	sal_Int16 fError : 1;		// 0080	==1, when picture is just an error message
374 	sal_Int16 bpp : 8;		// FF00	bits per pixel, 0 = unknown
375 	WW8_BRC rgbrc[4];
376 //	BRC brcTop;			// 0x2e	specification for border above picture
377 //	BRC brcLeft;		// 0x30 specification for border to the left
378 //	BRC brcBottom;		// 0x32	specification for border below picture
379 //	BRC	brcRight;		// 0x34	specification for border to the right
380 	sal_Int16 dxaOrigin;	// 0x36	horizontal offset of hand annotation origin
381 	sal_Int16 dyaOrigin;	// 0x38	vertical offset of hand annotation origin
382 //	sal_uInt8 rgb[];			// 0x3a	variable array of bytes containing Window's metafile, bitmap or TIFF file filename.
383 };
384 
385 struct WW8_PIC_SHADOW
386 {
387 	SVBT32 lcb;			// 0x0 number of bytes in the PIC structure plus size of following picture data which may be a Window's metafile, a bitmap, or the filename of a TIFF file.
388 	SVBT16 cbHeader;	// 0x4 number of bytes in the PIC (to allow for future expansion).
389 	struct {
390 		SVBT16 mm;		// 0x6	int
391 		SVBT16 xExt;		// 0x8	int
392 		SVBT16 yExt;		// 0xa	int
393 		SVBT16 hMF;		// 0xc	int
394 	}MFP;
395 //	SVBT8 bm[14];		// 0xe	BITMAP(14 bytes)	Window's bitmap structure when PIC describes a BITMAP.
396 	SVBT8 rcWinMF[14];	// 0xe	rc (rectangle - 8 bytes) rect for window origin
397 						//		and extents when  metafile is stored -- ignored if 0
398 	SVBT16 dxaGoal;		// 0x1c	horizontal  measurement in twips of the  rectangle the picture should be imaged within.
399 	SVBT16 dyaGoal;		// 0x1e	vertical  measurement in twips of the  rectangle the picture should be imaged within.
400 	SVBT16 mx;			// 0x20	horizontal scaling factor supplied by user in .1% units.
401 	SVBT16 my;			// 0x22	vertical scaling factor supplied by user in .1% units.
402 	SVBT16 dxaCropLeft;	// 0x24	the amount the picture has been cropped on the left in twips.
403 	SVBT16 dyaCropTop;	// 0x26	the amount the picture has been cropped on the top in twips.
404 	SVBT16 dxaCropRight;	// 0x28 the amount the picture has been cropped on the right in twips.
405 	SVBT16 dyaCropBottom;// 0x2a	the amount the picture has been cropped on the bottom in twips.
406 	SVBT8 aBits1; //0x2c
407 	SVBT8 aBits2;
408 	WW8_BRC rgbrc[4];
409 //	BRC brcTop;			// 0x2e	specification for border above picture
410 //	BRC brcLeft;		// 0x30 specification for border to the left
411 //	BRC brcBottom;		// 0x32	specification for border below picture
412 //	BRC	brcRight;		// 0x34	specification for border to the right
413 	SVBT16 dxaOrigin;	// 0x36	horizontal offset of hand annotation origin
414 	SVBT16 dyaOrigin;	// 0x38	vertical offset of hand annotation origin
415 //	SVBT8 rgb[];			// 0x3a	variable array of bytes containing Window's metafile, bitmap or TIFF file filename.
416 };
417 
418 
419 struct WW8_TBD
420 {
421 	SVBT8 aBits1;
422 //	sal_uInt8 jc : 3;		// 0x07 justification code: 0=left tab, 1=centered tab, 2=right tab, 3=decimal tab, 4=bar
423 //	sal_uInt8 tlc : 3;		// 0x38	tab leader code: 0=no leader, 1=dotted leader,
424 						// 2=hyphenated leader, 3=single line leader, 4=heavy line leader
425 //	*	int	:2	C0	reserved
426 };
427 
428 struct WW8_TCell	// hiermit wird weitergearbeitet (entspricht weitestgehend dem Ver8-Format)
429 {
430 	sal_Bool bFirstMerged	: 1;// 0001	set to 1 when cell is first cell of a range of cells that have been merged.
431 	sal_Bool bMerged		: 1;// 0002	set to 1 when cell has been merged with preceding cell.
432 	sal_Bool bVertical		: 1;// set to 1 when cell has vertical text flow
433 	sal_Bool bBackward		: 1;// for a vertical table cell, text flow is bottom to top when 1 and is bottom to top when 0.
434 	sal_Bool bRotateFont	: 1;// set to 1 when cell has rotated characters (i.e. uses @font)
435 	sal_Bool bVertMerge		: 1;// set to 1 when cell is vertically merged with the cell(s) above and/or below. When cells are vertically merged, the display area of the merged cells are consolidated. The consolidated area is used to display the contents of the first vertically merged cell (the cell with fVertRestart set to 1), and all other vertically merged cells (those with fVertRestart set to 0) must be empty. Cells can only be merged vertically if their left and right boundaries are (nearly) identical (i.e. if corresponding entries in rgdxaCenter of the table rows differ by at most 3).
436 	sal_Bool bVertRestart	: 1;// set to 1 when the cell is the first of a set of vertically merged cells. The contents of a cell with fVertStart set to 1 are displayed in the consolidated area belonging to the entire set of vertically merged cells. Vertically merged cells with fVertRestart set to 0 must be empty.
437 	sal_uInt8 nVertAlign		: 2;// specifies the alignment of the cell contents relative to text flow (e.g. in a cell with bottom to top text flow and bottom vertical alignment, the text is shifted horizontally to match the cell's right boundary):
438 													//			0 top
439 													//			1 center
440 													//			2 bottom
441 	sal_uInt16 fUnused		: 7;// reserved - nicht loeschen: macht das sal_uInt16 voll !!
442 
443 	WW8_BRC rgbrc[4];				// border codes
444 //notational convenience for referring to brcTop, brcLeft, etc fields.
445 //	BRC brcTop;				// specification of the top border of a table cell
446 //	BRC brcLeft;			// specification of left border of table row
447 //	BRC brcBottom;			// specification of bottom border of table row
448 //	BRC brcRight;			// specification of right border of table row.
449 };
450 // cbTC (count of bytes of a TC) is 18(decimal), 12(hex).
451 
452 
453 struct WW8_TCellVer6	// wird aus der Datei gelesen
454 {
455 	SVBT8  aBits1Ver6;
456 	SVBT8  aBits2Ver6;
457 //	sal_uInt16 fFirstMerged : 1;// 0001	set to 1 when cell is first cell of a range of cells that have been merged.
458 //	sal_uInt16 fMerged : 1;		// 0002	set to 1 when cell has been merged with preceding cell.
459 //	sal_uInt16 fUnused : 14;	// FFFC	reserved
460 	WW8_BRCVer6 rgbrcVer6[4];
461 // notational convenience for referring to brcTop, brcLeft, etc fields:
462 //			BRC brcTop;				// specification of the top border of a table cell
463 //			BRC brcLeft;			// specification of left border of table row
464 //			BRC brcBottom;			// specification of bottom border of table row
465 //			BRC brcRight;			// specification of right border of table row.
466 };
467 // cbTC (count of bytes of a TC) is 10(decimal), A(hex).
468 
469 struct WW8_TCellVer8	// wird aus der Datei gelesen
470 {
471 	SVBT16 aBits1Ver8;		// Dokumentation siehe oben unter WW8_TCell
472 	SVBT16 aUnused;			// reserve
473 	WW8_BRC rgbrcVer8[4];	// Dokumentation siehe oben unter WW8_TCell
474 };
475 // cbTC (count of bytes of a TC) is 20(decimal), 14(hex).
476 
477 
478 struct WW8_SHD				// struct SHD fehlt in der Beschreibung
479 {
480 private:
481 	sal_uInt16 aBits;
482 //	sal_uInt16 nFore : 5;		// 0x001f ForegroundColor
483 //	sal_uInt16 nBack : 5;		// 0x03e0 BackgroundColor
484 //	sal_uInt16 nStyle : 5;		// 0x7c00 Percentage and Style
485 //	sal_uInt16 nDontKnow : 1;	// 0x8000 ???   ab Ver8: ebenfalls fuer Style
486 
487 public:
WW8_SHDWW8_SHD488 	WW8_SHD(){ aBits = 0; }
489 
GetForeWW8_SHD490 	sal_uInt8 GetFore()	const							{ return (sal_uInt8)( aBits        & 0x1f); }
GetBackWW8_SHD491 	sal_uInt8 GetBack()	const							{ return (sal_uInt8)((aBits >> 5 ) & 0x1f); }
GetStyleWW8_SHD492 	sal_uInt8 GetStyle(sal_Bool bVer67)	const { return (sal_uInt8)((aBits >> 10) & ( bVer67?0x1f:0x3f ) ); }
493 
GetValueWW8_SHD494 	sal_uInt16 GetValue()	const						{ return aBits; }
495 
SetValueWW8_SHD496 	void SetValue(   sal_uInt16 nVal ){ aBits = nVal; }
SetWWValueWW8_SHD497 	void SetWWValue( SVBT16 nVal ){ aBits = (sal_uInt16)SVBT16ToShort( nVal ); }
498 
SetForeWW8_SHD499 	void SetFore( sal_uInt8 nVal ){ aBits = (aBits & 0xffe0) |  (nVal & 0x1f);     }
SetBackWW8_SHD500 	void SetBack( sal_uInt8 nVal ){ aBits = (aBits & 0xfc1f) | ((nVal & 0x1f)<<5); }
SetStyleWW8_SHD501 	void SetStyle( sal_Bool bVer67, sal_uInt8 nVal ){
502 										 aBits = (aBits & ( bVer67?0x83ff:0x03ff ) )
503 																					  | ((nVal & ( bVer67?0x1f:0x2f ))<<10); }
504 };
505 
506 
507 struct WW8_ANLV
508 {
509 	SVBT8 nfc;			// 0        number format code, 0=Arabic, 1=Upper case Roman, 2=Lower case Roman
510 						//		    3=Upper case Letter, 4=Lower case letter, 5=Ordinal
511 	SVBT8 cbTextBefore;	// 1        offset into anld.rgch limit of prefix text
512 	SVBT8 cbTextAfter;	// 2
513 	SVBT8 aBits1;
514 //	sal_uInt8 jc : 2;		// 3 : 0x03	justification code, 0=left, 1=center, 2=right, 3=left and right justify
515 //	sal_uInt8 fPrev : 1;		//     0x04	when ==1, include previous levels
516 //	sal_uInt8 fHang : 1;		//     0x08	when ==1, number will be displayed using a hanging indent
517 //	sal_uInt8 fSetBold : 1;	//     0x10	when ==1, boldness of number will be determined by anld.fBold.
518 //	sal_uInt8 fSetItalic : 1;//     0x20	when ==1, italicness of number will be determined by anld.fItalic
519 //	sal_uInt8 fSetSmallCaps : 1;//  0x40	when ==1, anld.fSmallCaps will determine whether number will be displayed in small caps or not.
520 //	sal_uInt8 fSetCaps : 1;	//     0x80	when ==1, anld.fCaps will determine whether number will be displayed capitalized or not
521 	SVBT8 aBits2;
522 //	sal_uInt8 fSetStrike : 1;// 4 : 0x01	when ==1, anld.fStrike will determine whether the number will be displayed using strikethrough or not.
523 //	sal_uInt8 fSetKul : 1;	//     0x02 when ==1, anld.kul will determine the underlining state of the autonumber.
524 //	sal_uInt8 fPrevSpace : 1;//     0x04	when ==1, autonumber will be displayed with a single prefixing space character
525 //	sal_uInt8 fBold : 1;		//     0x08	determines boldness of autonumber when anld.fSetBold == 1.
526 //	sal_uInt8 fItalic : 1;	//     0x10	determines italicness of autonumber when anld.fSetItalic == 1.
527 //	sal_uInt8 fSmallCaps : 1;//     0x20	determines whether autonumber will be displayed using small caps when anld.fSetSmallCaps == 1.
528 //	sal_uInt8 fCaps : 1;		//     0x40	determines whether autonumber will be displayed using caps when anld.fSetCaps == 1.
529 //	sal_uInt8 fStrike : 1;	//     0x80	determines whether autonumber will be displayed using caps when anld.fSetStrike == 1.
530 	SVBT8 aBits3;
531 //	sal_uInt8 kul : 3;		// 5 : 0x07	determines whether  autonumber will be displayed with underlining when anld.fSetKul == 1.
532 //	sal_uInt8 ico : 5;		//     0xF1	color of autonumber
533 	SVBT16 ftc;			// 6        font code of  autonumber
534 	SVBT16 hps;			// 8	    font half point size (or 0=auto)
535 	SVBT16 iStartAt;	// 0x0a	    starting value (0 to 65535)
536 	SVBT16 dxaIndent;	// 0x0c     *short?* *sal_uInt16?* width of prefix text (same as indent)
537 	SVBT16 dxaSpace;	// 0x0e		minimum space between number and paragraph
538 };
539 // *cbANLV (count of bytes of ANLV) is 16 (decimal), 10(hex).
540 
541 struct WW8_ANLD
542 {
543 	WW8_ANLV eAnlv;		// 0
544 	SVBT8 fNumber1;		// 0x10		number only 1 item per table cell
545 	SVBT8 fNumberAcross;	// 0x11		number across cells in table rows(instead of down)
546 	SVBT8 fRestartHdn;	// 0x12		restart heading number on section boundary
547 	SVBT8 fSpareX;		// 0x13		unused( should be 0)
548 	sal_uInt8  rgchAnld[32];	// 0x14	characters displayed before/after autonumber
549 };
550 
551 
552 struct WW8_OLST
553 {
554 	WW8_ANLV rganlv[9];	// 0    an array of 9 ANLV structures (heading levels)
555 	SVBT8 fRestartHdr;	// 0x90 when ==1, restart heading on section break
556 	SVBT8 fSpareOlst2;	// 0x91 reserved
557 	SVBT8 fSpareOlst3;	// 0x92 reserved
558 	SVBT8 fSpareOlst4;	// 0x93 reserved
559 	sal_uInt8 rgch[64];		// 0x94 array of 64 chars		text before/after number
560 };
561 // cbOLST is 212(decimal), D4(hex).
562 
563 struct WW8_FDOA
564 {
565 	SVBT32 fc;			// 0  FC pointing to drawing object data
566 	SVBT16 ctxbx;		// 4  count of textboxes in the drawing object
567 };
568 
569 struct WW8_DO
570 {
571 	SVBT16 dok; 			// 0	Drawn Object Kind, currently this is always 0
572 	SVBT16 cb;				// 2	size (count of bytes) of the entire DO
573 	SVBT8  bx;				// 4	x position relative to anchor CP
574 	SVBT8  by;				// 5	y position relative to anchor CP
575 	SVBT16 dhgt;				// 6	height of DO
576 	SVBT16 aBits1;
577 //	sal_uInt16 fAnchorLock : 1;	// 8	1 if the DO anchor is locked
578 //	sal_uInt8[] rgdp;			// 0xa	variable length array of drawing primitives
579 };
580 
581 struct WW8_DPHEAD
582 {
583 	SVBT16 dpk;			// 	0	Drawn Primitive Kind  REVIEW davebu
584   //		0=start of grouping, 1=line, 2=textbox, 3=rectangle,
585   //		4=arc, 5=elipse, 6=polyline, 7=callout textbox,
586   //		8=end of grouping, 9=sample primitve holding default values
587 	SVBT16 cb;			// 2	size (count of bytes) of this DP
588 	SVBT16 xa;			// 4	These 2 points describe the rectangle
589 	SVBT16 ya;			// 6 	enclosing this DP relative to the origin of
590 	SVBT16 dxa;			// 8 	the DO
591 	SVBT16 dya;			// 0xa
592 };
593 
594 
595 struct WW8_DP_LINETYPE
596 {
597 	SVBT32 lnpc;			// LiNe Property Color -- RGB color value
598 	SVBT16 lnpw;			// line property weight in twips
599 	SVBT16 lnps;			// line property style : 0=Solid, 1=Dashed
600 							// 2=Dotted, 3=Dash Dot, 4=Dash Dot Dot, 5=Hollow
601 };
602 
603 struct WW8_DP_SHADOW	// Schattierung!
604 {
605 	SVBT16 shdwpi;			// Shadow Property Intensity
606 	SVBT16 xaOffset;		// x offset of shadow
607 	SVBT16 yaOffset;		// y offset of shadow
608 };
609 
610 struct WW8_DP_FILL
611 {
612 	SVBT32 dlpcFg;			// FiLl Property Color ForeGround -- RGB color value
613 	SVBT32 dlpcBg;			// Property Color BackGround -- RGB color value
614 	SVBT16 flpp;			// FiLl Property Pattern REVIEW davebu
615 };
616 
617 struct WW8_DP_LINEEND
618 {
619 	SVBT16 aStartBits;
620 //	sal_uInt16 eppsStart : 2;	// Start EndPoint Property Style
621 							// 0=None, 1=Hollow, 2=Filled
622 //	sal_uInt16 eppwStart : 2;	// Start EndPoint Property Weight
623 //	sal_uInt16 epplStart : 2;	// Start EndPoint Property length
624 //	sal_uInt16 dummyStart : 10;	// Alignment
625 	SVBT16 aEndBits;
626 //	sal_uInt16 eppsEnd : 2;		// End EndPoint Property Style
627 //	sal_uInt16 eppwEnd : 2; 	// End EndPoint Property Weight
628 //	sal_uInt16 epplEnd : 2;		// End EndPoint Property length
629 //	sal_uInt16 dummyEnd : 10;	// Alignment
630 };
631 
632 struct WW8_DP_LINE
633 {
634 //	WW8_DPHEAD dphead;		// 0	Common header for a drawing primitive
635 	SVBT16 xaStart;			// starting point for line
636 	SVBT16 yaStart;			//
637 	SVBT16 xaEnd;			// ending point for line
638 	SVBT16 yaEnd;
639 	WW8_DP_LINETYPE aLnt;
640 	WW8_DP_LINEEND aEpp;
641 	WW8_DP_SHADOW aShd;
642 };
643 
644 struct WW8_DP_TXTBOX
645 {
646 	WW8_DP_LINETYPE aLnt;
647 	WW8_DP_FILL aFill;
648 	WW8_DP_SHADOW aShd;
649 	SVBT16 aBits1;
650 //	sal_uInt16 fRoundCorners : 1; //0x24	0001	1 if the textbox has rounded corners
651 //	sal_uInt16 zaShape : 15;	// 0x24 	000e	REVIEW davebu
652 	SVBT16 dzaInternalMargin; // 0x26	REVIEW davebu
653 };
654 
655 struct WW8_DP_RECT
656 {
657 	WW8_DP_LINETYPE aLnt;
658 	WW8_DP_FILL aFill;
659 	WW8_DP_SHADOW aShd;
660 	SVBT16 aBits1;
661 //	sal_uInt16 fRoundCorners : 1; // 0x24	0001	1 if the textbox has rounded corners
662 //	sal_uInt16 zaShape : 15; // 0x24 000e	REVIEW davebu
663 };
664 
665 struct WW8_DP_ARC
666 {
667 	WW8_DP_LINETYPE aLnt;
668 	WW8_DP_FILL aFill;
669 	WW8_DP_SHADOW aShd;
670 	SVBT8 fLeft;		// 0x24	00ff	REVIEW davebu
671 	SVBT8 fUp;			// 0x24	ff00	REVIEW davebu
672 //	sal_uInt16 fLeft : 8;	// 0x24	00ff	REVIEW davebu
673 //	sal_uInt16 fUp : 8;		// 0x24	ff00	REVIEW davebu
674 };
675 
676 struct WW8_DP_ELIPSE
677 {
678 	WW8_DP_LINETYPE aLnt;
679 	WW8_DP_FILL aFill;
680 	WW8_DP_SHADOW aShd;
681 };
682 
683 struct WW8_DP_POLYLINE
684 {
685 	WW8_DP_LINETYPE aLnt;
686 	WW8_DP_FILL aFill;
687 	WW8_DP_LINEEND aEpp;
688 	WW8_DP_SHADOW aShd;
689 	SVBT16 aBits1;
690 //	sal_uInt16 fPolygon : 1; // 0x28  0001	1 if this is a polygon
691 //	sal_uInt16 cpt : 15;	// 0x28	  00fe	count of points
692 //	short xaFirst;		// 0x2a	These are the endpoints of the first line.
693 //	short yaFirst;		// 0x2c
694 //	short xaEnd;		// 0x2e
695 //	short yaEnd;		// 0x30
696 //	short rgpta[];		// 0x32	An array of xa,ya pairs for the remaining points
697 };
698 
699 struct WW8_DP_CALLOUT_TXTBOX
700 {
701 	SVBT16 flags;				// 0x0c	REVIEW davebu flags
702 	SVBT16 dzaOffset;			// 0x0e	REVIEW davebu
703 	SVBT16 dzaDescent;			// 0x10	REVIEW davebu
704 	SVBT16 dzaLength;			// 0x12	REVIEW davebu
705 	WW8_DPHEAD dpheadTxbx;		// 0x14	DPHEAD for a textbox
706 	WW8_DP_TXTBOX dptxbx;		// 0x20	DP for a textbox
707 	WW8_DPHEAD dpheadPolyLine;	// 0x4c	DPHEAD for a Polyline
708 	WW8_DP_POLYLINE dpPolyLine;	// 0x48	DP for a polyline
709 };
710 
711 struct WW8_DP_DEFAULTS
712 {
713 	WW8_DP_LINETYPE aLnt;
714 	WW8_DP_FILL aFill;
715 	WW8_DP_LINEEND aEpp;
716 	WW8_DP_SHADOW aShd;
717 	SVBT16 dzaOffset;		// 0x2a	REVIEW davebu
718 	SVBT16 dzaDescent;		// 0x2c	REVIEW davebu
719 	SVBT16 dzaLength;		// 0x2e	REVIEW davebu
720 
721 	SVBT16 aBits3;
722 //	sal_uInt16 fRoundCorners : 1;	// 0x30 0001	1 if the textbox has rounded corners
723 //	sal_uInt16 zaShape : 15;		// 0x30	000fe	REVIEW davebu
724 	SVBT16 dzaInternalMargin;	// 0x32	REVIEW davebu
725 };
726 
727 
728 struct WW8_PCD
729 {
730 	SVBT8 aBits1;
731 //	sal_uInt8 fNoParaLast : 1;	// when 1, means that piece contains no end of paragraph marks.
732 //	sal_uInt8 fPaphNil : 1;		// used internally by Word
733 //	sal_uInt8 fCopied : 1;		// used internally by Word
734 //			*	int	:5
735 	SVBT8 aBits2;			// fn int:8, used internally by Word
736 	SVBT32 fc;				// file offset of beginning of piece. The size of the
737 							// ithpiece can be determined by subtracting rgcp[i] of
738 							// the containing plcfpcd from its rgcp[i+1].
739 	SVBT16 prm;				// PRM contains either a single sprm or else an index number
740 							// of the grpprl which contains the sprms that modify the
741 							// properties of the piece.
742 };
743 
744 struct WW8_PHE_Base
745 {
746 	sal_uInt8 aBits1;            //
747 //								0	0	fSpare	int	:1	0001	reserved
748 //								fUnk	int	:1	0002	phe entry is invalid
749 //														when == 1
750 //								fDiffLines	int	:1	0004	when 1, total
751 //								 height of paragraph is known but lines in
752 //								 paragraph have different heights.
753 //								*	int	:5	00F8	reserved
754 	sal_uInt8 nlMac;				//	when fDiffLines is 0 is number of lines in
755 //							//	paragraph
756 	SVBT16 dxaCol;			//	width of lines in paragraph
757 	SVBT16 dyl;
758 //								4	4	dylLine	int	when fDiffLines is 0,
759 //								is height of every line in paragraph.in pixels
760 //								4	4 dylHeight uns	when fDiffLines is 1,
761 //								is the total height in pixels of the paragraph
762 };
763 
764 /*
765 eigentlich muessten wir das jetzt in etwa *so* praezisieren:
766 
767 			struct WW8_PHE_Ver6 : public WW8_PHE_Base
768 			{
769 				//	6 Bytes gross
770 			};
771 			struct WW8_PHE_Ver6 : public WW8_PHE_Base
772 			{
773 				SVBT16 a;
774 				SVBT16 b;
775 				SVBT16 c;	// 12 Byte gross
776 			};
777 */
778 
779 // AnnoTation References Descriptor (ATRD)
780 struct WW8_ATRD					// fuer die 8-Version
781 {
782 	SVBT16 xstUsrInitl[ 10 ];		// pascal-style String holding initials
783 									// of annotation author
784 	SVBT16 ibst;					// index into GrpXstAtnOwners
785 	SVBT16 ak;						// not used
786 	SVBT16 grfbmc;					// not used
787 	SVBT32 ITagBkmk;				// when not -1, this tag identifies the
788 									// annotation bookmark that locates the
789 									// range of CPs in the main document which
790 									// this annotation references.
791 };
792 
793 struct WW67_ATRD				// fuer die 6/7-Version
794 {
795 	sal_Char xstUsrInitl[ 10 ];		// pascal-style String holding initials
796 									// of annotation author
797 	SVBT16 ibst;					// index into GrpXstAtnOwners
798 	SVBT16 ak;						// not used
799 	SVBT16 grfbmc;					// not used
800 	SVBT32 ITagBkmk;				// when not -1, this tag identifies the
801 									// annotation bookmark that locates the
802 									// range of CPs in the main document which
803 									// this annotation references.
804 };
805 
806 
807 #ifdef __WW8_NEEDS_PACK
808 #pragma pack()
809 #endif
810 
811 #endif
812