Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _WW8STRUC_HXX
21 : #define _WW8STRUC_HXX
22 :
23 : #include <osl/endian.h>
24 : #include <tools/string.hxx>
25 : #include <sal/config.h>
26 :
27 : #include <editeng/borderline.hxx>
28 : #include <filter/msfilter/util.hxx>
29 :
30 : #if defined OSL_BIGENDIAN || SAL_TYPES_ALIGNMENT4 > 2 || defined UNX
31 : # define __WW8_NEEDS_COPY
32 : #endif
33 :
34 : #ifdef SAL_W32
35 : # pragma pack(push, 2)
36 : #endif
37 :
38 32 : inline void Set_UInt8( sal_uInt8 *& p, sal_uInt8 n )
39 : {
40 32 : ByteToSVBT8( n, *(SVBT8*)p );
41 32 : p+= 1;
42 32 : }
43 :
44 1155 : inline void Set_UInt16( sal_uInt8 *& p, sal_uInt16 n )
45 : {
46 1155 : ShortToSVBT16( n, *(SVBT16*)p );
47 1155 : p+= 2;
48 1155 : }
49 :
50 725 : inline void Set_UInt32( sal_uInt8 *& p, sal_uInt32 n )
51 : {
52 725 : UInt32ToSVBT32( n, *(SVBT32*)p );
53 725 : p+= 4;
54 725 : }
55 :
56 : struct Word2CHPX
57 : {
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;
85 :
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;
100 :
101 0 : Word2CHPX()
102 : {
103 0 : fBold = 0;
104 0 : fItalic = 0;
105 0 : fRMarkDel = 0;
106 0 : fOutline = 0;
107 0 : fFldVanish = 0;
108 0 : fSmallCaps = 0;
109 0 : fCaps = 0;
110 0 : fVanish = 0;
111 0 : fRMark = 0;
112 0 : fSpec = 0;
113 0 : fStrike = 0;
114 0 : fObj = 0;
115 0 : fBoldBi = 0;
116 0 : fItalicBi = 0;
117 0 : fBiDi = 0;
118 0 : fDiacUSico = 0;
119 0 : fsIco = 0;
120 0 : fsFtc = 0;
121 0 : fsHps = 0;
122 0 : fsKul = 0;
123 0 : fsPos = 0;
124 0 : fsSpace = 0;
125 0 : fsLid = 0;
126 0 : fsIcoBi = 0;
127 0 : fsFtcBi = 0;
128 0 : fsHpsBi = 0;
129 0 : fsLidBi = 0;
130 :
131 0 : ftc = 0;
132 0 : hps = 0;
133 0 : qpsSpace = 0;
134 0 : fSysVanish = 0;
135 0 : fNumRun = 0;
136 0 : ico = 0;
137 0 : kul = 0;
138 0 : hpsPos = 0;
139 0 : icoBi = 0;
140 0 : lid = 0;
141 0 : ftcBi = 0;
142 0 : hpsBi = 0;
143 0 : lidBi = 0;
144 0 : fcPic = 0;
145 0 : }
146 : };
147 :
148 :
149 : typedef sal_Int16 WW8_PN;
150 : typedef sal_Int32 WW8_FC;
151 : typedef sal_Int32 WW8_CP;
152 :
153 : const WW8_FC WW8_FC_MAX = SAL_MAX_INT32;
154 : const WW8_CP WW8_CP_MAX = SAL_MAX_INT32;
155 :
156 : /** STD - STyle Definition
157 :
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.
166 : */
167 : struct WW8_STD
168 : {
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 */
187 :
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[];
194 : };
195 :
196 : /** Basis zum Einlesen UND zum Arbeiten (wird jeweils unter schiedlich beerbt)
197 : */
198 215 : struct WW8_FFN_BASE // Font Descriptor
199 : {
200 : // ab Ver6
201 : sal_uInt8 cbFfnM1; // 0x0 total length of FFN - 1.
202 :
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
208 :
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
212 : };
213 :
214 : /** Hiermit arbeiten wir im Parser (und Dumper)
215 : */
216 430 : struct WW8_FFN : public WW8_FFN_BASE
217 : {
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.
226 : };
227 :
228 :
229 :
230 : struct WW8_BRCVer6 // alter Border Code
231 : {
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.
242 : };
243 :
244 : class WW8_BRC // Border Code
245 : {
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 4815 : WW8_BRC()
259 : {
260 4815 : memset(aBits1, 0, sizeof(aBits1));
261 4815 : memset(aBits2, 0, sizeof(aBits2));
262 4815 : }
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;
268 : };
269 :
270 : typedef WW8_BRC WW8_BRC5[5]; // 5 * Border Code
271 :
272 : enum BRC_Sides
273 : {
274 : WW8_TOP = 0, WW8_LEFT = 1, WW8_BOT = 2, WW8_RIGHT = 3, WW8_BETW = 4
275 : };
276 :
277 : /*
278 : Document Typography Info (DOPTYPOGRAPHY) These options are Far East only,
279 : and are accessible through the Typography tab of the Tools/Options dialog.
280 : */
281 : class WW8DopTypography
282 : {
283 : public:
284 : void ReadFromMem(sal_uInt8 *&pData);
285 : void WriteToMem(sal_uInt8 *&pData) const;
286 :
287 : //Maps what I think is the language this is to affect to the OOo language
288 : sal_uInt16 GetConvertedLang() const;
289 :
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 ?
311 :
312 : enum RuleLengths {nMaxFollowing = 101, nMaxLeading = 51};
313 : static const sal_Unicode * GetJapanNotBeginLevel1();
314 : static const sal_Unicode * GetJapanNotEndLevel1();
315 :
316 : sal_Int16 cchFollowingPunct; // length of rgxchFPunct
317 : sal_Int16 cchLeadingPunct; // length of rgxchLPunct
318 :
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];
323 : };
324 :
325 : struct WW8_DOGRID
326 : {
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
331 :
332 :
333 :
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
338 : */
339 :
340 :
341 :
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.
351 : };
352 :
353 12 : struct WW8_PIC
354 : {
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.
388 : };
389 :
390 : struct WW8_PIC_SHADOW
391 : {
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.
421 : };
422 :
423 :
424 : struct WW8_TBD
425 : {
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
431 : };
432 :
433 648 : struct WW8_TCell // hiermit wird weitergearbeitet (entspricht weitestgehend dem Ver8-Format)
434 : {
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 !!
447 :
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.
454 : };
455 : // cbTC (count of bytes of a TC) is 18(decimal), 12(hex).
456 :
457 :
458 : struct WW8_TCellVer6 // wird aus der Datei gelesen
459 : {
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.
471 : };
472 : // cbTC (count of bytes of a TC) is 10(decimal), A(hex).
473 :
474 : struct WW8_TCellVer8 // wird aus der Datei gelesen
475 : {
476 : SVBT16 aBits1Ver8; // Dokumentation siehe oben unter WW8_TCell
477 : SVBT16 aUnused; // reserve
478 : WW8_BRC rgbrcVer8[4]; // Dokumentation siehe oben unter WW8_TCell
479 : };
480 : // cbTC (count of bytes of a TC) is 20(decimal), 14(hex).
481 :
482 :
483 : struct WW8_SHD // struct SHD fehlt in der Beschreibung
484 : {
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
491 :
492 : public:
493 308 : WW8_SHD() : maBits(0) {}
494 :
495 7 : sal_uInt8 GetFore() const { return (sal_uInt8)( maBits & 0x1f); }
496 7 : sal_uInt8 GetBack() const { return (sal_uInt8)((maBits >> 5 ) & 0x1f); }
497 7 : sal_uInt8 GetStyle(bool bVer67) const
498 7 : { return (sal_uInt8)((maBits >> 10) & ( bVer67 ? 0x1f : 0x3f ) ); }
499 :
500 153 : sal_uInt16 GetValue() const { return maBits; }
501 :
502 : void SetValue(sal_uInt16 nVal) { maBits = nVal; }
503 158 : void SetWWValue(SVBT16 nVal) { maBits = SVBT16ToShort(nVal); }
504 :
505 2 : void SetFore(sal_uInt8 nVal)
506 : {
507 2 : maBits &= 0xffe0;
508 2 : maBits |= (nVal & 0x1f);
509 2 : }
510 2 : void SetBack(sal_uInt8 nVal)
511 : {
512 2 : maBits &= 0xfc1f;
513 2 : maBits |= (nVal & 0x1f) << 5;
514 2 : }
515 2 : void SetStyle(bool bVer67, sal_uInt8 nVal)
516 : {
517 2 : if (bVer67)
518 : {
519 2 : maBits &= 0x83ff;
520 2 : maBits |= (nVal & 0x1f) << 10;
521 : }
522 : else
523 : {
524 0 : maBits &= 0x03ff;
525 0 : maBits |= (nVal & 0x2f) << 10;
526 : }
527 2 : }
528 : };
529 :
530 : struct WW8_ANLV
531 : {
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
561 : };
562 : // *cbANLV (count of bytes of ANLV) is 16 (decimal), 10(hex).
563 :
564 : struct WW8_ANLD
565 : {
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
572 : };
573 :
574 : struct WW8_OLST
575 : {
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
582 : };
583 : // cbOLST is 212(decimal), D4(hex).
584 :
585 : struct WW8_FDOA
586 : {
587 : SVBT32 fc; // 0 FC pointing to drawing object data
588 : SVBT16 ctxbx; // 4 count of textboxes in the drawing object
589 : };
590 :
591 : struct WW8_DO
592 : {
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
601 : };
602 :
603 : struct WW8_DPHEAD
604 : {
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
614 : };
615 :
616 :
617 : struct WW8_DP_LINETYPE
618 : {
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
623 : };
624 :
625 : struct WW8_DP_SHADOW // Schattierung!
626 : {
627 : SVBT16 shdwpi; // Shadow Property Intensity
628 : SVBT16 xaOffset; // x offset of shadow
629 : SVBT16 yaOffset; // y offset of shadow
630 : };
631 :
632 : struct WW8_DP_FILL
633 : {
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
637 : };
638 :
639 : struct WW8_DP_LINEEND
640 : {
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
652 : };
653 :
654 : struct WW8_DP_LINE
655 : {
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;
664 : };
665 :
666 : struct WW8_DP_TXTBOX
667 : {
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
675 : };
676 :
677 : struct WW8_DP_RECT
678 : {
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
685 : };
686 :
687 : struct WW8_DP_ARC
688 : {
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
696 : };
697 :
698 : struct WW8_DP_ELIPSE
699 : {
700 : WW8_DP_LINETYPE aLnt;
701 : WW8_DP_FILL aFill;
702 : WW8_DP_SHADOW aShd;
703 : };
704 :
705 : struct WW8_DP_POLYLINE
706 : {
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
719 : };
720 :
721 : struct WW8_DP_CALLOUT_TXTBOX
722 : {
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
731 : };
732 :
733 : struct WW8_PCD
734 : {
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.
747 : };
748 :
749 : // AnnoTation Refernce Descriptor (ATRD)
750 : struct WW8_ATRD // fuer die 8-Version
751 : {
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.
761 : };
762 :
763 : struct WW8_ATRDEXTRA
764 : {
765 : // --- Extended bit since Word 2002 --- //
766 :
767 : SVBT32 dttm;
768 : SVBT16 bf;
769 : SVBT32 cDepth;
770 : SVBT32 diatrdParent;
771 : SVBT32 Discussitem;
772 : };
773 :
774 : struct WW67_ATRD // fuer die 6/7-Version
775 : {
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.
785 : };
786 :
787 : struct WW8_TablePos
788 : {
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 : };
798 :
799 : struct WW8_FSPA
800 : {
801 : public:
802 : 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.
803 : sal_Int32 nXaLeft; //left of rectangle enclosing shape relative to the origin of the shape
804 : sal_Int32 nYaTop; //top of rectangle enclosing shape relative to the origin of the shape
805 : sal_Int32 nXaRight; //right of rectangle enclosing shape relative to the origin of the shape
806 : sal_Int32 nYaBottom;//bottom of the rectangle enclosing shape relative to the origin of the shape
807 : sal_uInt16 bHdr:1;
808 : //0001 1 in the undo doc when shape is from the header doc, 0 otherwise (undefined when not in the undo doc)
809 : sal_uInt16 nbx:2;
810 : //0006 x position of shape relative to anchor CP
811 : //0 relative to page margin
812 : //1 relative to top of page
813 : //2 relative to text (column for horizontal text; paragraph for vertical text)
814 : //3 reserved for future use
815 : sal_uInt16 nby:2;
816 : //0018 y position of shape relative to anchor CP
817 : //0 relative to page margin
818 : //1 relative to top of page
819 : //2 relative to text (paragraph for horizontal text; column for vertical text)
820 : sal_uInt16 nwr:4;
821 : //01E0 text wrapping mode
822 : //0 like 2, but doesn't require absolute object
823 : //1 no text next to shape
824 : //2 wrap around absolute object
825 : //3 wrap as if no object present
826 : //4 wrap tightly around object
827 : //5 wrap tightly, but allow holes
828 : //6-15 reserved for future use
829 : sal_uInt16 nwrk:4;
830 : //1E00 text wrapping mode type (valid only for wrapping modes 2 and 4
831 : //0 wrap both sides
832 : //1 wrap only on left
833 : //2 wrap only on right
834 : //3 wrap only on largest side
835 : sal_uInt16 bRcaSimple:1;
836 : //2000 when set, temporarily overrides bx, by, forcing the xaLeft, xaRight, yaTop, and yaBottom fields to all be page relative.
837 : sal_uInt16 bBelowText:1;
838 : //4000
839 : //1 shape is below text
840 : //0 shape is above text
841 : sal_uInt16 bAnchorLock:1;
842 : //8000 1 anchor is locked
843 : // 0 anchor is not locked
844 : sal_Int32 nTxbx; //count of textboxes in shape (undo doc only)
845 : public:
846 : enum FSPAOrient {RelPgMargin, RelPageBorder, RelText};
847 : };
848 :
849 :
850 : struct WW8_FSPA_SHADOW // alle Member an gleicher Position und Groesse,
851 : { // wegen: pF = (WW8_FSPA*)pFS;
852 : SVBT32 nSpId;
853 : SVBT32 nXaLeft;
854 : SVBT32 nYaTop;
855 : SVBT32 nXaRight;
856 : SVBT32 nYaBottom;
857 : SVBT16 aBits1;
858 : SVBT32 nTxbx;
859 : };
860 :
861 : struct WW8_TXBXS
862 : {
863 : SVBT32 cTxbx_iNextReuse;
864 : SVBT32 cReusable;
865 : SVBT16 fReusable;
866 : SVBT32 reserved;
867 : SVBT32 ShapeId;
868 : SVBT32 txidUndo;
869 : };
870 :
871 : struct WW8_STRINGID
872 : {
873 : // M.M. This is the extra data stored in the SttbfFnm
874 : // For now I only need the String Id
875 : SVBT16 nStringId;
876 : SVBT16 reserved1;
877 : SVBT16 reserved2;
878 : SVBT16 reserved3;
879 : };
880 :
881 : struct WW8_WKB
882 : {
883 : // M.M. This is the WkbPLCF struct
884 : // For now I only need the Link Id
885 : SVBT16 reserved1;
886 : SVBT16 reserved2;
887 : SVBT16 reserved3;
888 : SVBT16 nLinkId;
889 : SVBT16 reserved4;
890 : SVBT16 reserved5;
891 : };
892 :
893 : #ifdef SAL_W32
894 : # pragma pack(pop)
895 : #endif
896 :
897 : struct SEPr
898 : {
899 : SEPr();
900 : sal_uInt8 bkc;
901 : sal_uInt8 fTitlePage;
902 : sal_Int8 fAutoPgn;
903 : sal_uInt8 nfcPgn;
904 : sal_uInt8 fUnlocked;
905 : sal_uInt8 cnsPgn;
906 : sal_uInt8 fPgnRestart;
907 : sal_uInt8 fEndNote;
908 : sal_Int8 lnc;
909 : sal_Int8 grpfIhdt;
910 : sal_uInt16 nLnnMod;
911 : sal_Int32 dxaLnn;
912 : sal_Int16 dxaPgn;
913 : sal_Int16 dyaPgn;
914 : sal_Int8 fLBetween;
915 : sal_Int8 vjc;
916 : sal_uInt16 dmBinFirst;
917 : sal_uInt16 dmBinOther;
918 : sal_uInt16 dmPaperReq;
919 : /*
920 : 28 1C brcTop BRC top page border
921 :
922 : 32 20 brcLeft BRC left page border
923 :
924 : 36 24 brcBottom BRC bottom page border
925 :
926 : 40 28 brcRight BRC right page border
927 : */
928 : sal_Int16 fPropRMark;
929 : sal_Int16 ibstPropRMark;
930 : sal_Int32 dttmPropRMark; //DTTM
931 : sal_Int32 dxtCharSpace;
932 : sal_Int32 dyaLinePitch;
933 : sal_uInt16 clm;
934 : sal_Int16 reserved1;
935 : sal_uInt8 dmOrientPage;
936 : sal_uInt8 iHeadingPgn;
937 : sal_uInt16 pgnStart;
938 : sal_Int16 lnnMin;
939 : sal_uInt16 wTextFlow;
940 : sal_Int16 reserved2;
941 : sal_uInt16 pgbApplyTo:3;
942 : sal_uInt16 pgbPageDepth:2;
943 : sal_Int16 pgbOffsetFrom:3;
944 : sal_Int16 :8;
945 : sal_uInt32 xaPage;
946 : sal_uInt32 yaPage;
947 : sal_uInt32 xaPageNUp;
948 : sal_uInt32 yaPageNUp;
949 : sal_uInt32 dxaLeft;
950 : sal_uInt32 dxaRight;
951 : sal_Int32 dyaTop;
952 : sal_Int32 dyaBottom;
953 : sal_uInt32 dzaGutter;
954 : sal_uInt32 dyaHdrTop;
955 : sal_uInt32 dyaHdrBottom;
956 : sal_Int16 ccolM1;
957 : sal_Int8 fEvenlySpaced;
958 : sal_Int8 reserved3;
959 : sal_uInt8 fBiDi;
960 : sal_uInt8 fFacingCol;
961 : sal_uInt8 fRTLGutter;
962 : sal_uInt8 fRTLAlignment;
963 : sal_Int32 dxaColumns;
964 : sal_Int32 rgdxaColumnWidthSpacing[89];
965 : sal_Int32 dxaColumnWidth;
966 : sal_uInt8 dmOrientFirst;
967 : sal_uInt8 fLayout;
968 : sal_Int16 reserved4;
969 : };
970 :
971 : namespace wwUtility
972 : {
973 3 : inline sal_uInt32 RGBToBGR(sal_uInt32 nColour) { return msfilter::util::BGRToRGB(nColour); }
974 : }
975 :
976 : #endif
977 :
978 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|