update dev300-m58
[ooovba.git] / sw / source / filter / ww8 / ww8struc.hxx
blobbb9c9cfc825f917e74bfdf9cd4b3451319e32a93
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ww8struc.hxx,v $
10 * $Revision: 1.39 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
33 #ifndef _WW8STRUC_HXX
34 #define _WW8STRUC_HXX
36 #include <osl/endian.h>
37 #include <tools/string.hxx>
38 #include <sal/config.h>
40 #if defined OSL_BIGENDIAN || SAL_TYPES_ALIGNMENT4 > 2 || defined UNX
41 # define __WW8_NEEDS_COPY
42 #endif
44 #ifdef SAL_W32
45 # pragma pack(push, 2)
46 #elif defined(SAL_OS2)
47 # pragma pack(2)
48 #endif
50 inline void Set_UInt8( BYTE *& p, UINT8 n )
52 ByteToSVBT8( n, *(SVBT8*)p );
53 p+= 1;
56 inline void Set_UInt16( BYTE *& p, UINT16 n )
58 ShortToSVBT16( n, *(SVBT16*)p );
59 p+= 2;
62 inline void Set_UInt32( BYTE *& p, UINT32 n )
64 UInt32ToSVBT32( n, *(SVBT32*)p );
65 p+= 4;
68 struct Word2CHPX
70 sal_uInt16 fBold:1;
71 sal_uInt16 fItalic:1;
72 sal_uInt16 fRMarkDel:1;
73 sal_uInt16 fOutline:1;
74 sal_uInt16 fFldVanish:1;
75 sal_uInt16 fSmallCaps:1;
76 sal_uInt16 fCaps:1;
77 sal_uInt16 fVanish:1;
78 sal_uInt16 fRMark:1;
79 sal_uInt16 fSpec:1;
80 sal_uInt16 fStrike:1;
81 sal_uInt16 fObj:1;
82 sal_uInt16 fBoldBi:1;
83 sal_uInt16 fItalicBi:1;
84 sal_uInt16 fBiDi:1;
85 sal_uInt16 fDiacUSico:1;
86 sal_uInt16 fsIco:1;
87 sal_uInt16 fsFtc:1;
88 sal_uInt16 fsHps:1;
89 sal_uInt16 fsKul:1;
90 sal_uInt16 fsPos:1;
91 sal_uInt16 fsSpace:1;
92 sal_uInt16 fsLid:1;
93 sal_uInt16 fsIcoBi:1;
94 sal_uInt16 fsFtcBi:1;
95 sal_uInt16 fsHpsBi:1;
96 sal_uInt16 fsLidBi:1;
98 sal_uInt16 ftc;
99 sal_uInt16 hps;
100 sal_uInt8 qpsSpace:6;
101 sal_uInt8 fSysVanish:1;
102 sal_uInt8 fNumRun:1;
103 sal_uInt8 ico:5;
104 sal_uInt8 kul:3;
105 sal_uInt8 hpsPos;
106 sal_uInt8 icoBi;
107 sal_uInt16 lid;
108 sal_uInt16 ftcBi;
109 sal_uInt16 hpsBi;
110 sal_uInt16 lidBi;
111 sal_uInt32 fcPic;
113 Word2CHPX()
115 fBold = 0;
116 fItalic = 0;
117 fRMarkDel = 0;
118 fOutline = 0;
119 fFldVanish = 0;
120 fSmallCaps = 0;
121 fCaps = 0;
122 fVanish = 0;
123 fRMark = 0;
124 fSpec = 0;
125 fStrike = 0;
126 fObj = 0;
127 fBoldBi = 0;
128 fItalicBi = 0;
129 fBiDi = 0;
130 fDiacUSico = 0;
131 fsIco = 0;
132 fsFtc = 0;
133 fsHps = 0;
134 fsKul = 0;
135 fsPos = 0;
136 fsSpace = 0;
137 fsLid = 0;
138 fsIcoBi = 0;
139 fsFtcBi = 0;
140 fsHpsBi = 0;
141 fsLidBi = 0;
143 ftc = 0;
144 hps = 0;
145 qpsSpace = 0;
146 fSysVanish = 0;
147 fNumRun = 0;
148 ico = 0;
149 kul = 0;
150 hpsPos = 0;
151 icoBi = 0;
152 lid = 0;
153 ftcBi = 0;
154 hpsBi = 0;
155 lidBi = 0;
156 fcPic = 0;
161 typedef sal_Int16 WW8_PN;
162 typedef sal_Int32 WW8_FC;
163 typedef sal_Int32 WW8_CP;
165 const WW8_FC WW8_FC_MAX = SAL_MAX_INT32;
166 const WW8_CP WW8_CP_MAX = SAL_MAX_INT32;
168 /** STD - STyle Definition
170 The STD contains the entire definition of a style.
171 It has two parts, a fixed-length base (cbSTDBase bytes long)
172 and a variable length remainder holding the name, and the upx and upe
173 arrays (a upx and upe for each type stored in the style, std.cupx)
174 Note that new fields can be added to the BASE of the STD without
175 invalidating the file format, because the STSHI contains the length
176 that is stored in the file. When reading STDs from an older version,
177 new fields will be zero.
179 struct WW8_STD
181 // Base part of STD:
182 UINT16 sti : 12; // invariant style identifier
183 UINT16 fScratch : 1; // spare field for any temporary use,
184 // always reset back to zero!
185 UINT16 fInvalHeight : 1; // PHEs of all text with this style are wrong
186 UINT16 fHasUpe : 1; // UPEs have been generated
187 UINT16 fMassCopy : 1; // std has been mass-copied; if unused at
188 // save time, style should be deleted
189 UINT16 sgc : 4; // style type code
190 UINT16 istdBase : 12; // base style
191 UINT16 cupx : 4; // # of UPXs (and UPEs)
192 UINT16 istdNext : 12; // next style
193 UINT16 bchUpe; // offset to end of upx's, start of upe's
194 //-------- jetzt neu:
195 // ab Ver8 gibts zwei Felder mehr:
196 UINT16 fAutoRedef : 1; /* auto redefine style when appropriate */
197 UINT16 fHidden : 1; /* hidden from UI? */
198 UINT16 : 14; /* unused bits */
200 // Variable length part of STD:
201 // UINT8 stzName[2]; /* sub-names are separated by chDelimStyle
202 // char grupx[];
203 // the UPEs are not stored on the file; they are a cache of the based-on
204 // chain
205 // char grupe[];
208 /** Basis zum Einlesen UND zum Arbeiten (wird jeweils unter schiedlich beerbt)
210 struct WW8_FFN_BASE // Font Descriptor
212 // ab Ver6
213 BYTE cbFfnM1; // 0x0 total length of FFN - 1.
215 BYTE prg: 2; // 0x1:03 pitch request
216 BYTE fTrueType : 1; // 0x1:04 when 1, font is a TrueType font
217 // 0x1:08 reserved
218 BYTE ff : 3; // 0x1:70 font family id
219 // 0x1:80 reserved
221 short wWeight; // 0x2 base weight of font
222 BYTE chs; // 0x4 character set identifier
223 BYTE ibszAlt; // 0x5 index into ffn.szFfn to the name of the alternate font
226 /** Hiermit arbeiten wir im Parser (und Dumper)
228 struct WW8_FFN : public WW8_FFN_BASE
230 // ab Ver8 als Unicode
231 String sFontname;// 0x6 bzw. 0x40 ab Ver8 zero terminated string that
232 // records name of font.
233 // Maximal size of szFfn is 65 characters.
234 // Vorsicht: Dieses Array kann auch kleiner sein!!!
235 // Possibly followed by a second sz which records the
236 // name of an alternate font to use if the first named
237 // font does not exist on this system.
242 struct WW8_BRCVer6 // alter Border Code
244 SVBT16 aBits1;
245 // UINT16 dxpLineWidth : 3;// 0007 When dxpLineWidth is 0, 1, 2, 3, 4, or 5, this field is the width of
246 // a single line of border in units of 0.75 points
247 // Must be nonzero when brcType is nonzero.
248 // 6 == dotted, 7 == dashed.
249 // UINT16 brcType : 2; // 0018 border type code: 0 == none, 1 == single, 2 == thick, 3 == double
250 // UINT16 fShadow : 1; // 0020 when 1, border is drawn with shadow. Must be 0 when BRC is a substructure of the TC
251 // UINT16 ico : 5; // 07C0 color code (see chp.ico)
252 // UINT16 dxpSpace : 5; // F800 width of space to maintain between border and text within border.
253 // Must be 0 when BRC is a substructure of the TC. Stored in points for Windows.
256 class WW8_BRC // Border Code
258 public:
259 SVBT16 aBits1;
260 SVBT16 aBits2;
261 // UINT16 dxpLineWidth : 3;// 0007 When dxpLineWidth is 0, 1, 2, 3, 4, or 5, this field is the width of
262 // a single line of border in units of 0.75 points
263 // Must be nonzero when brcType is nonzero.
264 // 6 == dotted, 7 == dashed.
265 // UINT16 brcType : 2; // 0018 border type code: 0 == none, 1 == single, 2 == thick, 3 == double
266 // UINT16 fShadow : 1; // 0020 when 1, border is drawn with shadow. Must be 0 when BRC is a substructure of the TC
267 // UINT16 ico : 5; // 07C0 color code (see chp.ico)
268 // UINT16 dxpSpace : 5; // F800 width of space to maintain between border and text within border.
269 // Must be 0 when BRC is a substructure of the TC. Stored in points for Windows.
270 WW8_BRC()
272 memset(aBits1, 0, sizeof(aBits1));
273 memset(aBits2, 0, sizeof(aBits2));
275 short DetermineBorderProperties (bool bVer67, short *pSpace=0,
276 BYTE *pCol=0, short *pIdx=0) const;
277 bool IsEmpty(bool bVer67) const;
278 bool IsZeroed(bool bVer67) const;
279 bool IsBlank() const;
282 typedef WW8_BRC WW8_BRC5[5]; // 5 * Border Code
284 enum BRC_Sides
286 WW8_TOP = 0, WW8_LEFT = 1, WW8_BOT = 2, WW8_RIGHT = 3, WW8_BETW = 4
289 class WW8_BordersSO // for StarOffice-Border Code
291 public:
292 USHORT mnOut;
293 USHORT mnIn;
294 USHORT mnDist;
295 public:
296 enum eBorderCode
298 single0, single1, single2, single3, single4, single5,
299 double0, double1, double2, double3, double4, double5, double6,
300 double7, double8, double9, double10,
301 none
303 static const WW8_BordersSO &Get0x01LineMatch(eBorderCode nIdx);
307 Document Typography Info (DOPTYPOGRAPHY) These options are Far East only,
308 and are accessible through the Typography tab of the Tools/Options dialog.
310 class WW8DopTypography
312 public:
313 void ReadFromMem(BYTE *&pData);
314 void WriteToMem(BYTE *&pData) const;
316 //Maps what I think is the language this is to affect to the OOo language
317 USHORT GetConvertedLang() const;
319 UINT16 fKerningPunct : 1; // true if we're kerning punctuation
320 UINT16 iJustification : 2; // Kinsoku method of justification:
321 // 0 = always expand
322 // 1 = compress punctuation
323 // 2 = compress punctuation and kana.
324 UINT16 iLevelOfKinsoku : 2; // Level of Kinsoku:
325 // 0 = Level 1
326 // 1 = Level 2
327 // 2 = Custom
328 UINT16 f2on1 : 1; // 2-page-on-1 feature is turned on.
329 UINT16 reserved1 : 4; // in 97 its marked as reserved BUT
330 UINT16 reserved2 : 6; // reserved ?
331 //we find that the following applies,
332 //2 == Japanese
333 //4 == Chinese (VR...
334 //6 == Korean
335 //8 == Chinese (Ta...
336 //perhaps a bit field where the DOP can possibly relate to more than
337 //one language at a time, nevertheless MS seems to have painted
338 //themselves into a small corner with one DopTypography for the
339 //full document, might not matter all that much though ?
341 enum RuleLengths {nMaxFollowing = 101, nMaxLeading = 51};
342 static const sal_Unicode * GetJapanNotBeginLevel1();
343 static const sal_Unicode * GetJapanNotEndLevel1();
345 INT16 cchFollowingPunct; // length of rgxchFPunct
346 INT16 cchLeadingPunct; // length of rgxchLPunct
348 // array of characters that should never appear at the start of a line
349 sal_Unicode rgxchFPunct[nMaxFollowing];
350 // array of characters that should never appear at the end of a line
351 sal_Unicode rgxchLPunct[nMaxLeading];
354 struct WW8_DOGRID
356 short xaGrid; // x-coord of the upper left-hand corner of the grid
357 short yaGrid; // y-coord of the upper left-hand corner of the grid
358 short dxaGrid; // width of each grid square
359 short dyaGrid; // height of each grid square
363 /* a c h t u n g : es duerfen keine solchen Bitfelder ueber einen eingelesenes Byte-Array
364 gelegt werden!!
365 stattdessen ist ein aBits1 darueber zu legen, das mit & auszulesen ist
366 GRUND: Compiler auf Intel und Sparc sortieren die Bits unterschiedlich
371 short dyGridDisplay:7; // the number of grid squares (in the y direction)
372 // between each gridline drawn on the screen. 0 means
373 // don't display any gridlines in the y direction.
374 short fTurnItOff :1; // suppress display of gridlines
375 short dxGridDisplay:7; // the number of grid squares (in the x direction)
376 // between each gridline drawn on the screen. 0 means
377 // don't display any gridlines in the y direction.
378 short fFollowMargins:1; // if true, the grid will start at the left and top
379 // margins and ignore xaGrid and yaGrid.
382 struct WW8_PIC
384 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.
385 UINT16 cbHeader; // 0x4 number of bytes in the PIC (to allow for future expansion).
386 struct {
387 INT16 mm; // 0x6 int
388 INT16 xExt; // 0x8 int
389 INT16 yExt; // 0xa int
390 INT16 hMF; // 0xc int
391 }MFP;
392 // BYTE bm[14]; // 0xe BITMAP(14 bytes) Window's bitmap structure when PIC describes a BITMAP.
393 BYTE rcWinMF[14]; // 0xe rc (rectangle - 8 bytes) rect for window origin
394 // and extents when metafile is stored -- ignored if 0
395 INT16 dxaGoal; // 0x1c horizontal measurement in twips of the rectangle the picture should be imaged within.
396 INT16 dyaGoal; // 0x1e vertical measurement in twips of the rectangle the picture should be imaged within.
397 UINT16 mx; // 0x20 horizontal scaling factor supplied by user in .1% units.
398 UINT16 my; // 0x22 vertical scaling factor supplied by user in .1% units.
399 INT16 dxaCropLeft; // 0x24 the amount the picture has been cropped on the left in twips.
400 INT16 dyaCropTop; // 0x26 the amount the picture has been cropped on the top in twips.
401 INT16 dxaCropRight; // 0x28 the amount the picture has been cropped on the right in twips.
402 INT16 dyaCropBottom;// 0x2a the amount the picture has been cropped on the bottom in twips.
403 INT16 brcl : 4; // 000F Obsolete, superseded by brcTop, etc. In
404 INT16 fFrameEmpty : 1; // 0010 picture consists of a single frame
405 INT16 fBitmap : 1; // 0020 ==1, when picture is just a bitmap
406 INT16 fDrawHatch : 1; // 0040 ==1, when picture is an active OLE object
407 INT16 fError : 1; // 0080 ==1, when picture is just an error message
408 INT16 bpp : 8; // FF00 bits per pixel, 0 = unknown
409 WW8_BRC rgbrc[4];
410 // BRC brcTop; // 0x2e specification for border above picture
411 // BRC brcLeft; // 0x30 specification for border to the left
412 // BRC brcBottom; // 0x32 specification for border below picture
413 // BRC brcRight; // 0x34 specification for border to the right
414 INT16 dxaOrigin; // 0x36 horizontal offset of hand annotation origin
415 INT16 dyaOrigin; // 0x38 vertical offset of hand annotation origin
416 // BYTE rgb[]; // 0x3a variable array of bytes containing Window's metafile, bitmap or TIFF file filename.
419 struct WW8_PIC_SHADOW
421 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.
422 SVBT16 cbHeader; // 0x4 number of bytes in the PIC (to allow for future expansion).
423 struct {
424 SVBT16 mm; // 0x6 int
425 SVBT16 xExt; // 0x8 int
426 SVBT16 yExt; // 0xa int
427 SVBT16 hMF; // 0xc int
428 }MFP;
429 // SVBT8 bm[14]; // 0xe BITMAP(14 bytes) Window's bitmap structure when PIC describes a BITMAP.
430 SVBT8 rcWinMF[14]; // 0xe rc (rectangle - 8 bytes) rect for window origin
431 // and extents when metafile is stored -- ignored if 0
432 SVBT16 dxaGoal; // 0x1c horizontal measurement in twips of the rectangle the picture should be imaged within.
433 SVBT16 dyaGoal; // 0x1e vertical measurement in twips of the rectangle the picture should be imaged within.
434 SVBT16 mx; // 0x20 horizontal scaling factor supplied by user in .1% units.
435 SVBT16 my; // 0x22 vertical scaling factor supplied by user in .1% units.
436 SVBT16 dxaCropLeft; // 0x24 the amount the picture has been cropped on the left in twips.
437 SVBT16 dyaCropTop; // 0x26 the amount the picture has been cropped on the top in twips.
438 SVBT16 dxaCropRight; // 0x28 the amount the picture has been cropped on the right in twips.
439 SVBT16 dyaCropBottom;// 0x2a the amount the picture has been cropped on the bottom in twips.
440 SVBT8 aBits1; //0x2c
441 SVBT8 aBits2;
442 // WW8_BRC rgbrc[4];
443 // BRC brcTop; // 0x2e specification for border above picture
444 // BRC brcLeft; // 0x30 specification for border to the left
445 // BRC brcBottom; // 0x32 specification for border below picture
446 // BRC brcRight; // 0x34 specification for border to the right
447 // SVBT16 dxaOrigin; // 0x36 horizontal offset of hand annotation origin
448 // SVBT16 dyaOrigin; // 0x38 vertical offset of hand annotation origin
449 // SVBT8 rgb[]; // 0x3a variable array of bytes containing Window's metafile, bitmap or TIFF file filename.
453 struct WW8_TBD
455 SVBT8 aBits1;
456 // BYTE jc : 3; // 0x07 justification code: 0=left tab, 1=centered tab, 2=right tab, 3=decimal tab, 4=bar
457 // BYTE tlc : 3; // 0x38 tab leader code: 0=no leader, 1=dotted leader,
458 // 2=hyphenated leader, 3=single line leader, 4=heavy line leader
459 // * int :2 C0 reserved
462 struct WW8_TCell // hiermit wird weitergearbeitet (entspricht weitestgehend dem Ver8-Format)
464 BYTE bFirstMerged : 1;// 0001 set to 1 when cell is first cell of a range of cells that have been merged.
465 BYTE bMerged : 1;// 0002 set to 1 when cell has been merged with preceding cell.
466 BYTE bVertical : 1;// set to 1 when cell has vertical text flow
467 BYTE bBackward : 1;// for a vertical table cell, text flow is bottom to top when 1 and is bottom to top when 0.
468 BYTE bRotateFont : 1;// set to 1 when cell has rotated characters (i.e. uses @font)
469 BYTE 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).
470 BYTE 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.
471 BYTE 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):
472 // 0 top
473 // 1 center
474 // 2 bottom
475 UINT16 fUnused : 7;// reserved - nicht loeschen: macht das UINT16 voll !!
477 WW8_BRC rgbrc[4]; // border codes
478 //notational convenience for referring to brcTop, brcLeft, etc fields.
479 // BRC brcTop; // specification of the top border of a table cell
480 // BRC brcLeft; // specification of left border of table row
481 // BRC brcBottom; // specification of bottom border of table row
482 // BRC brcRight; // specification of right border of table row.
484 // cbTC (count of bytes of a TC) is 18(decimal), 12(hex).
487 struct WW8_TCellVer6 // wird aus der Datei gelesen
489 SVBT8 aBits1Ver6;
490 SVBT8 aBits2Ver6;
491 // UINT16 fFirstMerged : 1;// 0001 set to 1 when cell is first cell of a range of cells that have been merged.
492 // UINT16 fMerged : 1; // 0002 set to 1 when cell has been merged with preceding cell.
493 // UINT16 fUnused : 14; // FFFC reserved
494 WW8_BRCVer6 rgbrcVer6[4];
495 // notational convenience for referring to brcTop, brcLeft, etc fields:
496 // BRC brcTop; // specification of the top border of a table cell
497 // BRC brcLeft; // specification of left border of table row
498 // BRC brcBottom; // specification of bottom border of table row
499 // BRC brcRight; // specification of right border of table row.
501 // cbTC (count of bytes of a TC) is 10(decimal), A(hex).
503 struct WW8_TCellVer8 // wird aus der Datei gelesen
505 SVBT16 aBits1Ver8; // Dokumentation siehe oben unter WW8_TCell
506 SVBT16 aUnused; // reserve
507 WW8_BRC rgbrcVer8[4]; // Dokumentation siehe oben unter WW8_TCell
509 // cbTC (count of bytes of a TC) is 20(decimal), 14(hex).
512 struct WW8_SHD // struct SHD fehlt in der Beschreibung
514 private:
515 UINT16 maBits;
516 // UINT16 nFore : 5; // 0x001f ForegroundColor
517 // UINT16 nBack : 5; // 0x03e0 BackgroundColor
518 // UINT16 nStyle : 5; // 0x7c00 Percentage and Style
519 // UINT16 nDontKnow : 1; // 0x8000 ??? ab Ver8: ebenfalls fuer Style
521 public:
522 WW8_SHD() : maBits(0) {}
524 BYTE GetFore() const { return (BYTE)( maBits & 0x1f); }
525 BYTE GetBack() const { return (BYTE)((maBits >> 5 ) & 0x1f); }
526 BYTE GetStyle(bool bVer67) const
527 { return (BYTE)((maBits >> 10) & ( bVer67 ? 0x1f : 0x3f ) ); }
529 UINT16 GetValue() const { return maBits; }
531 void SetValue(UINT16 nVal) { maBits = nVal; }
532 void SetWWValue(SVBT16 nVal) { maBits = SVBT16ToShort(nVal); }
534 void SetFore(BYTE nVal)
536 maBits &= 0xffe0;
537 maBits |= (nVal & 0x1f);
539 void SetBack(BYTE nVal)
541 maBits &= 0xfc1f;
542 maBits |= (nVal & 0x1f) << 5;
544 void SetStyle(bool bVer67, BYTE nVal)
546 if (bVer67)
548 maBits &= 0x83ff;
549 maBits |= (nVal & 0x1f) << 10;
551 else
553 maBits &= 0x03ff;
554 maBits |= (nVal & 0x2f) << 10;
559 struct WW8_ANLV
561 SVBT8 nfc; // 0 number format code, 0=Arabic, 1=Upper case Roman, 2=Lower case Roman
562 // 3=Upper case Letter, 4=Lower case letter, 5=Ordinal
563 SVBT8 cbTextBefore; // 1 offset into anld.rgch limit of prefix text
564 SVBT8 cbTextAfter; // 2
565 SVBT8 aBits1;
566 // BYTE jc : 2; // 3 : 0x03 justification code, 0=left, 1=center, 2=right, 3=left and right justify
567 // BYTE fPrev : 1; // 0x04 when ==1, include previous levels
568 // BYTE fHang : 1; // 0x08 when ==1, number will be displayed using a hanging indent
569 // BYTE fSetBold : 1; // 0x10 when ==1, boldness of number will be determined by anld.fBold.
570 // BYTE fSetItalic : 1;// 0x20 when ==1, italicness of number will be determined by anld.fItalic
571 // BYTE fSetSmallCaps : 1;// 0x40 when ==1, anld.fSmallCaps will determine whether number will be displayed in small caps or not.
572 // BYTE fSetCaps : 1; // 0x80 when ==1, anld.fCaps will determine whether number will be displayed capitalized or not
573 SVBT8 aBits2;
574 // BYTE fSetStrike : 1;// 4 : 0x01 when ==1, anld.fStrike will determine whether the number will be displayed using strikethrough or not.
575 // BYTE fSetKul : 1; // 0x02 when ==1, anld.kul will determine the underlining state of the autonumber.
576 // BYTE fPrevSpace : 1;// 0x04 when ==1, autonumber will be displayed with a single prefixing space character
577 // BYTE fBold : 1; // 0x08 determines boldness of autonumber when anld.fSetBold == 1.
578 // BYTE fItalic : 1; // 0x10 determines italicness of autonumber when anld.fSetItalic == 1.
579 // BYTE fSmallCaps : 1;// 0x20 determines whether autonumber will be displayed using small caps when anld.fSetSmallCaps == 1.
580 // BYTE fCaps : 1; // 0x40 determines whether autonumber will be displayed using caps when anld.fSetCaps == 1.
581 // BYTE fStrike : 1; // 0x80 determines whether autonumber will be displayed using caps when anld.fSetStrike == 1.
582 SVBT8 aBits3;
583 // BYTE kul : 3; // 5 : 0x07 determines whether autonumber will be displayed with underlining when anld.fSetKul == 1.
584 // BYTE ico : 5; // 0xF1 color of autonumber
585 SVBT16 ftc; // 6 font code of autonumber
586 SVBT16 hps; // 8 font half point size (or 0=auto)
587 SVBT16 iStartAt; // 0x0a starting value (0 to 65535)
588 SVBT16 dxaIndent; // 0x0c *short?* *USHORT?* width of prefix text (same as indent)
589 SVBT16 dxaSpace; // 0x0e minimum space between number and paragraph
591 // *cbANLV (count of bytes of ANLV) is 16 (decimal), 10(hex).
593 struct WW8_ANLD
595 WW8_ANLV eAnlv; // 0
596 SVBT8 fNumber1; // 0x10 number only 1 item per table cell
597 SVBT8 fNumberAcross; // 0x11 number across cells in table rows(instead of down)
598 SVBT8 fRestartHdn; // 0x12 restart heading number on section boundary
599 SVBT8 fSpareX; // 0x13 unused( should be 0)
600 BYTE rgchAnld[32]; // 0x14 characters displayed before/after autonumber
603 struct WW8_OLST
605 WW8_ANLV rganlv[9]; // 0 an array of 9 ANLV structures (heading levels)
606 SVBT8 fRestartHdr; // 0x90 when ==1, restart heading on section break
607 SVBT8 fSpareOlst2; // 0x91 reserved
608 SVBT8 fSpareOlst3; // 0x92 reserved
609 SVBT8 fSpareOlst4; // 0x93 reserved
610 BYTE rgch[64]; // 0x94 array of 64 chars text before/after number
612 // cbOLST is 212(decimal), D4(hex).
614 #if 0
615 struct ANLV
617 ALNV();
618 void ReadFromMem(const sal_uInt8 *&pData);
619 sal_uInt8 nfc;
620 sal_uInt8 cbTextBefore;
621 sal_uInt8 cbTextAfter;
622 sal_uInt8 jc : 2;
623 sal_uInt8 fPrev : 1;
624 sal_uInt8 fHang : 1;
625 sal_uInt8 fSetBold : 1;
626 sal_uInt8 fSetItalic : 1;
627 sal_uInt8 fSetSmallCaps : 1;
628 sal_uInt8 fSetCaps : 1;
629 sal_uInt8 fSetStrike : 1;
630 sal_uInt8 fSetKul : 1;
631 sal_uInt8 fPrevSpace : 1;
632 sal_uInt8 fBold : 1;
633 sal_uInt8 fItalic : 1;
634 sal_uInt8 fSmallCaps : 1;
635 sal_uInt8 fCaps : 1;
636 sal_uInt8 fStrike : 1;
637 sal_uInt8 kul : 3;
638 sal_uInt8 ico : 5;
639 sal_uInt16 ftc;
640 sal_uInt16 hps;
641 sal_uInt16 iStartAt;
642 sal_uInt16 dxaIndent;
643 sal_uInt16 dxaSpace;
646 struct OLST
648 OLST();
649 void ReadFromMem(const sal_uInt8 *&pData, bool bVer67)
650 ANLV rganlv[9]; // 0 an array of 9 ANLV structures (heading levels)
651 sal_uInt8 fRestartHdr; // when ==1, restart heading on section break
652 sal_uInt8 fSpareOlst2; // reserved
653 sal_uInt8 fSpareOlst3; // reserved
654 sal_uInt8 fSpareOlst4; // reserved
655 sal_uInt16 rgxch[64]; // array of 64 chars text before/after number
656 #if 0
657 sal_uInt16 rgxch[32]; // array of 32 chars text before/after number
658 sal_uInt8 rgch[64]; // array of 64 chars text before/after number
659 #endif
661 #endif
663 struct WW8_FDOA
665 SVBT32 fc; // 0 FC pointing to drawing object data
666 SVBT16 ctxbx; // 4 count of textboxes in the drawing object
669 struct WW8_DO
671 SVBT16 dok; // 0 Drawn Object Kind, currently this is always 0
672 SVBT16 cb; // 2 size (count of bytes) of the entire DO
673 SVBT8 bx; // 4 x position relative to anchor CP
674 SVBT8 by; // 5 y position relative to anchor CP
675 SVBT16 dhgt; // 6 height of DO
676 SVBT16 aBits1;
677 // UINT16 fAnchorLock : 1; // 8 1 if the DO anchor is locked
678 // BYTE[] rgdp; // 0xa variable length array of drawing primitives
681 struct WW8_DPHEAD
683 SVBT16 dpk; // 0 Drawn Primitive Kind REVIEW davebu
684 // 0=start of grouping, 1=line, 2=textbox, 3=rectangle,
685 // 4=arc, 5=elipse, 6=polyline, 7=callout textbox,
686 // 8=end of grouping, 9=sample primitve holding default values
687 SVBT16 cb; // 2 size (count of bytes) of this DP
688 SVBT16 xa; // 4 These 2 points describe the rectangle
689 SVBT16 ya; // 6 enclosing this DP relative to the origin of
690 SVBT16 dxa; // 8 the DO
691 SVBT16 dya; // 0xa
695 struct WW8_DP_LINETYPE
697 SVBT32 lnpc; // LiNe Property Color -- RGB color value
698 SVBT16 lnpw; // line property weight in twips
699 SVBT16 lnps; // line property style : 0=Solid, 1=Dashed
700 // 2=Dotted, 3=Dash Dot, 4=Dash Dot Dot, 5=Hollow
703 struct WW8_DP_SHADOW // Schattierung!
705 SVBT16 shdwpi; // Shadow Property Intensity
706 SVBT16 xaOffset; // x offset of shadow
707 SVBT16 yaOffset; // y offset of shadow
710 struct WW8_DP_FILL
712 SVBT32 dlpcFg; // FiLl Property Color ForeGround -- RGB color value
713 SVBT32 dlpcBg; // Property Color BackGround -- RGB color value
714 SVBT16 flpp; // FiLl Property Pattern REVIEW davebu
717 struct WW8_DP_LINEEND
719 SVBT16 aStartBits;
720 // UINT16 eppsStart : 2; // Start EndPoint Property Style
721 // 0=None, 1=Hollow, 2=Filled
722 // UINT16 eppwStart : 2; // Start EndPoint Property Weight
723 // UINT16 epplStart : 2; // Start EndPoint Property length
724 // UINT16 dummyStart : 10; // Alignment
725 SVBT16 aEndBits;
726 // UINT16 eppsEnd : 2; // End EndPoint Property Style
727 // UINT16 eppwEnd : 2; // End EndPoint Property Weight
728 // UINT16 epplEnd : 2; // End EndPoint Property length
729 // UINT16 dummyEnd : 10; // Alignment
732 struct WW8_DP_LINE
734 // WW8_DPHEAD dphead; // 0 Common header for a drawing primitive
735 SVBT16 xaStart; // starting point for line
736 SVBT16 yaStart; //
737 SVBT16 xaEnd; // ending point for line
738 SVBT16 yaEnd;
739 WW8_DP_LINETYPE aLnt;
740 WW8_DP_LINEEND aEpp;
741 WW8_DP_SHADOW aShd;
744 struct WW8_DP_TXTBOX
746 WW8_DP_LINETYPE aLnt;
747 WW8_DP_FILL aFill;
748 WW8_DP_SHADOW aShd;
749 SVBT16 aBits1;
750 // UINT16 fRoundCorners : 1; //0x24 0001 1 if the textbox has rounded corners
751 // UINT16 zaShape : 15; // 0x24 000e REVIEW davebu
752 SVBT16 dzaInternalMargin; // 0x26 REVIEW davebu
755 struct WW8_DP_RECT
757 WW8_DP_LINETYPE aLnt;
758 WW8_DP_FILL aFill;
759 WW8_DP_SHADOW aShd;
760 SVBT16 aBits1;
761 // UINT16 fRoundCorners : 1; // 0x24 0001 1 if the textbox has rounded corners
762 // UINT16 zaShape : 15; // 0x24 000e REVIEW davebu
765 struct WW8_DP_ARC
767 WW8_DP_LINETYPE aLnt;
768 WW8_DP_FILL aFill;
769 WW8_DP_SHADOW aShd;
770 SVBT8 fLeft; // 0x24 00ff REVIEW davebu
771 SVBT8 fUp; // 0x24 ff00 REVIEW davebu
772 // UINT16 fLeft : 8; // 0x24 00ff REVIEW davebu
773 // UINT16 fUp : 8; // 0x24 ff00 REVIEW davebu
776 struct WW8_DP_ELIPSE
778 WW8_DP_LINETYPE aLnt;
779 WW8_DP_FILL aFill;
780 WW8_DP_SHADOW aShd;
783 struct WW8_DP_POLYLINE
785 WW8_DP_LINETYPE aLnt;
786 WW8_DP_FILL aFill;
787 WW8_DP_LINEEND aEpp;
788 WW8_DP_SHADOW aShd;
789 SVBT16 aBits1;
790 // UINT16 fPolygon : 1; // 0x28 0001 1 if this is a polygon
791 // UINT16 cpt : 15; // 0x28 00fe count of points
792 // short xaFirst; // 0x2a These are the endpoints of the first line.
793 // short yaFirst; // 0x2c
794 // short xaEnd; // 0x2e
795 // short yaEnd; // 0x30
796 // short rgpta[]; // 0x32 An array of xa,ya pairs for the remaining points
799 struct WW8_DP_CALLOUT_TXTBOX
801 SVBT16 flags; // 0x0c REVIEW davebu flags
802 SVBT16 dzaOffset; // 0x0e REVIEW davebu
803 SVBT16 dzaDescent; // 0x10 REVIEW davebu
804 SVBT16 dzaLength; // 0x12 REVIEW davebu
805 WW8_DPHEAD dpheadTxbx; // 0x14 DPHEAD for a textbox
806 WW8_DP_TXTBOX dptxbx; // 0x20 DP for a textbox
807 WW8_DPHEAD dpheadPolyLine; // 0x4c DPHEAD for a Polyline
808 WW8_DP_POLYLINE dpPolyLine; // 0x48 DP for a polyline
811 struct WW8_PCD
813 SVBT8 aBits1;
814 // BYTE fNoParaLast : 1; // when 1, means that piece contains no end of paragraph marks.
815 // BYTE fPaphNil : 1; // used internally by Word
816 // BYTE fCopied : 1; // used internally by Word
817 // * int :5
818 SVBT8 aBits2; // fn int:8, used internally by Word
819 SVBT32 fc; // file offset of beginning of piece. The size of the
820 // ithpiece can be determined by subtracting rgcp[i] of
821 // the containing plcfpcd from its rgcp[i+1].
822 SVBT16 prm; // PRM contains either a single sprm or else an index number
823 // of the grpprl which contains the sprms that modify the
824 // properties of the piece.
827 // AnnoTation Refernce Descriptor (ATRD)
828 struct WW8_ATRD // fuer die 8-Version
830 SVBT16 xstUsrInitl[ 10 ]; // pascal-style String holding initials
831 // of annotation author
832 SVBT16 ibst; // index into GrpXstAtnOwners
833 SVBT16 ak; // not used
834 SVBT16 grfbmc; // not used
835 SVBT32 ITagBkmk; // when not -1, this tag identifies the
836 // annotation bookmark that locates the
837 // range of CPs in the main document which
838 // this annotation references.
841 struct WW8_ATRDEXTRA
843 // --- Extended bit since Word 2002 --- //
845 SVBT32 dttm;
846 SVBT16 bf;
847 SVBT32 cDepth;
848 SVBT32 diatrdParent;
849 SVBT32 Discussitem;
852 struct WW67_ATRD // fuer die 6/7-Version
854 sal_Char xstUsrInitl[ 10 ]; // pascal-style String holding initials
855 // of annotation author
856 SVBT16 ibst; // index into GrpXstAtnOwners
857 SVBT16 ak; // not used
858 SVBT16 grfbmc; // not used
859 SVBT32 ITagBkmk; // when not -1, this tag identifies the
860 // annotation bookmark that locates the
861 // range of CPs in the main document which
862 // this annotation references.
865 struct WW8_TablePos
867 INT16 nSp26;
868 INT16 nSp27;
869 INT16 nLeMgn;
870 INT16 nRiMgn;
871 INT16 nUpMgn;
872 INT16 nLoMgn;
873 BYTE nSp29;
874 BYTE nSp37;
877 struct WW8_FSPA
879 public:
880 sal_Int32 nSpId; //Shape Identifier. Used in conjunction with the office art data (found via fcDggInfo in the FIB) to find the actual data for this shape.
881 sal_Int32 nXaLeft; //left of rectangle enclosing shape relative to the origin of the shape
882 sal_Int32 nYaTop; //top of rectangle enclosing shape relative to the origin of the shape
883 sal_Int32 nXaRight; //right of rectangle enclosing shape relative to the origin of the shape
884 sal_Int32 nYaBottom;//bottom of the rectangle enclosing shape relative to the origin of the shape
885 sal_uInt16 bHdr:1;
886 //0001 1 in the undo doc when shape is from the header doc, 0 otherwise (undefined when not in the undo doc)
887 sal_uInt16 nbx:2;
888 //0006 x position of shape relative to anchor CP
889 //0 relative to page margin
890 //1 relative to top of page
891 //2 relative to text (column for horizontal text; paragraph for vertical text)
892 //3 reserved for future use
893 sal_uInt16 nby:2;
894 //0018 y position of shape relative to anchor CP
895 //0 relative to page margin
896 //1 relative to top of page
897 //2 relative to text (paragraph for horizontal text; column for vertical text)
898 sal_uInt16 nwr:4;
899 //01E0 text wrapping mode
900 //0 like 2, but doesn't require absolute object
901 //1 no text next to shape
902 //2 wrap around absolute object
903 //3 wrap as if no object present
904 //4 wrap tightly around object
905 //5 wrap tightly, but allow holes
906 //6-15 reserved for future use
907 sal_uInt16 nwrk:4;
908 //1E00 text wrapping mode type (valid only for wrapping modes 2 and 4
909 //0 wrap both sides
910 //1 wrap only on left
911 //2 wrap only on right
912 //3 wrap only on largest side
913 sal_uInt16 bRcaSimple:1;
914 //2000 when set, temporarily overrides bx, by, forcing the xaLeft, xaRight, yaTop, and yaBottom fields to all be page relative.
915 sal_uInt16 bBelowText:1;
916 //4000
917 //1 shape is below text
918 //0 shape is above text
919 sal_uInt16 bAnchorLock:1;
920 //8000 1 anchor is locked
921 // 0 anchor is not locked
922 sal_Int32 nTxbx; //count of textboxes in shape (undo doc only)
923 public:
924 enum FSPAOrient {RelPgMargin, RelPageBorder, RelText};
928 struct WW8_FSPA_SHADOW // alle Member an gleicher Position und Groesse,
929 { // wegen: pF = (WW8_FSPA*)pFS;
930 SVBT32 nSpId;
931 SVBT32 nXaLeft;
932 SVBT32 nYaTop;
933 SVBT32 nXaRight;
934 SVBT32 nYaBottom;
935 SVBT16 aBits1;
936 SVBT32 nTxbx;
939 struct WW8_TXBXS
941 SVBT32 cTxbx_iNextReuse;
942 SVBT32 cReusable;
943 SVBT16 fReusable;
944 SVBT32 reserved;
945 SVBT32 ShapeId;
946 SVBT32 txidUndo;
949 struct WW8_STRINGID
951 // M.M. This is the extra data stored in the SttbfFnm
952 // For now I only need the String Id
953 SVBT16 nStringId;
954 SVBT16 reserved1;
955 SVBT16 reserved2;
956 SVBT16 reserved3;
959 struct WW8_WKB
961 // M.M. This is the WkbPLCF struct
962 // For now I only need the Link Id
963 SVBT16 reserved1;
964 SVBT16 reserved2;
965 SVBT16 reserved3;
966 SVBT16 nLinkId;
967 SVBT16 reserved4;
968 SVBT16 reserved5;
971 #ifdef SAL_W32
972 # pragma pack(pop)
973 #elif defined(SAL_OS2)
974 # pragma pack()
975 #endif
977 struct SEPr
979 SEPr();
980 sal_uInt8 bkc;
981 sal_uInt8 fTitlePage;
982 sal_Int8 fAutoPgn;
983 sal_uInt8 nfcPgn;
984 sal_uInt8 fUnlocked;
985 sal_uInt8 cnsPgn;
986 sal_uInt8 fPgnRestart;
987 sal_uInt8 fEndNote;
988 sal_Int8 lnc;
989 sal_Int8 grpfIhdt;
990 sal_uInt16 nLnnMod;
991 sal_Int32 dxaLnn;
992 sal_Int16 dxaPgn;
993 sal_Int16 dyaPgn;
994 sal_Int8 fLBetween;
995 sal_Int8 vjc;
996 sal_uInt16 dmBinFirst;
997 sal_uInt16 dmBinOther;
998 sal_uInt16 dmPaperReq;
999 #if 0
1000 28 1C brcTop BRC top page border
1002 32 20 brcLeft BRC left page border
1004 36 24 brcBottom BRC bottom page border
1006 40 28 brcRight BRC right page border
1007 #endif
1008 sal_Int16 fPropRMark;
1009 sal_Int16 ibstPropRMark;
1010 sal_Int32 dttmPropRMark; //DTTM
1011 sal_Int32 dxtCharSpace;
1012 sal_Int32 dyaLinePitch;
1013 sal_uInt16 clm;
1014 sal_Int16 reserved1;
1015 sal_uInt8 dmOrientPage;
1016 sal_uInt8 iHeadingPgn;
1017 sal_uInt16 pgnStart;
1018 sal_Int16 lnnMin;
1019 sal_uInt16 wTextFlow;
1020 sal_Int16 reserved2;
1021 sal_uInt16 pgbApplyTo:3;
1022 sal_uInt16 pgbPageDepth:2;
1023 sal_Int16 pgbOffsetFrom:3;
1024 sal_Int16 :8;
1025 sal_uInt32 xaPage;
1026 sal_uInt32 yaPage;
1027 sal_uInt32 xaPageNUp;
1028 sal_uInt32 yaPageNUp;
1029 sal_uInt32 dxaLeft;
1030 sal_uInt32 dxaRight;
1031 sal_Int32 dyaTop;
1032 sal_Int32 dyaBottom;
1033 sal_uInt32 dzaGutter;
1034 sal_uInt32 dyaHdrTop;
1035 sal_uInt32 dyaHdrBottom;
1036 sal_Int16 ccolM1;
1037 sal_Int8 fEvenlySpaced;
1038 sal_Int8 reserved3;
1039 sal_uInt8 fBiDi;
1040 sal_uInt8 fFacingCol;
1041 sal_uInt8 fRTLGutter;
1042 sal_uInt8 fRTLAlignment;
1043 sal_Int32 dxaColumns;
1044 sal_Int32 rgdxaColumnWidthSpacing[89];
1045 sal_Int32 dxaColumnWidth;
1046 sal_uInt8 dmOrientFirst;
1047 sal_uInt8 fLayout;
1048 sal_Int16 reserved4;
1049 #if 0
1050 OLST olstAnm; //currently unused
1051 #endif
1054 namespace wwUtility
1056 sal_uInt32 BGRToRGB(sal_uInt32 nColour);
1057 inline sal_uInt32 RGBToBGR(sal_uInt32 nColour) { return BGRToRGB(nColour); }
1060 #endif
1062 /* vi:set tabstop=4 shiftwidth=4 expandtab: */