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