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 _WW8SCAN_HXX
21 : #define _WW8SCAN_HXX
22 :
23 : #ifndef LONG_MAX
24 : #include <limits.h>
25 : #endif
26 : #include <stack>
27 : #include <vector>
28 : #include <list>
29 : #include <algorithm>
30 : #include <tools/solar.h> // UINTXX
31 : #include <tools/stream.hxx>
32 : #include <tools/string.hxx>
33 : #include "hash_wrap.hxx"
34 : #include "sortedarray.hxx"
35 :
36 : #include "ww8struc.hxx" // FIB, STSHI, STD...
37 : #include <types.hxx>
38 :
39 : #include <unomid.h>
40 :
41 : //--Line below which the code has meaningful comments
42 :
43 : //Commonly used string literals for stream and storage names in word docs
44 : namespace SL
45 : {
46 : # define DEFCONSTSTRINGARRAY(X) extern const char a##X[sizeof("" #X "")]
47 : DEFCONSTSTRINGARRAY(ObjectPool);
48 : DEFCONSTSTRINGARRAY(1Table);
49 : DEFCONSTSTRINGARRAY(0Table);
50 : DEFCONSTSTRINGARRAY(Data);
51 : DEFCONSTSTRINGARRAY(CheckBox);
52 : DEFCONSTSTRINGARRAY(ListBox);
53 : DEFCONSTSTRINGARRAY(TextBox);
54 : DEFCONSTSTRINGARRAY(TextField);
55 : DEFCONSTSTRINGARRAY(MSMacroCmds);
56 : }
57 :
58 : struct SprmInfo
59 : {
60 : sal_uInt16 nId; ///< A ww8 sprm is hardcoded as 16bits
61 : unsigned int nLen : 6;
62 : unsigned int nVari : 2;
63 : };
64 :
65 : struct SprmInfoHash
66 : {
67 712073 : size_t operator()(const SprmInfo &a) const
68 : {
69 712073 : return a.nId;
70 : }
71 : };
72 :
73 : typedef ww::WrappedHash<SprmInfo, SprmInfoHash> wwSprmSearcher;
74 : typedef ww::WrappedHash<sal_uInt16> wwSprmSequence;
75 :
76 : /**
77 : wwSprmParser knows how to take a sequence of bytes and split it up into
78 : sprms and their arguments
79 : */
80 : class wwSprmParser
81 : {
82 : private:
83 : ww::WordVersion meVersion;
84 : sal_uInt8 mnDelta;
85 : const wwSprmSearcher *mpKnownSprms;
86 : static const wwSprmSearcher* GetWW8SprmSearcher();
87 : static const wwSprmSearcher* GetWW6SprmSearcher();
88 : static const wwSprmSearcher* GetWW2SprmSearcher();
89 :
90 : SprmInfo GetSprmInfo(sal_uInt16 nId) const;
91 :
92 : sal_uInt8 SprmDataOfs(sal_uInt16 nId) const;
93 :
94 : enum SprmType {L_FIX=0, L_VAR=1, L_VAR2=2};
95 : public:
96 : //7- ids are very different to 8+ ones
97 : wwSprmParser(ww::WordVersion eVersion);
98 : /// Return the SPRM id at the beginning of this byte sequence
99 : sal_uInt16 GetSprmId(const sal_uInt8* pSp) const;
100 :
101 : sal_uInt16 GetSprmSize(sal_uInt16 nId, const sal_uInt8* pSprm) const;
102 :
103 : /// Get known len of a sprms head, the bytes of the sprm id + any bytes
104 : /// reserved to hold a variable length
105 : sal_uInt16 DistanceToData(sal_uInt16 nId) const;
106 :
107 : /// Get len of a sprms data area, ignoring the bytes of the sprm id and
108 : /// ignoring any len bytes. Reports the remaining data after those bytes
109 : sal_uInt16 GetSprmTailLen(sal_uInt16 nId, const sal_uInt8 * pSprm) const;
110 :
111 : /// The minimum acceptable sprm len possible for this type of parser
112 339801 : int MinSprmLen() const { return (IsSevenMinus(meVersion)) ? 2 : 3; }
113 :
114 : /// Returns the offset to data of the first sprm of id nId, 0
115 : // if not found. nLen must be the <= length of pSprms
116 : sal_uInt8* findSprmData(sal_uInt16 nId, sal_uInt8* pSprms, sal_uInt16 nLen)
117 : const;
118 : };
119 :
120 : //Read a Pascal-style, i.e. single byte string length followed
121 : //by string contents
122 0 : inline String read_uInt8_PascalString(SvStream& rStrm, rtl_TextEncoding eEnc)
123 : {
124 0 : return read_lenPrefixed_uInt8s_ToOUString<sal_uInt8>(rStrm, eEnc);
125 : }
126 :
127 2429 : inline String read_uInt16_PascalString(SvStream& rStrm)
128 : {
129 2429 : return read_lenPrefixed_uInt16s_ToOUString<sal_uInt16>(rStrm);
130 : }
131 :
132 : //Belt and Braces strings, i.e. Pascal-style strings followed by
133 : //null termination, Spolsky calls them "fucked strings" FWIW
134 : //http://www.joelonsoftware.com/articles/fog0000000319.html
135 : String read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding eEnc);
136 : String read_uInt16_BeltAndBracesString(SvStream& rStrm);
137 :
138 : //--Line abovewhich the code has meaningful comments
139 :
140 : class WW8Fib;
141 : class WW8ScannerBase;
142 : class WW8PLCFspecial;
143 : struct WW8PLCFxDesc;
144 : class WW8PLCFx_PCD;
145 :
146 : /**
147 : reads array of strings (see MS documentation: STring TaBle stored in File)
148 : returns NOT the original pascal strings but an array of converted char*
149 :
150 : attention: the *extra data* of each string are SKIPPED and ignored
151 : */
152 : void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen,
153 : sal_uInt16 nExtraLen, rtl_TextEncoding eCS, ::std::vector<String> &rArray,
154 : ::std::vector<ww::bytes>* pExtraArray = 0, ::std::vector<String>* pValueArray = 0);
155 :
156 : struct WW8FieldDesc
157 : {
158 : long nLen; ///< Gesamtlaenge ( zum Text ueberlesen )
159 : WW8_CP nSCode; ///< Anfang Befehlscode
160 : WW8_CP nLCode; ///< Laenge
161 : WW8_CP nSRes; ///< Anfang Ergebnis
162 : WW8_CP nLRes; ///< Laenge ( == 0, falls kein Ergebnis )
163 : sal_uInt16 nId; ///< WW-Id fuer Felder
164 : sal_uInt8 nOpt; ///< WW-Flags ( z.B.: vom User geaendert )
165 : sal_uInt8 bCodeNest:1; ///< Befehl rekursiv verwendet
166 : sal_uInt8 bResNest:1; ///< Befehl in Resultat eingefuegt
167 : };
168 :
169 : struct WW8PLCFxSave1
170 : {
171 : sal_uLong nPLCFxPos;
172 : sal_uLong nPLCFxPos2; ///< fuer PLCF_Cp_Fkp: PieceIter-Pos
173 : long nPLCFxMemOfs;
174 : WW8_CP nStartCp; ///< for cp based iterator like PAP and CHP
175 : long nCpOfs;
176 : WW8_FC nStartFC;
177 : WW8_CP nAttrStart;
178 : WW8_CP nAttrEnd;
179 : bool bLineEnd;
180 : };
181 :
182 : /**
183 : u.a. fuer Felder, also genausoviele Attr wie Positionen,
184 : falls Ctor-Param bNoEnd = false
185 : */
186 : class WW8PLCFspecial // Iterator fuer PLCFs
187 : {
188 : private:
189 : sal_Int32* pPLCF_PosArray; ///< Pointer auf Pos-Array und auf ganze Struktur
190 : sal_uInt8* pPLCF_Contents; ///< Pointer auf Inhalts-Array-Teil des Pos-Array
191 : long nIMax; ///< Anzahl der Elemente
192 : long nIdx; ///< Merker, wo wir gerade sind
193 : sal_uInt32 nStru;
194 : public:
195 : WW8PLCFspecial(SvStream* pSt, sal_uInt32 nFilePos, sal_uInt32 nPLCF,
196 : sal_uInt32 nStruct);
197 82 : ~WW8PLCFspecial() { delete[] pPLCF_PosArray; }
198 336 : long GetIdx() const { return nIdx; }
199 224 : void SetIdx( long nI ) { nIdx = nI; }
200 63 : long GetIMax() const { return nIMax; }
201 : bool SeekPos(long nPos); // geht ueber FC- bzw. CP-Wert
202 : // bzw. naechste groesseren Wert
203 : bool SeekPosExact(long nPos);
204 132 : sal_Int32 Where() const
205 132 : { return ( nIdx >= nIMax ) ? SAL_MAX_INT32 : pPLCF_PosArray[nIdx]; }
206 : bool Get(WW8_CP& rStart, void*& rpValue) const;
207 : bool GetData(long nIdx, WW8_CP& rPos, void*& rpValue) const;
208 :
209 12 : const void* GetData( long nInIdx ) const
210 : {
211 : return ( nInIdx >= nIMax ) ? 0
212 12 : : (const void*)&pPLCF_Contents[nInIdx * nStru];
213 : }
214 0 : sal_Int32 GetPos( long nInIdx ) const
215 0 : { return ( nInIdx >= nIMax ) ? SAL_MAX_INT32 : pPLCF_PosArray[nInIdx]; }
216 :
217 306 : void advance()
218 : {
219 306 : if (nIdx <= nIMax)
220 306 : ++nIdx;
221 306 : }
222 : };
223 :
224 : /** simple Iterator for SPRMs */
225 : class WW8SprmIter
226 : {
227 : private:
228 : const wwSprmParser &mrSprmParser;
229 : // these members will be updated
230 : const sal_uInt8* pSprms; // remaining part of the SPRMs ( == start of akt. SPRM)
231 : const sal_uInt8* pAktParams; // start of akt. SPRM's parameters
232 : sal_uInt16 nAktId;
233 : sal_uInt16 nAktSize;
234 :
235 : long nRemLen; // length of remaining SPRMs (including akt. SPRM)
236 :
237 : void UpdateMyMembers();
238 : public:
239 : explicit WW8SprmIter( const sal_uInt8* pSprms_, long nLen_,
240 : const wwSprmParser &rSprmParser);
241 : void SetSprms( const sal_uInt8* pSprms_, long nLen_ );
242 : const sal_uInt8* FindSprm(sal_uInt16 nId);
243 : void advance();
244 185129 : const sal_uInt8* GetSprms() const
245 185129 : { return ( pSprms && (0 < nRemLen) ) ? pSprms : 0; }
246 15458 : const sal_uInt8* GetAktParams() const { return pAktParams; }
247 159688 : sal_uInt16 GetAktId() const { return nAktId; }
248 : private:
249 : //No copying
250 : WW8SprmIter(const WW8SprmIter&);
251 : WW8SprmIter& operator=(const WW8SprmIter&);
252 : };
253 :
254 : /* u.a. fuer FKPs auf normale Attr., also ein Attr weniger als Positionen */
255 : class WW8PLCF // Iterator fuer PLCFs
256 : {
257 : private:
258 : WW8_CP* pPLCF_PosArray; // Pointer auf Pos-Array und auf ganze Struktur
259 : sal_uInt8* pPLCF_Contents; // Pointer auf Inhalts-Array-Teil des Pos-Array
260 : sal_Int32 nIMax; // Anzahl der Elemente
261 : sal_Int32 nIdx;
262 : int nStru;
263 :
264 : void ReadPLCF(SvStream& rSt, WW8_FC nFilePos, sal_uInt32 nPLCF);
265 :
266 : /*
267 : Falls im Dok ein PLC fehlt und die FKPs solo dastehen,
268 : machen wir uns hiermit einen PLC:
269 : */
270 : void GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN);
271 :
272 : void MakeFailedPLCF();
273 : public:
274 : WW8PLCF(SvStream& rSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
275 : WW8_CP nStartPos = -1);
276 :
277 : /*
278 : folgender Ctor generiert ggfs. einen PLC aus nPN und ncpN
279 : */
280 : WW8PLCF(SvStream& rSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
281 : WW8_CP nStartPos, sal_Int32 nPN, sal_Int32 ncpN);
282 :
283 131 : ~WW8PLCF(){ delete[] pPLCF_PosArray; }
284 960 : sal_Int32 GetIdx() const { return nIdx; }
285 1064 : void SetIdx( sal_Int32 nI ) { nIdx = nI; }
286 1 : sal_Int32 GetIMax() const { return nIMax; }
287 : bool SeekPos(WW8_CP nPos);
288 : WW8_CP Where() const;
289 : bool Get(WW8_CP& rStart, WW8_CP& rEnd, void*& rpValue) const;
290 2806 : void advance() { if( nIdx < nIMax ) ++nIdx; }
291 :
292 1 : const void* GetData( sal_Int32 nInIdx ) const
293 : {
294 : return ( nInIdx >= nIMax ) ? 0 :
295 1 : (const void*)&pPLCF_Contents[nInIdx * nStru];
296 : }
297 : };
298 :
299 : /* for Piece Table (.i.e. FastSave Table) */
300 : class WW8PLCFpcd
301 : {
302 : friend class WW8PLCFpcd_Iter;
303 : sal_Int32* pPLCF_PosArray; // Pointer auf Pos-Array und auf ganze Struktur
304 : sal_uInt8* pPLCF_Contents; // Pointer auf Inhalts-Array-Teil des Pos-Array
305 : long nIMax;
306 : sal_uInt32 nStru;
307 : public:
308 : WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos, sal_uInt32 nPLCF,
309 : sal_uInt32 nStruct);
310 36 : ~WW8PLCFpcd(){ delete[] pPLCF_PosArray; }
311 : };
312 :
313 : /* mehrere WW8PLCFpcd_Iter koennen auf die gleiche WW8PLCFpcd zeigen !!! */
314 : class WW8PLCFpcd_Iter
315 : {
316 : private:
317 : WW8PLCFpcd& rPLCF;
318 : long nIdx;
319 :
320 : //No copying
321 : WW8PLCFpcd_Iter(const WW8PLCFpcd_Iter&);
322 : WW8PLCFpcd_Iter& operator=(const WW8PLCFpcd_Iter&);
323 : public:
324 : WW8PLCFpcd_Iter( WW8PLCFpcd& rPLCFpcd, long nStartPos = -1 );
325 16651 : long GetIdx() const { return nIdx; }
326 11827 : void SetIdx( long nI ) { nIdx = nI; }
327 1414 : long GetIMax() const { return rPLCF.nIMax; }
328 : bool SeekPos(long nPos);
329 : sal_Int32 Where() const;
330 : bool Get(WW8_CP& rStart, WW8_CP& rEnd, void*& rpValue) const;
331 1074 : void advance()
332 : {
333 1074 : if( nIdx < rPLCF.nIMax )
334 1074 : ++nIdx;
335 1074 : }
336 : };
337 :
338 : // PLCF-Typ:
339 : enum ePLCFT{ CHP=0, PAP, SEP, /*HED, FNR, ENR,*/ PLCF_END };
340 :
341 : //Its hardcoded that eFTN be the first one: A very poor hack, needs to be fixed
342 : enum eExtSprm { eFTN = 256, eEDN = 257, eFLD = 258, eBKN = 259, eAND = 260 };
343 :
344 : /*
345 : pure virtual:
346 : */
347 : class WW8PLCFx // virtueller Iterator fuer Piece Table Exceptions
348 : {
349 : private:
350 : ww::WordVersion meVer; // Version number of FIB
351 : bool bIsSprm; // PLCF von Sprms oder von anderem ( Footnote, ... )
352 : WW8_FC nStartFc;
353 : bool bDirty;
354 :
355 : //No copying
356 : WW8PLCFx(const WW8PLCFx&);
357 : WW8PLCFx& operator=(const WW8PLCFx&);
358 : public:
359 734 : WW8PLCFx(ww::WordVersion eVersion, bool bSprm)
360 734 : : meVer(eVersion), bIsSprm(bSprm), bDirty(false) {}
361 734 : virtual ~WW8PLCFx() {}
362 125776 : bool IsSprm() const { return bIsSprm; }
363 : virtual sal_uLong GetIdx() const = 0;
364 : virtual void SetIdx( sal_uLong nIdx ) = 0;
365 : virtual sal_uLong GetIdx2() const;
366 : virtual void SetIdx2( sal_uLong nIdx );
367 : virtual bool SeekPos(WW8_CP nCpPos) = 0;
368 : virtual WW8_FC Where() = 0;
369 : virtual void GetSprms( WW8PLCFxDesc* p );
370 : virtual long GetNoSprms( WW8_CP& rStart, WW8_CP&, sal_Int32& rLen );
371 : virtual void advance() = 0;
372 0 : virtual sal_uInt16 GetIstd() const { return 0xffff; }
373 : virtual void Save( WW8PLCFxSave1& rSave ) const;
374 : virtual void Restore( const WW8PLCFxSave1& rSave );
375 38580 : ww::WordVersion GetFIBVersion() const { return meVer; }
376 14901 : void SetStartFc( WW8_FC nFc ) { nStartFc = nFc; }
377 4231 : WW8_FC GetStartFc() const { return nStartFc; }
378 11439 : void SetDirty(bool bIn) {bDirty=bIn;}
379 15517 : bool GetDirty() const {return bDirty;}
380 : };
381 :
382 216 : class WW8PLCFx_PCDAttrs : public WW8PLCFx
383 : {
384 : private:
385 : WW8PLCFpcd_Iter* pPcdI;
386 : WW8PLCFx_PCD* pPcd;
387 : sal_uInt8** const pGrpprls; // Attribute an Piece-Table
388 : SVBT32 aShortSprm; // mini storage: can contain ONE sprm with
389 : // 1 byte param
390 : sal_uInt16 nGrpprls; // Attribut Anzahl davon
391 :
392 : //No copying
393 : WW8PLCFx_PCDAttrs(const WW8PLCFx_PCDAttrs&);
394 : WW8PLCFx_PCDAttrs& operator=(const WW8PLCFx_PCDAttrs&);
395 : public:
396 : WW8PLCFx_PCDAttrs(ww::WordVersion eVersion, WW8PLCFx_PCD* pPLCFx_PCD,
397 : const WW8ScannerBase* pBase );
398 : virtual sal_uLong GetIdx() const;
399 : virtual void SetIdx( sal_uLong nI );
400 : virtual bool SeekPos(WW8_CP nCpPos);
401 : virtual WW8_FC Where();
402 : virtual void GetSprms( WW8PLCFxDesc* p );
403 : virtual void advance();
404 :
405 10388 : WW8PLCFpcd_Iter* GetIter() const { return pPcdI; }
406 : };
407 :
408 : class WW8PLCFx_PCD : public WW8PLCFx // Iterator fuer Piece Table
409 : {
410 : private:
411 : WW8PLCFpcd_Iter* pPcdI;
412 : bool bVer67;
413 : WW8_CP nClipStart;
414 :
415 : //No copying
416 : WW8PLCFx_PCD(const WW8PLCFx_PCD&);
417 : WW8PLCFx_PCD& operator=(const WW8PLCFx_PCD&);
418 : public:
419 : WW8PLCFx_PCD(ww::WordVersion eVersion, WW8PLCFpcd* pPLCFpcd,
420 : WW8_CP nStartCp, bool bVer67P);
421 : virtual ~WW8PLCFx_PCD();
422 : virtual sal_uLong GetIMax() const;
423 : virtual sal_uLong GetIdx() const;
424 : virtual void SetIdx( sal_uLong nI );
425 : virtual bool SeekPos(WW8_CP nCpPos);
426 : virtual WW8_FC Where();
427 : virtual long GetNoSprms( WW8_CP& rStart, WW8_CP&, sal_Int32& rLen );
428 : virtual void advance();
429 : WW8_CP AktPieceStartFc2Cp( WW8_FC nStartPos );
430 : WW8_FC AktPieceStartCp2Fc( WW8_CP nCp );
431 : void AktPieceFc2Cp(WW8_CP& rStartPos, WW8_CP& rEndPos,
432 : const WW8ScannerBase *pSBase);
433 108 : WW8PLCFpcd_Iter* GetPLCFIter() { return pPcdI; }
434 7291 : void SetClipStart(WW8_CP nIn) { nClipStart = nIn; }
435 10859 : WW8_CP GetClipStart() { return nClipStart; }
436 :
437 92925 : static sal_Int32 TransformPieceAddress(long nfc, bool& bIsUnicodeAddress)
438 : {
439 92925 : bIsUnicodeAddress = 0 == (0x40000000 & nfc);
440 92925 : return bIsUnicodeAddress ? nfc : (nfc & 0x3fffFFFF) / 2;
441 : }
442 : };
443 :
444 : /**
445 : Iterator for Piece Table Exceptions of Fkps
446 : works only with FCs, not with CPs ! ( Low-Level )
447 : */
448 : class WW8PLCFx_Fc_FKP : public WW8PLCFx
449 : {
450 : public:
451 634 : class WW8Fkp // Iterator for Formatted Disk Page
452 : {
453 : private:
454 : class Entry
455 : {
456 : public:
457 : WW8_FC mnFC;
458 :
459 : sal_uInt8* mpData;
460 : sal_uInt16 mnLen;
461 : sal_uInt16 mnIStd; // only for Fkp.Papx (actualy Style-Nr)
462 : bool mbMustDelete;
463 :
464 7365 : explicit Entry(WW8_FC nFC) : mnFC(nFC), mpData(0), mnLen(0),
465 7365 : mnIStd(0), mbMustDelete(false) {}
466 : Entry(const Entry &rEntry);
467 : ~Entry();
468 : bool operator<(const Entry& rEntry) const;
469 : Entry& operator=(const Entry& rEntry);
470 : };
471 :
472 : sal_uInt8 maRawData[512];
473 : std::vector<Entry> maEntries;
474 :
475 : long nItemSize; // entweder 1 Byte oder ein komplettes BX
476 :
477 : // Offset in Stream where last read of 52 bytes took place
478 : long nFilePos;
479 : sal_uInt8 mnIdx; // Pos-Merker
480 : ePLCFT ePLCF;
481 : sal_uInt8 mnIMax; // Anzahl der Eintraege
482 :
483 : wwSprmParser maSprmParser;
484 :
485 : //Fill in an Entry with sanity testing
486 : void FillEntry(Entry &rEntry, sal_Size nDataOffset, sal_uInt16 nLen);
487 : public:
488 : WW8Fkp (ww::WordVersion eVersion, SvStream* pFKPStrm,
489 : SvStream* pDataStrm, long _nFilePos, long nItemSiz, ePLCFT ePl,
490 : WW8_FC nStartFc = -1);
491 : void Reset(WW8_FC nPos);
492 20795 : long GetFilePos() const { return nFilePos; }
493 888 : sal_uInt8 GetIdx() const { return mnIdx; }
494 : bool SetIdx(sal_uInt8 nI);
495 : bool SeekPos(WW8_FC nFc);
496 4391 : WW8_FC Where() const
497 : {
498 4391 : return (mnIdx < mnIMax) ? maEntries[mnIdx].mnFC : WW8_FC_MAX;
499 : }
500 0 : void advance()
501 : {
502 0 : if (mnIdx < mnIMax)
503 0 : ++mnIdx;
504 0 : }
505 : sal_uInt8* Get( WW8_FC& rStart, WW8_FC& rEnd, sal_Int32& rLen ) const;
506 5034 : sal_uInt16 GetIstd() const { return maEntries[mnIdx].mnIStd; }
507 :
508 : /*
509 : liefert einen echten Pointer auf das Sprm vom Typ nId,
510 : falls ein solches im Fkp drin ist.
511 : */
512 : sal_uInt8* GetLenAndIStdAndSprms(sal_Int32& rLen) const;
513 :
514 : /*
515 : ruft GetLenAndIStdAndSprms() auf...
516 : */
517 : const sal_uInt8* HasSprm( sal_uInt16 nId );
518 : bool HasSprm(sal_uInt16 nId, std::vector<const sal_uInt8 *> &rResult);
519 :
520 0 : const wwSprmParser &GetSprmParser() const { return maSprmParser; }
521 : };
522 : private:
523 : SvStream* pFKPStrm; // Input-File
524 : SvStream* pDataStrm; // Input-File
525 : WW8PLCF* pPLCF;
526 : WW8Fkp* pFkp;
527 :
528 : /*
529 : Keep a cache of eMaxCache entries of previously seen pFkps, which
530 : speeds up considerably table parsing and load save plcfs for what turn
531 : out to be small text frames, which frames generally are
532 :
533 : size : cache hits
534 : cache all : 19168 pap, 48 chp
535 : == 100 : 19166 pap, 48 chp
536 : == 50 : 18918 pap, 48 chp
537 : == 10 : 18549 pap, 47 chp
538 : == 5 : 18515 pap, 47 chp
539 : */
540 : typedef std::list<WW8Fkp*>::iterator myiter;
541 : std::list<WW8Fkp*> maFkpCache;
542 : enum Limits {eMaxCache = 5};
543 :
544 : bool NewFkp();
545 :
546 : //No copying
547 : WW8PLCFx_Fc_FKP(const WW8PLCFx_Fc_FKP&);
548 : WW8PLCFx_Fc_FKP& operator=(const WW8PLCFx_Fc_FKP&);
549 : protected:
550 : ePLCFT ePLCF;
551 : WW8PLCFx_PCDAttrs* pPCDAttrs;
552 : public:
553 : WW8PLCFx_Fc_FKP( SvStream* pSt, SvStream* pTblSt, SvStream* pDataSt,
554 : const WW8Fib& rFib, ePLCFT ePl, WW8_FC nStartFcL );
555 : virtual ~WW8PLCFx_Fc_FKP();
556 : virtual sal_uLong GetIdx() const;
557 : virtual void SetIdx( sal_uLong nIdx );
558 : virtual bool SeekPos(WW8_FC nFcPos);
559 : virtual WW8_FC Where();
560 : sal_uInt8* GetSprmsAndPos( WW8_FC& rStart, WW8_FC& rEnd, sal_Int32& rLen );
561 : virtual void advance();
562 : virtual sal_uInt16 GetIstd() const;
563 : void GetPCDSprms( WW8PLCFxDesc& rDesc );
564 : const sal_uInt8* HasSprm( sal_uInt16 nId );
565 : bool HasSprm(sal_uInt16 nId, std::vector<const sal_uInt8 *> &rResult);
566 4392 : bool HasFkp() const { return (0 != pFkp); }
567 : };
568 :
569 : /// Iterator fuer Piece Table Exceptions of Fkps arbeitet auf CPs (High-Level)
570 : class WW8PLCFx_Cp_FKP : public WW8PLCFx_Fc_FKP
571 : {
572 : private:
573 : const WW8ScannerBase& rSBase;
574 : WW8PLCFx_PCD* pPcd;
575 : WW8PLCFpcd_Iter *pPieceIter;
576 : WW8_CP nAttrStart, nAttrEnd;
577 : sal_uInt8 bLineEnd : 1;
578 : sal_uInt8 bComplex : 1;
579 :
580 : //No copying
581 : WW8PLCFx_Cp_FKP(const WW8PLCFx_Cp_FKP&);
582 : WW8PLCFx_Cp_FKP& operator=(const WW8PLCFx_Cp_FKP&);
583 : public:
584 : WW8PLCFx_Cp_FKP( SvStream* pSt, SvStream* pTblSt, SvStream* pDataSt,
585 : const WW8ScannerBase& rBase, ePLCFT ePl );
586 : virtual ~WW8PLCFx_Cp_FKP();
587 : void ResetAttrStartEnd();
588 : sal_uLong GetPCDIMax() const;
589 : sal_uLong GetPCDIdx() const;
590 : void SetPCDIdx( sal_uLong nIdx );
591 : virtual sal_uLong GetIdx2() const;
592 : virtual void SetIdx2( sal_uLong nIdx );
593 : virtual bool SeekPos(WW8_CP nCpPos);
594 : virtual WW8_CP Where();
595 : virtual void GetSprms( WW8PLCFxDesc* p );
596 : virtual void advance();
597 : virtual void Save( WW8PLCFxSave1& rSave ) const;
598 : virtual void Restore( const WW8PLCFxSave1& rSave );
599 : };
600 :
601 : /// Iterator for Piece Table Exceptions of Sepx
602 : class WW8PLCFx_SEPX : public WW8PLCFx
603 : {
604 : private:
605 : wwSprmParser maSprmParser;
606 : SvStream* pStrm;
607 : WW8PLCF* pPLCF;
608 : sal_uInt8* pSprms;
609 : sal_uInt16 nArrMax;
610 : sal_uInt16 nSprmSiz;
611 :
612 : //no copying
613 : WW8PLCFx_SEPX(const WW8PLCFx_SEPX&);
614 : WW8PLCFx_SEPX& operator=(const WW8PLCFx_SEPX&);
615 : public:
616 : WW8PLCFx_SEPX( SvStream* pSt, SvStream* pTblxySt, const WW8Fib& rFib,
617 : WW8_CP nStartCp );
618 : virtual ~WW8PLCFx_SEPX();
619 : virtual sal_uLong GetIdx() const;
620 : virtual void SetIdx( sal_uLong nIdx );
621 : long GetIMax() const { return ( pPLCF ) ? pPLCF->GetIMax() : 0; }
622 : virtual bool SeekPos(WW8_CP nCpPos);
623 : virtual WW8_FC Where();
624 : virtual void GetSprms( WW8PLCFxDesc* p );
625 : virtual void advance();
626 : const sal_uInt8* HasSprm( sal_uInt16 nId ) const;
627 : const sal_uInt8* HasSprm( sal_uInt16 nId, sal_uInt8 n2nd ) const;
628 : const sal_uInt8* HasSprm( sal_uInt16 nId, const sal_uInt8* pOtherSprms,
629 : long nOtherSprmSiz ) const;
630 : bool Find4Sprms(sal_uInt16 nId1, sal_uInt16 nId2, sal_uInt16 nId3, sal_uInt16 nId4,
631 : sal_uInt8*& p1, sal_uInt8*& p2, sal_uInt8*& p3, sal_uInt8*& p4 ) const;
632 : };
633 :
634 : /// Iterator fuer Fuss-/Endnoten und Anmerkungen
635 : class WW8PLCFx_SubDoc : public WW8PLCFx
636 : {
637 : private:
638 : WW8PLCF* pRef;
639 : WW8PLCF* pTxt;
640 :
641 : //No copying
642 : WW8PLCFx_SubDoc(const WW8PLCFx_SubDoc&);
643 : WW8PLCFx_SubDoc& operator=(const WW8PLCFx_SubDoc&);
644 : public:
645 : WW8PLCFx_SubDoc(SvStream* pSt, ww::WordVersion eVersion, WW8_CP nStartCp,
646 : long nFcRef, long nLenRef, long nFcTxt, long nLenTxt, long nStruc = 0);
647 : virtual ~WW8PLCFx_SubDoc();
648 : virtual sal_uLong GetIdx() const;
649 : virtual void SetIdx( sal_uLong nIdx );
650 : virtual bool SeekPos(WW8_CP nCpPos);
651 : virtual WW8_FC Where();
652 :
653 : // liefert Reference Descriptoren
654 1 : const void* GetData( long nIdx = -1 ) const
655 : {
656 1 : return pRef ? pRef->GetData( -1L == nIdx ? pRef->GetIdx() : nIdx ) : 0;
657 : }
658 :
659 : //liefert Angabe, wo Kopf und Fusszeilen-Text zu finden ist
660 : bool Get(long& rStart, void*& rpValue) const;
661 : virtual void GetSprms(WW8PLCFxDesc* p);
662 : virtual void advance();
663 74 : long Count() const { return ( pRef ) ? pRef->GetIMax() : 0; }
664 : };
665 :
666 : /// Iterator for fields
667 : class WW8PLCFx_FLD : public WW8PLCFx
668 : {
669 : private:
670 : WW8PLCFspecial* pPLCF;
671 : const WW8Fib& rFib;
672 : //No copying
673 : WW8PLCFx_FLD(const WW8PLCFx_FLD&);
674 : WW8PLCFx_FLD& operator=(const WW8PLCFx_FLD &);
675 : public:
676 : WW8PLCFx_FLD(SvStream* pSt, const WW8Fib& rMyFib, short nType);
677 : virtual ~WW8PLCFx_FLD();
678 : virtual sal_uLong GetIdx() const;
679 : virtual void SetIdx( sal_uLong nIdx );
680 : virtual bool SeekPos(WW8_CP nCpPos);
681 : virtual WW8_FC Where();
682 : virtual void GetSprms(WW8PLCFxDesc* p);
683 : virtual void advance();
684 : bool StartPosIsFieldStart();
685 : bool EndPosIsFieldEnd();
686 : bool GetPara(long nIdx, WW8FieldDesc& rF);
687 : };
688 :
689 : enum eBookStatus { BOOK_NORMAL = 0, BOOK_IGNORE = 0x1, BOOK_FIELD = 0x2 };
690 :
691 : /// Iterator for Booknotes
692 : class WW8PLCFx_Book : public WW8PLCFx
693 : {
694 : private:
695 : WW8PLCFspecial* pBook[2]; // Start and End Position
696 : ::std::vector<String> aBookNames; // Name
697 : eBookStatus* pStatus;
698 : long nIMax; // Number of Booknotes
699 : sal_uInt16 nIsEnd;
700 : sal_Int32 nBookmarkId; // counter incremented by GetUniqueBookmarkName.
701 :
702 : //No copying
703 : WW8PLCFx_Book(const WW8PLCFx_Book&);
704 : WW8PLCFx_Book& operator=(const WW8PLCFx_Book&);
705 : public:
706 : WW8PLCFx_Book(SvStream* pTblSt,const WW8Fib& rFib);
707 : virtual ~WW8PLCFx_Book();
708 0 : long GetIMax() const { return nIMax; }
709 : virtual sal_uLong GetIdx() const;
710 : virtual void SetIdx( sal_uLong nI );
711 : virtual sal_uLong GetIdx2() const;
712 : virtual void SetIdx2( sal_uLong nIdx );
713 : virtual bool SeekPos(WW8_CP nCpPos);
714 : virtual WW8_FC Where();
715 : virtual long GetNoSprms( WW8_CP& rStart, WW8_CP& rEnd, sal_Int32& rLen );
716 : virtual void advance();
717 : const String* GetName() const;
718 0 : WW8_CP GetStartPos() const
719 0 : { return ( nIsEnd ) ? WW8_CP_MAX : pBook[0]->Where(); }
720 : long GetLen() const;
721 12 : bool GetIsEnd() const { return nIsEnd ? true : false; }
722 : long GetHandle() const;
723 : void SetStatus( sal_uInt16 nIndex, eBookStatus eStat );
724 : bool MapName(String& rName);
725 : String GetBookmark(long nStart,long nEnd, sal_uInt16 &nIndex);
726 : eBookStatus GetStatus() const;
727 : rtl::OUString GetUniqueBookmarkName(const rtl::OUString &rSuggestedName);
728 : };
729 :
730 : /*
731 : hiermit arbeiten wir draussen:
732 : */
733 : struct WW8PLCFManResult
734 : {
735 : WW8_CP nCpPos; // Attribut-Anfangsposition
736 : long nMemLen; // Laenge dazu
737 : long nCp2OrIdx; // footnote-textpos oder Index in PLCF
738 : WW8_CP nAktCp; // wird nur vom Aufrufer benutzt
739 : const sal_uInt8* pMemPos;// Mem-Pos fuer Sprms
740 : sal_uInt16 nSprmId; // Sprm-Id ( 0 = ungueltige Id -> ueberspringen! )
741 : // (2..255) oder Pseudo-Sprm-Id (256..260)
742 : // bzw. ab Winword-Ver8 die Sprm-Id (800..)
743 : sal_uInt8 nFlags; // Absatz- oder Section-Anfang
744 : };
745 :
746 : enum ManMaskTypes
747 : {
748 : MAN_MASK_NEW_PAP = 1, // neue Zeile
749 : MAN_MASK_NEW_SEP = 2 // neue Section
750 : };
751 :
752 : enum ManTypes // enums for PLCFMan-ctor
753 : {
754 : MAN_MAINTEXT = 0, MAN_FTN = 1, MAN_EDN = 2, MAN_HDFT = 3, MAN_AND = 4,
755 : MAN_TXBX = 5, MAN_TXBX_HDFT = 6
756 : };
757 :
758 : /*
759 : hiermit arbeitet der Manager drinnen:
760 : */
761 : struct WW8PLCFxDesc
762 : {
763 : WW8PLCFx* pPLCFx;
764 : ::std::stack<sal_uInt16>* pIdStk; // Speicher fuer Attr-Id fuer Attr-Ende(n)
765 : const sal_uInt8* pMemPos;// wo liegen die Sprm(s)
766 : long nOrigSprmsLen;
767 :
768 : WW8_CP nStartPos;
769 : WW8_CP nEndPos;
770 :
771 : WW8_CP nOrigStartPos;
772 : WW8_CP nOrigEndPos; // The ending character position of a paragraph is
773 : // always one before the end reported in the FKP,
774 : // also a character run that ends on the same location
775 : // as the paragraph mark is adjusted to end just before
776 : // the paragraph mark so as to handle their close
777 : // first. The value being used to determing where the
778 : // properties end is in nEndPos, but the original
779 : // unadjusted end character position is important as
780 : // it can be used as the beginning cp of the next set
781 : // of properties
782 :
783 : WW8_CP nCp2OrIdx; // wo liegen die NoSprm(s)
784 : sal_Int32 nSprmsLen; // wie viele Bytes fuer weitere Sprms / Laenge Fussnote
785 : long nCpOfs; // fuer Offset Header .. Footnote
786 : bool bFirstSprm; // fuer Erkennung erster Sprm einer Gruppe
787 : bool bRealLineEnd; // false bei Pap-Piece-Ende
788 : void Save( WW8PLCFxSave1& rSave ) const;
789 : void Restore( const WW8PLCFxSave1& rSave );
790 : //With nStartPos set to WW8_CP_MAX then in the case of a pap or chp
791 : //GetSprms will not search for the sprms, but instead take the
792 : //existing ones.
793 23191 : WW8PLCFxDesc() : pIdStk(0), nStartPos(WW8_CP_MAX) {}
794 : void ReduceByOffset();
795 : };
796 :
797 : #ifndef DUMP
798 :
799 : struct WW8PLCFxSaveAll;
800 : class WW8PLCFMan
801 : {
802 : public:
803 : enum WW8PLCFManLimits {MAN_ANZ_PLCF = 10};
804 : private:
805 : wwSprmParser maSprmParser;
806 : long nCpO; // Origin Cp -- the basis for nNewCp
807 :
808 : WW8_CP nLineEnd; // zeigt *hinter* das <CR>
809 : long nLastWhereIdxCp; // last result of WhereIdx()
810 : sal_uInt16 nPLCF; // so viele PLCFe werden verwaltet
811 : ManTypes nManType;
812 : bool mbDoingDrawTextBox; //Normally we adjust the end of attributes
813 : //so that the end of a paragraph occurs
814 : //before the para end mark, but for
815 : //drawboxes we want the true offsets
816 :
817 : WW8PLCFxDesc aD[MAN_ANZ_PLCF];
818 : WW8PLCFxDesc *pChp, *pPap, *pSep, *pFld, *pFtn, *pEdn, *pBkm, *pPcd,
819 : *pPcdA, *pAnd;
820 : WW8PLCFspecial *pFdoa, *pTxbx, *pTxbxBkd,*pMagicTables, *pSubdocs;
821 : sal_uInt8* pExtendedAtrds;
822 :
823 : const WW8Fib* pWwFib;
824 :
825 : sal_uInt16 WhereIdx(bool* pbStart=0, long* pPos=0) const;
826 : void AdjustEnds(WW8PLCFxDesc& rDesc);
827 : void GetNewSprms(WW8PLCFxDesc& rDesc);
828 : void GetNewNoSprms(WW8PLCFxDesc& rDesc);
829 : void GetSprmStart(short nIdx, WW8PLCFManResult* pRes) const;
830 : void GetSprmEnd(short nIdx, WW8PLCFManResult* pRes) const;
831 : void GetNoSprmStart(short nIdx, WW8PLCFManResult* pRes) const;
832 : void GetNoSprmEnd(short nIdx, WW8PLCFManResult* pRes) const;
833 : void AdvSprm(short nIdx, bool bStart);
834 : void AdvNoSprm(short nIdx, bool bStart);
835 : sal_uInt16 GetId(const WW8PLCFxDesc* p ) const;
836 : public:
837 : WW8PLCFMan(WW8ScannerBase* pBase, ManTypes nType, long nStartCp,
838 : bool bDoingDrawTextBox = false);
839 : ~WW8PLCFMan();
840 :
841 : /*
842 : Where fragt, an welcher naechsten Position sich irgendein
843 : Attr aendert...
844 : */
845 : WW8_CP Where() const;
846 :
847 : bool Get(WW8PLCFManResult* pResult) const;
848 : void advance();
849 : sal_uInt16 GetColl() const; // index of actual Style
850 : WW8PLCFx_FLD* GetFld() const;
851 0 : WW8PLCFx_SubDoc* GetEdn() const { return (WW8PLCFx_SubDoc*)pEdn->pPLCFx; }
852 2 : WW8PLCFx_SubDoc* GetFtn() const { return (WW8PLCFx_SubDoc*)pFtn->pPLCFx; }
853 0 : WW8PLCFx_SubDoc* GetAtn() const { return (WW8PLCFx_SubDoc*)pAnd->pPLCFx; }
854 12 : WW8PLCFx_Book* GetBook() const { return (WW8PLCFx_Book*)pBkm->pPLCFx; }
855 62777 : long GetCpOfs() const { return pChp->nCpOfs; } // for Header/Footer...
856 :
857 : /* fragt, ob *aktueller Absatz* einen Sprm diesen Typs hat */
858 : const sal_uInt8* HasParaSprm( sal_uInt16 nId ) const;
859 :
860 : /* fragt, ob *aktueller Textrun* einen Sprm diesen Typs hat */
861 : const sal_uInt8* HasCharSprm( sal_uInt16 nId ) const;
862 : bool HasCharSprm(sal_uInt16 nId, std::vector<const sal_uInt8 *> &rResult) const;
863 :
864 2716 : WW8PLCFx_Cp_FKP* GetChpPLCF() const
865 2716 : { return (WW8PLCFx_Cp_FKP*)pChp->pPLCFx; }
866 2712 : WW8PLCFx_Cp_FKP* GetPapPLCF() const
867 2712 : { return (WW8PLCFx_Cp_FKP*)pPap->pPLCFx; }
868 120 : WW8PLCFx_SEPX* GetSepPLCF() const
869 120 : { return (WW8PLCFx_SEPX*)pSep->pPLCFx; }
870 1661 : WW8PLCFxDesc* GetPap() const { return pPap; }
871 : bool TransferOpenSprms(std::stack<sal_uInt16> &rStack);
872 : void SeekPos( long nNewCp );
873 : void SaveAllPLCFx( WW8PLCFxSaveAll& rSave ) const;
874 : void RestoreAllPLCFx( const WW8PLCFxSaveAll& rSave );
875 55 : WW8PLCFspecial* GetFdoa() const { return pFdoa; }
876 59 : WW8PLCFspecial* GetTxbx() const { return pTxbx; }
877 57 : WW8PLCFspecial* GetTxbxBkd() const { return pTxbxBkd; }
878 108 : WW8PLCFspecial* GetMagicTables() const { return pMagicTables; }
879 42 : WW8PLCFspecial* GetWkbPLCF() const { return pSubdocs; }
880 0 : sal_uInt8* GetExtendedAtrds() const { return pExtendedAtrds; }
881 115 : ManTypes GetManType() const { return nManType; }
882 52117 : bool GetDoingDrawTextBox() const { return mbDoingDrawTextBox; }
883 : };
884 :
885 : struct WW8PLCFxSaveAll
886 : {
887 : WW8PLCFxSave1 aS[WW8PLCFMan::MAN_ANZ_PLCF];
888 : };
889 :
890 : #endif // !DUMP
891 :
892 : class WW8ScannerBase
893 : {
894 : friend WW8PLCFx_PCDAttrs::WW8PLCFx_PCDAttrs(ww::WordVersion eVersion,
895 : WW8PLCFx_PCD* pPLCFx_PCD, const WW8ScannerBase* pBase );
896 : friend WW8PLCFx_Cp_FKP::WW8PLCFx_Cp_FKP( SvStream*, SvStream*, SvStream*,
897 : const WW8ScannerBase&, ePLCFT );
898 :
899 : #ifndef DUMP
900 : friend WW8PLCFMan::WW8PLCFMan(WW8ScannerBase*, ManTypes, long, bool);
901 : friend class SwWW8FltControlStack;
902 : #endif
903 :
904 : private:
905 : WW8Fib* pWw8Fib;
906 : WW8PLCFx_Cp_FKP* pChpPLCF; // Character-Attrs
907 : WW8PLCFx_Cp_FKP* pPapPLCF; // Para-Attrs
908 : WW8PLCFx_SEPX* pSepPLCF; // Section-Attrs
909 : WW8PLCFx_SubDoc* pFtnPLCF; // Footnotes
910 : WW8PLCFx_SubDoc* pEdnPLCF; // EndNotes
911 : WW8PLCFx_SubDoc* pAndPLCF; // Anmerkungen
912 : WW8PLCFx_FLD* pFldPLCF; // Fields in Main Text
913 : WW8PLCFx_FLD* pFldHdFtPLCF; // Fields in Header / Footer
914 : WW8PLCFx_FLD* pFldTxbxPLCF; // Fields in Textboxes in Main Text
915 : WW8PLCFx_FLD* pFldTxbxHdFtPLCF; // Fields in Textboxes in Header / Footer
916 : WW8PLCFx_FLD* pFldFtnPLCF; // Fields in Footnotes
917 : WW8PLCFx_FLD* pFldEdnPLCF; // Fields in Endnotes
918 : WW8PLCFx_FLD* pFldAndPLCF; // Fields in Anmerkungen
919 : WW8PLCFspecial* pMainFdoa; // Graphic Primitives in Main Text
920 : WW8PLCFspecial* pHdFtFdoa; // Graphic Primitives in Header / Footer
921 : WW8PLCFspecial* pMainTxbx; // Textboxen in Main Text
922 : WW8PLCFspecial* pMainTxbxBkd; // Break-Deskriptoren fuer diese
923 : WW8PLCFspecial* pHdFtTxbx; // TextBoxen in Header / Footer
924 : WW8PLCFspecial* pHdFtTxbxBkd; // Break-Deskriptoren fuer diese
925 : WW8PLCFspecial* pMagicTables; // Break-Deskriptoren fuer diese
926 : WW8PLCFspecial* pSubdocs; // subdoc references in master document
927 : sal_uInt8* pExtendedAtrds; // Extended ATRDs
928 : WW8PLCFx_Book* pBook; // Bookmarks
929 :
930 : WW8PLCFpcd* pPiecePLCF; // fuer FastSave ( Basis-PLCF ohne Iterator )
931 : WW8PLCFpcd_Iter* pPieceIter; // fuer FastSave ( Iterator dazu )
932 : WW8PLCFx_PCD* pPLCFx_PCD; // dito
933 : WW8PLCFx_PCDAttrs* pPLCFx_PCDAttrs;
934 : sal_uInt8** pPieceGrpprls; // Attribute an Piece-Table
935 : sal_uInt16 nPieceGrpprls; // Anzahl davon
936 :
937 : WW8PLCFpcd* OpenPieceTable( SvStream* pStr, const WW8Fib* pWwF );
938 : void DeletePieceTable();
939 : public:
940 : WW8ScannerBase( SvStream* pSt, SvStream* pTblSt, SvStream* pDataSt,
941 : WW8Fib* pWwF );
942 : ~WW8ScannerBase();
943 37 : bool AreThereFootnotes() const { return pFtnPLCF->Count() > 0; };
944 37 : bool AreThereEndnotes() const { return pEdnPLCF->Count() > 0; };
945 :
946 : //If you use WW8Fc2Cp you are almost certainly doing the wrong thing
947 : //when it comes to fastsaved files, avoid like the plague. For export
948 : //given that we never write fastsaved files you can use it, otherwise
949 : //I will beat you with a stick
950 : WW8_CP WW8Fc2Cp(WW8_FC nFcPos) const ;
951 : WW8_FC WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode = 0,
952 : WW8_CP* pNextPieceCp = 0, bool* pTestFlag = 0) const;
953 :
954 : xub_StrLen WW8ReadString(SvStream& rStrm, String& rStr, WW8_CP nAktStartCp,
955 : long nTotalLen, rtl_TextEncoding eEnc ) const;
956 :
957 : };
958 :
959 : /** FIB - the File Information Block
960 :
961 : The FIB contains a "magic word" and pointers to the various other parts of
962 : the file, as well as information about the length of the file.
963 : The FIB starts at the beginning of the file.
964 : */
965 : class WW8Fib
966 : {
967 : private:
968 : sal_Unicode nNumDecimalSep;
969 :
970 : public:
971 : /**
972 : Program-Version asked for by us:
973 : in Ctor we check if it matches the value of nFib
974 :
975 : 6 == "WinWord 6 or WinWord 95",
976 : 7 == "only WinWord 95"
977 : 8 == "WinWord 97 or newer"
978 : */
979 : sal_uInt8 nVersion;
980 : /*
981 : error status
982 : */
983 : sal_uLong nFibError;
984 : /*
985 : vom Ctor aus dem FIB gelesene Daten
986 : (entspricht nur ungefaehr der tatsaechlichen Struktur
987 : des Winword-FIB)
988 : */
989 : sal_uInt16 wIdent; // 0x0 int magic number
990 : /*
991 : File Information Block (FIB) values:
992 : WinWord 1.0 = 33
993 : WinWord 2.0 = 45
994 : WinWord 6.0c for 16bit = 101
995 : Word 6/32 bit = 104
996 : Word 95 = 104
997 : Word 97 = 193
998 : Word 2000 = 217
999 : Word 2002 = 257
1000 : Word 2003 = 268
1001 : Word 2007 = 274
1002 : */
1003 : sal_uInt16 nFib; // 0x2 FIB version written
1004 : sal_uInt16 nProduct; // 0x4 product version written by
1005 : sal_Int16 lid; // 0x6 language stamp---localized version;
1006 : WW8_PN pnNext; // 0x8
1007 :
1008 : sal_uInt16 fDot :1; // 0xa 0001
1009 : sal_uInt16 fGlsy :1;
1010 : sal_uInt16 fComplex :1; // 0004 when 1, file is in complex, fast-saved format.
1011 : sal_uInt16 fHasPic :1; // 0008 file contains 1 or more pictures
1012 : sal_uInt16 cQuickSaves :4; // 00F0 count of times file was quicksaved
1013 : sal_uInt16 fEncrypted :1; //0100 1 if file is encrypted, 0 if not
1014 : sal_uInt16 fWhichTblStm :1; //0200 When 0, this fib refers to the table stream
1015 : sal_uInt16 fReadOnlyRecommended :1;
1016 : sal_uInt16 fWriteReservation :1;
1017 : // named "0Table", when 1, this fib refers to the
1018 : // table stream named "1Table". Normally, a file
1019 : // will have only one table stream, but under unusual
1020 : // circumstances a file may have table streams with
1021 : // both names. In that case, this flag must be used
1022 : // to decide which table stream is valid.
1023 :
1024 : sal_uInt16 fExtChar :1; // 1000 =1, when using extended character set in file
1025 : sal_uInt16 fFarEast :1; // 4000 =1, probably, when far-East language vaiants of Word is used to create a file #i90932#
1026 :
1027 : sal_uInt16 fObfuscated :1; // 8000=1. specifies whether the document is obfuscated using XOR obfuscation. otherwise this bit MUST be ignored.
1028 :
1029 : sal_uInt16 nFibBack; // 0xc
1030 : sal_uInt16 nHash; // 0xe file encrypted hash
1031 : sal_uInt16 nKey; // 0x10 file encrypted key
1032 : sal_uInt8 envr; // 0x12 environment in which file was created
1033 : // 0 created by Win Word / 1 created by Mac Word
1034 : sal_uInt8 fMac :1; // 0x13 when 1, this file was last saved in the Mac environment
1035 : sal_uInt8 fEmptySpecial :1;
1036 : sal_uInt8 fLoadOverridePage :1;
1037 : sal_uInt8 fFuturesavedUndo :1;
1038 : sal_uInt8 fWord97Saved :1;
1039 : sal_uInt8 fWord2000Saved :1;
1040 : sal_uInt8 :2;
1041 :
1042 : sal_uInt16 chse; // 0x14 default extended character set id for text in document stream. (overidden by chp.chse)
1043 : // 0 = ANSI / 256 Macintosh character set.
1044 : sal_uInt16 chseTables; // 0x16 default extended character set id for text in
1045 : // internal data structures: 0 = ANSI, 256 = Macintosh
1046 : WW8_FC fcMin; // 0x18 file offset of first character of text
1047 : WW8_FC fcMac; // 0x1c file offset of last character of text + 1
1048 :
1049 : // Einschub fuer WW8 *****************************************************
1050 : sal_uInt16 csw; // Count of fields in the array of "shorts"
1051 :
1052 : // Marke: "rgsw" Beginning of the array of shorts
1053 : sal_uInt16 wMagicCreated; // unique number Identifying the File's creator
1054 : // 0x6A62 is the creator ID for Word and is reserved.
1055 : // Other creators should choose a different value.
1056 : sal_uInt16 wMagicRevised; // identifies the File's last modifier
1057 : sal_uInt16 wMagicCreatedPrivate; // private data
1058 : sal_uInt16 wMagicRevisedPrivate; // private data
1059 : /*
1060 : sal_Int16 pnFbpChpFirst_W6; // not used
1061 : sal_Int16 pnChpFirst_W6; // not used
1062 : sal_Int16 cpnBteChp_W6; // not used
1063 : sal_Int16 pnFbpPapFirst_W6; // not used
1064 : sal_Int16 pnPapFirst_W6; // not used
1065 : sal_Int16 cpnBtePap_W6; // not used
1066 : sal_Int16 pnFbpLvcFirst_W6; // not used
1067 : sal_Int16 pnLvcFirst_W6; // not used
1068 : sal_Int16 cpnBteLvc_W6; // not used
1069 : */
1070 : sal_Int16 lidFE; // Language id if document was written by Far East version
1071 : // of Word (i.e. FIB.fFarEast is on)
1072 : sal_uInt16 clw; // Number of fields in the array of longs
1073 :
1074 : // Ende des Einschubs fuer WW8 *******************************************
1075 :
1076 : // Marke: "rglw" Beginning of the array of longs
1077 : WW8_FC cbMac; // 0x20 file offset of last byte written to file + 1.
1078 :
1079 : // WW8_FC u4[4]; // 0x24
1080 : WW8_CP ccpText; // 0x34 length of main document text stream
1081 : WW8_CP ccpFtn; // 0x38 length of footnote subdocument text stream
1082 : WW8_CP ccpHdr; // 0x3c length of header subdocument text stream
1083 : WW8_CP ccpMcr; // 0x40 length of macro subdocument text stream
1084 : WW8_CP ccpAtn; // 0x44 length of annotation subdocument text stream
1085 : WW8_CP ccpEdn; // 0x48 length of endnote subdocument text stream
1086 : WW8_CP ccpTxbx; // 0x4c length of textbox subdocument text stream
1087 : WW8_CP ccpHdrTxbx; // 0x50 length of header textbox subdocument text stream
1088 :
1089 : // Einschub fuer WW8 *****************************************************
1090 : sal_Int32 pnFbpChpFirst; // when there was insufficient memory for Word to expand
1091 : // the PLCFbte at save time, the PLCFbte is written
1092 : // to the file in a linked list of 512-byte pieces
1093 : // starting with this pn.
1094 : /*
1095 : // folgende Felder existieren zwar so in der Datei,
1096 : // wir benutzen jedoch unten deklarierte General-Variablen
1097 : // fuer Ver67 und Ver8 gemeinsam.
1098 : sal_Int32 pnChpFirst; // the page number of the lowest numbered page in the
1099 : // document that records CHPX FKP information
1100 : sal_Int32 cpnBteChp; // count of CHPX FKPs recorded in file. In non-complex
1101 : // files if the number of entries in the PLCFbteChpx
1102 : // is less than this, the PLCFbteChpx is incomplete.
1103 : */
1104 : sal_Int32 pnFbpPapFirst; // when there was insufficient memory for Word to expand
1105 : // the PLCFbte at save time, the PLCFbte is written to
1106 : // the file in a linked list of 512-byte pieces
1107 : // starting with this pn
1108 : /*
1109 : // folgende Felder existieren zwar so in der Datei,
1110 : // wir benutzen jedoch unten deklarierte General-Variablen
1111 : // fuer Ver67 und Ver8 gemeinsam.
1112 : sal_Int32 pnPapFirst; // the page number of the lowest numbered page in the
1113 : // document that records PAPX FKP information
1114 : sal_Int32 cpnBtePap; // count of PAPX FKPs recorded in file. In non-complex
1115 : // files if the number of entries in the PLCFbtePapx is
1116 : // less than this, the PLCFbtePapx is incomplete.
1117 : */
1118 : sal_Int32 pnFbpLvcFirst; // when there was insufficient memory for Word to expand
1119 : // the PLCFbte at save time, the PLCFbte is written to
1120 : // the file in a linked list of 512-byte pieces
1121 : // starting with this pn
1122 : sal_Int32 pnLvcFirst; // the page number of the lowest numbered page in the
1123 : // document that records LVC FKP information
1124 : sal_Int32 cpnBteLvc; // count of LVC FKPs recorded in file. In non-complex
1125 : // files if the number of entries in the PLCFbtePapx is
1126 : // less than this, the PLCFbtePapx is incomplete.
1127 : sal_Int32 fcIslandFirst; // ?
1128 : sal_Int32 fcIslandLim; // ?
1129 : sal_uInt16 cfclcb; // Number of fields in the array of FC/LCB pairs.
1130 :
1131 : // Ende des Einschubs fuer WW8 *******************************************
1132 :
1133 : // Marke: "rgfclcb" Beginning of array of FC/LCB pairs.
1134 : WW8_FC fcStshfOrig; // file offset of original allocation for STSH in table
1135 : // stream. During fast save Word will attempt to reuse
1136 : // this allocation if STSH is small enough to fit.
1137 : sal_Int32 lcbStshfOrig; // 0x5c count of bytes of original STSH allocation
1138 : WW8_FC fcStshf; // 0x60 file offset of STSH in file.
1139 : sal_Int32 lcbStshf; // 0x64 count of bytes of current STSH allocation
1140 : WW8_FC fcPlcffndRef; // 0x68 file offset of footnote reference PLCF.
1141 : sal_Int32 lcbPlcffndRef; // 0x6c count of bytes of footnote reference PLCF
1142 : // == 0 if no footnotes defined in document.
1143 :
1144 : WW8_FC fcPlcffndTxt; // 0x70 file offset of footnote text PLCF.
1145 : sal_Int32 lcbPlcffndTxt; // 0x74 count of bytes of footnote text PLCF.
1146 : // == 0 if no footnotes defined in document
1147 :
1148 : WW8_FC fcPlcfandRef; // 0x78 file offset of annotation reference PLCF.
1149 : sal_Int32 lcbPlcfandRef; // 0x7c count of bytes of annotation reference PLCF.
1150 :
1151 : WW8_FC fcPlcfandTxt; // 0x80 file offset of annotation text PLCF.
1152 : sal_Int32 lcbPlcfandTxt; // 0x84 count of bytes of the annotation text PLCF
1153 :
1154 : WW8_FC fcPlcfsed; // 8x88 file offset of section descriptor PLCF.
1155 : sal_Int32 lcbPlcfsed; // 0x8c count of bytes of section descriptor PLCF.
1156 :
1157 : WW8_FC fcPlcfpad; // 0x90 file offset of paragraph descriptor PLCF
1158 : sal_Int32 lcbPlcfpad; // 0x94 count of bytes of paragraph descriptor PLCF.
1159 : // ==0 if file was never viewed in Outline view.
1160 : // Should not be written by third party creators
1161 :
1162 : WW8_FC fcPlcfphe; // 0x98 file offset of PLCF of paragraph heights.
1163 : sal_Int32 lcbPlcfphe; // 0x9c count of bytes of paragraph height PLCF.
1164 : // ==0 when file is non-complex.
1165 :
1166 : WW8_FC fcSttbfglsy; // 0xa0 file offset of glossary string table.
1167 : sal_Int32 lcbSttbfglsy; // 0xa4 count of bytes of glossary string table.
1168 : // == 0 for non-glossary documents.
1169 : // !=0 for glossary documents.
1170 :
1171 : WW8_FC fcPlcfglsy; // 0xa8 file offset of glossary PLCF.
1172 : sal_Int32 lcbPlcfglsy; // 0xac count of bytes of glossary PLCF.
1173 : // == 0 for non-glossary documents.
1174 : // !=0 for glossary documents.
1175 :
1176 : WW8_FC fcPlcfhdd; // 0xb0 byte offset of header PLCF.
1177 : sal_Int32 lcbPlcfhdd; // 0xb4 count of bytes of header PLCF.
1178 : // == 0 if document contains no headers
1179 :
1180 : WW8_FC fcPlcfbteChpx; // 0xb8 file offset of character property bin table.PLCF.
1181 : sal_Int32 lcbPlcfbteChpx;// 0xbc count of bytes of character property bin table PLCF.
1182 :
1183 : WW8_FC fcPlcfbtePapx; // 0xc0 file offset of paragraph property bin table.PLCF.
1184 : sal_Int32 lcbPlcfbtePapx;// 0xc4 count of bytes of paragraph property bin table PLCF.
1185 :
1186 : WW8_FC fcPlcfsea; // 0xc8 file offset of PLCF reserved for private use. The SEA is 6 bytes long.
1187 : sal_Int32 lcbPlcfsea; // 0xcc count of bytes of private use PLCF.
1188 :
1189 : WW8_FC fcSttbfffn; // 0xd0 file offset of font information STTBF. See the FFN file structure definition.
1190 : sal_Int32 lcbSttbfffn; // 0xd4 count of bytes in sttbfffn.
1191 :
1192 : WW8_FC fcPlcffldMom; // 0xd8 offset in doc stream to the PLCF of field positions in the main document.
1193 : sal_Int32 lcbPlcffldMom; // 0xdc
1194 :
1195 : WW8_FC fcPlcffldHdr; // 0xe0 offset in doc stream to the PLCF of field positions in the header subdocument.
1196 : sal_Int32 lcbPlcffldHdr; // 0xe4
1197 :
1198 : WW8_FC fcPlcffldFtn; // 0xe8 offset in doc stream to the PLCF of field positions in the footnote subdocument.
1199 : sal_Int32 lcbPlcffldFtn; // 0xec
1200 :
1201 : WW8_FC fcPlcffldAtn; // 0xf0 offset in doc stream to the PLCF of field positions in the annotation subdocument.
1202 : sal_Int32 lcbPlcffldAtn; // 0xf4
1203 :
1204 : WW8_FC fcPlcffldMcr; // 0xf8 offset in doc stream to the PLCF of field positions in the macro subdocument.
1205 : sal_Int32 lcbPlcffldMcr; // 9xfc
1206 :
1207 : WW8_FC fcSttbfbkmk; // 0x100 offset in document stream of the STTBF that records bookmark names in the main document
1208 : sal_Int32 lcbSttbfbkmk; // 0x104
1209 :
1210 : WW8_FC fcPlcfbkf; // 0x108 offset in document stream of the PLCF that records the beginning CP offsets of bookmarks in the main document. See BKF
1211 : sal_Int32 lcbPlcfbkf; // 0x10c
1212 :
1213 : WW8_FC fcPlcfbkl; // 0x110 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.
1214 : sal_Int32 lcbPlcfbkl; // 0x114 sal_Int32
1215 :
1216 : WW8_FC fcCmds; // 0x118 FC
1217 : sal_Int32 lcbCmds; // 0x11c
1218 :
1219 : WW8_FC fcPlcfmcr; // 0x120 FC
1220 : sal_Int32 lcbPlcfmcr; // 0x124
1221 :
1222 : WW8_FC fcSttbfmcr; // 0x128 FC
1223 : sal_Int32 lcbSttbfmcr; // 0x12c
1224 :
1225 : WW8_FC fcPrDrvr; // 0x130 file offset of the printer driver information (names of drivers, port etc...)
1226 : sal_Int32 lcbPrDrvr; // 0x134 count of bytes of the printer driver information (names of drivers, port etc...)
1227 :
1228 : WW8_FC fcPrEnvPort; // 0x138 file offset of the print environment in portrait mode.
1229 : sal_Int32 lcbPrEnvPort; // 0x13c count of bytes of the print environment in portrait mode.
1230 :
1231 : WW8_FC fcPrEnvLand; // 0x140 file offset of the print environment in landscape mode.
1232 : sal_Int32 lcbPrEnvLand; // 0x144 count of bytes of the print environment in landscape mode.
1233 :
1234 : WW8_FC fcWss; // 0x148 file offset of Window Save State data structure. See WSS.
1235 : sal_Int32 lcbWss; // 0x14c count of bytes of WSS. ==0 if unable to store the window state.
1236 :
1237 : WW8_FC fcDop; // 0x150 file offset of document property data structure.
1238 : sal_uInt32 lcbDop; // 0x154 count of bytes of document properties.
1239 : // cbDOP is 84 when nFib < 103
1240 :
1241 :
1242 : WW8_FC fcSttbfAssoc; // 0x158 offset to STTBF of associated strings. See STTBFASSOC.
1243 : sal_Int32 lcbSttbfAssoc; // 0x15C
1244 :
1245 : WW8_FC fcClx; // 0x160 file offset of beginning of information for complex files.
1246 : sal_Int32 lcbClx; // 0x164 count of bytes of complex file information. 0 if file is non-complex.
1247 :
1248 : WW8_FC fcPlcfpgdFtn; // 0x168 file offset of page descriptor PLCF for footnote subdocument.
1249 : sal_Int32 lcbPlcfpgdFtn; // 0x16C count of bytes of page descriptor PLCF for footnote subdocument.
1250 : // ==0 if document has not been paginated. The length of the PGD is 8 bytes.
1251 :
1252 : WW8_FC fcAutosaveSource; // 0x170 file offset of the name of the original file.
1253 : sal_Int32 lcbAutosaveSource; // 0x174 count of bytes of the name of the original file.
1254 :
1255 : WW8_FC fcGrpStAtnOwners; // 0x178 group of strings recording the names of the owners of annotations
1256 : sal_Int32 lcbGrpStAtnOwners; // 0x17C count of bytes of the group of strings
1257 :
1258 : WW8_FC fcSttbfAtnbkmk; // 0x180 file offset of the sttbf that records names of bookmarks in the annotation subdocument
1259 : sal_Int32 lcbSttbfAtnbkmk; // 0x184 length in bytes of the sttbf that records names of bookmarks in the annotation subdocument
1260 :
1261 : // Einschubs fuer WW67 ***************************************************
1262 :
1263 : // sal_Int16 wSpare4Fib; // Reserve, muss hier nicht deklariert werden
1264 :
1265 : /*
1266 : // folgende Felder existieren zwar so in der Datei,
1267 : // wir benutzen jedoch unten deklarierte General-Variablen
1268 : // fuer Ver67 und Ver8 gemeinsam.
1269 : WW8_PN pnChpFirst; // the page number of the lowest numbered page in
1270 : // the document that records CHPX FKP information
1271 : WW8_PN pnPapFirst; // the page number of the lowest numbered page in
1272 : // the document that records PAPX FKP information
1273 :
1274 : WW8_PN cpnBteChp; // count of CHPX FKPs recorded in file. In non-complex
1275 : // files if the number of entries in the PLCFbteChpx is
1276 : // less than this, the PLCFbteChpx is incomplete.
1277 : WW8_PN cpnBtePap; // count of PAPX FKPs recorded in file. In non-complex
1278 : // files if the number of entries in the PLCFbtePapx is
1279 : // less than this, the PLCFbtePapx is incomplete.
1280 : */
1281 :
1282 : // Ende des Einschubs fuer WW67 ******************************************
1283 :
1284 : WW8_FC fcPlcfdoaMom; // 0x192 file offset of the FDOA (drawn object) PLCF for main document.
1285 : // ==0 if document has no drawn objects. The length of the FDOA is 6 bytes.
1286 : // ab Ver8 unused
1287 : sal_Int32 lcbPlcfdoaMom; // 0x196 length in bytes of the FDOA PLCF of the main document
1288 : // ab Ver8 unused
1289 : WW8_FC fcPlcfdoaHdr; // 0x19A file offset of the FDOA (drawn object) PLCF for the header document.
1290 : // ==0 if document has no drawn objects. The length of the FDOA is 6 bytes.
1291 : // ab Ver8 unused
1292 : sal_Int32 lcbPlcfdoaHdr; // 0x19E length in bytes of the FDOA PLCF of the header document
1293 : // ab Ver8 unused
1294 :
1295 : WW8_FC fcPlcfspaMom; // offset in table stream of the FSPA PLCF for main document.
1296 : // == 0 if document has no office art objects
1297 : // war in Ver67 nur leere Reserve
1298 : sal_Int32 lcbPlcfspaMom; // length in bytes of the FSPA PLCF of the main document
1299 : // war in Ver67 nur leere Reserve
1300 : WW8_FC fcPlcfspaHdr; // offset in table stream of the FSPA PLCF for header document.
1301 : // == 0 if document has no office art objects
1302 : // war in Ver67 nur leere Reserve
1303 : sal_Int32 lcbPlcfspaHdr; // length in bytes of the FSPA PLCF of the header document
1304 : // war in Ver67 nur leere Reserve
1305 :
1306 : WW8_FC fcPlcfAtnbkf; // 0x1B2 file offset of BKF (bookmark first) PLCF of the annotation subdocument
1307 : sal_Int32 lcbPlcfAtnbkf; // 0x1B6 length in bytes of BKF (bookmark first) PLCF of the annotation subdocument
1308 :
1309 : WW8_FC fcPlcfAtnbkl; // 0x1BA file offset of BKL (bookmark last) PLCF of the annotation subdocument
1310 : sal_Int32 lcbPlcfAtnbkl; // 0x1BE length in bytes of BKL (bookmark first) PLCF of the annotation subdocument
1311 :
1312 : WW8_FC fcPms; // 0x1C2 file offset of PMS (Print Merge State) information block
1313 : sal_Int32 lcbPMS; // 0x1C6 length in bytes of PMS
1314 :
1315 : WW8_FC fcFormFldSttbf; // 0x1CA file offset of form field Sttbf which contains strings used in form field dropdown controls
1316 : sal_Int32 lcbFormFldSttbf; // 0x1CE length in bytes of form field Sttbf
1317 :
1318 : WW8_FC fcPlcfendRef; // 0x1D2 file offset of PLCFendRef which points to endnote references in the main document stream
1319 : sal_Int32 lcbPlcfendRef; // 0x1D6
1320 :
1321 : WW8_FC fcPlcfendTxt; // 0x1DA file offset of PLCFendRef which points to endnote text in the endnote document
1322 : // stream which corresponds with the PLCFendRef
1323 : sal_Int32 lcbPlcfendTxt; // 0x1DE
1324 :
1325 : WW8_FC fcPlcffldEdn; // 0x1E2 offset to PLCF of field positions in the endnote subdoc
1326 : sal_Int32 lcbPlcffldEdn; // 0x1E6
1327 :
1328 : WW8_FC fcPlcfpgdEdn; // 0x1EA offset to PLCF of page boundaries in the endnote subdoc.
1329 : sal_Int32 lcbPlcfpgdEdn; // 0x1EE
1330 :
1331 :
1332 : WW8_FC fcDggInfo; // offset in table stream of the office art object table data.
1333 : // The format of office art object table data is found in a separate document.
1334 : // war in Ver67 nur leere Reserve
1335 : sal_Int32 lcbDggInfo; // length in bytes of the office art object table data
1336 : // war in Ver67 nur leere Reserve
1337 :
1338 : WW8_FC fcSttbfRMark; // 0x1fa offset to STTBF that records the author abbreviations...
1339 : sal_Int32 lcbSttbfRMark; // 0x1fe
1340 : WW8_FC fcSttbfCaption; // 0x202 offset to STTBF that records caption titles...
1341 : sal_Int32 lcbSttbfCaption; // 0x206
1342 : WW8_FC fcSttbAutoCaption; // offset in table stream to the STTBF that records the object names and
1343 : // indices into the caption STTBF for objects which get auto captions.
1344 : sal_Int32 lcbSttbAutoCaption; // 0x20e
1345 :
1346 : WW8_FC fcPlcfwkb; // 0x212 offset to PLCF that describes the boundaries of contributing documents...
1347 : sal_Int32 lcbPlcfwkb; // 0x216
1348 :
1349 : WW8_FC fcPlcfspl; // offset in table stream of PLCF (of SPLS structures) that records spell check state
1350 : // war in Ver67 nur leere Reserve
1351 : sal_Int32 lcbPlcfspl; // war in Ver67 nur leere Reserve
1352 :
1353 : WW8_FC fcPlcftxbxTxt; // 0x222 ...PLCF of beginning CP in the text box subdoc
1354 : sal_Int32 lcbPlcftxbxTxt; // 0x226
1355 : WW8_FC fcPlcffldTxbx; // 0x22a ...PLCF of field boundaries recorded in the textbox subdoc.
1356 : sal_Int32 lcbPlcffldTxbx; // 0x22e
1357 : WW8_FC fcPlcfHdrtxbxTxt;// 0x232 ...PLCF of beginning CP in the header text box subdoc
1358 : sal_Int32 lcbPlcfHdrtxbxTxt;// 0x236
1359 : WW8_FC fcPlcffldHdrTxbx;// 0x23a ...PLCF of field boundaries recorded in the header textbox subdoc.
1360 : sal_Int32 lcbPlcffldHdrTxbx;// 0x23e
1361 : WW8_FC fcStwUser;
1362 : sal_uInt32 lcbStwUser;
1363 : WW8_FC fcSttbttmbd;
1364 : sal_uInt32 lcbSttbttmbd;
1365 :
1366 : WW8_FC fcSttbFnm; // 0x02da offset in the table stream of masters subdocument names
1367 : sal_Int32 lcbSttbFnm; // 0x02de length
1368 :
1369 : /*
1370 : spezielle Listenverwaltung fuer WW8
1371 : */
1372 : WW8_FC fcPlcfLst; // 0x02e2 offset in the table stream of list format information.
1373 : sal_Int32 lcbPlcfLst; // 0x02e6 length
1374 : WW8_FC fcPlfLfo; // 0x02ea offset in the table stream of list format override information.
1375 : sal_Int32 lcbPlfLfo; // 0x02ee length
1376 : /*
1377 : spezielle Break-Verwaltung fuer Text-Box-Stories in WW8
1378 : */
1379 : WW8_FC fcPlcftxbxBkd; // 0x02f2 PLCF fuer TextBox-Break-Deskriptoren im Maintext
1380 : sal_Int32 lcbPlcftxbxBkd; // 0x02f6
1381 : WW8_FC fcPlcfHdrtxbxBkd;// 0x02fa PLCF fuer TextBox-Break-Deskriptoren im Header-/Footer-Bereich
1382 : sal_Int32 lcbPlcfHdrtxbxBkd;// 0x02fe
1383 :
1384 : // 0x302 - 372 == ignore
1385 : /*
1386 : ListNames (skip to here!)
1387 : */
1388 : WW8_FC fcSttbListNames;// 0x0372 PLCF for Listname Table
1389 : sal_Int32 lcbSttbListNames;// 0x0376
1390 :
1391 : WW8_FC fcPlcfTch;
1392 : sal_Int32 lcbPlcfTch;
1393 :
1394 : // 0x38A - 41A == ignore
1395 : WW8_FC fcAtrdExtra;
1396 : sal_uInt32 lcbAtrdExtra;
1397 :
1398 : // 0x422 - 0x4D4 == ignore
1399 : WW8_FC fcHplxsdr; //bizarrely, word xp seems to require this set to shows dates from AtrdExtra
1400 : sal_uInt32 lcbHplxsdr;
1401 :
1402 : /*
1403 : General-Varaiblen, die fuer Ver67 und Ver8 verwendet werden,
1404 : obwohl sie in der jeweiligen DATEI verschiedene Groesse haben:
1405 : */
1406 : sal_Int32 pnChpFirst;
1407 : sal_Int32 pnPapFirst;
1408 : sal_Int32 cpnBteChp;
1409 : sal_Int32 cpnBtePap;
1410 : /*
1411 : The actual nFib, moved here because some readers assumed
1412 : they couldn't read any format with nFib > some constant
1413 : */
1414 : sal_uInt16 nFib_actual; // 0x05bc #i56856#
1415 : /*
1416 : nun wird lediglich noch ein Ctor benoetigt
1417 : */
1418 : WW8Fib( SvStream& rStrm, sal_uInt8 nWantedVersion,sal_uInt32 nOffset=0 );
1419 :
1420 : /* leider falsch, man braucht auch noch einen fuer den Export */
1421 : WW8Fib( sal_uInt8 nVersion = 6 );
1422 : bool WriteHeader(SvStream& rStrm);
1423 : bool Write(SvStream& rStrm);
1424 : static rtl_TextEncoding GetFIBCharset(sal_uInt16 chs);
1425 : ww::WordVersion GetFIBVersion() const;
1426 : WW8_CP GetBaseCp(ManTypes nType) const;
1427 : sal_Unicode getNumDecimalSep() const;
1428 : };
1429 :
1430 : class WW8Style
1431 : {
1432 : protected:
1433 : WW8Fib& rFib;
1434 : SvStream& rSt;
1435 :
1436 : sal_uInt16 cstd; // Count of styles in stylesheet
1437 : sal_uInt16 cbSTDBaseInFile; // Length of STD Base as stored in a file
1438 : sal_uInt16 fStdStylenamesWritten : 1; // Are built-in stylenames stored?
1439 : sal_uInt16 : 15; // Spare flags
1440 : sal_uInt16 stiMaxWhenSaved; // Max sti known when file was written
1441 : sal_uInt16 istdMaxFixedWhenSaved; // How many fixed-index istds are there?
1442 : sal_uInt16 nVerBuiltInNamesWhenSaved; // Current version of built-in stylenames
1443 : // ftc used by StandardChpStsh for this document
1444 : sal_uInt16 ftcAsci;
1445 : // CJK ftc used by StandardChpStsh for this document
1446 : sal_uInt16 ftcFE;
1447 : // CTL/Other ftc used by StandardChpStsh for this document
1448 : sal_uInt16 ftcOther;
1449 : // CTL ftc used by StandardChpStsh for this document
1450 : sal_uInt16 ftcBi;
1451 :
1452 : //No copying
1453 : WW8Style(const WW8Style&);
1454 : WW8Style& operator=(const WW8Style&);
1455 : public:
1456 : WW8Style( SvStream& rSt, WW8Fib& rFibPara );
1457 : WW8_STD* Read1STDFixed( short& rSkip, short* pcbStd );
1458 : WW8_STD* Read1Style( short& rSkip, String* pString, short* pcbStd );
1459 123 : sal_uInt16 GetCount() const { return cstd; }
1460 : };
1461 :
1462 : class WW8Fonts
1463 : {
1464 : protected:
1465 : WW8_FFN* pFontA; // Array of Pointers to Font Description
1466 : sal_uInt16 nMax; // Array-Size
1467 : public:
1468 : WW8Fonts( SvStream& rSt, WW8Fib& rFib );
1469 37 : ~WW8Fonts() { delete[] pFontA; }
1470 : const WW8_FFN* GetFont( sal_uInt16 nNum ) const;
1471 : sal_uInt16 GetMax() const { return nMax; }
1472 : };
1473 :
1474 : typedef sal_uInt8 HdFtFlags;
1475 : namespace nsHdFtFlags
1476 : {
1477 : const HdFtFlags WW8_HEADER_EVEN = 0x01;
1478 : const HdFtFlags WW8_HEADER_ODD = 0x02;
1479 : const HdFtFlags WW8_FOOTER_EVEN = 0x04;
1480 : const HdFtFlags WW8_FOOTER_ODD = 0x08;
1481 : const HdFtFlags WW8_HEADER_FIRST = 0x10;
1482 : const HdFtFlags WW8_FOOTER_FIRST = 0x20;
1483 : }
1484 :
1485 : /// Document Properties
1486 : class WW8Dop
1487 : {
1488 : public:
1489 : /* Error Status */
1490 : sal_uLong nDopError;
1491 : /*
1492 : Corresponds only roughly to the actual structure of the Winword DOP,
1493 : the winword FIB version matters to what exists.
1494 : */
1495 : // Initialisier-Dummy:
1496 : sal_uInt8 nDataStart;
1497 : //-------------------------
1498 : sal_uInt16 fFacingPages : 1; // 1 when facing pages should be printed
1499 : sal_uInt16 fWidowControl : 1; // 1 when widow control is in effect. 0 when widow control disabled.
1500 : sal_uInt16 fPMHMainDoc : 1; // 1 when doc is a main doc for Print Merge Helper, 0 when not; default=0
1501 : sal_uInt16 grfSuppression : 2; // 0 Default line suppression storage; 0= form letter line suppression; 1= no line suppression; default=0
1502 : sal_uInt16 fpc : 2; // 1 footnote position code: 0 as endnotes, 1 at bottom of page, 2 immediately beneath text
1503 : sal_uInt16 : 1; // 0 unused
1504 : //-------------------------
1505 : sal_uInt16 grpfIhdt : 8; // 0 specification of document headers and footers. See explanation under Headers and Footers topic.
1506 : //-------------------------
1507 : sal_uInt16 rncFtn : 2; // 0 restart index for footnotes, 0 don't restart note numbering, 1 section, 2 page
1508 : sal_uInt16 nFtn : 14; // 1 initial footnote number for document
1509 : sal_uInt16 fOutlineDirtySave : 1; // when 1, indicates that information in the hPLCFpad should be refreshed since outline has been dirtied
1510 : sal_uInt16 : 7; // reserved
1511 : sal_uInt16 fOnlyMacPics : 1; // when 1, Word believes all pictures recorded in the document were created on a Macintosh
1512 : sal_uInt16 fOnlyWinPics : 1; // when 1, Word believes all pictures recorded in the document were created in Windows
1513 : sal_uInt16 fLabelDoc : 1; // when 1, document was created as a print merge labels document
1514 : sal_uInt16 fHyphCapitals : 1; // when 1, Word is allowed to hyphenate words that are capitalized. When 0, capitalized may not be hyphenated
1515 : sal_uInt16 fAutoHyphen : 1; // when 1, Word will hyphenate newly typed text as a background task
1516 : sal_uInt16 fFormNoFields : 1;
1517 : sal_uInt16 fLinkStyles : 1; // when 1, Word will merge styles from its template
1518 : sal_uInt16 fRevMarking : 1; // when 1, Word will mark revisions as the document is edited
1519 : sal_uInt16 fBackup : 1; // always make backup when document saved when 1.
1520 : sal_uInt16 fExactCWords : 1;
1521 : sal_uInt16 fPagHidden : 1; //
1522 : sal_uInt16 fPagResults : 1;
1523 : sal_uInt16 fLockAtn : 1; // when 1, annotations are locked for editing
1524 : sal_uInt16 fMirrorMargins : 1; // swap margins on left/right pages when 1.
1525 : sal_uInt16 fReadOnlyRecommended : 1;// user has recommended that this doc be opened read-only when 1
1526 : sal_uInt16 fDfltTrueType : 1; // when 1, use TrueType fonts by default (flag obeyed only when doc was created by WinWord 2.x)
1527 : sal_uInt16 fPagSuppressTopSpacing : 1;//when 1, file created with SUPPRESSTOPSPACING=YES in win.ini. (flag obeyed only when doc was created by WinWord 2.x).
1528 : sal_uInt16 fProtEnabled : 1; // when 1, document is protected from edit operations
1529 : sal_uInt16 fDispFormFldSel : 1;// when 1, restrict selections to occur only within form fields
1530 : sal_uInt16 fRMView : 1; // when 1, show revision markings on screen
1531 : sal_uInt16 fRMPrint : 1; // when 1, print revision marks when document is printed
1532 : sal_uInt16 fWriteReservation : 1;
1533 : sal_uInt16 fLockRev : 1; // when 1, the current revision marking state is locked
1534 : sal_uInt16 fEmbedFonts : 1; // when 1, document contains embedded True Type fonts
1535 : // compatability options
1536 : sal_uInt16 copts_fNoTabForInd : 1; // when 1, don�t add automatic tab stops for hanging indent
1537 : sal_uInt16 copts_fNoSpaceRaiseLower : 1; // when 1, don�t add extra space for raised or lowered characters
1538 : sal_uInt16 copts_fSupressSpbfAfterPgBrk : 1; // when 1, supress the paragraph Space Before and Space After options after a page break
1539 : sal_uInt16 copts_fWrapTrailSpaces : 1; // when 1, wrap trailing spaces at the end of a line to the next line
1540 : sal_uInt16 copts_fMapPrintTextColor : 1; // when 1, print colors as black on non-color printers
1541 : sal_uInt16 copts_fNoColumnBalance : 1; // when 1, don�t balance columns for Continuous Section starts
1542 : sal_uInt16 copts_fConvMailMergeEsc : 1;
1543 : sal_uInt16 copts_fSupressTopSpacing : 1; // when 1, supress extra line spacing at top of page
1544 : sal_uInt16 copts_fOrigWordTableRules : 1; // when 1, combine table borders like Word 5.x for the Macintosh
1545 : sal_uInt16 copts_fTransparentMetafiles : 1; // when 1, don�t blank area between metafile pictures
1546 : sal_uInt16 copts_fShowBreaksInFrames : 1; // when 1, show hard page or column breaks in frames
1547 : sal_uInt16 copts_fSwapBordersFacingPgs : 1; // when 1, swap left and right pages on odd facing pages
1548 : sal_uInt16 copts_fExpShRtn : 1; // when 1, expand character spaces on the line ending SHIFT+RETURN // #i56856#
1549 :
1550 : sal_Int16 dxaTab; // 720 twips default tab width
1551 : sal_uInt16 wSpare; //
1552 : sal_uInt16 dxaHotZ; // width of hyphenation hot zone measured in twips
1553 : sal_uInt16 cConsecHypLim; // number of lines allowed to have consecutive hyphens
1554 : sal_uInt16 wSpare2; // reserved
1555 : sal_Int32 dttmCreated; // DTTM date and time document was created
1556 : sal_Int32 dttmRevised; // DTTM date and time document was last revised
1557 : sal_Int32 dttmLastPrint; // DTTM date and time document was last printed
1558 : sal_Int16 nRevision; // number of times document has been revised since its creation
1559 : sal_Int32 tmEdited; // time document was last edited
1560 : sal_Int32 cWords; // count of words tallied by last Word Count execution
1561 : sal_Int32 cCh; // count of characters tallied by last Word Count execution
1562 : sal_Int16 cPg; // count of pages tallied by last Word Count execution
1563 : sal_Int32 cParas; // count of paragraphs tallied by last Word Count execution
1564 : sal_uInt16 rncEdn : 2; // restart endnote number code: 0 don�t restart endnote numbering, 1 section, 2 page
1565 : sal_uInt16 nEdn : 14; // beginning endnote number
1566 : sal_uInt16 epc : 2; // endnote position code: 0 at end of section, 3 at end of document
1567 : // sal_uInt16 nfcFtnRef : 4; // number format code for auto footnotes: 0 Arabic, 1 Upper case Roman, 2 Lower case Roman
1568 : // 3 Upper case Letter, 4 Lower case Letter
1569 : // ersetzt durch gleichlautendes Feld unten
1570 : // sal_uInt16 nfcEdnRef : 4; // number format code for auto endnotes: 0 Arabic, 1 Upper case Roman, 2 Lower case Roman
1571 : // 3 Upper case Letter, 4 Lower case Letter
1572 : // ersetzt durch gleichlautendes Feld unten
1573 : sal_uInt16 fPrintFormData : 1; // only print data inside of form fields
1574 : sal_uInt16 fSaveFormData : 1; // only save document data that is inside of a form field.
1575 : sal_uInt16 fShadeFormData : 1; // shade form fields
1576 : sal_uInt16 : 2; // reserved
1577 : sal_uInt16 fWCFtnEdn : 1; // when 1, include footnotes and endnotes in word count
1578 : sal_Int32 cLines; // count of lines tallied by last Word Count operation
1579 : sal_Int32 cWordsFtnEnd; // count of words in footnotes and endnotes tallied by last Word Count operation
1580 : sal_Int32 cChFtnEdn; // count of characters in footnotes and endnotes tallied by last Word Count operation
1581 : sal_Int16 cPgFtnEdn; // count of pages in footnotes and endnotes tallied by last Word Count operation
1582 : sal_Int32 cParasFtnEdn; // count of paragraphs in footnotes and endnotes tallied by last Word Count operation
1583 : sal_Int32 cLinesFtnEdn; // count of paragraphs in footnotes and endnotes tallied by last Word Count operation
1584 : sal_Int32 lKeyProtDoc; // document protection password key, only valid if dop.fProtEnabled, dop.fLockAtn or dop.fLockRev are 1.
1585 : sal_uInt16 wvkSaved : 3; // document view kind: 0 Normal view, 1 Outline view, 2 Page View
1586 : sal_uInt16 wScaleSaved : 9; //
1587 : sal_uInt16 zkSaved : 2;
1588 : sal_uInt16 fRotateFontW6 : 1;
1589 : sal_uInt16 iGutterPos : 1 ;
1590 :
1591 : // hier sollte bei nFib < 103 Schluss sein, sonst ist Datei fehlerhaft!
1592 :
1593 : /*
1594 : bei nFib >= 103 gehts weiter:
1595 : */
1596 : sal_uInt32 fNoTabForInd :1; // see above in compatability options
1597 : sal_uInt32 fNoSpaceRaiseLower :1; // see above
1598 : sal_uInt32 fSupressSpbfAfterPageBreak :1; // see above
1599 : sal_uInt32 fWrapTrailSpaces :1; // see above
1600 : sal_uInt32 fMapPrintTextColor :1; // see above
1601 : sal_uInt32 fNoColumnBalance :1; // see above
1602 : sal_uInt32 fConvMailMergeEsc :1; // see above
1603 : sal_uInt32 fSupressTopSpacing :1; // see above
1604 : sal_uInt32 fOrigWordTableRules :1; // see above
1605 : sal_uInt32 fTransparentMetafiles :1; // see above
1606 : sal_uInt32 fShowBreaksInFrames :1; // see above
1607 : sal_uInt32 fSwapBordersFacingPgs :1; // see above
1608 : sal_uInt32 fCompatabilityOptions_Unknown1_13 :1; // #i78591#
1609 : sal_uInt32 fExpShRtn :1; // #i78591# and #i56856#
1610 : sal_uInt32 fCompatabilityOptions_Unknown1_15 :1; // #i78591#
1611 : sal_uInt32 fCompatabilityOptions_Unknown1_16 :1; // #i78591#
1612 : sal_uInt32 fSuppressTopSpacingMac5 :1; // Suppress extra line spacing at top
1613 : // of page like MacWord 5.x
1614 : sal_uInt32 fTruncDxaExpand :1; // Expand/Condense by whole number of points
1615 : sal_uInt32 fPrintBodyBeforeHdr :1; // Print body text before header/footer
1616 : sal_uInt32 fNoLeading :1; // Don't add extra spacebetween rows of text
1617 : sal_uInt32 fCompatabilityOptions_Unknown1_21 :1; // #i78591#
1618 : sal_uInt32 fMWSmallCaps : 1; // Use larger small caps like MacWord 5.x
1619 : sal_uInt32 fCompatabilityOptions_Unknown1_23 :1; // #i78591#
1620 : sal_uInt32 fCompatabilityOptions_Unknown1_24 :1; // #i78591#
1621 : sal_uInt32 fCompatabilityOptions_Unknown1_25 :1; // #i78591#
1622 : sal_uInt32 fCompatabilityOptions_Unknown1_26 :1; // #i78591#
1623 : sal_uInt32 fCompatabilityOptions_Unknown1_27 :1; // #i78591#
1624 : sal_uInt32 fCompatabilityOptions_Unknown1_28 :1; // #i78591#
1625 : sal_uInt32 fCompatabilityOptions_Unknown1_29 :1; // #i78591#
1626 : sal_uInt32 fCompatabilityOptions_Unknown1_30 :1; // #i78591#
1627 : sal_uInt32 fCompatabilityOptions_Unknown1_31 :1; // #i78591#
1628 : sal_uInt32 fUsePrinterMetrics : 1; //The magic option
1629 :
1630 : // hier sollte bei nFib <= 105 Schluss sein, sonst ist Datei fehlerhaft!
1631 :
1632 : /*
1633 : bei nFib > 105 gehts weiter:
1634 : */
1635 : sal_Int16 adt; // Autoformat Document Type:
1636 : // 0 for normal.
1637 : // 1 for letter, and
1638 : // 2 for email.
1639 : WW8DopTypography doptypography; // see WW8STRUC.HXX
1640 : WW8_DOGRID dogrid; // see WW8STRUC.HXX
1641 : sal_uInt16 :1; // reserved
1642 : sal_uInt16 lvl :4; // Which outline levels are showing in outline view
1643 : sal_uInt16 :4; // reserved
1644 : sal_uInt16 fHtmlDoc :1; // This file is based upon an HTML file
1645 : sal_uInt16 :1; // reserved
1646 : sal_uInt16 fSnapBorder :1; // Snap table and page borders to page border
1647 : sal_uInt16 fIncludeHeader :1; // Place header inside page border
1648 : sal_uInt16 fIncludeFooter :1; // Place footer inside page border
1649 : sal_uInt16 fForcePageSizePag :1; // Are we in online view
1650 : sal_uInt16 fMinFontSizePag :1; // Are we auto-promoting fonts to >= hpsZoonFontPag?
1651 : sal_uInt16 fHaveVersions :1; // versioning is turned on
1652 : sal_uInt16 fAutoVersion :1; // autoversioning is enabled
1653 : sal_uInt16 : 14; // reserved
1654 : // Skip 12 Bytes here: ASUMI
1655 : sal_Int32 cChWS;
1656 : sal_Int32 cChWSFtnEdn;
1657 : sal_Int32 grfDocEvents;
1658 : // Skip 4+30+8 Bytes here
1659 : sal_Int32 cDBC;
1660 : sal_Int32 cDBCFtnEdn;
1661 : // Skip 4 Bytes here
1662 : sal_Int16 nfcFtnRef;
1663 : sal_Int16 nfcEdnRef;
1664 : sal_Int16 hpsZoonFontPag;
1665 : sal_Int16 dywDispPag;
1666 :
1667 : sal_uInt32 fCompatabilityOptions_Unknown2_1 :1; // #i78591#
1668 : sal_uInt32 fCompatabilityOptions_Unknown2_2 :1; // #i78591#
1669 : sal_uInt32 fDontUseHTMLAutoSpacing:1;
1670 : sal_uInt32 fCompatabilityOptions_Unknown2_4 :1; // #i78591#
1671 : sal_uInt32 fCompatabilityOptions_Unknown2_5 :1; // #i78591#
1672 : sal_uInt32 fCompatabilityOptions_Unknown2_6 :1; // #i78591#
1673 : sal_uInt32 fCompatabilityOptions_Unknown2_7 :1; // #i78591#
1674 : sal_uInt32 fCompatabilityOptions_Unknown2_8 :1; // #i78591#
1675 : sal_uInt32 fCompatabilityOptions_Unknown2_9 :1; // #i78591#
1676 : sal_uInt32 fCompatabilityOptions_Unknown2_10 :1; // #i78591#
1677 : sal_uInt32 fCompatabilityOptions_Unknown2_11 :1; // #i78591#
1678 : sal_uInt32 fCompatabilityOptions_Unknown2_12 :1; // #i78591#
1679 : sal_uInt32 fCompatabilityOptions_Unknown2_13 :1; // #i78591#
1680 : sal_uInt32 fCompatabilityOptions_Unknown2_14 :1; // #i78591#
1681 : sal_uInt32 fCompatabilityOptions_Unknown2_15 :1; // #i78591#
1682 : sal_uInt32 fCompatabilityOptions_Unknown2_16 :1; // #i78591#
1683 : sal_uInt32 fCompatabilityOptions_Unknown2_17 :1; // #i78591#
1684 : sal_uInt32 fCompatabilityOptions_Unknown2_18 :1; // #i78591#
1685 : sal_uInt32 fCompatabilityOptions_Unknown2_19 :1; // #i78591#
1686 : sal_uInt32 fCompatabilityOptions_Unknown2_20 :1; // #i78591#
1687 : sal_uInt32 fCompatabilityOptions_Unknown2_21 :1; // #i78591#
1688 : sal_uInt32 fCompatabilityOptions_Unknown2_22 :1; // #i78591#
1689 : sal_uInt32 fCompatabilityOptions_Unknown2_23 :1; // #i78591#
1690 : sal_uInt32 fCompatabilityOptions_Unknown2_24 :1; // #i78591#
1691 : sal_uInt32 fCompatabilityOptions_Unknown2_25 :1; // #i78591#
1692 : sal_uInt32 fCompatabilityOptions_Unknown2_26 :1; // #i78591#
1693 : sal_uInt32 fCompatabilityOptions_Unknown2_27 :1; // #i78591#
1694 : sal_uInt32 fCompatabilityOptions_Unknown2_28 :1; // #i78591#
1695 : sal_uInt32 fCompatabilityOptions_Unknown2_29 :1; // #i78591#
1696 : sal_uInt32 fCompatabilityOptions_Unknown2_30 :1; // #i78591#
1697 : sal_uInt32 fCompatabilityOptions_Unknown2_31 :1; // #i78591#
1698 : sal_uInt32 fCompatabilityOptions_Unknown2_32 :1; // #i78591#
1699 :
1700 : sal_uInt16 fUnknown3:15;
1701 : sal_uInt16 fUseBackGroundInAllmodes:1;
1702 :
1703 : sal_uInt16 fDoNotEmbedSystemFont:1;
1704 : sal_uInt16 fWordCompat:1;
1705 : sal_uInt16 fLiveRecover:1;
1706 : sal_uInt16 fEmbedFactoids:1;
1707 : sal_uInt16 fFactoidXML:1;
1708 : sal_uInt16 fFactoidAllDone:1;
1709 : sal_uInt16 fFolioPrint:1;
1710 : sal_uInt16 fReverseFolio:1;
1711 : sal_uInt16 iTextLineEnding:3;
1712 : sal_uInt16 fHideFcc:1;
1713 : sal_uInt16 fAcetateShowMarkup:1;
1714 : sal_uInt16 fAcetateShowAtn:1;
1715 : sal_uInt16 fAcetateShowInsDel:1;
1716 : sal_uInt16 fAcetateShowProps:1;
1717 :
1718 : // 2. Initialisier-Dummy:
1719 : sal_uInt8 nDataEnd;
1720 :
1721 : bool bUseThaiLineBreakingRules;
1722 :
1723 : /* Constructor for importing, needs to know the version of word used */
1724 : WW8Dop(SvStream& rSt, sal_Int16 nFib, sal_Int32 nPos, sal_uInt32 nSize);
1725 :
1726 : /* Constructs default DOP suitable for exporting */
1727 : WW8Dop();
1728 : bool Write(SvStream& rStrm, WW8Fib& rFib) const;
1729 : public:
1730 : sal_uInt32 GetCompatabilityOptions() const;
1731 : void SetCompatabilityOptions(sal_uInt32 a32Bit);
1732 : // i#78591#
1733 : sal_uInt32 GetCompatabilityOptions2() const;
1734 : void SetCompatabilityOptions2(sal_uInt32 a32Bit);
1735 : };
1736 :
1737 18 : class WW8PLCF_HdFt
1738 : {
1739 : private:
1740 : WW8PLCF aPLCF;
1741 : long nTextOfs;
1742 : short nIdxOffset;
1743 : public:
1744 : WW8PLCF_HdFt( SvStream* pSt, WW8Fib& rFib, WW8Dop& rDop );
1745 : bool GetTextPos(sal_uInt8 grpfIhdt, sal_uInt8 nWhich, WW8_CP& rStart, long& rLen);
1746 : bool GetTextPosExact(short nIdx, WW8_CP& rStart, long& rLen);
1747 : void UpdateIndex( sal_uInt8 grpfIhdt );
1748 : };
1749 :
1750 : void SwapQuotesInField(String &rFmt);
1751 :
1752 : Word2CHPX ReadWord2Chpx(SvStream &rSt, sal_Size nOffset, sal_uInt8 nSize);
1753 : std::vector<sal_uInt8> ChpxToSprms(const Word2CHPX &rChpx);
1754 :
1755 : bool checkSeek(SvStream &rSt, sal_uInt32 nOffset)
1756 : SAL_WARN_UNUSED_RESULT;
1757 :
1758 : bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength)
1759 : SAL_WARN_UNUSED_RESULT;
1760 :
1761 : //MS has a (slightly) inaccurate view of how many twips
1762 : //are in the default letter size of a page
1763 : const sal_uInt16 lLetterWidth = 12242;
1764 : const sal_uInt16 lLetterHeight = 15842;
1765 :
1766 : #ifdef OSL_BIGENDIAN
1767 : void swapEndian(sal_Unicode *pString);
1768 : #endif
1769 :
1770 : #endif
1771 :
1772 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|