1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
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"
36 #include "ww8struc.hxx" // FIB, STSHI, STD...
41 //--Line below which the code has meaningful comments
43 //Commonly used string literals for stream and storage names in word docs
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
);
60 sal_uInt16 nId
; ///< A ww8 sprm is hardcoded as 16bits
61 unsigned int nLen
: 6;
62 unsigned int nVari
: 2;
67 size_t operator()(const SprmInfo
&a
) const
73 typedef ww::WrappedHash
<SprmInfo
, SprmInfoHash
> wwSprmSearcher
;
74 typedef ww::WrappedHash
<sal_uInt16
> wwSprmSequence
;
77 wwSprmParser knows how to take a sequence of bytes and split it up into
78 sprms and their arguments
83 ww::WordVersion meVersion
;
85 const wwSprmSearcher
*mpKnownSprms
;
86 static const wwSprmSearcher
* GetWW8SprmSearcher();
87 static const wwSprmSearcher
* GetWW6SprmSearcher();
88 static const wwSprmSearcher
* GetWW2SprmSearcher();
90 SprmInfo
GetSprmInfo(sal_uInt16 nId
) const;
92 sal_uInt8
SprmDataOfs(sal_uInt16 nId
) const;
94 enum SprmType
{L_FIX
=0, L_VAR
=1, L_VAR2
=2};
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;
101 sal_uInt16
GetSprmSize(sal_uInt16 nId
, const sal_uInt8
* pSprm
) const;
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;
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;
111 /// The minimum acceptable sprm len possible for this type of parser
112 int MinSprmLen() const { return (IsSevenMinus(meVersion
)) ? 2 : 3; }
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
)
120 //Read a Pascal-style, i.e. single byte string length followed
122 inline String
read_uInt8_PascalString(SvStream
& rStrm
, rtl_TextEncoding eEnc
)
124 return read_lenPrefixed_uInt8s_ToOUString
<sal_uInt8
>(rStrm
, eEnc
);
127 inline String
read_uInt16_PascalString(SvStream
& rStrm
)
129 return read_lenPrefixed_uInt16s_ToOUString
<sal_uInt16
>(rStrm
);
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
);
138 //--Line abovewhich the code has meaningful comments
141 class WW8ScannerBase
;
142 class WW8PLCFspecial
;
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*
150 attention: the *extra data* of each string are SKIPPED and ignored
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);
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
172 sal_uLong nPLCFxPos2
; ///< fuer PLCF_Cp_Fkp: PieceIter-Pos
174 WW8_CP nStartCp
; ///< for cp based iterator like PAP and CHP
183 u.a. fuer Felder, also genausoviele Attr wie Positionen,
184 falls Ctor-Param bNoEnd = false
186 class WW8PLCFspecial
// Iterator fuer PLCFs
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
195 WW8PLCFspecial(SvStream
* pSt
, sal_uInt32 nFilePos
, sal_uInt32 nPLCF
,
197 ~WW8PLCFspecial() { delete[] pPLCF_PosArray
; }
198 long GetIdx() const { return nIdx
; }
199 void SetIdx( long nI
) { nIdx
= nI
; }
200 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 sal_Int32
Where() const
205 { 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;
209 const void* GetData( long nInIdx
) const
211 return ( nInIdx
>= nIMax
) ? 0
212 : (const void*)&pPLCF_Contents
[nInIdx
* nStru
];
214 sal_Int32
GetPos( long nInIdx
) const
215 { return ( nInIdx
>= nIMax
) ? SAL_MAX_INT32
: pPLCF_PosArray
[nInIdx
]; }
224 /** simple Iterator for SPRMs */
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
235 long nRemLen
; // length of remaining SPRMs (including akt. SPRM)
237 void UpdateMyMembers();
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
);
244 const sal_uInt8
* GetSprms() const
245 { return ( pSprms
&& (0 < nRemLen
) ) ? pSprms
: 0; }
246 const sal_uInt8
* GetAktParams() const { return pAktParams
; }
247 sal_uInt16
GetAktId() const { return nAktId
; }
250 WW8SprmIter(const WW8SprmIter
&);
251 WW8SprmIter
& operator=(const WW8SprmIter
&);
254 /* u.a. fuer FKPs auf normale Attr., also ein Attr weniger als Positionen */
255 class WW8PLCF
// Iterator fuer PLCFs
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
264 void ReadPLCF(SvStream
& rSt
, WW8_FC nFilePos
, sal_uInt32 nPLCF
);
267 Falls im Dok ein PLC fehlt und die FKPs solo dastehen,
268 machen wir uns hiermit einen PLC:
270 void GeneratePLCF(SvStream
& rSt
, sal_Int32 nPN
, sal_Int32 ncpN
);
272 void MakeFailedPLCF();
274 WW8PLCF(SvStream
& rSt
, WW8_FC nFilePos
, sal_Int32 nPLCF
, int nStruct
,
275 WW8_CP nStartPos
= -1);
278 folgender Ctor generiert ggfs. einen PLC aus nPN und ncpN
280 WW8PLCF(SvStream
& rSt
, WW8_FC nFilePos
, sal_Int32 nPLCF
, int nStruct
,
281 WW8_CP nStartPos
, sal_Int32 nPN
, sal_Int32 ncpN
);
283 ~WW8PLCF(){ delete[] pPLCF_PosArray
; }
284 sal_Int32
GetIdx() const { return nIdx
; }
285 void SetIdx( sal_Int32 nI
) { nIdx
= nI
; }
286 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 void advance() { if( nIdx
< nIMax
) ++nIdx
; }
292 const void* GetData( sal_Int32 nInIdx
) const
294 return ( nInIdx
>= nIMax
) ? 0 :
295 (const void*)&pPLCF_Contents
[nInIdx
* nStru
];
299 /* for Piece Table (.i.e. FastSave Table) */
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
308 WW8PLCFpcd(SvStream
* pSt
, sal_uInt32 nFilePos
, sal_uInt32 nPLCF
,
310 ~WW8PLCFpcd(){ delete[] pPLCF_PosArray
; }
313 /* mehrere WW8PLCFpcd_Iter koennen auf die gleiche WW8PLCFpcd zeigen !!! */
314 class WW8PLCFpcd_Iter
321 WW8PLCFpcd_Iter(const WW8PLCFpcd_Iter
&);
322 WW8PLCFpcd_Iter
& operator=(const WW8PLCFpcd_Iter
&);
324 WW8PLCFpcd_Iter( WW8PLCFpcd
& rPLCFpcd
, long nStartPos
= -1 );
325 long GetIdx() const { return nIdx
; }
326 void SetIdx( long nI
) { nIdx
= nI
; }
327 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;
333 if( nIdx
< rPLCF
.nIMax
)
339 enum ePLCFT
{ CHP
=0, PAP
, SEP
, /*HED, FNR, ENR,*/ PLCF_END
};
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 };
347 class WW8PLCFx
// virtueller Iterator fuer Piece Table Exceptions
350 ww::WordVersion meVer
; // Version number of FIB
351 bool bIsSprm
; // PLCF von Sprms oder von anderem ( Footnote, ... )
356 WW8PLCFx(const WW8PLCFx
&);
357 WW8PLCFx
& operator=(const WW8PLCFx
&);
359 WW8PLCFx(ww::WordVersion eVersion
, bool bSprm
)
360 : meVer(eVersion
), bIsSprm(bSprm
), bDirty(false) {}
361 virtual ~WW8PLCFx() {}
362 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 virtual sal_uInt16
GetIstd() const { return 0xffff; }
373 virtual void Save( WW8PLCFxSave1
& rSave
) const;
374 virtual void Restore( const WW8PLCFxSave1
& rSave
);
375 ww::WordVersion
GetFIBVersion() const { return meVer
; }
376 void SetStartFc( WW8_FC nFc
) { nStartFc
= nFc
; }
377 WW8_FC
GetStartFc() const { return nStartFc
; }
378 void SetDirty(bool bIn
) {bDirty
=bIn
;}
379 bool GetDirty() const {return bDirty
;}
382 class WW8PLCFx_PCDAttrs
: public WW8PLCFx
385 WW8PLCFpcd_Iter
* pPcdI
;
387 sal_uInt8
** const pGrpprls
; // Attribute an Piece-Table
388 SVBT32 aShortSprm
; // mini storage: can contain ONE sprm with
390 sal_uInt16 nGrpprls
; // Attribut Anzahl davon
393 WW8PLCFx_PCDAttrs(const WW8PLCFx_PCDAttrs
&);
394 WW8PLCFx_PCDAttrs
& operator=(const WW8PLCFx_PCDAttrs
&);
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();
405 WW8PLCFpcd_Iter
* GetIter() const { return pPcdI
; }
408 class WW8PLCFx_PCD
: public WW8PLCFx
// Iterator fuer Piece Table
411 WW8PLCFpcd_Iter
* pPcdI
;
416 WW8PLCFx_PCD(const WW8PLCFx_PCD
&);
417 WW8PLCFx_PCD
& operator=(const WW8PLCFx_PCD
&);
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 WW8PLCFpcd_Iter
* GetPLCFIter() { return pPcdI
; }
434 void SetClipStart(WW8_CP nIn
) { nClipStart
= nIn
; }
435 WW8_CP
GetClipStart() { return nClipStart
; }
437 static sal_Int32
TransformPieceAddress(long nfc
, bool& bIsUnicodeAddress
)
439 bIsUnicodeAddress
= 0 == (0x40000000 & nfc
);
440 return bIsUnicodeAddress
? nfc
: (nfc
& 0x3fffFFFF) / 2;
445 Iterator for Piece Table Exceptions of Fkps
446 works only with FCs, not with CPs ! ( Low-Level )
448 class WW8PLCFx_Fc_FKP
: public WW8PLCFx
451 class WW8Fkp
// Iterator for Formatted Disk Page
461 sal_uInt16 mnIStd
; // only for Fkp.Papx (actualy Style-Nr)
464 explicit Entry(WW8_FC nFC
) : mnFC(nFC
), mpData(0), mnLen(0),
465 mnIStd(0), mbMustDelete(false) {}
466 Entry(const Entry
&rEntry
);
468 bool operator<(const Entry
& rEntry
) const;
469 Entry
& operator=(const Entry
& rEntry
);
472 sal_uInt8 maRawData
[512];
473 std::vector
<Entry
> maEntries
;
475 long nItemSize
; // entweder 1 Byte oder ein komplettes BX
477 // Offset in Stream where last read of 52 bytes took place
479 sal_uInt8 mnIdx
; // Pos-Merker
481 sal_uInt8 mnIMax
; // Anzahl der Eintraege
483 wwSprmParser maSprmParser
;
485 //Fill in an Entry with sanity testing
486 void FillEntry(Entry
&rEntry
, sal_Size nDataOffset
, sal_uInt16 nLen
);
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 long GetFilePos() const { return nFilePos
; }
493 sal_uInt8
GetIdx() const { return mnIdx
; }
494 bool SetIdx(sal_uInt8 nI
);
495 bool SeekPos(WW8_FC nFc
);
498 return (mnIdx
< mnIMax
) ? maEntries
[mnIdx
].mnFC
: WW8_FC_MAX
;
505 sal_uInt8
* Get( WW8_FC
& rStart
, WW8_FC
& rEnd
, sal_Int32
& rLen
) const;
506 sal_uInt16
GetIstd() const { return maEntries
[mnIdx
].mnIStd
; }
509 liefert einen echten Pointer auf das Sprm vom Typ nId,
510 falls ein solches im Fkp drin ist.
512 sal_uInt8
* GetLenAndIStdAndSprms(sal_Int32
& rLen
) const;
515 ruft GetLenAndIStdAndSprms() auf...
517 const sal_uInt8
* HasSprm( sal_uInt16 nId
);
518 bool HasSprm(sal_uInt16 nId
, std::vector
<const sal_uInt8
*> &rResult
);
520 const wwSprmParser
&GetSprmParser() const { return maSprmParser
; }
523 SvStream
* pFKPStrm
; // Input-File
524 SvStream
* pDataStrm
; // Input-File
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
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
540 typedef std::list
<WW8Fkp
*>::iterator myiter
;
541 std::list
<WW8Fkp
*> maFkpCache
;
542 enum Limits
{eMaxCache
= 5};
547 WW8PLCFx_Fc_FKP(const WW8PLCFx_Fc_FKP
&);
548 WW8PLCFx_Fc_FKP
& operator=(const WW8PLCFx_Fc_FKP
&);
551 WW8PLCFx_PCDAttrs
* pPCDAttrs
;
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 bool HasFkp() const { return (0 != pFkp
); }
569 /// Iterator fuer Piece Table Exceptions of Fkps arbeitet auf CPs (High-Level)
570 class WW8PLCFx_Cp_FKP
: public WW8PLCFx_Fc_FKP
573 const WW8ScannerBase
& rSBase
;
575 WW8PLCFpcd_Iter
*pPieceIter
;
576 WW8_CP nAttrStart
, nAttrEnd
;
577 sal_uInt8 bLineEnd
: 1;
578 sal_uInt8 bComplex
: 1;
581 WW8PLCFx_Cp_FKP(const WW8PLCFx_Cp_FKP
&);
582 WW8PLCFx_Cp_FKP
& operator=(const WW8PLCFx_Cp_FKP
&);
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
);
601 /// Iterator for Piece Table Exceptions of Sepx
602 class WW8PLCFx_SEPX
: public WW8PLCFx
605 wwSprmParser maSprmParser
;
613 WW8PLCFx_SEPX(const WW8PLCFx_SEPX
&);
614 WW8PLCFx_SEPX
& operator=(const WW8PLCFx_SEPX
&);
616 WW8PLCFx_SEPX( SvStream
* pSt
, SvStream
* pTblxySt
, const WW8Fib
& rFib
,
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;
634 /// Iterator fuer Fuss-/Endnoten und Anmerkungen
635 class WW8PLCFx_SubDoc
: public WW8PLCFx
642 WW8PLCFx_SubDoc(const WW8PLCFx_SubDoc
&);
643 WW8PLCFx_SubDoc
& operator=(const WW8PLCFx_SubDoc
&);
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();
653 // liefert Reference Descriptoren
654 const void* GetData( long nIdx
= -1 ) const
656 return pRef
? pRef
->GetData( -1L == nIdx
? pRef
->GetIdx() : nIdx
) : 0;
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 long Count() const { return ( pRef
) ? pRef
->GetIMax() : 0; }
666 /// Iterator for fields
667 class WW8PLCFx_FLD
: public WW8PLCFx
670 WW8PLCFspecial
* pPLCF
;
673 WW8PLCFx_FLD(const WW8PLCFx_FLD
&);
674 WW8PLCFx_FLD
& operator=(const WW8PLCFx_FLD
&);
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
);
689 enum eBookStatus
{ BOOK_NORMAL
= 0, BOOK_IGNORE
= 0x1, BOOK_FIELD
= 0x2 };
691 /// Iterator for Booknotes
692 class WW8PLCFx_Book
: public WW8PLCFx
695 WW8PLCFspecial
* pBook
[2]; // Start and End Position
696 ::std::vector
<String
> aBookNames
; // Name
697 eBookStatus
* pStatus
;
698 long nIMax
; // Number of Booknotes
700 sal_Int32 nBookmarkId
; // counter incremented by GetUniqueBookmarkName.
703 WW8PLCFx_Book(const WW8PLCFx_Book
&);
704 WW8PLCFx_Book
& operator=(const WW8PLCFx_Book
&);
706 WW8PLCFx_Book(SvStream
* pTblSt
,const WW8Fib
& rFib
);
707 virtual ~WW8PLCFx_Book();
708 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 WW8_CP
GetStartPos() const
719 { return ( nIsEnd
) ? WW8_CP_MAX
: pBook
[0]->Where(); }
721 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 OUString
GetUniqueBookmarkName(const OUString
&rSuggestedName
);
731 hiermit arbeiten wir draussen:
733 struct WW8PLCFManResult
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
748 MAN_MASK_NEW_PAP
= 1, // neue Zeile
749 MAN_MASK_NEW_SEP
= 2 // neue Section
752 enum ManTypes
// enums for PLCFMan-ctor
754 MAN_MAINTEXT
= 0, MAN_FTN
= 1, MAN_EDN
= 2, MAN_HDFT
= 3, MAN_AND
= 4,
755 MAN_TXBX
= 5, MAN_TXBX_HDFT
= 6
759 hiermit arbeitet der Manager drinnen:
764 ::std::stack
<sal_uInt16
>* pIdStk
; // Speicher fuer Attr-Id fuer Attr-Ende(n)
765 const sal_uInt8
* pMemPos
;// wo liegen die Sprm(s)
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
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
797 , nStartPos(WW8_CP_MAX
)
798 , nEndPos(WW8_CP_MAX
)
799 , nOrigStartPos(WW8_CP_MAX
)
800 , nOrigEndPos(WW8_CP_MAX
)
801 , nCp2OrIdx(WW8_CP_MAX
)
805 , bRealLineEnd(false)
808 void ReduceByOffset();
813 struct WW8PLCFxSaveAll
;
817 enum WW8PLCFManLimits
{MAN_ANZ_PLCF
= 10};
819 wwSprmParser maSprmParser
;
820 long nCpO
; // Origin Cp -- the basis for nNewCp
822 WW8_CP nLineEnd
; // zeigt *hinter* das <CR>
823 long nLastWhereIdxCp
; // last result of WhereIdx()
824 sal_uInt16 nPLCF
; // so viele PLCFe werden verwaltet
826 bool mbDoingDrawTextBox
; //Normally we adjust the end of attributes
827 //so that the end of a paragraph occurs
828 //before the para end mark, but for
829 //drawboxes we want the true offsets
831 WW8PLCFxDesc aD
[MAN_ANZ_PLCF
];
832 WW8PLCFxDesc
*pChp
, *pPap
, *pSep
, *pFld
, *pFtn
, *pEdn
, *pBkm
, *pPcd
,
834 WW8PLCFspecial
*pFdoa
, *pTxbx
, *pTxbxBkd
,*pMagicTables
, *pSubdocs
;
835 sal_uInt8
* pExtendedAtrds
;
837 const WW8Fib
* pWwFib
;
839 sal_uInt16
WhereIdx(bool* pbStart
=0, long* pPos
=0) const;
840 void AdjustEnds(WW8PLCFxDesc
& rDesc
);
841 void GetNewSprms(WW8PLCFxDesc
& rDesc
);
842 void GetNewNoSprms(WW8PLCFxDesc
& rDesc
);
843 void GetSprmStart(short nIdx
, WW8PLCFManResult
* pRes
) const;
844 void GetSprmEnd(short nIdx
, WW8PLCFManResult
* pRes
) const;
845 void GetNoSprmStart(short nIdx
, WW8PLCFManResult
* pRes
) const;
846 void GetNoSprmEnd(short nIdx
, WW8PLCFManResult
* pRes
) const;
847 void AdvSprm(short nIdx
, bool bStart
);
848 void AdvNoSprm(short nIdx
, bool bStart
);
849 sal_uInt16
GetId(const WW8PLCFxDesc
* p
) const;
851 WW8PLCFMan(WW8ScannerBase
* pBase
, ManTypes nType
, long nStartCp
,
852 bool bDoingDrawTextBox
= false);
856 Where fragt, an welcher naechsten Position sich irgendein
859 WW8_CP
Where() const;
861 bool Get(WW8PLCFManResult
* pResult
) const;
863 sal_uInt16
GetColl() const; // index of actual Style
864 WW8PLCFx_FLD
* GetFld() const;
865 WW8PLCFx_SubDoc
* GetEdn() const { return (WW8PLCFx_SubDoc
*)pEdn
->pPLCFx
; }
866 WW8PLCFx_SubDoc
* GetFtn() const { return (WW8PLCFx_SubDoc
*)pFtn
->pPLCFx
; }
867 WW8PLCFx_SubDoc
* GetAtn() const { return (WW8PLCFx_SubDoc
*)pAnd
->pPLCFx
; }
868 WW8PLCFx_Book
* GetBook() const { return (WW8PLCFx_Book
*)pBkm
->pPLCFx
; }
869 long GetCpOfs() const { return pChp
->nCpOfs
; } // for Header/Footer...
871 /* fragt, ob *aktueller Absatz* einen Sprm diesen Typs hat */
872 const sal_uInt8
* HasParaSprm( sal_uInt16 nId
) const;
874 /* fragt, ob *aktueller Textrun* einen Sprm diesen Typs hat */
875 const sal_uInt8
* HasCharSprm( sal_uInt16 nId
) const;
876 bool HasCharSprm(sal_uInt16 nId
, std::vector
<const sal_uInt8
*> &rResult
) const;
878 WW8PLCFx_Cp_FKP
* GetChpPLCF() const
879 { return (WW8PLCFx_Cp_FKP
*)pChp
->pPLCFx
; }
880 WW8PLCFx_Cp_FKP
* GetPapPLCF() const
881 { return (WW8PLCFx_Cp_FKP
*)pPap
->pPLCFx
; }
882 WW8PLCFx_SEPX
* GetSepPLCF() const
883 { return (WW8PLCFx_SEPX
*)pSep
->pPLCFx
; }
884 WW8PLCFxDesc
* GetPap() const { return pPap
; }
885 bool TransferOpenSprms(std::stack
<sal_uInt16
> &rStack
);
886 void SeekPos( long nNewCp
);
887 void SaveAllPLCFx( WW8PLCFxSaveAll
& rSave
) const;
888 void RestoreAllPLCFx( const WW8PLCFxSaveAll
& rSave
);
889 WW8PLCFspecial
* GetFdoa() const { return pFdoa
; }
890 WW8PLCFspecial
* GetTxbx() const { return pTxbx
; }
891 WW8PLCFspecial
* GetTxbxBkd() const { return pTxbxBkd
; }
892 WW8PLCFspecial
* GetMagicTables() const { return pMagicTables
; }
893 WW8PLCFspecial
* GetWkbPLCF() const { return pSubdocs
; }
894 sal_uInt8
* GetExtendedAtrds() const { return pExtendedAtrds
; }
895 ManTypes
GetManType() const { return nManType
; }
896 bool GetDoingDrawTextBox() const { return mbDoingDrawTextBox
; }
899 struct WW8PLCFxSaveAll
901 WW8PLCFxSave1 aS
[WW8PLCFMan::MAN_ANZ_PLCF
];
908 friend WW8PLCFx_PCDAttrs::WW8PLCFx_PCDAttrs(ww::WordVersion eVersion
,
909 WW8PLCFx_PCD
* pPLCFx_PCD
, const WW8ScannerBase
* pBase
);
910 friend WW8PLCFx_Cp_FKP::WW8PLCFx_Cp_FKP( SvStream
*, SvStream
*, SvStream
*,
911 const WW8ScannerBase
&, ePLCFT
);
914 friend WW8PLCFMan::WW8PLCFMan(WW8ScannerBase
*, ManTypes
, long, bool);
915 friend class SwWW8FltControlStack
;
920 WW8PLCFx_Cp_FKP
* pChpPLCF
; // Character-Attrs
921 WW8PLCFx_Cp_FKP
* pPapPLCF
; // Para-Attrs
922 WW8PLCFx_SEPX
* pSepPLCF
; // Section-Attrs
923 WW8PLCFx_SubDoc
* pFtnPLCF
; // Footnotes
924 WW8PLCFx_SubDoc
* pEdnPLCF
; // EndNotes
925 WW8PLCFx_SubDoc
* pAndPLCF
; // Anmerkungen
926 WW8PLCFx_FLD
* pFldPLCF
; // Fields in Main Text
927 WW8PLCFx_FLD
* pFldHdFtPLCF
; // Fields in Header / Footer
928 WW8PLCFx_FLD
* pFldTxbxPLCF
; // Fields in Textboxes in Main Text
929 WW8PLCFx_FLD
* pFldTxbxHdFtPLCF
; // Fields in Textboxes in Header / Footer
930 WW8PLCFx_FLD
* pFldFtnPLCF
; // Fields in Footnotes
931 WW8PLCFx_FLD
* pFldEdnPLCF
; // Fields in Endnotes
932 WW8PLCFx_FLD
* pFldAndPLCF
; // Fields in Anmerkungen
933 WW8PLCFspecial
* pMainFdoa
; // Graphic Primitives in Main Text
934 WW8PLCFspecial
* pHdFtFdoa
; // Graphic Primitives in Header / Footer
935 WW8PLCFspecial
* pMainTxbx
; // Textboxen in Main Text
936 WW8PLCFspecial
* pMainTxbxBkd
; // Break-Deskriptoren fuer diese
937 WW8PLCFspecial
* pHdFtTxbx
; // TextBoxen in Header / Footer
938 WW8PLCFspecial
* pHdFtTxbxBkd
; // Break-Deskriptoren fuer diese
939 WW8PLCFspecial
* pMagicTables
; // Break-Deskriptoren fuer diese
940 WW8PLCFspecial
* pSubdocs
; // subdoc references in master document
941 sal_uInt8
* pExtendedAtrds
; // Extended ATRDs
942 WW8PLCFx_Book
* pBook
; // Bookmarks
944 WW8PLCFpcd
* pPiecePLCF
; // fuer FastSave ( Basis-PLCF ohne Iterator )
945 WW8PLCFpcd_Iter
* pPieceIter
; // fuer FastSave ( Iterator dazu )
946 WW8PLCFx_PCD
* pPLCFx_PCD
; // dito
947 WW8PLCFx_PCDAttrs
* pPLCFx_PCDAttrs
;
948 sal_uInt8
** pPieceGrpprls
; // Attribute an Piece-Table
949 sal_uInt16 nPieceGrpprls
; // Anzahl davon
951 WW8PLCFpcd
* OpenPieceTable( SvStream
* pStr
, const WW8Fib
* pWwF
);
952 void DeletePieceTable();
954 WW8ScannerBase( SvStream
* pSt
, SvStream
* pTblSt
, SvStream
* pDataSt
,
957 bool AreThereFootnotes() const { return pFtnPLCF
->Count() > 0; };
958 bool AreThereEndnotes() const { return pEdnPLCF
->Count() > 0; };
960 //If you use WW8Fc2Cp you are almost certainly doing the wrong thing
961 //when it comes to fastsaved files, avoid like the plague. For export
962 //given that we never write fastsaved files you can use it, otherwise
963 //I will beat you with a stick
964 WW8_CP
WW8Fc2Cp(WW8_FC nFcPos
) const ;
965 WW8_FC
WW8Cp2Fc(WW8_CP nCpPos
, bool* pIsUnicode
= 0,
966 WW8_CP
* pNextPieceCp
= 0, bool* pTestFlag
= 0) const;
968 xub_StrLen
WW8ReadString(SvStream
& rStrm
, String
& rStr
, WW8_CP nAktStartCp
,
969 long nTotalLen
, rtl_TextEncoding eEnc
) const;
973 /** FIB - the File Information Block
975 The FIB contains a "magic word" and pointers to the various other parts of
976 the file, as well as information about the length of the file.
977 The FIB starts at the beginning of the file.
982 sal_Unicode nNumDecimalSep
;
986 Program-Version asked for by us:
987 in Ctor we check if it matches the value of nFib
989 6 == "WinWord 6 or WinWord 95",
990 7 == "only WinWord 95"
991 8 == "WinWord 97 or newer"
999 vom Ctor aus dem FIB gelesene Daten
1000 (entspricht nur ungefaehr der tatsaechlichen Struktur
1003 sal_uInt16 wIdent
; // 0x0 int magic number
1005 File Information Block (FIB) values:
1008 WinWord 6.0c for 16bit = 101
1017 sal_uInt16 nFib
; // 0x2 FIB version written
1018 sal_uInt16 nProduct
; // 0x4 product version written by
1019 sal_Int16 lid
; // 0x6 language stamp---localized version;
1020 WW8_PN pnNext
; // 0x8
1022 sal_uInt16 fDot
:1; // 0xa 0001
1023 sal_uInt16 fGlsy
:1;
1024 sal_uInt16 fComplex
:1; // 0004 when 1, file is in complex, fast-saved format.
1025 sal_uInt16 fHasPic
:1; // 0008 file contains 1 or more pictures
1026 sal_uInt16 cQuickSaves
:4; // 00F0 count of times file was quicksaved
1027 sal_uInt16 fEncrypted
:1; //0100 1 if file is encrypted, 0 if not
1028 sal_uInt16 fWhichTblStm
:1; //0200 When 0, this fib refers to the table stream
1029 sal_uInt16 fReadOnlyRecommended
:1;
1030 sal_uInt16 fWriteReservation
:1;
1031 // named "0Table", when 1, this fib refers to the
1032 // table stream named "1Table". Normally, a file
1033 // will have only one table stream, but under unusual
1034 // circumstances a file may have table streams with
1035 // both names. In that case, this flag must be used
1036 // to decide which table stream is valid.
1038 sal_uInt16 fExtChar
:1; // 1000 =1, when using extended character set in file
1039 sal_uInt16 fFarEast
:1; // 4000 =1, probably, when far-East language vaiants of Word is used to create a file #i90932#
1041 sal_uInt16 fObfuscated
:1; // 8000=1. specifies whether the document is obfuscated using XOR obfuscation. otherwise this bit MUST be ignored.
1043 sal_uInt16 nFibBack
; // 0xc
1044 sal_uInt16 nHash
; // 0xe file encrypted hash
1045 sal_uInt16 nKey
; // 0x10 file encrypted key
1046 sal_uInt8 envr
; // 0x12 environment in which file was created
1047 // 0 created by Win Word / 1 created by Mac Word
1048 sal_uInt8 fMac
:1; // 0x13 when 1, this file was last saved in the Mac environment
1049 sal_uInt8 fEmptySpecial
:1;
1050 sal_uInt8 fLoadOverridePage
:1;
1051 sal_uInt8 fFuturesavedUndo
:1;
1052 sal_uInt8 fWord97Saved
:1;
1053 sal_uInt8 fWord2000Saved
:1;
1056 sal_uInt16 chse
; // 0x14 default extended character set id for text in document stream. (overidden by chp.chse)
1057 // 0 = ANSI / 256 Macintosh character set.
1058 sal_uInt16 chseTables
; // 0x16 default extended character set id for text in
1059 // internal data structures: 0 = ANSI, 256 = Macintosh
1060 WW8_FC fcMin
; // 0x18 file offset of first character of text
1061 WW8_FC fcMac
; // 0x1c file offset of last character of text + 1
1063 // Einschub fuer WW8 *****************************************************
1064 sal_uInt16 csw
; // Count of fields in the array of "shorts"
1066 // Marke: "rgsw" Beginning of the array of shorts
1067 sal_uInt16 wMagicCreated
; // unique number Identifying the File's creator
1068 // 0x6A62 is the creator ID for Word and is reserved.
1069 // Other creators should choose a different value.
1070 sal_uInt16 wMagicRevised
; // identifies the File's last modifier
1071 sal_uInt16 wMagicCreatedPrivate
; // private data
1072 sal_uInt16 wMagicRevisedPrivate
; // private data
1074 sal_Int16 pnFbpChpFirst_W6; // not used
1075 sal_Int16 pnChpFirst_W6; // not used
1076 sal_Int16 cpnBteChp_W6; // not used
1077 sal_Int16 pnFbpPapFirst_W6; // not used
1078 sal_Int16 pnPapFirst_W6; // not used
1079 sal_Int16 cpnBtePap_W6; // not used
1080 sal_Int16 pnFbpLvcFirst_W6; // not used
1081 sal_Int16 pnLvcFirst_W6; // not used
1082 sal_Int16 cpnBteLvc_W6; // not used
1084 sal_Int16 lidFE
; // Language id if document was written by Far East version
1085 // of Word (i.e. FIB.fFarEast is on)
1086 sal_uInt16 clw
; // Number of fields in the array of longs
1088 // Ende des Einschubs fuer WW8 *******************************************
1090 // Marke: "rglw" Beginning of the array of longs
1091 WW8_FC cbMac
; // 0x20 file offset of last byte written to file + 1.
1093 // WW8_FC u4[4]; // 0x24
1094 WW8_CP ccpText
; // 0x34 length of main document text stream
1095 WW8_CP ccpFtn
; // 0x38 length of footnote subdocument text stream
1096 WW8_CP ccpHdr
; // 0x3c length of header subdocument text stream
1097 WW8_CP ccpMcr
; // 0x40 length of macro subdocument text stream
1098 WW8_CP ccpAtn
; // 0x44 length of annotation subdocument text stream
1099 WW8_CP ccpEdn
; // 0x48 length of endnote subdocument text stream
1100 WW8_CP ccpTxbx
; // 0x4c length of textbox subdocument text stream
1101 WW8_CP ccpHdrTxbx
; // 0x50 length of header textbox subdocument text stream
1103 // Einschub fuer WW8 *****************************************************
1104 sal_Int32 pnFbpChpFirst
; // when there was insufficient memory for Word to expand
1105 // the PLCFbte at save time, the PLCFbte is written
1106 // to the file in a linked list of 512-byte pieces
1107 // starting with this pn.
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 pnChpFirst; // the page number of the lowest numbered page in the
1113 // document that records CHPX FKP information
1114 sal_Int32 cpnBteChp; // count of CHPX FKPs recorded in file. In non-complex
1115 // files if the number of entries in the PLCFbteChpx
1116 // is less than this, the PLCFbteChpx is incomplete.
1118 sal_Int32 pnFbpPapFirst
; // 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
1123 // folgende Felder existieren zwar so in der Datei,
1124 // wir benutzen jedoch unten deklarierte General-Variablen
1125 // fuer Ver67 und Ver8 gemeinsam.
1126 sal_Int32 pnPapFirst; // the page number of the lowest numbered page in the
1127 // document that records PAPX FKP information
1128 sal_Int32 cpnBtePap; // count of PAPX FKPs recorded in file. In non-complex
1129 // files if the number of entries in the PLCFbtePapx is
1130 // less than this, the PLCFbtePapx is incomplete.
1132 sal_Int32 pnFbpLvcFirst
; // when there was insufficient memory for Word to expand
1133 // the PLCFbte at save time, the PLCFbte is written to
1134 // the file in a linked list of 512-byte pieces
1135 // starting with this pn
1136 sal_Int32 pnLvcFirst
; // the page number of the lowest numbered page in the
1137 // document that records LVC FKP information
1138 sal_Int32 cpnBteLvc
; // count of LVC FKPs recorded in file. In non-complex
1139 // files if the number of entries in the PLCFbtePapx is
1140 // less than this, the PLCFbtePapx is incomplete.
1141 sal_Int32 fcIslandFirst
; // ?
1142 sal_Int32 fcIslandLim
; // ?
1143 sal_uInt16 cfclcb
; // Number of fields in the array of FC/LCB pairs.
1145 // Ende des Einschubs fuer WW8 *******************************************
1147 // Marke: "rgfclcb" Beginning of array of FC/LCB pairs.
1148 WW8_FC fcStshfOrig
; // file offset of original allocation for STSH in table
1149 // stream. During fast save Word will attempt to reuse
1150 // this allocation if STSH is small enough to fit.
1151 sal_Int32 lcbStshfOrig
; // 0x5c count of bytes of original STSH allocation
1152 WW8_FC fcStshf
; // 0x60 file offset of STSH in file.
1153 sal_Int32 lcbStshf
; // 0x64 count of bytes of current STSH allocation
1154 WW8_FC fcPlcffndRef
; // 0x68 file offset of footnote reference PLCF.
1155 sal_Int32 lcbPlcffndRef
; // 0x6c count of bytes of footnote reference PLCF
1156 // == 0 if no footnotes defined in document.
1158 WW8_FC fcPlcffndTxt
; // 0x70 file offset of footnote text PLCF.
1159 sal_Int32 lcbPlcffndTxt
; // 0x74 count of bytes of footnote text PLCF.
1160 // == 0 if no footnotes defined in document
1162 WW8_FC fcPlcfandRef
; // 0x78 file offset of annotation reference PLCF.
1163 sal_Int32 lcbPlcfandRef
; // 0x7c count of bytes of annotation reference PLCF.
1165 WW8_FC fcPlcfandTxt
; // 0x80 file offset of annotation text PLCF.
1166 sal_Int32 lcbPlcfandTxt
; // 0x84 count of bytes of the annotation text PLCF
1168 WW8_FC fcPlcfsed
; // 8x88 file offset of section descriptor PLCF.
1169 sal_Int32 lcbPlcfsed
; // 0x8c count of bytes of section descriptor PLCF.
1171 WW8_FC fcPlcfpad
; // 0x90 file offset of paragraph descriptor PLCF
1172 sal_Int32 lcbPlcfpad
; // 0x94 count of bytes of paragraph descriptor PLCF.
1173 // ==0 if file was never viewed in Outline view.
1174 // Should not be written by third party creators
1176 WW8_FC fcPlcfphe
; // 0x98 file offset of PLCF of paragraph heights.
1177 sal_Int32 lcbPlcfphe
; // 0x9c count of bytes of paragraph height PLCF.
1178 // ==0 when file is non-complex.
1180 WW8_FC fcSttbfglsy
; // 0xa0 file offset of glossary string table.
1181 sal_Int32 lcbSttbfglsy
; // 0xa4 count of bytes of glossary string table.
1182 // == 0 for non-glossary documents.
1183 // !=0 for glossary documents.
1185 WW8_FC fcPlcfglsy
; // 0xa8 file offset of glossary PLCF.
1186 sal_Int32 lcbPlcfglsy
; // 0xac count of bytes of glossary PLCF.
1187 // == 0 for non-glossary documents.
1188 // !=0 for glossary documents.
1190 WW8_FC fcPlcfhdd
; // 0xb0 byte offset of header PLCF.
1191 sal_Int32 lcbPlcfhdd
; // 0xb4 count of bytes of header PLCF.
1192 // == 0 if document contains no headers
1194 WW8_FC fcPlcfbteChpx
; // 0xb8 file offset of character property bin table.PLCF.
1195 sal_Int32 lcbPlcfbteChpx
;// 0xbc count of bytes of character property bin table PLCF.
1197 WW8_FC fcPlcfbtePapx
; // 0xc0 file offset of paragraph property bin table.PLCF.
1198 sal_Int32 lcbPlcfbtePapx
;// 0xc4 count of bytes of paragraph property bin table PLCF.
1200 WW8_FC fcPlcfsea
; // 0xc8 file offset of PLCF reserved for private use. The SEA is 6 bytes long.
1201 sal_Int32 lcbPlcfsea
; // 0xcc count of bytes of private use PLCF.
1203 WW8_FC fcSttbfffn
; // 0xd0 file offset of font information STTBF. See the FFN file structure definition.
1204 sal_Int32 lcbSttbfffn
; // 0xd4 count of bytes in sttbfffn.
1206 WW8_FC fcPlcffldMom
; // 0xd8 offset in doc stream to the PLCF of field positions in the main document.
1207 sal_Int32 lcbPlcffldMom
; // 0xdc
1209 WW8_FC fcPlcffldHdr
; // 0xe0 offset in doc stream to the PLCF of field positions in the header subdocument.
1210 sal_Int32 lcbPlcffldHdr
; // 0xe4
1212 WW8_FC fcPlcffldFtn
; // 0xe8 offset in doc stream to the PLCF of field positions in the footnote subdocument.
1213 sal_Int32 lcbPlcffldFtn
; // 0xec
1215 WW8_FC fcPlcffldAtn
; // 0xf0 offset in doc stream to the PLCF of field positions in the annotation subdocument.
1216 sal_Int32 lcbPlcffldAtn
; // 0xf4
1218 WW8_FC fcPlcffldMcr
; // 0xf8 offset in doc stream to the PLCF of field positions in the macro subdocument.
1219 sal_Int32 lcbPlcffldMcr
; // 9xfc
1221 WW8_FC fcSttbfbkmk
; // 0x100 offset in document stream of the STTBF that records bookmark names in the main document
1222 sal_Int32 lcbSttbfbkmk
; // 0x104
1224 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
1225 sal_Int32 lcbPlcfbkf
; // 0x10c
1227 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.
1228 sal_Int32 lcbPlcfbkl
; // 0x114 sal_Int32
1230 WW8_FC fcCmds
; // 0x118 FC
1231 sal_Int32 lcbCmds
; // 0x11c
1233 WW8_FC fcPlcfmcr
; // 0x120 FC
1234 sal_Int32 lcbPlcfmcr
; // 0x124
1236 WW8_FC fcSttbfmcr
; // 0x128 FC
1237 sal_Int32 lcbSttbfmcr
; // 0x12c
1239 WW8_FC fcPrDrvr
; // 0x130 file offset of the printer driver information (names of drivers, port etc...)
1240 sal_Int32 lcbPrDrvr
; // 0x134 count of bytes of the printer driver information (names of drivers, port etc...)
1242 WW8_FC fcPrEnvPort
; // 0x138 file offset of the print environment in portrait mode.
1243 sal_Int32 lcbPrEnvPort
; // 0x13c count of bytes of the print environment in portrait mode.
1245 WW8_FC fcPrEnvLand
; // 0x140 file offset of the print environment in landscape mode.
1246 sal_Int32 lcbPrEnvLand
; // 0x144 count of bytes of the print environment in landscape mode.
1248 WW8_FC fcWss
; // 0x148 file offset of Window Save State data structure. See WSS.
1249 sal_Int32 lcbWss
; // 0x14c count of bytes of WSS. ==0 if unable to store the window state.
1251 WW8_FC fcDop
; // 0x150 file offset of document property data structure.
1252 sal_uInt32 lcbDop
; // 0x154 count of bytes of document properties.
1253 // cbDOP is 84 when nFib < 103
1256 WW8_FC fcSttbfAssoc
; // 0x158 offset to STTBF of associated strings. See STTBFASSOC.
1257 sal_Int32 lcbSttbfAssoc
; // 0x15C
1259 WW8_FC fcClx
; // 0x160 file offset of beginning of information for complex files.
1260 sal_Int32 lcbClx
; // 0x164 count of bytes of complex file information. 0 if file is non-complex.
1262 WW8_FC fcPlcfpgdFtn
; // 0x168 file offset of page descriptor PLCF for footnote subdocument.
1263 sal_Int32 lcbPlcfpgdFtn
; // 0x16C count of bytes of page descriptor PLCF for footnote subdocument.
1264 // ==0 if document has not been paginated. The length of the PGD is 8 bytes.
1266 WW8_FC fcAutosaveSource
; // 0x170 file offset of the name of the original file.
1267 sal_Int32 lcbAutosaveSource
; // 0x174 count of bytes of the name of the original file.
1269 WW8_FC fcGrpStAtnOwners
; // 0x178 group of strings recording the names of the owners of annotations
1270 sal_Int32 lcbGrpStAtnOwners
; // 0x17C count of bytes of the group of strings
1272 WW8_FC fcSttbfAtnbkmk
; // 0x180 file offset of the sttbf that records names of bookmarks in the annotation subdocument
1273 sal_Int32 lcbSttbfAtnbkmk
; // 0x184 length in bytes of the sttbf that records names of bookmarks in the annotation subdocument
1275 // Einschubs fuer WW67 ***************************************************
1277 // sal_Int16 wSpare4Fib; // Reserve, muss hier nicht deklariert werden
1280 // folgende Felder existieren zwar so in der Datei,
1281 // wir benutzen jedoch unten deklarierte General-Variablen
1282 // fuer Ver67 und Ver8 gemeinsam.
1283 WW8_PN pnChpFirst; // the page number of the lowest numbered page in
1284 // the document that records CHPX FKP information
1285 WW8_PN pnPapFirst; // the page number of the lowest numbered page in
1286 // the document that records PAPX FKP information
1288 WW8_PN cpnBteChp; // count of CHPX FKPs recorded in file. In non-complex
1289 // files if the number of entries in the PLCFbteChpx is
1290 // less than this, the PLCFbteChpx is incomplete.
1291 WW8_PN cpnBtePap; // count of PAPX FKPs recorded in file. In non-complex
1292 // files if the number of entries in the PLCFbtePapx is
1293 // less than this, the PLCFbtePapx is incomplete.
1296 // Ende des Einschubs fuer WW67 ******************************************
1298 WW8_FC fcPlcfdoaMom
; // 0x192 file offset of the FDOA (drawn object) PLCF for main document.
1299 // ==0 if document has no drawn objects. The length of the FDOA is 6 bytes.
1301 sal_Int32 lcbPlcfdoaMom
; // 0x196 length in bytes of the FDOA PLCF of the main document
1303 WW8_FC fcPlcfdoaHdr
; // 0x19A file offset of the FDOA (drawn object) PLCF for the header document.
1304 // ==0 if document has no drawn objects. The length of the FDOA is 6 bytes.
1306 sal_Int32 lcbPlcfdoaHdr
; // 0x19E length in bytes of the FDOA PLCF of the header document
1309 WW8_FC fcPlcfspaMom
; // offset in table stream of the FSPA PLCF for main document.
1310 // == 0 if document has no office art objects
1311 // war in Ver67 nur leere Reserve
1312 sal_Int32 lcbPlcfspaMom
; // length in bytes of the FSPA PLCF of the main document
1313 // war in Ver67 nur leere Reserve
1314 WW8_FC fcPlcfspaHdr
; // offset in table stream of the FSPA PLCF for header document.
1315 // == 0 if document has no office art objects
1316 // war in Ver67 nur leere Reserve
1317 sal_Int32 lcbPlcfspaHdr
; // length in bytes of the FSPA PLCF of the header document
1318 // war in Ver67 nur leere Reserve
1320 WW8_FC fcPlcfAtnbkf
; // 0x1B2 file offset of BKF (bookmark first) PLCF of the annotation subdocument
1321 sal_Int32 lcbPlcfAtnbkf
; // 0x1B6 length in bytes of BKF (bookmark first) PLCF of the annotation subdocument
1323 WW8_FC fcPlcfAtnbkl
; // 0x1BA file offset of BKL (bookmark last) PLCF of the annotation subdocument
1324 sal_Int32 lcbPlcfAtnbkl
; // 0x1BE length in bytes of BKL (bookmark first) PLCF of the annotation subdocument
1326 WW8_FC fcPms
; // 0x1C2 file offset of PMS (Print Merge State) information block
1327 sal_Int32 lcbPMS
; // 0x1C6 length in bytes of PMS
1329 WW8_FC fcFormFldSttbf
; // 0x1CA file offset of form field Sttbf which contains strings used in form field dropdown controls
1330 sal_Int32 lcbFormFldSttbf
; // 0x1CE length in bytes of form field Sttbf
1332 WW8_FC fcPlcfendRef
; // 0x1D2 file offset of PLCFendRef which points to endnote references in the main document stream
1333 sal_Int32 lcbPlcfendRef
; // 0x1D6
1335 WW8_FC fcPlcfendTxt
; // 0x1DA file offset of PLCFendRef which points to endnote text in the endnote document
1336 // stream which corresponds with the PLCFendRef
1337 sal_Int32 lcbPlcfendTxt
; // 0x1DE
1339 WW8_FC fcPlcffldEdn
; // 0x1E2 offset to PLCF of field positions in the endnote subdoc
1340 sal_Int32 lcbPlcffldEdn
; // 0x1E6
1342 WW8_FC fcPlcfpgdEdn
; // 0x1EA offset to PLCF of page boundaries in the endnote subdoc.
1343 sal_Int32 lcbPlcfpgdEdn
; // 0x1EE
1346 WW8_FC fcDggInfo
; // offset in table stream of the office art object table data.
1347 // The format of office art object table data is found in a separate document.
1348 // war in Ver67 nur leere Reserve
1349 sal_Int32 lcbDggInfo
; // length in bytes of the office art object table data
1350 // war in Ver67 nur leere Reserve
1352 WW8_FC fcSttbfRMark
; // 0x1fa offset to STTBF that records the author abbreviations...
1353 sal_Int32 lcbSttbfRMark
; // 0x1fe
1354 WW8_FC fcSttbfCaption
; // 0x202 offset to STTBF that records caption titles...
1355 sal_Int32 lcbSttbfCaption
; // 0x206
1356 WW8_FC fcSttbAutoCaption
; // offset in table stream to the STTBF that records the object names and
1357 // indices into the caption STTBF for objects which get auto captions.
1358 sal_Int32 lcbSttbAutoCaption
; // 0x20e
1360 WW8_FC fcPlcfwkb
; // 0x212 offset to PLCF that describes the boundaries of contributing documents...
1361 sal_Int32 lcbPlcfwkb
; // 0x216
1363 WW8_FC fcPlcfspl
; // offset in table stream of PLCF (of SPLS structures) that records spell check state
1364 // war in Ver67 nur leere Reserve
1365 sal_Int32 lcbPlcfspl
; // war in Ver67 nur leere Reserve
1367 WW8_FC fcPlcftxbxTxt
; // 0x222 ...PLCF of beginning CP in the text box subdoc
1368 sal_Int32 lcbPlcftxbxTxt
; // 0x226
1369 WW8_FC fcPlcffldTxbx
; // 0x22a ...PLCF of field boundaries recorded in the textbox subdoc.
1370 sal_Int32 lcbPlcffldTxbx
; // 0x22e
1371 WW8_FC fcPlcfHdrtxbxTxt
;// 0x232 ...PLCF of beginning CP in the header text box subdoc
1372 sal_Int32 lcbPlcfHdrtxbxTxt
;// 0x236
1373 WW8_FC fcPlcffldHdrTxbx
;// 0x23a ...PLCF of field boundaries recorded in the header textbox subdoc.
1374 sal_Int32 lcbPlcffldHdrTxbx
;// 0x23e
1376 sal_uInt32 lcbStwUser
;
1378 sal_uInt32 lcbSttbttmbd
;
1380 WW8_FC fcSttbFnm
; // 0x02da offset in the table stream of masters subdocument names
1381 sal_Int32 lcbSttbFnm
; // 0x02de length
1384 spezielle Listenverwaltung fuer WW8
1386 WW8_FC fcPlcfLst
; // 0x02e2 offset in the table stream of list format information.
1387 sal_Int32 lcbPlcfLst
; // 0x02e6 length
1388 WW8_FC fcPlfLfo
; // 0x02ea offset in the table stream of list format override information.
1389 sal_Int32 lcbPlfLfo
; // 0x02ee length
1391 spezielle Break-Verwaltung fuer Text-Box-Stories in WW8
1393 WW8_FC fcPlcftxbxBkd
; // 0x02f2 PLCF fuer TextBox-Break-Deskriptoren im Maintext
1394 sal_Int32 lcbPlcftxbxBkd
; // 0x02f6
1395 WW8_FC fcPlcfHdrtxbxBkd
;// 0x02fa PLCF fuer TextBox-Break-Deskriptoren im Header-/Footer-Bereich
1396 sal_Int32 lcbPlcfHdrtxbxBkd
;// 0x02fe
1398 // 0x302 - 372 == ignore
1400 ListNames (skip to here!)
1402 WW8_FC fcSttbListNames
;// 0x0372 PLCF for Listname Table
1403 sal_Int32 lcbSttbListNames
;// 0x0376
1406 sal_Int32 lcbPlcfTch
;
1408 // 0x38A - 41A == ignore
1410 sal_uInt32 lcbAtrdExtra
;
1412 // 0x422 - 0x4D4 == ignore
1413 WW8_FC fcHplxsdr
; //bizarrely, word xp seems to require this set to shows dates from AtrdExtra
1414 sal_uInt32 lcbHplxsdr
;
1417 General-Varaiblen, die fuer Ver67 und Ver8 verwendet werden,
1418 obwohl sie in der jeweiligen DATEI verschiedene Groesse haben:
1420 sal_Int32 pnChpFirst
;
1421 sal_Int32 pnPapFirst
;
1422 sal_Int32 cpnBteChp
;
1423 sal_Int32 cpnBtePap
;
1425 The actual nFib, moved here because some readers assumed
1426 they couldn't read any format with nFib > some constant
1428 sal_uInt16 nFib_actual
; // 0x05bc #i56856#
1430 nun wird lediglich noch ein Ctor benoetigt
1432 WW8Fib( SvStream
& rStrm
, sal_uInt8 nWantedVersion
,sal_uInt32 nOffset
=0 );
1434 /* leider falsch, man braucht auch noch einen fuer den Export */
1435 WW8Fib( sal_uInt8 nVersion
= 6 );
1436 bool WriteHeader(SvStream
& rStrm
);
1437 bool Write(SvStream
& rStrm
);
1438 static rtl_TextEncoding
GetFIBCharset(sal_uInt16 chs
);
1439 ww::WordVersion
GetFIBVersion() const;
1440 WW8_CP
GetBaseCp(ManTypes nType
) const;
1441 sal_Unicode
getNumDecimalSep() const;
1450 sal_uInt16 cstd
; // Count of styles in stylesheet
1451 sal_uInt16 cbSTDBaseInFile
; // Length of STD Base as stored in a file
1452 sal_uInt16 fStdStylenamesWritten
: 1; // Are built-in stylenames stored?
1453 sal_uInt16
: 15; // Spare flags
1454 sal_uInt16 stiMaxWhenSaved
; // Max sti known when file was written
1455 sal_uInt16 istdMaxFixedWhenSaved
; // How many fixed-index istds are there?
1456 sal_uInt16 nVerBuiltInNamesWhenSaved
; // Current version of built-in stylenames
1457 // ftc used by StandardChpStsh for this document
1459 // CJK ftc used by StandardChpStsh for this document
1461 // CTL/Other ftc used by StandardChpStsh for this document
1462 sal_uInt16 ftcOther
;
1463 // CTL ftc used by StandardChpStsh for this document
1467 WW8Style(const WW8Style
&);
1468 WW8Style
& operator=(const WW8Style
&);
1470 WW8Style( SvStream
& rSt
, WW8Fib
& rFibPara
);
1471 WW8_STD
* Read1STDFixed( short& rSkip
, short* pcbStd
);
1472 WW8_STD
* Read1Style( short& rSkip
, String
* pString
, short* pcbStd
);
1473 sal_uInt16
GetCount() const { return cstd
; }
1479 WW8_FFN
* pFontA
; // Array of Pointers to Font Description
1480 sal_uInt16 nMax
; // Array-Size
1482 WW8Fonts( SvStream
& rSt
, WW8Fib
& rFib
);
1483 ~WW8Fonts() { delete[] pFontA
; }
1484 const WW8_FFN
* GetFont( sal_uInt16 nNum
) const;
1485 sal_uInt16
GetMax() const { return nMax
; }
1488 typedef sal_uInt8 HdFtFlags
;
1489 namespace nsHdFtFlags
1491 const HdFtFlags WW8_HEADER_EVEN
= 0x01;
1492 const HdFtFlags WW8_HEADER_ODD
= 0x02;
1493 const HdFtFlags WW8_FOOTER_EVEN
= 0x04;
1494 const HdFtFlags WW8_FOOTER_ODD
= 0x08;
1495 const HdFtFlags WW8_HEADER_FIRST
= 0x10;
1496 const HdFtFlags WW8_FOOTER_FIRST
= 0x20;
1499 /// Document Properties
1504 sal_uLong nDopError
;
1506 Corresponds only roughly to the actual structure of the Winword DOP,
1507 the winword FIB version matters to what exists.
1509 // Initialisier-Dummy:
1510 sal_uInt8 nDataStart
;
1511 //-------------------------
1512 sal_uInt16 fFacingPages
: 1; // 1 when facing pages should be printed
1513 sal_uInt16 fWidowControl
: 1; // 1 when widow control is in effect. 0 when widow control disabled.
1514 sal_uInt16 fPMHMainDoc
: 1; // 1 when doc is a main doc for Print Merge Helper, 0 when not; default=0
1515 sal_uInt16 grfSuppression
: 2; // 0 Default line suppression storage; 0= form letter line suppression; 1= no line suppression; default=0
1516 sal_uInt16 fpc
: 2; // 1 footnote position code: 0 as endnotes, 1 at bottom of page, 2 immediately beneath text
1517 sal_uInt16
: 1; // 0 unused
1518 //-------------------------
1519 sal_uInt16 grpfIhdt
: 8; // 0 specification of document headers and footers. See explanation under Headers and Footers topic.
1520 //-------------------------
1521 sal_uInt16 rncFtn
: 2; // 0 restart index for footnotes, 0 don't restart note numbering, 1 section, 2 page
1522 sal_uInt16 nFtn
: 14; // 1 initial footnote number for document
1523 sal_uInt16 fOutlineDirtySave
: 1; // when 1, indicates that information in the hPLCFpad should be refreshed since outline has been dirtied
1524 sal_uInt16
: 7; // reserved
1525 sal_uInt16 fOnlyMacPics
: 1; // when 1, Word believes all pictures recorded in the document were created on a Macintosh
1526 sal_uInt16 fOnlyWinPics
: 1; // when 1, Word believes all pictures recorded in the document were created in Windows
1527 sal_uInt16 fLabelDoc
: 1; // when 1, document was created as a print merge labels document
1528 sal_uInt16 fHyphCapitals
: 1; // when 1, Word is allowed to hyphenate words that are capitalized. When 0, capitalized may not be hyphenated
1529 sal_uInt16 fAutoHyphen
: 1; // when 1, Word will hyphenate newly typed text as a background task
1530 sal_uInt16 fFormNoFields
: 1;
1531 sal_uInt16 fLinkStyles
: 1; // when 1, Word will merge styles from its template
1532 sal_uInt16 fRevMarking
: 1; // when 1, Word will mark revisions as the document is edited
1533 sal_uInt16 fBackup
: 1; // always make backup when document saved when 1.
1534 sal_uInt16 fExactCWords
: 1;
1535 sal_uInt16 fPagHidden
: 1; //
1536 sal_uInt16 fPagResults
: 1;
1537 sal_uInt16 fLockAtn
: 1; // when 1, annotations are locked for editing
1538 sal_uInt16 fMirrorMargins
: 1; // swap margins on left/right pages when 1.
1539 sal_uInt16 fReadOnlyRecommended
: 1;// user has recommended that this doc be opened read-only when 1
1540 sal_uInt16 fDfltTrueType
: 1; // when 1, use TrueType fonts by default (flag obeyed only when doc was created by WinWord 2.x)
1541 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).
1542 sal_uInt16 fProtEnabled
: 1; // when 1, document is protected from edit operations
1543 sal_uInt16 fDispFormFldSel
: 1;// when 1, restrict selections to occur only within form fields
1544 sal_uInt16 fRMView
: 1; // when 1, show revision markings on screen
1545 sal_uInt16 fRMPrint
: 1; // when 1, print revision marks when document is printed
1546 sal_uInt16 fWriteReservation
: 1;
1547 sal_uInt16 fLockRev
: 1; // when 1, the current revision marking state is locked
1548 sal_uInt16 fEmbedFonts
: 1; // when 1, document contains embedded True Type fonts
1549 // compatability options
1550 sal_uInt16 copts_fNoTabForInd
: 1; // when 1, don�t add automatic tab stops for hanging indent
1551 sal_uInt16 copts_fNoSpaceRaiseLower
: 1; // when 1, don�t add extra space for raised or lowered characters
1552 sal_uInt16 copts_fSupressSpbfAfterPgBrk
: 1; // when 1, supress the paragraph Space Before and Space After options after a page break
1553 sal_uInt16 copts_fWrapTrailSpaces
: 1; // when 1, wrap trailing spaces at the end of a line to the next line
1554 sal_uInt16 copts_fMapPrintTextColor
: 1; // when 1, print colors as black on non-color printers
1555 sal_uInt16 copts_fNoColumnBalance
: 1; // when 1, don�t balance columns for Continuous Section starts
1556 sal_uInt16 copts_fConvMailMergeEsc
: 1;
1557 sal_uInt16 copts_fSupressTopSpacing
: 1; // when 1, supress extra line spacing at top of page
1558 sal_uInt16 copts_fOrigWordTableRules
: 1; // when 1, combine table borders like Word 5.x for the Macintosh
1559 sal_uInt16 copts_fTransparentMetafiles
: 1; // when 1, don�t blank area between metafile pictures
1560 sal_uInt16 copts_fShowBreaksInFrames
: 1; // when 1, show hard page or column breaks in frames
1561 sal_uInt16 copts_fSwapBordersFacingPgs
: 1; // when 1, swap left and right pages on odd facing pages
1562 sal_uInt16 copts_fExpShRtn
: 1; // when 1, expand character spaces on the line ending SHIFT+RETURN // #i56856#
1564 sal_Int16 dxaTab
; // 720 twips default tab width
1565 sal_uInt16 wSpare
; //
1566 sal_uInt16 dxaHotZ
; // width of hyphenation hot zone measured in twips
1567 sal_uInt16 cConsecHypLim
; // number of lines allowed to have consecutive hyphens
1568 sal_uInt16 wSpare2
; // reserved
1569 sal_Int32 dttmCreated
; // DTTM date and time document was created
1570 sal_Int32 dttmRevised
; // DTTM date and time document was last revised
1571 sal_Int32 dttmLastPrint
; // DTTM date and time document was last printed
1572 sal_Int16 nRevision
; // number of times document has been revised since its creation
1573 sal_Int32 tmEdited
; // time document was last edited
1574 sal_Int32 cWords
; // count of words tallied by last Word Count execution
1575 sal_Int32 cCh
; // count of characters tallied by last Word Count execution
1576 sal_Int16 cPg
; // count of pages tallied by last Word Count execution
1577 sal_Int32 cParas
; // count of paragraphs tallied by last Word Count execution
1578 sal_uInt16 rncEdn
: 2; // restart endnote number code: 0 don�t restart endnote numbering, 1 section, 2 page
1579 sal_uInt16 nEdn
: 14; // beginning endnote number
1580 sal_uInt16 epc
: 2; // endnote position code: 0 at end of section, 3 at end of document
1581 // sal_uInt16 nfcFtnRef : 4; // number format code for auto footnotes: 0 Arabic, 1 Upper case Roman, 2 Lower case Roman
1582 // 3 Upper case Letter, 4 Lower case Letter
1583 // ersetzt durch gleichlautendes Feld unten
1584 // sal_uInt16 nfcEdnRef : 4; // number format code for auto endnotes: 0 Arabic, 1 Upper case Roman, 2 Lower case Roman
1585 // 3 Upper case Letter, 4 Lower case Letter
1586 // ersetzt durch gleichlautendes Feld unten
1587 sal_uInt16 fPrintFormData
: 1; // only print data inside of form fields
1588 sal_uInt16 fSaveFormData
: 1; // only save document data that is inside of a form field.
1589 sal_uInt16 fShadeFormData
: 1; // shade form fields
1590 sal_uInt16
: 2; // reserved
1591 sal_uInt16 fWCFtnEdn
: 1; // when 1, include footnotes and endnotes in word count
1592 sal_Int32 cLines
; // count of lines tallied by last Word Count operation
1593 sal_Int32 cWordsFtnEnd
; // count of words in footnotes and endnotes tallied by last Word Count operation
1594 sal_Int32 cChFtnEdn
; // count of characters in footnotes and endnotes tallied by last Word Count operation
1595 sal_Int16 cPgFtnEdn
; // count of pages in footnotes and endnotes tallied by last Word Count operation
1596 sal_Int32 cParasFtnEdn
; // count of paragraphs in footnotes and endnotes tallied by last Word Count operation
1597 sal_Int32 cLinesFtnEdn
; // count of paragraphs in footnotes and endnotes tallied by last Word Count operation
1598 sal_Int32 lKeyProtDoc
; // document protection password key, only valid if dop.fProtEnabled, dop.fLockAtn or dop.fLockRev are 1.
1599 sal_uInt16 wvkSaved
: 3; // document view kind: 0 Normal view, 1 Outline view, 2 Page View
1600 sal_uInt16 wScaleSaved
: 9; ///< Specifies the zoom percentage that was in use when the document was saved.
1601 sal_uInt16 zkSaved
: 2;
1602 sal_uInt16 fRotateFontW6
: 1;
1603 sal_uInt16 iGutterPos
: 1 ;
1605 // hier sollte bei nFib < 103 Schluss sein, sonst ist Datei fehlerhaft!
1608 bei nFib >= 103 gehts weiter:
1610 sal_uInt32 fNoTabForInd
:1; // see above in compatability options
1611 sal_uInt32 fNoSpaceRaiseLower
:1; // see above
1612 sal_uInt32 fSupressSpbfAfterPageBreak
:1; // see above
1613 sal_uInt32 fWrapTrailSpaces
:1; // see above
1614 sal_uInt32 fMapPrintTextColor
:1; // see above
1615 sal_uInt32 fNoColumnBalance
:1; // see above
1616 sal_uInt32 fConvMailMergeEsc
:1; // see above
1617 sal_uInt32 fSupressTopSpacing
:1; // see above
1618 sal_uInt32 fOrigWordTableRules
:1; // see above
1619 sal_uInt32 fTransparentMetafiles
:1; // see above
1620 sal_uInt32 fShowBreaksInFrames
:1; // see above
1621 sal_uInt32 fSwapBordersFacingPgs
:1; // see above
1622 sal_uInt32 fCompatabilityOptions_Unknown1_13
:1; // #i78591#
1623 sal_uInt32 fExpShRtn
:1; // #i78591# and #i56856#
1624 sal_uInt32 fCompatabilityOptions_Unknown1_15
:1; // #i78591#
1625 sal_uInt32 fCompatabilityOptions_Unknown1_16
:1; // #i78591#
1626 sal_uInt32 fSuppressTopSpacingMac5
:1; // Suppress extra line spacing at top
1627 // of page like MacWord 5.x
1628 sal_uInt32 fTruncDxaExpand
:1; // Expand/Condense by whole number of points
1629 sal_uInt32 fPrintBodyBeforeHdr
:1; // Print body text before header/footer
1630 sal_uInt32 fNoLeading
:1; // Don't add extra spacebetween rows of text
1631 sal_uInt32 fCompatabilityOptions_Unknown1_21
:1; // #i78591#
1632 sal_uInt32 fMWSmallCaps
: 1; // Use larger small caps like MacWord 5.x
1633 sal_uInt32 fCompatabilityOptions_Unknown1_23
:1; // #i78591#
1634 sal_uInt32 fCompatabilityOptions_Unknown1_24
:1; // #i78591#
1635 sal_uInt32 fCompatabilityOptions_Unknown1_25
:1; // #i78591#
1636 sal_uInt32 fCompatabilityOptions_Unknown1_26
:1; // #i78591#
1637 sal_uInt32 fCompatabilityOptions_Unknown1_27
:1; // #i78591#
1638 sal_uInt32 fCompatabilityOptions_Unknown1_28
:1; // #i78591#
1639 sal_uInt32 fCompatabilityOptions_Unknown1_29
:1; // #i78591#
1640 sal_uInt32 fCompatabilityOptions_Unknown1_30
:1; // #i78591#
1641 sal_uInt32 fCompatabilityOptions_Unknown1_31
:1; // #i78591#
1642 sal_uInt32 fUsePrinterMetrics
: 1; //The magic option
1644 // hier sollte bei nFib <= 105 Schluss sein, sonst ist Datei fehlerhaft!
1647 bei nFib > 105 gehts weiter:
1649 sal_Int16 adt
; // Autoformat Document Type:
1651 // 1 for letter, and
1653 WW8DopTypography doptypography
; // see WW8STRUC.HXX
1654 WW8_DOGRID dogrid
; // see WW8STRUC.HXX
1655 sal_uInt16
:1; // reserved
1656 sal_uInt16 lvl
:4; // Which outline levels are showing in outline view
1657 sal_uInt16
:4; // reserved
1658 sal_uInt16 fHtmlDoc
:1; // This file is based upon an HTML file
1659 sal_uInt16
:1; // reserved
1660 sal_uInt16 fSnapBorder
:1; // Snap table and page borders to page border
1661 sal_uInt16 fIncludeHeader
:1; // Place header inside page border
1662 sal_uInt16 fIncludeFooter
:1; // Place footer inside page border
1663 sal_uInt16 fForcePageSizePag
:1; // Are we in online view
1664 sal_uInt16 fMinFontSizePag
:1; // Are we auto-promoting fonts to >= hpsZoonFontPag?
1665 sal_uInt16 fHaveVersions
:1; // versioning is turned on
1666 sal_uInt16 fAutoVersion
:1; // autoversioning is enabled
1667 sal_uInt16
: 14; // reserved
1668 // Skip 12 Bytes here: ASUMI
1670 sal_Int32 cChWSFtnEdn
;
1671 sal_Int32 grfDocEvents
;
1672 // Skip 4+30+8 Bytes here
1674 sal_Int32 cDBCFtnEdn
;
1675 // Skip 4 Bytes here
1676 sal_Int16 nfcFtnRef
;
1677 sal_Int16 nfcEdnRef
;
1678 sal_Int16 hpsZoonFontPag
;
1679 sal_Int16 dywDispPag
;
1681 sal_uInt32 fCompatabilityOptions_Unknown2_1
:1; // #i78591#
1682 sal_uInt32 fCompatabilityOptions_Unknown2_2
:1; // #i78591#
1683 sal_uInt32 fDontUseHTMLAutoSpacing
:1;
1684 sal_uInt32 fCompatabilityOptions_Unknown2_4
:1; // #i78591#
1685 sal_uInt32 fCompatabilityOptions_Unknown2_5
:1; // #i78591#
1686 sal_uInt32 fCompatabilityOptions_Unknown2_6
:1; // #i78591#
1687 sal_uInt32 fCompatabilityOptions_Unknown2_7
:1; // #i78591#
1688 sal_uInt32 fCompatabilityOptions_Unknown2_8
:1; // #i78591#
1689 sal_uInt32 fCompatabilityOptions_Unknown2_9
:1; // #i78591#
1690 sal_uInt32 fCompatabilityOptions_Unknown2_10
:1; // #i78591#
1691 sal_uInt32 fCompatabilityOptions_Unknown2_11
:1; // #i78591#
1692 sal_uInt32 fCompatabilityOptions_Unknown2_12
:1; // #i78591#
1693 sal_uInt32 fCompatabilityOptions_Unknown2_13
:1; // #i78591#
1694 sal_uInt32 fCompatabilityOptions_Unknown2_14
:1; // #i78591#
1695 sal_uInt32 fCompatabilityOptions_Unknown2_15
:1; // #i78591#
1696 sal_uInt32 fCompatabilityOptions_Unknown2_16
:1; // #i78591#
1697 sal_uInt32 fCompatabilityOptions_Unknown2_17
:1; // #i78591#
1698 sal_uInt32 fCompatabilityOptions_Unknown2_18
:1; // #i78591#
1699 sal_uInt32 fCompatabilityOptions_Unknown2_19
:1; // #i78591#
1700 sal_uInt32 fCompatabilityOptions_Unknown2_20
:1; // #i78591#
1701 sal_uInt32 fCompatabilityOptions_Unknown2_21
:1; // #i78591#
1702 sal_uInt32 fCompatabilityOptions_Unknown2_22
:1; // #i78591#
1703 sal_uInt32 fCompatabilityOptions_Unknown2_23
:1; // #i78591#
1704 sal_uInt32 fCompatabilityOptions_Unknown2_24
:1; // #i78591#
1705 sal_uInt32 fCompatabilityOptions_Unknown2_25
:1; // #i78591#
1706 sal_uInt32 fCompatabilityOptions_Unknown2_26
:1; // #i78591#
1707 sal_uInt32 fCompatabilityOptions_Unknown2_27
:1; // #i78591#
1708 sal_uInt32 fCompatabilityOptions_Unknown2_28
:1; // #i78591#
1709 sal_uInt32 fCompatabilityOptions_Unknown2_29
:1; // #i78591#
1710 sal_uInt32 fCompatabilityOptions_Unknown2_30
:1; // #i78591#
1711 sal_uInt32 fCompatabilityOptions_Unknown2_31
:1; // #i78591#
1712 sal_uInt32 fCompatabilityOptions_Unknown2_32
:1; // #i78591#
1714 sal_uInt16 fUnknown3
:15;
1715 sal_uInt16 fUseBackGroundInAllmodes
:1;
1717 sal_uInt16 fDoNotEmbedSystemFont
:1;
1718 sal_uInt16 fWordCompat
:1;
1719 sal_uInt16 fLiveRecover
:1;
1720 sal_uInt16 fEmbedFactoids
:1;
1721 sal_uInt16 fFactoidXML
:1;
1722 sal_uInt16 fFactoidAllDone
:1;
1723 sal_uInt16 fFolioPrint
:1;
1724 sal_uInt16 fReverseFolio
:1;
1725 sal_uInt16 iTextLineEnding
:3;
1726 sal_uInt16 fHideFcc
:1;
1727 sal_uInt16 fAcetateShowMarkup
:1;
1728 sal_uInt16 fAcetateShowAtn
:1;
1729 sal_uInt16 fAcetateShowInsDel
:1;
1730 sal_uInt16 fAcetateShowProps
:1;
1732 // 2. Initialisier-Dummy:
1735 bool bUseThaiLineBreakingRules
;
1737 /* Constructor for importing, needs to know the version of word used */
1738 WW8Dop(SvStream
& rSt
, sal_Int16 nFib
, sal_Int32 nPos
, sal_uInt32 nSize
);
1740 /* Constructs default DOP suitable for exporting */
1742 bool Write(SvStream
& rStrm
, WW8Fib
& rFib
) const;
1744 sal_uInt32
GetCompatabilityOptions() const;
1745 void SetCompatabilityOptions(sal_uInt32 a32Bit
);
1747 sal_uInt32
GetCompatabilityOptions2() const;
1748 void SetCompatabilityOptions2(sal_uInt32 a32Bit
);
1758 WW8PLCF_HdFt( SvStream
* pSt
, WW8Fib
& rFib
, WW8Dop
& rDop
);
1759 bool GetTextPos(sal_uInt8 grpfIhdt
, sal_uInt8 nWhich
, WW8_CP
& rStart
, long& rLen
);
1760 bool GetTextPosExact(short nIdx
, WW8_CP
& rStart
, long& rLen
);
1761 void UpdateIndex( sal_uInt8 grpfIhdt
);
1764 void SwapQuotesInField(String
&rFmt
);
1766 Word2CHPX
ReadWord2Chpx(SvStream
&rSt
, sal_Size nOffset
, sal_uInt8 nSize
);
1767 std::vector
<sal_uInt8
> ChpxToSprms(const Word2CHPX
&rChpx
);
1769 bool checkSeek(SvStream
&rSt
, sal_uInt32 nOffset
)
1770 SAL_WARN_UNUSED_RESULT
;
1772 bool checkRead(SvStream
&rSt
, void *pDest
, sal_uInt32 nLength
)
1773 SAL_WARN_UNUSED_RESULT
;
1775 //MS has a (slightly) inaccurate view of how many twips
1776 //are in the default letter size of a page
1777 const sal_uInt16 lLetterWidth
= 12242;
1778 const sal_uInt16 lLetterHeight
= 15842;
1780 #ifdef OSL_BIGENDIAN
1781 void swapEndian(sal_Unicode
*pString
);
1786 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */