1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
33 #include <tools/solar.h>
38 struct W1_FIB
/////////////////////////////////////////////////////////
40 SVBT16 wIdent
;// 0x0 int magic number
42 return SVBT16ToShort(wIdent
); }
43 SVBT16 nFib
;// 0x2 FIB version written
45 return SVBT16ToShort(nFib
); }
46 SVBT16 nProduct
;// 0x4 product version written by
47 USHORT
nProductGet() {
48 return SVBT16ToShort(nProduct
); }
49 SVBT16 nlocale
;// 0x6 language stamp---localized version;
51 return SVBT16ToShort(nlocale
); }
54 return SVBT16ToShort(pnNext
); }
57 return SVBT16ToShort(fFlags
); }
58 // SVBT16 fDot :1;// 0xa 0001
60 return 0 != ((fFlagsGet() >> 0) & 1); }
61 // SVBT16 fGlsy :1;// 0002
63 return 0 != ((fFlagsGet() >> 1) & 1); }
64 // SVBT16 fComplex :1;// 0004 when 1, file is in complex, fast-saved format.
66 return 0 != ((fFlagsGet() >> 2) & 1); }
67 // SVBT16 fHasPic :1;// 0008 file contains 1 or more pictures
69 return 0 != ((fFlagsGet() >> 3) & 1); }
70 // SVBT16 cQuickSaves :4;// 00F0 count of times file was quicksaved
71 USHORT
cQuickSavesGet() {
72 return (USHORT
)((fFlagsGet() >> 4) & 0xf); }
73 // SVBT16 u1 :8;// FF00 unused
75 return (USHORT
)((fFlagsGet() >> 8) & 0xff); }
76 SVBT16 nFibBack
;// 0xc
77 USHORT
nFibBackGet() {
78 return SVBT16ToShort(nFibBack
); }
79 SVBT16 u2
[5];// 0xe reserved
80 SVBT32 fcMin
;// 0x18 file offset of first character of text
82 return SVBT32ToUInt32(fcMin
); }
83 SVBT32 fcMac
;// 0x1c file offset of last character of text + 1
85 return SVBT32ToUInt32(fcMac
); }
86 SVBT32 cbMac
;// 0x20 file offset of last byte written to file + 1.
88 return SVBT32ToUInt32(cbMac
); }
89 SVBT32 u4
[4];// 0x24 reserved
90 SVBT32 ccpText
;// 0x34 length of main document text stream
92 return SVBT32ToUInt32(ccpText
); }
93 SVBT32 ccpFtn
;// 0x38 length of footnote subdocument text stream
95 return SVBT32ToUInt32(ccpFtn
); }
96 SVBT32 ccpHdd
;// 0x3c length of header subdocument text stream
98 return SVBT32ToUInt32(ccpHdd
); }
99 SVBT32 ccpMcr
;// 0x40 length of macro subdocument text stream
101 return SVBT32ToUInt32(ccpMcr
); }
102 SVBT32 ccpAtn
;// 0x44 length of annotation subdocument text stream
104 return SVBT32ToUInt32(ccpAtn
); }
105 SVBT32 cp5
[4];// 0x48
106 SVBT32 fcStshfOrig
;// 0x58 file offset of original allocation for STSH in file
107 ULONG
fcStshfOrigGet() {
108 return SVBT32ToUInt32(fcStshfOrig
); }
109 SVBT16 cbStshfOrig
;// 0x5c count of bytes of original STSH allocation
110 USHORT
cbStshfOrigGet() {
111 return SVBT16ToShort(cbStshfOrig
); }
112 SVBT32 fcStshf
;// 0x5e file offset of STSH in file.
114 return SVBT32ToUInt32(fcStshf
); }
115 SVBT16 cbStshf
;// 0x62 count of bytes of current STSH allocation
116 USHORT
cbStshfGet() {
117 return SVBT16ToShort(cbStshf
); }
118 SVBT32 fcPlcffndRef
;// 0x64 file offset of footnote reference PLC.
119 ULONG
fcPlcffndRefGet() {
120 return SVBT32ToUInt32(fcPlcffndRef
); }
121 SVBT16 cbPlcffndRef
;// 0x68 count of bytes of footnote reference PLC
122 USHORT
cbPlcffndRefGet() {
123 return SVBT16ToShort(cbPlcffndRef
); }
124 // == 0 if no footnotes defined in document.
126 SVBT32 fcPlcffndTxt
;// 0x6a file offset of footnote text PLC.
127 ULONG
fcPlcffndTxtGet() {
128 return SVBT32ToUInt32(fcPlcffndTxt
); }
129 SVBT16 cbPlcffndTxt
;// 0x6e count of bytes of footnote text PLC.
130 USHORT
cbPlcffndTxtGet() {
131 return SVBT16ToShort(cbPlcffndTxt
); }
132 // == 0 if no footnotes defined in document
134 SVBT32 fcPlcfandRef
;// 0x70 file offset of annotation reference PLC.
135 ULONG
fcPlcfandRefGet() {
136 return SVBT32ToUInt32(fcPlcfandRef
); }
137 SVBT16 cbPlcfandRef
;// 0x74 count of bytes of annotation reference PLC.
138 USHORT
cbPlcfandRefGet() {
139 return SVBT16ToShort(cbPlcfandRef
); }
141 SVBT32 fcPlcfandTxt
;// 0x76 file offset of annotation text PLC.
142 ULONG
fcPlcfandTxtGet() {
143 return SVBT32ToUInt32(fcPlcfandTxt
); }
144 SVBT16 cbPlcfandTxt
;// 0x7a count of bytes of the annotation text PLC
145 USHORT
cbPlcfandTxtGet() {
146 return SVBT16ToShort(cbPlcfandTxt
); }
148 SVBT32 fcPlcfsed
;// 8x7c file offset of section descriptor PLC.
149 ULONG
fcPlcfsedGet() {
150 return SVBT32ToUInt32(fcPlcfsed
); }
151 SVBT16 cbPlcfsed
;// 0x80 count of bytes of section descriptor PLC.
152 USHORT
cbPlcfsedGet() {
153 return SVBT16ToShort(cbPlcfsed
); }
155 SVBT32 fcPlcfpgd
;// 0x82 file offset of paragraph descriptor PLC
156 ULONG
fcPlcfpgdGet() {
157 return SVBT32ToUInt32(fcPlcfpgd
); }
158 SVBT16 cbPlcfpgd
;// 0x86 count of bytes of paragraph descriptor PLC.
159 USHORT
cbPlcfpgdGet() {
160 return SVBT16ToShort(cbPlcfpgd
); }
161 // ==0 if file was never repaginated
162 // Should not be written by third party creators
164 SVBT32 fcPlcfphe
;// 0x88 file offset of PLC of paragraph heights.
165 ULONG
fcPlcfpheGet() {
166 return SVBT32ToUInt32(fcPlcfphe
); }
167 SVBT16 cbPlcfphe
;// 0x8c count of bytes of paragraph height PLC.
168 USHORT
cbPlcfpheGet() {
169 return SVBT16ToShort(cbPlcfphe
); }
170 // ==0 when file is non-complex.
172 SVBT32 fcSttbfglsy
;// 0x8e file offset of glossary string table.
173 ULONG
fcSttbfglsyGet() {
174 return SVBT32ToUInt32(fcSttbfglsy
); }
175 SVBT16 cbSttbfglsy
;// 0x92 count of bytes of glossary string table.
176 USHORT
cbSttbfglsyGet() {
177 return SVBT16ToShort(cbSttbfglsy
); }
178 // == 0 for non-glossary documents.
179 // !=0 for glossary documents.
181 SVBT32 fcPlcfglsy
;// 0x94 file offset of glossary PLC.
182 ULONG
fcPlcfglsyGet() {
183 return SVBT32ToUInt32(fcPlcfglsy
); }
184 SVBT16 cbPlcfglsy
;// 0x98 count of bytes of glossary PLC.
185 USHORT
cbPlcfglsyGet() {
186 return SVBT16ToShort(cbPlcfglsy
); }
187 // == 0 for non-glossary documents.
188 // !=0 for glossary documents.
190 SVBT32 fcPlcfhdd
;// 0x9a byte offset of header PLC.
191 ULONG
fcPlcfhddGet() {
192 return SVBT32ToUInt32(fcPlcfhdd
); }
193 SVBT16 cbPlcfhdd
;// 0x9e count of bytes of header PLC.
194 USHORT
cbPlcfhddGet() {
195 return SVBT16ToShort(cbPlcfhdd
); }
196 // == 0 if document contains no headers
198 SVBT32 fcPlcfbteChpx
;// 0xa0 file offset of character property bin table.PLC.
199 ULONG
fcPlcfbteChpxGet() {
200 return SVBT32ToUInt32(fcPlcfbteChpx
); }
201 SVBT16 cbPlcfbteChpx
;// 0xa4 count of bytes of character property bin table PLC.
202 USHORT
cbPlcfbteChpxGet() {
203 return SVBT16ToShort(cbPlcfbteChpx
); }
205 SVBT32 fcPlcfbtePapx
;// 0xa6 file offset of paragraph property bin table.PLC.
206 ULONG
fcPlcfbtePapxGet() {
207 return SVBT32ToUInt32(fcPlcfbtePapx
); }
208 SVBT16 cbPlcfbtePapx
;// 0xaa count of bytes of paragraph property bin table PLC.
209 USHORT
cbPlcfbtePapxGet() {
210 return SVBT16ToShort(cbPlcfbtePapx
); }
212 SVBT32 fcPlcfsea
;// 0xac file offset of PLC reserved for private use. The SEA is 6 bytes long.
213 ULONG
fcPlcfseaGet() {
214 return SVBT32ToUInt32(fcPlcfsea
); }
215 SVBT16 cbPlcfsea
;// 0xb0 count of bytes of private use PLC.
216 USHORT
cbPlcfseaGet() {
217 return SVBT16ToShort(cbPlcfsea
); }
219 SVBT32 fcSttbfffn
;// 0xb2 file offset of font information STTBF. See the FFN file structure definition.
220 ULONG
fcSttbfffnGet() {
221 return SVBT32ToUInt32(fcSttbfffn
); }
222 SVBT16 cbSttbfffn
;// 0xb6 count of bytes in sttbfffn.
223 USHORT
cbSttbfffnGet() {
224 return SVBT16ToShort(cbSttbfffn
); }
226 SVBT32 fcPlcffldMom
;// 0xb8 offset in doc stream to the PLC of field positions in the main document.
227 ULONG
fcPlcffldMomGet() {
228 return SVBT32ToUInt32(fcPlcffldMom
); }
229 SVBT16 cbPlcffldMom
;// 0xbc
230 USHORT
cbPlcffldMomGet() {
231 return SVBT16ToShort(cbPlcffldMom
); }
233 SVBT32 fcPlcffldHdr
;// 0xbe offset in doc stream to the PLC of field positions in the header subdocument.
234 ULONG
fcPlcffldHdrGet() {
235 return SVBT32ToUInt32(fcPlcffldHdr
); }
236 SVBT16 cbPlcffldHdr
;// 0xc2
237 USHORT
cbPlcffldHdrGet() {
238 return SVBT16ToShort(cbPlcffldHdr
); }
240 SVBT32 fcPlcffldFtn
;// 0xc4 offset in doc stream to the PLC of field positions in the footnote subdocument.
241 ULONG
fcPlcffldFtnGet() {
242 return SVBT32ToUInt32(fcPlcffldFtn
); }
243 SVBT16 cbPlcffldFtn
;// 0xc8
244 USHORT
cbPlcffldFtnGet() {
245 return SVBT16ToShort(cbPlcffldFtn
); }
247 SVBT32 fcPlcffldAtn
;// 0xca offset in doc stream to the PLC of field positions in the annotation subdocument.
248 ULONG
fcPlcffldAtnGet() {
249 return SVBT32ToUInt32(fcPlcffldAtn
); }
250 SVBT16 cbPlcffldAtn
;// 0xce
251 USHORT
cbPlcffldAtnGet() {
252 return SVBT16ToShort(cbPlcffldAtn
); }
254 SVBT32 fcPlcffldMcr
;// 0xd0 offset in doc stream to the PLC of field positions in the macro subdocument.
255 ULONG
fcPlcffldMcrGet() {
256 return SVBT32ToUInt32(fcPlcffldMcr
); }
257 SVBT16 cbPlcffldMcr
;// 0xd4
258 USHORT
cbPlcffldMcrGet() {
259 return SVBT16ToShort(cbPlcffldMcr
); }
261 SVBT32 fcSttbfbkmk
;// 0xd6 offset in document stream of the STTBF that records bookmark names in the main document
262 ULONG
fcSttbfbkmkGet() {
263 return SVBT32ToUInt32(fcSttbfbkmk
); }
264 SVBT16 cbSttbfbkmk
;// 0xda
265 USHORT
cbSttbfbkmkGet() {
266 return SVBT16ToShort(cbSttbfbkmk
); }
268 SVBT32 fcPlcfbkf
;// 0xdc offset in document stream of the PLCF that records the beginning CP offsets of bookmarks in the main document. See BKF
269 ULONG
fcPlcfbkfGet() {
270 return SVBT32ToUInt32(fcPlcfbkf
); }
271 SVBT16 cbPlcfbkf
;// 0xe0
272 USHORT
cbPlcfbkfGet() {
273 return SVBT16ToShort(cbPlcfbkf
); }
275 SVBT32 fcPlcfbkl
;// 0xe2 offset in document stream of the PLCF that records the ending CP offsets of bookmarks recorded in the main document. See the BKL structure definition.
276 ULONG
fcPlcfbklGet() {
277 return SVBT32ToUInt32(fcPlcfbkl
); }
278 SVBT16 cbPlcfbkl
;// 0xe6 SVBT16
279 USHORT
cbPlcfbklGet() {
280 return SVBT16ToShort(cbPlcfbkl
); }
282 SVBT32 fcCmds
;// 0xe8 FC
284 return SVBT32ToUInt32(fcCmds
); }
285 SVBT16 cbCmds
;// 0xec
287 return SVBT16ToShort(cbCmds
); }
289 SVBT32 fcPlcmcr
;// 0xee FC
290 ULONG
fcPlcmcrGet() {
291 return SVBT32ToUInt32(fcPlcmcr
); }
292 SVBT16 cbPlcmcr
;// 0xf2
293 USHORT
cbPlcmcrGet() {
294 return SVBT16ToShort(cbPlcmcr
); }
296 SVBT32 fcSttbfmcr
;// 0xf4 FC
297 ULONG
fcSttbfmcrGet() {
298 return SVBT32ToUInt32(fcSttbfmcr
); }
299 SVBT16 cbSttbfmcr
;// 0xf8
300 USHORT
cbSttbfmcrGet() {
301 return SVBT16ToShort(cbSttbfmcr
); }
303 SVBT32 fcPrEnv
;// 0xfa
305 return SVBT32ToUInt32(fcPrEnv
); }
306 SVBT16 cbPrEnv
;// 0xfe
307 USHORT
cbPrEnvGet() {
308 return SVBT16ToShort(cbPrEnv
); }
310 SVBT32 fcWss
;// 0x100 file offset of Window Save State data structure. See WSS.
312 return SVBT32ToUInt32(fcWss
); }
313 SVBT16 cbWss
;// 0x100 count of bytes of WSS. ==0 if unable to store the window state.
315 return SVBT16ToShort(cbWss
); }
317 SVBT32 fcDop
;// 0x106 file offset of document property data structure.
319 return SVBT32ToUInt32(fcDop
); }
320 SVBT16 cbDop
;// 0x10a count of bytes of document properties.
322 return SVBT16ToShort(cbDop
); }
325 SVBT32 fcSttbfAssoc
;// 0x10c offset to STTBF of associated strings. See STTBFASSOC.
326 ULONG
fcSttbfAssocGet() {
327 return SVBT32ToUInt32(fcSttbfAssoc
); }
328 SVBT16 cbSttbfAssoc
;// 0x110
329 USHORT
cbSttbfAssocGet() {
330 return SVBT16ToShort(cbSttbfAssoc
); }
332 SVBT32 fcClx
;// 0x112 file offset of beginning of information for complex files.
334 return SVBT32ToUInt32(fcClx
); }
335 SVBT16 cbClx
;// 0x116 count of bytes of complex file information. 0 if file is non-complex.
337 return SVBT16ToShort(cbClx
); }
339 SVBT32 fcPlcfpgdFtn
;// 0x118 file offset of page descriptor PLC for footnote subdocument.
340 ULONG
fcPlcfpgdFtnGet() {
341 return SVBT32ToUInt32(fcPlcfpgdFtn
); }
342 SVBT16 cbPlcfpgdFtn
;// 0x11C count of bytes of page descriptor PLC for footnote subdocument.
343 USHORT
cbPlcfpgdFtnGet() {
344 return SVBT16ToShort(cbPlcfpgdFtn
); }
345 // ==0 if document has not been paginated. The length of the PGD is 8 bytes.
347 SVBT32 fcSpare1
;// 0x11e file offset of the name of the original file.
348 ULONG
fcSpare1Get() {
349 return SVBT32ToUInt32(fcSpare1
); }
350 SVBT16 cbSpare1
;// 0x122 count of bytes of the name of the original file.
351 USHORT
cbSpare1Get() {
352 return SVBT16ToShort(cbSpare1
); }
353 SVBT32 fcSpare2
;// 0x124 file offset of the name of the original file.
354 ULONG
fcSpare2Get() {
355 return SVBT32ToUInt32(fcSpare2
); }
356 SVBT16 cbSpare2
;// 0x128 count of bytes of the name of the original file.
357 USHORT
cbSpare2Get() {
358 return SVBT16ToShort(cbSpare2
); }
359 SVBT32 fcSpare3
;// 0x12a file offset of the name of the original file.
360 ULONG
fcSpare3Get() {
361 return SVBT32ToUInt32(fcSpare3
); }
362 SVBT16 cbSpare3
;// 0x12e count of bytes of the name of the original file.
363 USHORT
cbSpare3Get() {
364 return SVBT16ToShort(cbSpare3
); }
365 SVBT32 fcSpare4
;// 0x130 file offset of the name of the original file.
366 ULONG
fcSpare4Get() {
367 return SVBT32ToUInt32(fcSpare4
); }
368 SVBT16 cbSpare4
;// 0x134 count of bytes of the name of the original file.
369 USHORT
cbSpare4Get() {
370 return SVBT16ToShort(cbSpare4
); }
372 SVBT16 cpnBteChp
;// 0x18E count of CHPX FKPs recorded in file. In non-complex files if the number of
373 USHORT
cpnBteChpGet() {
374 return SVBT16ToShort(cpnBteChp
); }
375 // entries in the plcfbteChpx is less than this, the plcfbteChpx is incomplete.
376 SVBT16 cpnBtePap
;// 0x190 count of PAPX FKPs recorded in file. In non-complex files if the number of
377 USHORT
cpnBtePapGet() {
378 return SVBT16ToShort(cpnBtePap
); }
379 // entries in the plcfbtePapx is less than this, the plcfbtePapx is incomplete.
382 struct W1_DOP
///////////////////////////////////// Document Properties
386 return SVBT16ToShort(fFlags
); }
387 // SVBT16 fFacingPages : 1;// 1 when facing pages should be printed
388 BOOL
fFacingPagesGet() {
389 return 0 != ((fFlagsGet() >> 0) & 1); }
390 // SVBT16 fWidowControl : 1;// 1 when widow control is in effect. 0 when widow control disabled.
391 BOOL
fWidowControlGet() {
392 return 0 != ((fFlagsGet() >> 1) & 1); }
393 // SVBT16 : 3;// unused
394 // SVBT16 fpc : 2;// 1 footnote position code: 0 as endnotes, 1 at bottom of page, 2 immediately beneath text
396 return (USHORT
)((fFlagsGet() >> 5) & 3); }
397 // SVBT16 fWide : 1;// Landscape
399 return 0 != ((fFlagsGet() >> 7) & 1); }
400 // SVBT16 grpfIhdt : 8;// 0 specification of document headers and footers. See explanation under Headers and Footers topic.
401 USHORT
grpfIhdtGet() {
402 return (USHORT
)((fFlagsGet() >> 8) & 0xff); }
404 USHORT
fFtnFlagsGet() {
405 return SVBT16ToShort(fFtnFlags
); }
406 // SVBT16 fFtnRestart : 1;
407 BOOL
fFtnRestartGet() {
408 return 0 != ((fFtnFlagsGet() >> 0) & 1); }
409 // SVBT16 nFtn : 15;// 1 initial footnote number for document
411 return (USHORT
)((fFtnFlagsGet() >> 1) & 0x7fff); }
413 USHORT
fRvsFlagsGet() {
414 return SVBT16ToShort(fRvsFlags
); }
415 // SVBT16 irmBar : 8;
417 return (USHORT
)((fRvsFlagsGet() >> 0) & 0xff); }
418 // SVBT16 irmProps : 7;
419 USHORT
irmPropsGet() {
420 return (USHORT
)((fRvsFlagsGet() >> 8) & 0x7f); }
421 // SVBT16 fRevMarking : 1;// when 1, Word will mark revisions as the document is edited
422 BOOL
fRevMarkingGet() {
423 return 0 != ((fRvsFlagsGet() >> 15) & 1); }
425 USHORT
fSveFlagsGet() {
426 return SVBT16ToShort(fSveFlags
); }
427 // SVBT16 fBackup : 1;// always make backup when document saved when 1.
429 return 0 != ((fSveFlagsGet() >> 0) & 1); }
430 // SVBT16 fExactCWords : 1;
431 BOOL
fExactCWordsGet() {
432 return 0 != ((fSveFlagsGet() >> 1) & 1); }
433 // SVBT16 fPagHidden : 1;//
434 BOOL
fPagHiddenGet() {
435 return 0 != ((fSveFlagsGet() >> 2) & 1); }
436 // SVBT16 fPagResults : 1;
437 BOOL
fPagResultsGet() {
438 return 0 != ((fSveFlagsGet() >> 3) & 1); }
439 // SVBT16 fLockAtn : 1;// when 1, annotations are locked for editing
441 return 0 != ((fSveFlagsGet() >> 4) & 1); }
442 // SVBT16 fMirrorMargins : 1;// swap margins on left/right pages when 1.
443 BOOL
fMirrorMarginsGet() {
444 return 0 != ((fSveFlagsGet() >> 5) & 1); }
445 // SVBT16 : 10;// unused
447 USHORT
fSparesGet() {
448 return SVBT16ToShort(fSpares
); }
451 return SVBT16ToShort(yaPage
); }
454 return SVBT16ToShort(xaPage
); }
457 return SVBT16ToShort(dyaTop
); }
459 USHORT
dxaLeftGet() {
460 return SVBT16ToShort(dxaLeft
); }
462 USHORT
dyaBottomGet() {
463 return SVBT16ToShort(dyaBottom
); }
465 USHORT
dxaRightGet() {
466 return SVBT16ToShort(dxaRight
); }
468 USHORT
dxaGutterGet() {
469 return SVBT16ToShort(dxaGutter
); }
470 SVBT16 dxaTab
;// 720 twips default tab width
472 return SVBT16ToShort(dxaTab
); }
475 return SVBT16ToShort(wSpare
); }
476 SVBT16 dxaHotZ
;// width of hyphenation hot zone measured in twips
477 USHORT
dxaHotZGet() {
478 return SVBT16ToShort(dxaHotZ
); }
479 SVBT16 rgwSpare
[2];// reserved
480 SVBT32 dttmCreated
;// DTTM date and time document was created
481 ULONG
dttmCreatedGet() {
482 return SVBT32ToUInt32(dttmCreated
); }
483 SVBT32 dttmRevised
;// DTTM date and time document was last revised
484 ULONG
dttmRevisedGet() {
485 return SVBT32ToUInt32(dttmRevised
); }
486 SVBT32 dttmLastPrint
;// DTTM date and time document was last printed
487 ULONG
dttmLastPrintGet() {
488 return SVBT32ToUInt32(dttmLastPrint
); }
489 SVBT16 nRevision
;// number of times document has been revised since its creation
490 USHORT
nRevisionGet() {
491 return SVBT16ToShort(nRevision
); }
492 SVBT32 tmEdited
;// time document was last edited
493 ULONG
tmEditedGet() {
494 return SVBT32ToUInt32(tmEdited
); }
495 SVBT32 cWords
;// count of words tallied by last Word Count execution
497 return SVBT32ToUInt32(cWords
); }
498 SVBT32 cCh
;// count of characters tallied by last Word Count execution
500 return SVBT32ToUInt32(cCh
); }
501 SVBT16 cPg
;// count of pages tallied by last Word Count execution
503 return SVBT16ToShort(cPg
); }
504 SVBT16 rgwSpareDocSum
[2];
508 struct W1_CHP
/////////////////////////////////////////////////////////
511 SVBT16 ftc
;// Font Code
512 SVBT8 hps
;// Font size in half points
513 SVBT8 hpsPos
;// Sub/Superscript ( signed number, 0 = normal )
515 SVBT32 fcPic
;// not stored in File
516 SVBT8 fnPic
;// internal
517 SVBT16 hpsLargeChp
;// ???
519 W1_CHP() { memset( this, 0, sizeof( *this)); }
521 USHORT
fCharGet() { return SVBT16ToShort(fChar
); }
522 void fCharSet(USHORT n
) { ShortToSVBT16(n
, fChar
); }
523 BOOL
fBoldGet() { return 0 != ((fCharGet() >> 0) & 1); }
524 void fBoldSet(BOOL b
) { fCharSet( ( fCharGet() & 0xfffe ) | ( b
<< 0 ) ); }
525 BOOL
fItalicGet() { return 0 != ((fCharGet() >> 1) & 1); }
526 void fItalicSet(BOOL b
) { fCharSet( ( fCharGet() & 0xfffd ) | ( b
<< 1 ) ); }
527 BOOL
fStrikeGet() { return 0 != ((fCharGet() >> 2) & 1); }
528 BOOL
fOutlineGet() { return 0 != ((fCharGet() >> 3) & 1); }
529 BOOL
fFldVanishGet() { return 0 != ((fCharGet() >> 4) & 1); }
530 BOOL
fSmallCapsGet() { return 0 != ((fCharGet() >> 5) & 1); }
531 BOOL
fCapsGet() { return 0 != ((fCharGet() >> 6) & 1); }
532 BOOL
fVanishGet() { return 0 != ((fCharGet() >> 7) & 1); }
533 BOOL
fRMarkGet() { return 0 != ((fCharGet() >> 8) & 1); }
534 BOOL
fSpecGet() { return 0 != ((fCharGet() >> 9) & 1); }
535 BOOL
fsIcoGet() { return 0 != ((fCharGet() >> 10) & 1); }
536 BOOL
fsFtcGet() { return 0 != ((fCharGet() >> 11) & 1); }
537 void fsFtcSet(BOOL b
) { fCharSet( ( fCharGet() & 0xf7ff ) | ( b
<< 11 ) ); }
538 BOOL
fsHpsGet() { return 0 != ((fCharGet() >> 12) & 1); }
539 void fsHpsSet(BOOL b
) { fCharSet( ( fCharGet() & 0xefff ) | ( b
<< 12 ) ); }
540 BOOL
fsKulGet() { return 0 != ((fCharGet() >> 13) & 1); }
541 void fsKulSet(BOOL b
) { fCharSet( ( fCharGet() & 0xdfff ) | ( b
<< 13 ) ); }
542 BOOL
fsPosGet() { return 0 != ((fCharGet() >> 14) & 1); }
543 BOOL
fsSpaceGet() { return 0 != ((fCharGet() >> 15) & 1); }
544 // SVBT16 fBold :1;// 1 == opposite boldness of style
545 // SVBT16 fItalic :1;// 1 == opposite of style
546 // SVBT16 fStrike :1;// 1 == opposite of style
547 // SVBT16 fOutline :1;// 1 == opposite of style
548 // SVBT16 fFldVanish :1;// 1 == opposite of style
549 // SVBT16 fSmallCaps :1;// 1 == opposite of style
550 // SVBT16 fCaps :1;// 1 == opposite of style
551 // SVBT16 fVanish :1;// 1 == opposite of style
552 // SVBT16 fRMark :1;// ???
553 // SVBT16 fSpec :1;// 1 == opposite of style
554 // SVBT16 fsIco :1;// 1 == Color (ico) different to style
555 // SVBT16 fsFtc :1;// 1 == FontCode (ftc) different to style
556 // SVBT16 fsHps :1;// 1 == FontSize (hps) different to style
557 // SVBT16 fsKul :1;// 1 == Underline Code (kul) different to style
558 // SVBT16 fsPos :1;// 1 == Char position (hpsPos) different to style
559 // SVBT16 fsSpace :1;// 1 == Char Spacing (qpsSpace) different to style
561 USHORT
ftcGet() { return SVBT16ToShort(ftc
); }
562 void ftcSet(USHORT n
) { ShortToSVBT16(n
, ftc
); }
563 void hpsSet(BYTE n
) { ByteToSVBT8(n
, hps
); }
564 BYTE
hpsGet() { return SVBT8ToByte(hps
); }
566 BYTE
hpsPosGet() { return SVBT8ToByte(hpsPos
); }
567 USHORT
fTextGet() { return SVBT16ToShort(fText
); }
568 void fTextSet(USHORT n
) { ShortToSVBT16(n
, fText
); }
569 USHORT
qpsSpaceGet() { return (USHORT
)((fTextGet() >> 0) & 0x3f); }
570 USHORT
wSpare2Get() { return (USHORT
)((fTextGet() >> 6) & 3); }
571 USHORT
icoGet() { return (USHORT
)((fTextGet() >> 8) & 0xf); }
572 USHORT
kulGet() { return (USHORT
)((fTextGet() >> 12) & 7); }
573 void kulSet(USHORT n
) { fTextSet( ( fTextGet() & 0x8fff ) | ( ( n
& 7 ) << 12 ) ); }
574 BOOL
fSysVanishGet() { return 0 != ((fTextGet() >> 15) & 1); }
575 // SVBT16 qpsSpace :6;// Char Spacing, -7 .. 56; 57 = -7, 63 = -1
576 // SVBT16 wSpare2 : 2;// reserved
577 // SVBT16 ico :4;// color of Text: 0=black, 1=blue, 2=cyan, 3=green, 4=magenta, 5=red, 6=yellow, 7=white
578 // SVBT16 kul: 3;// Underline code: 0=none, 1=single, 2=by word, 3=double, 4=dotted
579 // SVBT16 fSysVanish: 1;// used internally
581 ULONG
fcPicGet() { return SVBT32ToUInt32(fcPic
); }
582 USHORT
fnPicGet() { return SVBT8ToByte(fnPic
); }
583 USHORT
hpsLargeChpGet() { return SVBT16ToShort(hpsLargeChp
); }
585 void Out(Ww1Shell
&, Ww1Manager
&);
588 struct W1_FFN
///////////////////////////////////////// Font Descriptor
590 SVBT8 cbFfnM1
;// 0x0 total length of FFN - 1.
591 USHORT
cbFfnM1Get() {
592 return SVBT8ToByte(cbFfnM1
); }
595 return SVBT8ToByte(fFlags
); }
596 // SVBT8 prg : 2;// 0x1:03 pitch request
598 return (USHORT
)((fFlagsGet() >> 0) & 3); }
599 // SVBT8 fTrueType : 1;// 0x1:04 when 1, font is a TrueType font
600 BOOL
fTrueTypeGet() {
601 return 0 != ((fFlagsGet() >> 2) & 1); }
602 // SVBT8 : 1;// 0x1:08 reserved
603 // SVBT8 ff : 3;// 0x1:70 font family id
605 return (USHORT
)((fFlagsGet() >> 4) & 7); }
606 // SVBT8 : 1;// 0x1:80 reserved
607 BYTE szFfn
[65];// 0x6 zero terminated string that records name of font.
608 // Vorsicht: Dieses Array kann auch kleiner sein!!!
609 // Possibly followed by a second sz which records the name of an
610 // alternate font to use if the first named font does not exist
611 // on this system. Maximal size of szFfn is 65 characters.
612 BYTE
* szFfnGet() { return szFfn
; }
615 struct W1_PHE
/////////////////////////////////////// Paragraph Height
619 return SVBT16ToShort(fFlags
); }
621 return 0 != (fFlagsGet() & 1); }
623 return 0 != ((fFlagsGet() >> 1) & 1); }
624 BOOL
fDiffLinesGet() {
625 return 0 != ((fFlagsGet() >> 2) & 1); }
627 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((fFlagsGet() >> 8) & 0xff); }
630 return SVBT16ToShort(dxaCol
); }
631 SVBT16 xxx
; // beachte die dreifachnutzung.... siehe doc.
632 USHORT
dylHeightGet() {
633 return SVBT16ToShort(xxx
); }
634 USHORT
dylLineGet() {
635 return SVBT16ToShort(xxx
); }
636 USHORT
fStyleDirtyGet() {
637 return SVBT16ToShort(xxx
); }
640 struct W1_PAPX
///////////////////////// Paragraph Property Difference
644 return SVBT8ToByte(stc
); }
651 struct W1_BRC
//////////////////////////////////////////// Border Code
655 return SVBT16ToShort(aBits
); }
656 // SVBT16 dxpLineWidth : 3;// 0007 When dxpLineWidth is 0, 1, 2, 3, 4, or 5,
657 // this field is the width of a single line of border
658 // in units of 0.75 points Must be nonzero when brcType
659 // is nonzero. 6 == dotted, 7 == dashed.
660 BYTE
dxpLineWidthGet() {
661 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 0) & 0x0007); }
662 // SVBT16 brcType : 2;// 0018 border type code: 0 == none, 1 == single, 2 == thick,
665 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 3) & 0x0003); }
666 // SVBT16 fShadow : 1;// 0020 when 1, border is drawn with shadow. Must be 0
667 // when BRC is a substructure of the TC
669 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 5) & 0x0001); }
670 // SVBT16 ico : 5;// 07C0 color code (see chp.ico)
672 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 6) & 0x001f); }
673 // SVBT16 dxpSpace : 5;// F800 width of space to maintain between border and
674 // text within border. Must be 0 when BRC is a
675 // substructure of the TC. Stored in points for Windows.
677 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 11) & 0x001f); }
680 struct W1_BRC10
///////////////////////////////// Border Code Word 1.0
684 return SVBT16ToShort(aBits
); }
685 BYTE
dxpLine2WidthGet() {
686 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 0) & 0x0007); }
687 BYTE
dxpSpaceBetweenGet() {
688 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 3) & 0x0007); }
689 BYTE
dxpLine1WidthGet() {
690 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 6) & 0x0007); }
692 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 9) & 0x001f); }
694 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 14) & 0x0001); }
696 return sal::static_int_cast
< sal_uInt8
, sal_uInt16
>((aBitsGet() >> 15) & 0x0001); }
699 struct W1_FLD
//////////////////////////////////////// FieldDescriptor
701 SVBT8 ch
; // boundary-type (begin(19), separator (20), end (21))
703 return SVBT8ToByte(ch
); }
704 SVBT8 flt
; // field type / flags
706 return SVBT8ToByte(flt
); }
707 // variant, when ch==21:
709 return (fltGet() >> 0) & 1; }
710 BOOL
fResultDirtyGet() {
711 return (fltGet() >> 2) & 1; }
712 BOOL
ResultEditedGet() {
713 return (fltGet() >> 3) & 1; }
715 return (fltGet() >> 4) & 1; }
716 BOOL
fPrivateResultGet() {
717 return (fltGet() >> 5) & 1; }
719 return (fltGet() >> 6) & 1; }
722 struct W1_PIC
/////////////////////////////////////// PictureStructure
724 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.
726 return SVBT32ToUInt32(lcb
); }
727 SVBT16 cbHeader
;// 0x4 number of bytes in the PIC (to allow for future expansion).
728 USHORT
cbHeaderGet() {
729 return SVBT16ToShort(cbHeader
); }
733 return SVBT16ToShort(mm
); }
734 SVBT16 xExt
;// 0x8 int
736 return SVBT16ToShort(xExt
); }
737 SVBT16 yExt
;// 0xa int
739 return SVBT16ToShort(yExt
); }
740 SVBT16 hMF
;// 0xc int
742 return SVBT16ToShort(hMF
); }
745 SVBT8 bm
[14];// 0xe BITMAP(14 bytes) Window's bitmap structure when PIC describes a BITMAP.
746 SVBT8 rcWinMF
[14];// 0xe rc (rectangle - 8 bytes) rect for window origin and extents when metafile is stored -- ignored if 0
748 SVBT16 dxaGoal
;// 0x1c horizontal measurement in twips of the rectangle the picture should be imaged within.
749 USHORT
dxaGoalGet() {
750 return SVBT16ToShort(dxaGoal
); }
751 SVBT16 dyaGoal
;// 0x1e vertical measurement in twips of the rectangle the picture should be imaged within.
752 USHORT
dyaGoalGet() {
753 return SVBT16ToShort(dyaGoal
); }
754 SVBT16 mx
;// 0x20 horizontal scaling factor supplied by user in .1% units.
756 return SVBT16ToShort(mx
); }
757 SVBT16 my
;// 0x22 vertical scaling factor supplied by user in .1% units.
759 return SVBT16ToShort(my
); }
760 SVBT16 dxaCropLeft
;// 0x24 the amount the picture has been cropped on the left in twips.
761 USHORT
dxaCropLeftGet() {
762 return SVBT16ToShort(dxaCropLeft
); }
763 SVBT16 dyaCropTop
;// 0x26 the amount the picture has been cropped on the top in twips.
764 USHORT
dyaCropTopGet() {
765 return SVBT16ToShort(dyaCropTop
); }
766 SVBT16 dxaCropRight
;// 0x28 the amount the picture has been cropped on the right in twips.
767 USHORT
dxaCropRightGet() {
768 return SVBT16ToShort(dxaCropRight
); }
769 SVBT16 dyaCropBottom
;// 0x2a the amount the picture has been cropped on the bottom in twips.
770 USHORT
dyaCropBottomGet() {
771 return SVBT16ToShort(dyaCropBottom
); }
774 return SVBT16ToShort(flags
); }
775 // brcl : 4;// 000F Obsolete, superseded by brcTop, etc. In
777 return sal::static_int_cast
< BYTE
, sal_uInt16
>(flagsGet() & 0xf); }
778 // fFrameEmpty : 1;// 0010 picture consists of a single frame
779 BOOL
fFrameEmptyGet() {
780 return sal::static_int_cast
< BYTE
, sal_uInt16
>((flagsGet() >> 4) & 1); }
782 // fBitmap : 1;// 0020 ==1, when picture is just a bitmap
783 // BOOL fBitmapGet() {
784 // return (flagsGet() >> 5) & 1; }
785 // fDrawHatch : 1;// 0040 ==1, when picture is an active OLE object
786 // BOOL fDrawHatchGet() {
787 // return (flagsGet() >> 6) & 1; }
788 // fError : 1;// 0080 ==1, when picture is just an error message
789 // BOOL fErrorGet() {
790 // return (flagsGet() >> 7) & 1; }
791 // bpp : 8;// FF00 bits per pixel, 0 = unknown
793 // return (flagsGet() >> 8) & 0xff; }
795 // USHORT rgbrcGet(USHORT nIndex) {
796 // return SVBT16ToShort(rgbrc[nIndex]); }
797 // W1_BRC brcTop;// 0x2e specification for border above picture
798 // W1_BRC brcLeft;// 0x30 specification for border to the left
799 // W1_BRC brcBottom;// 0x32 specification for border below picture
800 // W1_BRC brcRight;// 0x34 specification for border to the right
801 // SVBT16 dxaOrigin;// 0x36 horizontal offset of hand annotation origin
802 // USHORT dxaOriginGet() {
803 // return SVBT16ToShort(dxaOrigin); }
804 // SVBT16 dyaOrigin;// 0x38 vertical offset of hand annotation origin
805 // USHORT dyaOriginGet() {
806 // return SVBT16ToShort(dyaOrigin); }
807 SVBT8 rgb
;// 0x3a variable array of bytes containing Window's metafile, bitmap or TIFF file filename.
812 struct W1_TBD
/////////////////////////////////////////////////////////
816 return SVBT8ToByte(aBits1
); }
817 // SVBT8 jc : 3;// 0x07 justification code: 0=left tab, 1=centered tab, 2=right tab, 3=decimal tab, 4=bar
819 return aBits1Get() & 0x07; }
820 // SVBT8 tlc : 3;// 0x38 tab leader code: 0=no leader, 1=dotted leader,
821 // 2=hyphenated leader, 3=single line leader, 4=heavy line leader
823 return (aBits1Get() >> 3 ) & 0x07; }
824 // * int :2 C0 reserved
827 struct W1_TC
//////////////////////////////////////////////////////////
831 return SVBT8ToByte(aBits1
); }
832 BYTE
fFirstMergedGet() {
833 return aBits1Get() & 0x01; }
835 return (aBits1Get() >> 1 ) & 0x01; }
837 // SVBT16 fFirstMerged : 1;// 0001 set to 1 when cell is first cell of a range of cells that have been merged.
838 // SVBT16 fMerged : 1;// 0002 set to 1 when cell has been merged with preceding cell.
839 // SVBT16 fUnused : 14;// FFFC reserved
840 W1_BRC10 rgbrc
[4];// notational convenience for referring to brcTop, brcLeft, etc fields.
841 W1_BRC10
* rgbrcGet() {
843 // BRC brcTop;// specification of the top border of a table cell
844 // BRC brcLeft;// specification of left border of table row
845 // BRC brcBottom;// specification of bottom border of table row
846 // BRC brcRight;// specification of right border of table row.
848 // cbTC (count of bytes of a TC) is 10(decimal), A(hex).
851 struct W1_SHD
////////////////////////////////////////////// struct SHD
854 // SVBT16 nFore : 5;// 0x001f ForegroundColor
855 USHORT
GetFore() { return SVBT16ToShort(aBits1
) & 0x01; };
856 void SetFore( short nVal
){
857 ShortToSVBT16((SVBT16ToShort(aBits1
)&0xffe0)|(nVal
&0x1f), aBits1
); };
858 // SVBT16 nBack : 5;// 0x03e0 BackgroundColor
859 W1_SHD() { ShortToSVBT16( 0, aBits1
); };
860 USHORT
GetBack() { return (SVBT16ToShort(aBits1
) >> 5 & 0x1f ); };
861 void SetBack( short nVal
){
862 ShortToSVBT16((SVBT16ToShort(aBits1
)&0xfc1f)|(nVal
&0x1f)<<5, aBits1
); };
863 // SVBT16 nStyle : 5;// 0x7c00 Percentage and Style
864 USHORT
GetStyle() { return (SVBT16ToShort(aBits1
) >> 10 & 0x1f ); };
865 void SetStyle( short nVal
){
866 ShortToSVBT16((SVBT16ToShort(aBits1
)&0x83ff)|(nVal
&0x1f)<<10, aBits1
); };
867 // SVBT16 nDontKnow : 1;// 0x8000 ???
870 struct W1_ANLV
////////////////////////////////////////////////////////
872 SVBT8 nfc
;// 0 number format code, 0=Arabic, 1=Upper case Roman, 2=Lower case Roman
873 // 3=Upper case Letter, 4=Lower case letter, 5=Ordinal
874 SVBT8 cbTextBefore
;// 1 offset into anld.rgch limit of prefix text
875 SVBT8 cbTextAfter
;// 2
877 // SVBT8 jc : 2;// 3 : 0x03 justification code, 0=left, 1=center, 2=right, 3=left and right justify
878 // SVBT8 fPrev : 1;// 0x04 when ==1, include previous levels
879 // SVBT8 fHang : 1;// 0x08 when ==1, number will be displayed using a hanging indent
880 // SVBT8 fSetBold : 1;// 0x10 when ==1, boldness of number will be determined by anld.fBold.
881 // SVBT8 fSetItalic : 1;// 0x20 when ==1, italicness of number will be determined by anld.fItalic
882 // SVBT8 fSetSmallCaps : 1;// 0x40 when ==1, anld.fSmallCaps will determine whether number will be displayed in small caps or not.
883 // SVBT8 fSetCaps : 1;// 0x80 when ==1, anld.fCaps will determine whether number will be displayed capitalized or not
885 // SVBT8 fSetStrike : 1;// 4 : 0x01 when ==1, anld.fStrike will determine whether the number will be displayed using strikethrough or not.
886 // SVBT8 fSetKul : 1;// 0x02 when ==1, anld.kul will determine the underlining state of the autonumber.
887 // SVBT8 fPrevSpace : 1;// 0x04 when ==1, autonumber will be displayed with a single prefixing space character
888 // SVBT8 fBold : 1;// 0x08 determines boldness of autonumber when anld.fSetBold == 1.
889 // SVBT8 fItalic : 1;// 0x10 determines italicness of autonumber when anld.fSetItalic == 1.
890 // SVBT8 fSmallCaps : 1;// 0x20 determines whether autonumber will be displayed using small caps when anld.fSetSmallCaps == 1.
891 // SVBT8 fCaps : 1;// 0x40 determines whether autonumber will be displayed using caps when anld.fSetCaps == 1.
892 // SVBT8 fStrike : 1;// 0x80 determines whether autonumber will be displayed using caps when anld.fSetStrike == 1.
894 // SVBT8 kul : 3;// 5 : 0x07 determines whether autonumber will be displayed with underlining when anld.fSetKul == 1.
895 // SVBT8 ico : 5;// 0xF1 color of autonumber
896 SVBT16 ftc
;// 6 font code of autonumber
897 SVBT16 hps
;// 8 font half point size (or 0=auto)
898 SVBT16 iStartAt
;// 0x0a starting value (0 to 65535)
899 SVBT16 dxaIndent
;// 0x0c *short?* *USHORT?* width of prefix text (same as indent)
900 SVBT16 dxaSpace
;// 0x0e minimum space between number and paragraph
902 // *cbANLV (count of bytes of ANLV) is 16 (decimal), 10(hex).
904 struct W1_ANLD
////////////////////////////////////////////////////////
907 SVBT8 fNumber1
;// 0x10 number only 1 item per table cell
908 SVBT8 fNumberAcross
;// 0x11 number across cells in table rows(instead of down)
909 SVBT8 fRestartHdn
;// 0x12 restart heading number on section boundary
910 SVBT8 fSpareX
;// 0x13 unused( should be 0)
911 sal_Char rgchAnld
[32];// 0x14 characters displayed before/after autonumber
915 struct W1_OLST
////////////////////////////////////////////////////////
917 W1_ANLV rganlv
[9];// 0 an array of 9 ANLV structures (heading levels)
918 SVBT8 fRestartHdr
;// 0x90 when ==1, restart heading on section break
919 SVBT8 fSpareOlst2
;// 0x91 reserved
920 SVBT8 fSpareOlst3
;// 0x92 reserved
921 SVBT8 fSpareOlst4
;// 0x93 reserved
922 sal_Char rgch
[64];// 0x94 array of 64 chars text before/after number
924 // cbOLST is 212(decimal), D4(hex).