bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / filter / ww8 / ww8struc.hxx
blob06b3578f93c4a1515938db9ba13653d61fa4fc62
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _WW8STRUC_HXX
21 #define _WW8STRUC_HXX
23 #include <osl/endian.h>
24 #include <tools/string.hxx>
25 #include <sal/config.h>
27 #include <editeng/borderline.hxx>
28 #include <filter/msfilter/util.hxx>
30 #if defined OSL_BIGENDIAN || SAL_TYPES_ALIGNMENT4 > 2 || defined UNX
31 # define __WW8_NEEDS_COPY
32 #endif
34 #ifdef SAL_W32
35 # pragma pack(push, 2)
36 #endif
38 inline void Set_UInt8( sal_uInt8 *& p, sal_uInt8 n )
40 ByteToSVBT8( n, *(SVBT8*)p );
41 p+= 1;
44 inline void Set_UInt16( sal_uInt8 *& p, sal_uInt16 n )
46 ShortToSVBT16( n, *(SVBT16*)p );
47 p+= 2;
50 inline void Set_UInt32( sal_uInt8 *& p, sal_uInt32 n )
52 UInt32ToSVBT32( n, *(SVBT32*)p );
53 p+= 4;
56 struct Word2CHPX
58 sal_uInt16 fBold:1;
59 sal_uInt16 fItalic:1;
60 sal_uInt16 fRMarkDel:1;
61 sal_uInt16 fOutline:1;
62 sal_uInt16 fFldVanish:1;
63 sal_uInt16 fSmallCaps:1;
64 sal_uInt16 fCaps:1;
65 sal_uInt16 fVanish:1;
66 sal_uInt16 fRMark:1;
67 sal_uInt16 fSpec:1;
68 sal_uInt16 fStrike:1;
69 sal_uInt16 fObj:1;
70 sal_uInt16 fBoldBi:1;
71 sal_uInt16 fItalicBi:1;
72 sal_uInt16 fBiDi:1;
73 sal_uInt16 fDiacUSico:1;
74 sal_uInt16 fsIco:1;
75 sal_uInt16 fsFtc:1;
76 sal_uInt16 fsHps:1;
77 sal_uInt16 fsKul:1;
78 sal_uInt16 fsPos:1;
79 sal_uInt16 fsSpace:1;
80 sal_uInt16 fsLid:1;
81 sal_uInt16 fsIcoBi:1;
82 sal_uInt16 fsFtcBi:1;
83 sal_uInt16 fsHpsBi:1;
84 sal_uInt16 fsLidBi:1;
86 sal_uInt16 ftc;
87 sal_uInt16 hps;
88 sal_uInt8 qpsSpace:6;
89 sal_uInt8 fSysVanish:1;
90 sal_uInt8 fNumRun:1;
91 sal_uInt8 ico:5;
92 sal_uInt8 kul:3;
93 sal_uInt8 hpsPos;
94 sal_uInt8 icoBi;
95 sal_uInt16 lid;
96 sal_uInt16 ftcBi;
97 sal_uInt16 hpsBi;
98 sal_uInt16 lidBi;
99 sal_uInt32 fcPic;
101 Word2CHPX()
103 fBold = 0;
104 fItalic = 0;
105 fRMarkDel = 0;
106 fOutline = 0;
107 fFldVanish = 0;
108 fSmallCaps = 0;
109 fCaps = 0;
110 fVanish = 0;
111 fRMark = 0;
112 fSpec = 0;
113 fStrike = 0;
114 fObj = 0;
115 fBoldBi = 0;
116 fItalicBi = 0;
117 fBiDi = 0;
118 fDiacUSico = 0;
119 fsIco = 0;
120 fsFtc = 0;
121 fsHps = 0;
122 fsKul = 0;
123 fsPos = 0;
124 fsSpace = 0;
125 fsLid = 0;
126 fsIcoBi = 0;
127 fsFtcBi = 0;
128 fsHpsBi = 0;
129 fsLidBi = 0;
131 ftc = 0;
132 hps = 0;
133 qpsSpace = 0;
134 fSysVanish = 0;
135 fNumRun = 0;
136 ico = 0;
137 kul = 0;
138 hpsPos = 0;
139 icoBi = 0;
140 lid = 0;
141 ftcBi = 0;
142 hpsBi = 0;
143 lidBi = 0;
144 fcPic = 0;
149 typedef sal_Int16 WW8_PN;
150 typedef sal_Int32 WW8_FC;
151 typedef sal_Int32 WW8_CP;
153 const WW8_FC WW8_FC_MAX = SAL_MAX_INT32;
154 const WW8_CP WW8_CP_MAX = SAL_MAX_INT32;
156 /** STD - STyle Definition
158 The STD contains the entire definition of a style.
159 It has two parts, a fixed-length base (cbSTDBase bytes long)
160 and a variable length remainder holding the name, and the upx and upe
161 arrays (a upx and upe for each type stored in the style, std.cupx)
162 Note that new fields can be added to the BASE of the STD without
163 invalidating the file format, because the STSHI contains the length
164 that is stored in the file. When reading STDs from an older version,
165 new fields will be zero.
167 struct WW8_STD
169 // Base part of STD:
170 sal_uInt16 sti : 12; // invariant style identifier
171 sal_uInt16 fScratch : 1; // spare field for any temporary use,
172 // always reset back to zero!
173 sal_uInt16 fInvalHeight : 1; // PHEs of all text with this style are wrong
174 sal_uInt16 fHasUpe : 1; // UPEs have been generated
175 sal_uInt16 fMassCopy : 1; // std has been mass-copied; if unused at
176 // save time, style should be deleted
177 sal_uInt16 sgc : 4; // style type code
178 sal_uInt16 istdBase : 12; // base style
179 sal_uInt16 cupx : 4; // # of UPXs (and UPEs)
180 sal_uInt16 istdNext : 12; // next style
181 sal_uInt16 bchUpe; // offset to end of upx's, start of upe's
182 //-------- jetzt neu:
183 // ab Ver8 gibts zwei Felder mehr:
184 sal_uInt16 fAutoRedef : 1; /* auto redefine style when appropriate */
185 sal_uInt16 fHidden : 1; /* hidden from UI? */
186 sal_uInt16 : 14; /* unused bits */
188 // Variable length part of STD:
189 // sal_uInt8 stzName[2]; /* sub-names are separated by chDelimStyle
190 // char grupx[];
191 // the UPEs are not stored on the file; they are a cache of the based-on
192 // chain
193 // char grupe[];
196 /** Basis zum Einlesen UND zum Arbeiten (wird jeweils unter schiedlich beerbt)
198 struct WW8_FFN_BASE // Font Descriptor
200 // ab Ver6
201 sal_uInt8 cbFfnM1; // 0x0 total length of FFN - 1.
203 sal_uInt8 prg: 2; // 0x1:03 pitch request
204 sal_uInt8 fTrueType : 1; // 0x1:04 when 1, font is a TrueType font
205 // 0x1:08 reserved
206 sal_uInt8 ff : 3; // 0x1:70 font family id
207 // 0x1:80 reserved
209 short wWeight; // 0x2 base weight of font
210 sal_uInt8 chs; // 0x4 character set identifier
211 sal_uInt8 ibszAlt; // 0x5 index into ffn.szFfn to the name of the alternate font
214 /** Hiermit arbeiten wir im Parser (und Dumper)
216 struct WW8_FFN : public WW8_FFN_BASE
218 // ab Ver8 als Unicode
219 String sFontname;// 0x6 bzw. 0x40 ab Ver8 zero terminated string that
220 // records name of font.
221 // Maximal size of szFfn is 65 characters.
222 // Vorsicht: Dieses Array kann auch kleiner sein!!!
223 // Possibly followed by a second sz which records the
224 // name of an alternate font to use if the first named
225 // font does not exist on this system.
230 struct WW8_BRCVer6 // alter Border Code
232 SVBT16 aBits1;
233 // sal_uInt16 dxpLineWidth : 3;// 0007 When dxpLineWidth is 0, 1, 2, 3, 4, or 5, this field is the width of
234 // a single line of border in units of 0.75 points
235 // Must be nonzero when brcType is nonzero.
236 // 6 == dotted, 7 == dashed.
237 // sal_uInt16 brcType : 2; // 0018 border type code: 0 == none, 1 == single, 2 == thick, 3 == double
238 // sal_uInt16 fShadow : 1; // 0020 when 1, border is drawn with shadow. Must be 0 when BRC is a substructure of the TC
239 // sal_uInt16 ico : 5; // 07C0 color code (see chp.ico)
240 // sal_uInt16 dxpSpace : 5; // F800 width of space to maintain between border and text within border.
241 // Must be 0 when BRC is a substructure of the TC. Stored in points for Windows.
244 class WW8_BRC // Border Code
246 public:
247 SVBT16 aBits1;
248 SVBT16 aBits2;
249 // sal_uInt16 dxpLineWidth : 3;// 0007 When dxpLineWidth is 0, 1, 2, 3, 4, or 5, this field is the width of
250 // a single line of border in units of 0.75 points
251 // Must be nonzero when brcType is nonzero.
252 // 6 == dotted, 7 == dashed.
253 // sal_uInt16 brcType : 2; // 0018 border type code: 0 == none, 1 == single, 2 == thick, 3 == double
254 // sal_uInt16 fShadow : 1; // 0020 when 1, border is drawn with shadow. Must be 0 when BRC is a substructure of the TC
255 // sal_uInt16 ico : 5; // 07C0 color code (see chp.ico)
256 // sal_uInt16 dxpSpace : 5; // F800 width of space to maintain between border and text within border.
257 // Must be 0 when BRC is a substructure of the TC. Stored in points for Windows.
258 WW8_BRC()
260 memset(aBits1, 0, sizeof(aBits1));
261 memset(aBits2, 0, sizeof(aBits2));
263 short DetermineBorderProperties (bool bVer67, short *pSpace=0,
264 sal_uInt8 *pCol=0, short *pIdx=0) const;
265 bool IsEmpty(bool bVer67) const;
266 bool IsZeroed(bool bVer67) const;
267 bool IsBlank() const;
270 typedef WW8_BRC WW8_BRC5[5]; // 5 * Border Code
272 enum BRC_Sides
274 WW8_TOP = 0, WW8_LEFT = 1, WW8_BOT = 2, WW8_RIGHT = 3, WW8_BETW = 4
278 Document Typography Info (DOPTYPOGRAPHY) These options are Far East only,
279 and are accessible through the Typography tab of the Tools/Options dialog.
281 class WW8DopTypography
283 public:
284 void ReadFromMem(sal_uInt8 *&pData);
285 void WriteToMem(sal_uInt8 *&pData) const;
287 //Maps what I think is the language this is to affect to the OOo language
288 sal_uInt16 GetConvertedLang() const;
290 sal_uInt16 fKerningPunct : 1; // true if we're kerning punctuation
291 sal_uInt16 iJustification : 2; // Kinsoku method of justification:
292 // 0 = always expand
293 // 1 = compress punctuation
294 // 2 = compress punctuation and kana.
295 sal_uInt16 iLevelOfKinsoku : 2; // Level of Kinsoku:
296 // 0 = Level 1
297 // 1 = Level 2
298 // 2 = Custom
299 sal_uInt16 f2on1 : 1; // 2-page-on-1 feature is turned on.
300 sal_uInt16 reserved1 : 4; // in 97 its marked as reserved BUT
301 sal_uInt16 reserved2 : 6; // reserved ?
302 //we find that the following applies,
303 //2 == Japanese
304 //4 == Chinese (VR...
305 //6 == Korean
306 //8 == Chinese (Ta...
307 //perhaps a bit field where the DOP can possibly relate to more than
308 //one language at a time, nevertheless MS seems to have painted
309 //themselves into a small corner with one DopTypography for the
310 //full document, might not matter all that much though ?
312 enum RuleLengths {nMaxFollowing = 101, nMaxLeading = 51};
313 static const sal_Unicode * GetJapanNotBeginLevel1();
314 static const sal_Unicode * GetJapanNotEndLevel1();
316 sal_Int16 cchFollowingPunct; // length of rgxchFPunct
317 sal_Int16 cchLeadingPunct; // length of rgxchLPunct
319 // array of characters that should never appear at the start of a line
320 sal_Unicode rgxchFPunct[nMaxFollowing];
321 // array of characters that should never appear at the end of a line
322 sal_Unicode rgxchLPunct[nMaxLeading];
325 struct WW8_DOGRID
327 short xaGrid; // x-coord of the upper left-hand corner of the grid
328 short yaGrid; // y-coord of the upper left-hand corner of the grid
329 short dxaGrid; // width of each grid square
330 short dyaGrid; // height of each grid square
334 /* a c h t u n g : es duerfen keine solchen Bitfelder ueber einen eingelesenes Byte-Array
335 gelegt werden!!
336 stattdessen ist ein aBits1 darueber zu legen, das mit & auszulesen ist
337 GRUND: Compiler auf Intel und Sparc sortieren die Bits unterschiedlich
342 short dyGridDisplay:7; // the number of grid squares (in the y direction)
343 // between each gridline drawn on the screen. 0 means
344 // don't display any gridlines in the y direction.
345 short fTurnItOff :1; // suppress display of gridlines
346 short dxGridDisplay:7; // the number of grid squares (in the x direction)
347 // between each gridline drawn on the screen. 0 means
348 // don't display any gridlines in the y direction.
349 short fFollowMargins:1; // if true, the grid will start at the left and top
350 // margins and ignore xaGrid and yaGrid.
353 struct WW8_PIC
355 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.
356 sal_uInt16 cbHeader; // 0x4 number of bytes in the PIC (to allow for future expansion).
357 struct {
358 sal_Int16 mm; // 0x6 int
359 sal_Int16 xExt; // 0x8 int
360 sal_Int16 yExt; // 0xa int
361 sal_Int16 hMF; // 0xc int
362 }MFP;
363 // sal_uInt8 bm[14]; // 0xe BITMAP(14 bytes) Window's bitmap structure when PIC describes a BITMAP.
364 sal_uInt8 rcWinMF[14]; // 0xe rc (rectangle - 8 bytes) rect for window origin
365 // and extents when metafile is stored -- ignored if 0
366 sal_Int16 dxaGoal; // 0x1c horizontal measurement in twips of the rectangle the picture should be imaged within.
367 sal_Int16 dyaGoal; // 0x1e vertical measurement in twips of the rectangle the picture should be imaged within.
368 sal_uInt16 mx; // 0x20 horizontal scaling factor supplied by user in .1% units.
369 sal_uInt16 my; // 0x22 vertical scaling factor supplied by user in .1% units.
370 sal_Int16 dxaCropLeft; // 0x24 the amount the picture has been cropped on the left in twips.
371 sal_Int16 dyaCropTop; // 0x26 the amount the picture has been cropped on the top in twips.
372 sal_Int16 dxaCropRight; // 0x28 the amount the picture has been cropped on the right in twips.
373 sal_Int16 dyaCropBottom;// 0x2a the amount the picture has been cropped on the bottom in twips.
374 sal_Int16 brcl : 4; // 000F Obsolete, superseded by brcTop, etc. In
375 sal_Int16 fFrameEmpty : 1; // 0010 picture consists of a single frame
376 sal_Int16 fBitmap : 1; // 0020 ==1, when picture is just a bitmap
377 sal_Int16 fDrawHatch : 1; // 0040 ==1, when picture is an active OLE object
378 sal_Int16 fError : 1; // 0080 ==1, when picture is just an error message
379 sal_Int16 bpp : 8; // FF00 bits per pixel, 0 = unknown
380 WW8_BRC rgbrc[4];
381 // BRC brcTop; // 0x2e specification for border above picture
382 // BRC brcLeft; // 0x30 specification for border to the left
383 // BRC brcBottom; // 0x32 specification for border below picture
384 // BRC brcRight; // 0x34 specification for border to the right
385 sal_Int16 dxaOrigin; // 0x36 horizontal offset of hand annotation origin
386 sal_Int16 dyaOrigin; // 0x38 vertical offset of hand annotation origin
387 // sal_uInt8 rgb[]; // 0x3a variable array of bytes containing Window's metafile, bitmap or TIFF file filename.
390 struct WW8_PIC_SHADOW
392 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.
393 SVBT16 cbHeader; // 0x4 number of bytes in the PIC (to allow for future expansion).
394 struct {
395 SVBT16 mm; // 0x6 int
396 SVBT16 xExt; // 0x8 int
397 SVBT16 yExt; // 0xa int
398 SVBT16 hMF; // 0xc int
399 }MFP;
400 // SVBT8 bm[14]; // 0xe BITMAP(14 bytes) Window's bitmap structure when PIC describes a BITMAP.
401 SVBT8 rcWinMF[14]; // 0xe rc (rectangle - 8 bytes) rect for window origin
402 // and extents when metafile is stored -- ignored if 0
403 SVBT16 dxaGoal; // 0x1c horizontal measurement in twips of the rectangle the picture should be imaged within.
404 SVBT16 dyaGoal; // 0x1e vertical measurement in twips of the rectangle the picture should be imaged within.
405 SVBT16 mx; // 0x20 horizontal scaling factor supplied by user in .1% units.
406 SVBT16 my; // 0x22 vertical scaling factor supplied by user in .1% units.
407 SVBT16 dxaCropLeft; // 0x24 the amount the picture has been cropped on the left in twips.
408 SVBT16 dyaCropTop; // 0x26 the amount the picture has been cropped on the top in twips.
409 SVBT16 dxaCropRight; // 0x28 the amount the picture has been cropped on the right in twips.
410 SVBT16 dyaCropBottom;// 0x2a the amount the picture has been cropped on the bottom in twips.
411 SVBT8 aBits1; //0x2c
412 SVBT8 aBits2;
413 // WW8_BRC rgbrc[4];
414 // BRC brcTop; // 0x2e specification for border above picture
415 // BRC brcLeft; // 0x30 specification for border to the left
416 // BRC brcBottom; // 0x32 specification for border below picture
417 // BRC brcRight; // 0x34 specification for border to the right
418 // SVBT16 dxaOrigin; // 0x36 horizontal offset of hand annotation origin
419 // SVBT16 dyaOrigin; // 0x38 vertical offset of hand annotation origin
420 // SVBT8 rgb[]; // 0x3a variable array of bytes containing Window's metafile, bitmap or TIFF file filename.
424 struct WW8_TBD
426 SVBT8 aBits1;
427 // sal_uInt8 jc : 3; // 0x07 justification code: 0=left tab, 1=centered tab, 2=right tab, 3=decimal tab, 4=bar
428 // sal_uInt8 tlc : 3; // 0x38 tab leader code: 0=no leader, 1=dotted leader,
429 // 2=hyphenated leader, 3=single line leader, 4=heavy line leader
430 // * int :2 C0 reserved
433 struct WW8_TCell // hiermit wird weitergearbeitet (entspricht weitestgehend dem Ver8-Format)
435 sal_uInt8 bFirstMerged : 1;// 0001 set to 1 when cell is first cell of a range of cells that have been merged.
436 sal_uInt8 bMerged : 1;// 0002 set to 1 when cell has been merged with preceding cell.
437 sal_uInt8 bVertical : 1;// set to 1 when cell has vertical text flow
438 sal_uInt8 bBackward : 1;// for a vertical table cell, text flow is bottom to top when 1 and is bottom to top when 0.
439 sal_uInt8 bRotateFont : 1;// set to 1 when cell has rotated characters (i.e. uses @font)
440 sal_uInt8 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).
441 sal_uInt8 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.
442 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):
443 // 0 top
444 // 1 center
445 // 2 bottom
446 sal_uInt16 fUnused : 7;// reserved - nicht loeschen: macht das sal_uInt16 voll !!
448 WW8_BRC rgbrc[4]; // border codes
449 //notational convenience for referring to brcTop, brcLeft, etc fields.
450 // BRC brcTop; // specification of the top border of a table cell
451 // BRC brcLeft; // specification of left border of table row
452 // BRC brcBottom; // specification of bottom border of table row
453 // BRC brcRight; // specification of right border of table row.
455 // cbTC (count of bytes of a TC) is 18(decimal), 12(hex).
458 struct WW8_TCellVer6 // wird aus der Datei gelesen
460 SVBT8 aBits1Ver6;
461 SVBT8 aBits2Ver6;
462 // sal_uInt16 fFirstMerged : 1;// 0001 set to 1 when cell is first cell of a range of cells that have been merged.
463 // sal_uInt16 fMerged : 1; // 0002 set to 1 when cell has been merged with preceding cell.
464 // sal_uInt16 fUnused : 14; // FFFC reserved
465 WW8_BRCVer6 rgbrcVer6[4];
466 // notational convenience for referring to brcTop, brcLeft, etc fields:
467 // BRC brcTop; // specification of the top border of a table cell
468 // BRC brcLeft; // specification of left border of table row
469 // BRC brcBottom; // specification of bottom border of table row
470 // BRC brcRight; // specification of right border of table row.
472 // cbTC (count of bytes of a TC) is 10(decimal), A(hex).
474 struct WW8_TCellVer8 // wird aus der Datei gelesen
476 SVBT16 aBits1Ver8; // Dokumentation siehe oben unter WW8_TCell
477 SVBT16 aUnused; // reserve
478 WW8_BRC rgbrcVer8[4]; // Dokumentation siehe oben unter WW8_TCell
480 // cbTC (count of bytes of a TC) is 20(decimal), 14(hex).
483 struct WW8_SHD // struct SHD fehlt in der Beschreibung
485 private:
486 sal_uInt16 maBits;
487 // sal_uInt16 nFore : 5; // 0x001f ForegroundColor
488 // sal_uInt16 nBack : 5; // 0x03e0 BackgroundColor
489 // sal_uInt16 nStyle : 5; // 0x7c00 Percentage and Style
490 // sal_uInt16 nDontKnow : 1; // 0x8000 ??? ab Ver8: ebenfalls fuer Style
492 public:
493 WW8_SHD() : maBits(0) {}
495 sal_uInt8 GetFore() const { return (sal_uInt8)( maBits & 0x1f); }
496 sal_uInt8 GetBack() const { return (sal_uInt8)((maBits >> 5 ) & 0x1f); }
497 sal_uInt8 GetStyle(bool bVer67) const
498 { return (sal_uInt8)((maBits >> 10) & ( bVer67 ? 0x1f : 0x3f ) ); }
500 sal_uInt16 GetValue() const { return maBits; }
502 void SetValue(sal_uInt16 nVal) { maBits = nVal; }
503 void SetWWValue(SVBT16 nVal) { maBits = SVBT16ToShort(nVal); }
505 void SetFore(sal_uInt8 nVal)
507 maBits &= 0xffe0;
508 maBits |= (nVal & 0x1f);
510 void SetBack(sal_uInt8 nVal)
512 maBits &= 0xfc1f;
513 maBits |= (nVal & 0x1f) << 5;
515 void SetStyle(bool bVer67, sal_uInt8 nVal)
517 if (bVer67)
519 maBits &= 0x83ff;
520 maBits |= (nVal & 0x1f) << 10;
522 else
524 maBits &= 0x03ff;
525 maBits |= (nVal & 0x2f) << 10;
530 struct WW8_ANLV
532 SVBT8 nfc; // 0 number format code, 0=Arabic, 1=Upper case Roman, 2=Lower case Roman
533 // 3=Upper case Letter, 4=Lower case letter, 5=Ordinal
534 SVBT8 cbTextBefore; // 1 offset into anld.rgch limit of prefix text
535 SVBT8 cbTextAfter; // 2
536 SVBT8 aBits1;
537 // sal_uInt8 jc : 2; // 3 : 0x03 justification code, 0=left, 1=center, 2=right, 3=left and right justify
538 // sal_uInt8 fPrev : 1; // 0x04 when ==1, include previous levels
539 // sal_uInt8 fHang : 1; // 0x08 when ==1, number will be displayed using a hanging indent
540 // sal_uInt8 fSetBold : 1; // 0x10 when ==1, boldness of number will be determined by anld.fBold.
541 // sal_uInt8 fSetItalic : 1;// 0x20 when ==1, italicness of number will be determined by anld.fItalic
542 // sal_uInt8 fSetSmallCaps : 1;// 0x40 when ==1, anld.fSmallCaps will determine whether number will be displayed in small caps or not.
543 // sal_uInt8 fSetCaps : 1; // 0x80 when ==1, anld.fCaps will determine whether number will be displayed capitalized or not
544 SVBT8 aBits2;
545 // sal_uInt8 fSetStrike : 1;// 4 : 0x01 when ==1, anld.fStrike will determine whether the number will be displayed using strikethrough or not.
546 // sal_uInt8 fSetKul : 1; // 0x02 when ==1, anld.kul will determine the underlining state of the autonumber.
547 // sal_uInt8 fPrevSpace : 1;// 0x04 when ==1, autonumber will be displayed with a single prefixing space character
548 // sal_uInt8 fBold : 1; // 0x08 determines boldness of autonumber when anld.fSetBold == 1.
549 // sal_uInt8 fItalic : 1; // 0x10 determines italicness of autonumber when anld.fSetItalic == 1.
550 // sal_uInt8 fSmallCaps : 1;// 0x20 determines whether autonumber will be displayed using small caps when anld.fSetSmallCaps == 1.
551 // sal_uInt8 fCaps : 1; // 0x40 determines whether autonumber will be displayed using caps when anld.fSetCaps == 1.
552 // sal_uInt8 fStrike : 1; // 0x80 determines whether autonumber will be displayed using caps when anld.fSetStrike == 1.
553 SVBT8 aBits3;
554 // sal_uInt8 kul : 3; // 5 : 0x07 determines whether autonumber will be displayed with underlining when anld.fSetKul == 1.
555 // sal_uInt8 ico : 5; // 0xF1 color of autonumber
556 SVBT16 ftc; // 6 font code of autonumber
557 SVBT16 hps; // 8 font half point size (or 0=auto)
558 SVBT16 iStartAt; // 0x0a starting value (0 to 65535)
559 SVBT16 dxaIndent; // 0x0c *short?* *sal_uInt16?* width of prefix text (same as indent)
560 SVBT16 dxaSpace; // 0x0e minimum space between number and paragraph
562 // *cbANLV (count of bytes of ANLV) is 16 (decimal), 10(hex).
564 struct WW8_ANLD
566 WW8_ANLV eAnlv; // 0
567 SVBT8 fNumber1; // 0x10 number only 1 item per table cell
568 SVBT8 fNumberAcross; // 0x11 number across cells in table rows(instead of down)
569 SVBT8 fRestartHdn; // 0x12 restart heading number on section boundary
570 SVBT8 fSpareX; // 0x13 unused( should be 0)
571 sal_uInt8 rgchAnld[32]; // 0x14 characters displayed before/after autonumber
574 struct WW8_OLST
576 WW8_ANLV rganlv[9]; // 0 an array of 9 ANLV structures (heading levels)
577 SVBT8 fRestartHdr; // 0x90 when ==1, restart heading on section break
578 SVBT8 fSpareOlst2; // 0x91 reserved
579 SVBT8 fSpareOlst3; // 0x92 reserved
580 SVBT8 fSpareOlst4; // 0x93 reserved
581 sal_uInt8 rgch[64]; // 0x94 array of 64 chars text before/after number
583 // cbOLST is 212(decimal), D4(hex).
585 struct WW8_FDOA
587 SVBT32 fc; // 0 FC pointing to drawing object data
588 SVBT16 ctxbx; // 4 count of textboxes in the drawing object
591 struct WW8_DO
593 SVBT16 dok; // 0 Drawn Object Kind, currently this is always 0
594 SVBT16 cb; // 2 size (count of bytes) of the entire DO
595 SVBT8 bx; // 4 x position relative to anchor CP
596 SVBT8 by; // 5 y position relative to anchor CP
597 SVBT16 dhgt; // 6 height of DO
598 SVBT16 aBits1;
599 // sal_uInt16 fAnchorLock : 1; // 8 1 if the DO anchor is locked
600 // sal_uInt8[] rgdp; // 0xa variable length array of drawing primitives
603 struct WW8_DPHEAD
605 SVBT16 dpk; // 0 Drawn Primitive Kind REVIEW davebu
606 // 0=start of grouping, 1=line, 2=textbox, 3=rectangle,
607 // 4=arc, 5=elipse, 6=polyline, 7=callout textbox,
608 // 8=end of grouping, 9=sample primitve holding default values
609 SVBT16 cb; // 2 size (count of bytes) of this DP
610 SVBT16 xa; // 4 These 2 points describe the rectangle
611 SVBT16 ya; // 6 enclosing this DP relative to the origin of
612 SVBT16 dxa; // 8 the DO
613 SVBT16 dya; // 0xa
617 struct WW8_DP_LINETYPE
619 SVBT32 lnpc; // LiNe Property Color -- RGB color value
620 SVBT16 lnpw; // line property weight in twips
621 SVBT16 lnps; // line property style : 0=Solid, 1=Dashed
622 // 2=Dotted, 3=Dash Dot, 4=Dash Dot Dot, 5=Hollow
625 struct WW8_DP_SHADOW // Schattierung!
627 SVBT16 shdwpi; // Shadow Property Intensity
628 SVBT16 xaOffset; // x offset of shadow
629 SVBT16 yaOffset; // y offset of shadow
632 struct WW8_DP_FILL
634 SVBT32 dlpcFg; // FiLl Property Color ForeGround -- RGB color value
635 SVBT32 dlpcBg; // Property Color BackGround -- RGB color value
636 SVBT16 flpp; // FiLl Property Pattern REVIEW davebu
639 struct WW8_DP_LINEEND
641 SVBT16 aStartBits;
642 // sal_uInt16 eppsStart : 2; // Start EndPoint Property Style
643 // 0=None, 1=Hollow, 2=Filled
644 // sal_uInt16 eppwStart : 2; // Start EndPoint Property Weight
645 // sal_uInt16 epplStart : 2; // Start EndPoint Property length
646 // sal_uInt16 dummyStart : 10; // Alignment
647 SVBT16 aEndBits;
648 // sal_uInt16 eppsEnd : 2; // End EndPoint Property Style
649 // sal_uInt16 eppwEnd : 2; // End EndPoint Property Weight
650 // sal_uInt16 epplEnd : 2; // End EndPoint Property length
651 // sal_uInt16 dummyEnd : 10; // Alignment
654 struct WW8_DP_LINE
656 // WW8_DPHEAD dphead; // 0 Common header for a drawing primitive
657 SVBT16 xaStart; // starting point for line
658 SVBT16 yaStart; //
659 SVBT16 xaEnd; // ending point for line
660 SVBT16 yaEnd;
661 WW8_DP_LINETYPE aLnt;
662 WW8_DP_LINEEND aEpp;
663 WW8_DP_SHADOW aShd;
666 struct WW8_DP_TXTBOX
668 WW8_DP_LINETYPE aLnt;
669 WW8_DP_FILL aFill;
670 WW8_DP_SHADOW aShd;
671 SVBT16 aBits1;
672 // sal_uInt16 fRoundCorners : 1; //0x24 0001 1 if the textbox has rounded corners
673 // sal_uInt16 zaShape : 15; // 0x24 000e REVIEW davebu
674 SVBT16 dzaInternalMargin; // 0x26 REVIEW davebu
677 struct WW8_DP_RECT
679 WW8_DP_LINETYPE aLnt;
680 WW8_DP_FILL aFill;
681 WW8_DP_SHADOW aShd;
682 SVBT16 aBits1;
683 // sal_uInt16 fRoundCorners : 1; // 0x24 0001 1 if the textbox has rounded corners
684 // sal_uInt16 zaShape : 15; // 0x24 000e REVIEW davebu
687 struct WW8_DP_ARC
689 WW8_DP_LINETYPE aLnt;
690 WW8_DP_FILL aFill;
691 WW8_DP_SHADOW aShd;
692 SVBT8 fLeft; // 0x24 00ff REVIEW davebu
693 SVBT8 fUp; // 0x24 ff00 REVIEW davebu
694 // sal_uInt16 fLeft : 8; // 0x24 00ff REVIEW davebu
695 // sal_uInt16 fUp : 8; // 0x24 ff00 REVIEW davebu
698 struct WW8_DP_ELIPSE
700 WW8_DP_LINETYPE aLnt;
701 WW8_DP_FILL aFill;
702 WW8_DP_SHADOW aShd;
705 struct WW8_DP_POLYLINE
707 WW8_DP_LINETYPE aLnt;
708 WW8_DP_FILL aFill;
709 WW8_DP_LINEEND aEpp;
710 WW8_DP_SHADOW aShd;
711 SVBT16 aBits1;
712 // sal_uInt16 fPolygon : 1; // 0x28 0001 1 if this is a polygon
713 // sal_uInt16 cpt : 15; // 0x28 00fe count of points
714 // short xaFirst; // 0x2a These are the endpoints of the first line.
715 // short yaFirst; // 0x2c
716 // short xaEnd; // 0x2e
717 // short yaEnd; // 0x30
718 // short rgpta[]; // 0x32 An array of xa,ya pairs for the remaining points
721 struct WW8_DP_CALLOUT_TXTBOX
723 SVBT16 flags; // 0x0c REVIEW davebu flags
724 SVBT16 dzaOffset; // 0x0e REVIEW davebu
725 SVBT16 dzaDescent; // 0x10 REVIEW davebu
726 SVBT16 dzaLength; // 0x12 REVIEW davebu
727 WW8_DPHEAD dpheadTxbx; // 0x14 DPHEAD for a textbox
728 WW8_DP_TXTBOX dptxbx; // 0x20 DP for a textbox
729 WW8_DPHEAD dpheadPolyLine; // 0x4c DPHEAD for a Polyline
730 WW8_DP_POLYLINE dpPolyLine; // 0x48 DP for a polyline
733 struct WW8_PCD
735 SVBT8 aBits1;
736 // sal_uInt8 fNoParaLast : 1; // when 1, means that piece contains no end of paragraph marks.
737 // sal_uInt8 fPaphNil : 1; // used internally by Word
738 // sal_uInt8 fCopied : 1; // used internally by Word
739 // * int :5
740 SVBT8 aBits2; // fn int:8, used internally by Word
741 SVBT32 fc; // file offset of beginning of piece. The size of the
742 // ithpiece can be determined by subtracting rgcp[i] of
743 // the containing plcfpcd from its rgcp[i+1].
744 SVBT16 prm; // PRM contains either a single sprm or else an index number
745 // of the grpprl which contains the sprms that modify the
746 // properties of the piece.
749 // AnnoTation Refernce Descriptor (ATRD)
750 struct WW8_ATRD // fuer die 8-Version
752 SVBT16 xstUsrInitl[ 10 ]; // pascal-style String holding initials
753 // of annotation author
754 SVBT16 ibst; // index into GrpXstAtnOwners
755 SVBT16 ak; // not used
756 SVBT16 grfbmc; // not used
757 SVBT32 ITagBkmk; // when not -1, this tag identifies the
758 // annotation bookmark that locates the
759 // range of CPs in the main document which
760 // this annotation references.
763 struct WW8_ATRDEXTRA
765 // --- Extended bit since Word 2002 --- //
767 SVBT32 dttm;
768 SVBT16 bf;
769 SVBT32 cDepth;
770 SVBT32 diatrdParent;
771 SVBT32 Discussitem;
774 struct WW67_ATRD // fuer die 6/7-Version
776 sal_Char xstUsrInitl[ 10 ]; // pascal-style String holding initials
777 // of annotation author
778 SVBT16 ibst; // index into GrpXstAtnOwners
779 SVBT16 ak; // not used
780 SVBT16 grfbmc; // not used
781 SVBT32 ITagBkmk; // when not -1, this tag identifies the
782 // annotation bookmark that locates the
783 // range of CPs in the main document which
784 // this annotation references.
787 struct WW8_TablePos
789 sal_Int16 nSp26;
790 sal_Int16 nSp27;
791 sal_Int16 nLeMgn;
792 sal_Int16 nRiMgn;
793 sal_Int16 nUpMgn;
794 sal_Int16 nLoMgn;
795 sal_uInt8 nSp29;
796 sal_uInt8 nSp37;
797 bool bNoFly;
800 struct WW8_FSPA
802 public:
803 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.
804 sal_Int32 nXaLeft; //left of rectangle enclosing shape relative to the origin of the shape
805 sal_Int32 nYaTop; //top of rectangle enclosing shape relative to the origin of the shape
806 sal_Int32 nXaRight; //right of rectangle enclosing shape relative to the origin of the shape
807 sal_Int32 nYaBottom;//bottom of the rectangle enclosing shape relative to the origin of the shape
808 sal_uInt16 bHdr:1;
809 //0001 1 in the undo doc when shape is from the header doc, 0 otherwise (undefined when not in the undo doc)
810 sal_uInt16 nbx:2;
811 //0006 x position of shape relative to anchor CP
812 //0 relative to page margin
813 //1 relative to top of page
814 //2 relative to text (column for horizontal text; paragraph for vertical text)
815 //3 reserved for future use
816 sal_uInt16 nby:2;
817 //0018 y position of shape relative to anchor CP
818 //0 relative to page margin
819 //1 relative to top of page
820 //2 relative to text (paragraph for horizontal text; column for vertical text)
821 sal_uInt16 nwr:4;
822 //01E0 text wrapping mode
823 //0 like 2, but doesn't require absolute object
824 //1 no text next to shape
825 //2 wrap around absolute object
826 //3 wrap as if no object present
827 //4 wrap tightly around object
828 //5 wrap tightly, but allow holes
829 //6-15 reserved for future use
830 sal_uInt16 nwrk:4;
831 //1E00 text wrapping mode type (valid only for wrapping modes 2 and 4
832 //0 wrap both sides
833 //1 wrap only on left
834 //2 wrap only on right
835 //3 wrap only on largest side
836 sal_uInt16 bRcaSimple:1;
837 //2000 when set, temporarily overrides bx, by, forcing the xaLeft, xaRight, yaTop, and yaBottom fields to all be page relative.
838 sal_uInt16 bBelowText:1;
839 //4000
840 //1 shape is below text
841 //0 shape is above text
842 sal_uInt16 bAnchorLock:1;
843 //8000 1 anchor is locked
844 // 0 anchor is not locked
845 sal_Int32 nTxbx; //count of textboxes in shape (undo doc only)
846 public:
847 enum FSPAOrient {RelPgMargin, RelPageBorder, RelText};
851 struct WW8_FSPA_SHADOW // alle Member an gleicher Position und Groesse,
852 { // wegen: pF = (WW8_FSPA*)pFS;
853 SVBT32 nSpId;
854 SVBT32 nXaLeft;
855 SVBT32 nYaTop;
856 SVBT32 nXaRight;
857 SVBT32 nYaBottom;
858 SVBT16 aBits1;
859 SVBT32 nTxbx;
862 struct WW8_TXBXS
864 SVBT32 cTxbx_iNextReuse;
865 SVBT32 cReusable;
866 SVBT16 fReusable;
867 SVBT32 reserved;
868 SVBT32 ShapeId;
869 SVBT32 txidUndo;
872 struct WW8_STRINGID
874 // M.M. This is the extra data stored in the SttbfFnm
875 // For now I only need the String Id
876 SVBT16 nStringId;
877 SVBT16 reserved1;
878 SVBT16 reserved2;
879 SVBT16 reserved3;
882 /// The ATNBE structure contains information about an annotation bookmark in the document.
883 struct WW8_ATNBE
885 SVBT16 nBmc;
886 SVBT32 nTag;
887 SVBT32 nTagOld;
890 struct WW8_WKB
892 // M.M. This is the WkbPLCF struct
893 // For now I only need the Link Id
894 SVBT16 reserved1;
895 SVBT16 reserved2;
896 SVBT16 reserved3;
897 SVBT16 nLinkId;
898 SVBT16 reserved4;
899 SVBT16 reserved5;
902 #ifdef SAL_W32
903 # pragma pack(pop)
904 #endif
906 struct SEPr
908 SEPr();
909 sal_uInt8 bkc;
910 sal_uInt8 fTitlePage;
911 sal_Int8 fAutoPgn;
912 sal_uInt8 nfcPgn;
913 sal_uInt8 fUnlocked;
914 sal_uInt8 cnsPgn;
915 sal_uInt8 fPgnRestart;
916 sal_uInt8 fEndNote;
917 sal_Int8 lnc;
918 sal_Int8 grpfIhdt;
919 sal_uInt16 nLnnMod;
920 sal_Int32 dxaLnn;
921 sal_Int16 dxaPgn;
922 sal_Int16 dyaPgn;
923 sal_Int8 fLBetween;
924 sal_Int8 vjc;
925 sal_uInt16 dmBinFirst;
926 sal_uInt16 dmBinOther;
927 sal_uInt16 dmPaperReq;
929 28 1C brcTop BRC top page border
931 32 20 brcLeft BRC left page border
933 36 24 brcBottom BRC bottom page border
935 40 28 brcRight BRC right page border
937 sal_Int16 fPropRMark;
938 sal_Int16 ibstPropRMark;
939 sal_Int32 dttmPropRMark; //DTTM
940 sal_Int32 dxtCharSpace;
941 sal_Int32 dyaLinePitch;
942 sal_uInt16 clm;
943 sal_Int16 reserved1;
944 sal_uInt8 dmOrientPage;
945 sal_uInt8 iHeadingPgn;
946 sal_uInt16 pgnStart;
947 sal_Int16 lnnMin;
948 sal_uInt16 wTextFlow;
949 sal_Int16 reserved2;
950 sal_uInt16 pgbApplyTo:3;
951 sal_uInt16 pgbPageDepth:2;
952 sal_Int16 pgbOffsetFrom:3;
953 sal_Int16 :8;
954 sal_uInt32 xaPage;
955 sal_uInt32 yaPage;
956 sal_uInt32 xaPageNUp;
957 sal_uInt32 yaPageNUp;
958 sal_uInt32 dxaLeft;
959 sal_uInt32 dxaRight;
960 sal_Int32 dyaTop;
961 sal_Int32 dyaBottom;
962 sal_uInt32 dzaGutter;
963 sal_uInt32 dyaHdrTop;
964 sal_uInt32 dyaHdrBottom;
965 sal_Int16 ccolM1;
966 sal_Int8 fEvenlySpaced;
967 sal_Int8 reserved3;
968 sal_uInt8 fBiDi;
969 sal_uInt8 fFacingCol;
970 sal_uInt8 fRTLGutter;
971 sal_uInt8 fRTLAlignment;
972 sal_Int32 dxaColumns;
973 sal_Int32 rgdxaColumnWidthSpacing[89];
974 sal_Int32 dxaColumnWidth;
975 sal_uInt8 dmOrientFirst;
976 sal_uInt8 fLayout;
977 sal_Int16 reserved4;
980 namespace wwUtility
982 inline sal_uInt32 RGBToBGR(sal_uInt32 nColour) { return msfilter::util::BGRToRGB(nColour); }
985 #endif
987 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */