xref: /trunk/main/sw/source/filter/ww8/dump/ww8scan.hxx (revision 86e1cf34)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _WW8SCAN_HXX
25 #define _WW8SCAN_HXX
26 
27 
28 #ifndef LONG_MAX
29 #include <limits.h>
30 #endif
31 #ifndef _SAL_TYPES_H
32 #include <sal/types.h>
33 #endif
34 #include <tools/solar.h>		// UINTXX
35 #ifndef _TABLE_HXX //autogen
36 #include <tools/table.hxx>
37 #endif
38 #include <tools/datetime.hxx>
39 #include <tools/stream.hxx>
40 #include <tools/string.hxx>
41 
42 
43 #define _SVSTDARR_STRINGS
44 #include <svl/svstdarr.hxx>
45 
46 #ifndef WW8STRUC_HXX
47 #include <ww8struc.hxx>		// FIB, STSHI, STD
48 #endif
49 
50 #include <ww8scan.hxx>
51 
52 using namespace nsHdFtFlags;
53 
54 
55 #ifndef DELETEZ
56 #define DELETEZ( p ) ( delete( p ), p = 0 )
57 #endif
58 
59 
60 //class SvStream;
61 class  UShortStk;
62 class  WW8Fib;
63 class  WW8ScannerBase;
64 class  WW8PLCFspecial;
65 struct WW8PLCFxDesc;
66 class  WW8PLCFx_PCD;
67 class  SvUShortsSort;
68 
69 
70 String WW8ReadPString( SvStream& rStrm, rtl_TextEncoding eEnc,
71 					   sal_Bool bAtEndSeekRel1 = sal_True );
72 
73 // Folgende Methode liest einen 2-byter-UNICODE-String ein:
74 // - falls bAtEndSeekRel1 gesetzt ist, wird am Ende genau EIN Byte uebersprungen,
75 // - falls nChars (die Zeichen-Anzahl, NICHT die Byte-Anzahl) nicht gesetzt ist,
76 //   wird das erste sal_uInt16 als Lannengenangabe interpretiert,
77 //   ansonsten als erstes String-Zeichen genommen.
78 String WW8Read_xstz(SvStream& rStrm,
79 					sal_uInt16 nChars,
80 					sal_Bool   bAtEndSeekRel1);
81 
82 
83 // read array of strings (see MS documentation: STring TaBle stored in File)
84 // returns NOT the original pascal strings but an array of converted char*
85 //
86 // attention: the *extra data* of each string are SKIPPED and ignored
87 
88 /*  to be optimized like this:    */
89 void WW8ReadSTTBF(	sal_Bool bVer8, SvStream& rStrm,
90 					sal_uInt32 nStart, sal_Int32 nLen, sal_uInt16 nSkip,
91 					rtl_TextEncoding eCS,
92 					SvStrings &rArray, SvStrings* pExtraArray = 0 );
93 
94 
95 
96 sal_uInt16 WW8GetSprmId(        sal_uInt8 nVersion, sal_uInt8* pSp,   sal_uInt8*   pDelta = 0 );
97 short WW8GetSprmSizeNetto(  sal_uInt8 nVersion, sal_uInt8* pSprm, sal_uInt16* pId );
98 short WW8GetSprmSizeBrutto( sal_uInt8 nVersion, sal_uInt8* pSprm, sal_uInt16* pId );
99 sal_uInt8 WW8SprmDataOfs( sal_uInt16 nId );
100 
101 struct WW8FieldDesc
102 {
103 	long nLen;				// Gesamtlaenge ( zum Text ueberlesen )
104 	WW8_CP nSCode;           // Anfang Befehlscode
105 	long nLCode;			// Laenge
106 	WW8_CP nSRes;			// Anfang Ergebnis
107 	long nLRes;				// Laenge ( == 0, falls kein Ergebnis )
108 	sal_uInt16 nId;				// WW-Id fuer Felder
109 	sal_uInt8 nOpt;				// WW-Flags ( z.B.: vom User geaendert )
110 	sal_Bool bCodeNest:1;		// Befehl rekursiv verwendet
111 	sal_Bool bResNest:1;		// Befehl in Resultat eingefuegt
112 };
113 
114 sal_Bool WW8GetFieldPara( sal_uInt8 nVersion, WW8PLCFspecial& rPLCF, WW8FieldDesc& rF );
115 
116 
117 struct WW8PLCFxSave1
118 {
119 	sal_uLong nPLCFxPos;
120 	sal_uLong nPLCFxPos2;		// fuer PLCF_Cp_Fkp: PieceIter-Pos
121 	long nPLCFxMemOfs;
122 	WW8_CP nAttrStart;
123 	WW8_CP nAttrEnd;
124 	sal_Bool   bLineEnd;
125 };
126 
127 
128 /*
129 	u.a. fuer Felder, also genausoviele Attr wie Positionen,
130 	falls Ctor-Param bNoEnd = false
131 */
132 class WW8PLCFspecial		// Iterator fuer PLCFs
133 {
134 	sal_Int32* pPLCF_PosArray;	// Pointer auf Pos-Array und auf ganze Struktur
135 	sal_uInt8*  pPLCF_Contents;	// Pointer auf Inhalts-Array-Teil des Pos-Array
136 	long nIMax;			// Anzahl der Elemente
137 	long nIdx;			// Merker, wo wir gerade sind
138 	long nStru;
139 
140 public:
141 	WW8PLCFspecial( SvStream* pSt, long nFilePos, long nPLCF,
142 		  long nStruct, long nStartPos = -1, sal_Bool bNoEnd = sal_False );
~WW8PLCFspecial()143 	~WW8PLCFspecial(){ delete( pPLCF_PosArray ); pPLCF_PosArray = 0; }
GetIdx() const144 	sal_uLong GetIdx() const { return (sal_uLong)nIdx; }
SetIdx(sal_uLong nI)145 	void SetIdx( sal_uLong nI ) { nIdx = (long)nI; }	// geht ueber Nummer
GetIMax()146 	long GetIMax(){ return nIMax; }
147 	sal_Bool SeekPos( long nPos );			// geht ueber FC- bzw. CP-Wert
148 																	// bzw. naechste groesseren Wert
149 	sal_Bool SeekPosExact( long nPos );
Where()150 	long Where() { return ( nIdx >= nIMax ) ? LONG_MAX : pPLCF_PosArray[nIdx]; }
151 	sal_Bool Get( long& rStart, void*& rpValue );
152 	sal_Bool GetData( long nIdx, long& rPos, void*& rpValue );
153 
GetData(long nIdx) const154 	const void* GetData( long nIdx ) const {
155 		return ( nIdx >= nIMax ) ? 0 : (const void*)&pPLCF_Contents[nIdx * nStru]; }
GetPos(long nIdx)156 	long GetPos( long nIdx ){
157 		return ( nIdx >= nIMax ) ? LONG_MAX : pPLCF_PosArray[nIdx]; }
158 
operator ++(int)159 	WW8PLCFspecial& operator ++( int ) { nIdx++; return *this; }
operator --(int)160 	WW8PLCFspecial& operator --( int ) { nIdx--; return *this; }
161 };
162 
163 
164 
165 
166 /*
167 	simple Iterator for SPRMs
168 */
169 class WW8SprmIter
170 {
171 	// these members will be updated
172 	sal_uInt8*	pSprms;		// remaining part of the SPRMs ( == start of akt. SPRM)
173 	sal_uInt8*	pAktParams; // start of akt. SPRM's parameters
174 	sal_uInt16  nAktId;
175 	short   nAktSizeBrutto;
176 
177 	// these members will *not* be updated by UpdateMyMembers()
178 	sal_uInt8    nVersion;
179 	sal_uInt8    nDelta;
180 	short   nRemLen;	// length of remaining SPRMs (including akt. SPRM)
181 
182 	void UpdateMyMembers();
183 public:
184 	WW8SprmIter( sal_uInt8* pSprms_, short nLen_, sal_uInt8 nVersion_ );
185 	void   SetSprms( sal_uInt8* pSprms_, short nLen_ );
186 	sal_uInt8*  operator ++( int );
GetSprms() const187 	sal_uInt8*  GetSprms()     const { return ( pSprms && (0 < nRemLen) )
188 								? pSprms
189 								: 0; }
GetAktParams() const190 	sal_uInt8*  GetAktParams() const { return pAktParams; }
GetAktId() const191 	sal_uInt16 GetAktId()     const { return nAktId; }
192 };
193 
194 
195 
196 /*
197 	u.a. fuer FKPs auf normale Attr., also ein Attr weniger als Positionen
198 */
199 class WW8PLCF   					// Iterator fuer PLCFs
200 {
201 	sal_Int32* pPLCF_PosArray;	// Pointer auf Pos-Array und auf ganze Struktur
202 	sal_uInt8* pPLCF_Contents;		// Pointer auf Inhalts-Array-Teil des Pos-Array
203 	long nIMax;							// Anzahl der Elemente
204 	long nIdx;
205 	long nStru;
206 
207 	void ReadPLCF( SvStream* pSt, long nFilePos, long nPLCF );
208 
209 	/*
210 		Falls im Dok ein PLC fehlt und die FKPs solo dastehen,
211 		machen wir uns hiermit einen PLC:
212 	*/
213 	void GeneratePLCF( SvStream* pSt, long nPN, long ncpN );
214 
215 public:
216 	WW8PLCF( SvStream* pSt, long nFilePos, long nPLCF,
217 		long nStruct, long nStartPos = -1 );
218 
219 	/*
220 		folgender Ctor generiert ggfs. einen PLC aus nPN und ncpN
221 	*/
222 	WW8PLCF( SvStream* pSt, long nFilePos, long nPLCF,
223 		long nStruct, long nStartPos, long nPN, long ncpN );
224 
~WW8PLCF()225 	~WW8PLCF(){ delete( pPLCF_PosArray ); pPLCF_PosArray = 0; }
GetIdx() const226 	sal_uLong GetIdx() const { return (sal_uLong)nIdx; }
SetIdx(sal_uLong nI)227 	void SetIdx( sal_uLong nI ) { nIdx = (long)nI; }
GetIMax()228 	long GetIMax(){ return nIMax; }
229 	sal_Bool SeekPos( long nPos );
230 	long Where();
231 	sal_Bool Get( long& rStart, long& rEnd, void*& rpValue );
operator ++(int)232 	WW8PLCF& operator ++( int ) { if( nIdx < nIMax ) nIdx++; return *this; }
233 
GetData(long nIdx) const234 	const void* GetData( long nIdx ) const {
235 		return ( nIdx >= nIMax ) ? 0 : (const void*)&pPLCF_Contents[nIdx * nStru]; }
236 };
237 
238 
239 DECLARE_TABLE( WW8Pcd_FC_sortArr, sal_Int32 )
240 
241 
242 /*
243 	fuer Piece Table (bei Schnellspeicherung)
244 */
245 class WW8PLCFpcd
246 {
247 friend class WW8PLCFpcd_Iter;
248 	WW8Pcd_FC_sortArr aFC_sort; // sorted PCD entries by FC
249 	sal_Int32* pPLCF_PosArray;	// Pointer auf Pos-Array und auf ganze Struktur
250 	sal_uInt8*  pPLCF_Contents;	// Pointer auf Inhalts-Array-Teil des Pos-Array
251 	long nIMax;
252 	long nStru;
253 
254 public:
255 	WW8PLCFpcd( SvStream* pSt, long nFilePos, long nPLCF, long nStruct );
~WW8PLCFpcd()256 	~WW8PLCFpcd(){ delete( pPLCF_PosArray ); }
257 	sal_uLong FindIdx( WW8_FC nFC ) const;
258 };
259 
260 /*
261 	mehrere WW8PLCFpcd_Iter koennen auf die gleiche WW8PLCFpcd zeigen !!!
262 */
263 class WW8PLCFpcd_Iter
264 {
265 	WW8PLCFpcd& rPLCF;
266 	long nIdx;
267 
268 public:
269 	WW8PLCFpcd_Iter( WW8PLCFpcd& rPLCFpcd, long nStartPos = -1 );
270 //	~WW8PLCFpcd_Iter() {}
GetIdx() const271 	sal_uLong GetIdx() const { return (sal_uLong)nIdx; }
SetIdx(sal_uLong nI)272 	void SetIdx( sal_uLong nI ) { nIdx = (long)nI; }
GetIMax()273 	long GetIMax(){ return rPLCF.nIMax; }
274 	sal_Bool SeekPos( long nPos );
275 //	sal_Bool SeekMaxMainFC( WW8Fib& rWwF, long& rMaxPosData );
276 	long Where();
277 	sal_Bool Get( long& rStart, long& rEnd, void*& rpValue );
FindIdx(WW8_FC nFC) const278 	sal_uLong FindIdx( WW8_FC nFC ) const { return rPLCF.FindIdx( nFC ); }
operator ++(int)279 	WW8PLCFpcd_Iter& operator ++( int ) { if( nIdx < rPLCF.nIMax ) nIdx++; return *this; }
280 };
281 
282 // PLCF-Typ:
283 enum ePLCFT{ CHP=0, PAP, SEP, /*HED, FNR, ENR,*/ PLCF_END };
284 
285 /*
286 	pure virtual:
287 */
288 class WW8PLCFx   			// virtueller Iterator fuer Piece Table Exceptions
289 {
290 	sal_uInt8 nVersion;				// Versionsnummer des FIB
291 	sal_Bool bIsSprm; 				// PLCF von Sprms oder von anderem ( Footnote, ... )
292 
293 public:
WW8PLCFx(sal_uInt8 nFibVersion,sal_Bool bSprm)294 	WW8PLCFx( sal_uInt8 nFibVersion, sal_Bool bSprm )
295 		{ bIsSprm = bSprm; nVersion = nFibVersion; }
~WW8PLCFx()296 	virtual ~WW8PLCFx() {}
IsSprm()297 	sal_Bool IsSprm() { return bIsSprm; }
298 	virtual sal_uLong GetIdx() const = 0;
299 	virtual void SetIdx( sal_uLong nIdx ) = 0;
300 	virtual sal_uLong GetIdx2() const;
301 	virtual void SetIdx2( sal_uLong nIdx );
302 	virtual sal_Bool SeekPos( WW8_CP nCpPos ) = 0;
303 	virtual long Where() = 0;
304 //	virtual sal_uInt8* GetSprms( long& rStart, long& rEnd, long& rLen );
305 	virtual void GetSprms( WW8PLCFxDesc* p );
306 	virtual long GetNoSprms( long& rStart, long&, long& rLen );
307 	virtual WW8PLCFx& operator ++( int ) = 0;
GetIstd() const308 	virtual sal_uInt16 GetIstd() const { return 0xffff; }
309 	virtual void Save(          WW8PLCFxSave1& rSave ) const;
310 	virtual void Restore( const WW8PLCFxSave1& rSave );
GetVersion() const311 	sal_uInt8 GetVersion() const { return nVersion; }
312 };
313 
314 enum eCutT { CUT_NONE = 0, CUT_START, CUT_END, CUT_BOTH };
315 
316 class WW8PLCFx_PCDAttrs : public WW8PLCFx
317 {
318 	WW8PLCFpcd_Iter* pPcdI;
319 	WW8PLCFx_PCD* pPcd;
320 	sal_uInt8** pGrpprls;			// Attribute an Piece-Table
321 	SVBT32 aShortSprm;			// mini storage: can contain ONE sprm with
322 								// 1 byte param
323 	sal_uInt16 nGrpprls;			// Attribut Anzahl davon
324 
325 public:
326 	WW8PLCFx_PCDAttrs( sal_uInt8 nVersion, WW8PLCFx_PCD* pPLCFx_PCD, WW8ScannerBase* pBase );
327 	virtual ~WW8PLCFx_PCDAttrs();
328 	virtual sal_uLong GetIdx() const;
329 	virtual void SetIdx( sal_uLong nI );
330 	virtual sal_Bool SeekPos( WW8_CP nCpPos );
331 	virtual long Where();
332 	virtual void GetSprms( WW8PLCFxDesc* p );
333 	virtual WW8PLCFx& operator ++( int );
334 
GetIter() const335 	WW8PLCFpcd_Iter* GetIter() const { return pPcdI; }
336 };
337 
338 class WW8PLCFx_PCD : public WW8PLCFx			// Iterator fuer Piece Table
339 {
340 	WW8PLCFpcd_Iter* pPcdI;
341 	sal_Bool bVer67;
342 
343 public:
344 	WW8PLCFx_PCD( sal_uInt8 nVersion, WW8PLCFpcd* pPLCFpcd, WW8_CP nStartCp, sal_Bool bVer67P );
345 	virtual ~WW8PLCFx_PCD();
346 	virtual sal_uLong GetIMax() const;
347 	virtual sal_uLong GetIdx() const;
348 	virtual void SetIdx( sal_uLong nI );
349 	virtual sal_Bool SeekPos( WW8_CP nCpPos );
350 	virtual long Where();
351 //	virtual void GetSprms( WW8PLCFxDesc* p );
352 	virtual long GetNoSprms( long& rStart, long&, long& rLen );
353 	virtual WW8PLCFx& operator ++( int );
354 	WW8_CP AktPieceStartFc2Cp( WW8_FC nStartPos );
355 	WW8_FC AktPieceStartCp2Fc( WW8_CP nCp );
356 	eCutT AktPieceFc2Cp( long& rStartPos, long& rEndPos );
GetPLCFIter()357 	WW8PLCFpcd_Iter* GetPLCFIter() { return pPcdI; }
358 
TransformPieceAddress(long nfc,sal_Bool & bIsUnicodeAddress)359 	static sal_Int32 TransformPieceAddress(long nfc, sal_Bool& bIsUnicodeAddress)
360 	{
361 		bIsUnicodeAddress = 0 == (0x40000000 & nfc);
362 		return bIsUnicodeAddress
363 			?  nfc
364 			: (nfc & 0x3fffFFFF) / 2;
365 	}
IsVersion67() const366 	sal_Bool IsVersion67() const { return bVer67; }
367 };
368 
369 
370 class WW8PLCFx_Fc_FKP : public WW8PLCFx 	// Iterator fuer Piece Table Exceptions of Fkps
371 								// arbeitet nur auf FCs, nicht auf CPs !
372 								// ( Low-Level )
373 {
374 
375 
376 		class WW8Fkp   		// Iterator fuer Formatted Disk Page
377 		{
378 			struct WW8Grpprl
379 			{
380 				sal_uInt8*  pData;
381 				sal_uInt16 nLen;
382 				sal_uInt16 nIStd; // nur bei Fkp.Papx gueltig (aktuelle Style-Nr)
383 				sal_Bool   bMustDelete;
384 			};
385 
386 			WW8Grpprl* pGrpprl;		// Pointer of Meta Array (pointing
387 
388 			sal_uInt8* pFkp;	    	// gesamter Fkp
389 
390 			long nItemSize;		// entweder 1 Byte oder ein komplettes BX
391 			long nFilePos;		// Offset in Stream where last read of 52 bytes took place
392 			short nIdx;			// Pos-Merker
393 			ePLCFT ePLCF;
394 			sal_uInt8 nIMax;     	// Anzahl der Eintraege
395 			sal_uInt8 nVersion;
396 
397 		public:
398 			WW8Fkp( sal_uInt8 nFibVer, SvStream* pFKPStrm, SvStream* pDataStrm,
399 					long _nFilePos, long nItemSiz,
400 					ePLCFT ePl, WW8_FC nStartFc = -1 );
401 			~WW8Fkp();
GetFilePos() const402 			long GetFilePos() const { return nFilePos; }
GetIdx() const403 			sal_uLong GetIdx() const { return (sal_uLong)nIdx; }
404 			void SetIdx( sal_uLong nI );
405 			sal_Bool SeekPos( long nPos );
Where()406 			WW8_FC Where() { return (  nIdx<nIMax)
407 									 ? ((WW8_FC*)pFkp)[nIdx]
408 									 : LONG_MAX; }
operator ++(int)409 			WW8Fkp& operator ++( int ) { if( nIdx < nIMax ) nIdx++;
410 										 return *this; }
411 			sal_uInt8* Get( WW8_FC& rStart, WW8_FC& rEnd, short& rLen );
GetIstd() const412 			sal_uInt16 GetIstd() const { return pGrpprl[ nIdx ].nIStd; }
413 
414 			/*
415 				liefert einen echten Pointer auf das Sprm vom Typ nId,
416 				falls ein solches im Fkp drin ist.
417 			*/
418 			sal_uInt8* GetLenAndIStdAndSprms(short& rLen);
419 
420 			/*
421 				ruft GetLenAndIStdAndSprms() auf...
422 			*/
423 			sal_uInt8* HasSprm( sal_uInt16 nId );
424 
425 			sal_uLong GetParaHeight() const;	// fuer Header/Footer bei Papx-Fkps
426 
GetVersion() const427 			sal_uInt8 GetVersion() const { return nVersion; }
428 		};
429 
430 
431 	WW8PLCFx_PCDAttrs* pPCDAttrs;
432 	SvStream* pFKPStrm;			// Input-File
433 	SvStream* pDataStrm;		// Input-File
434 	WW8PLCF* pPLCF;
435 	WW8Fkp* pFkp;
436 	WW8_FC nStartFc;
437 
438 	sal_Bool NewFkp();
439 
440 protected:
441 	ePLCFT ePLCF;
442 
443 public:
444 	WW8PLCFx_Fc_FKP( SvStream* pSt, SvStream* pTblSt, SvStream* pDataSt,
445 					 WW8Fib& rFib, ePLCFT ePl, WW8_FC nStartFcL,
446 					 WW8PLCFx_PCDAttrs* pPLCFx_PCD );
447 	virtual ~WW8PLCFx_Fc_FKP();
448 	virtual sal_uLong GetIdx() const;
449 	virtual void SetIdx( sal_uLong nIdx );
450 	virtual sal_Bool SeekPos( WW8_FC nFcPos );
451 	virtual WW8_FC Where();
452 	sal_uInt8* GetSprms( WW8_FC& rStart, WW8_FC& rEnd, long& rLen );
453 	virtual WW8PLCFx& operator ++( int );
454 	virtual sal_uInt16 GetIstd() const;
455 	void GetPCDSprms( WW8PLCFxDesc& rDesc );
456 	sal_uInt8* HasSprm( sal_uInt16 nId );
457 	sal_uLong GetParaHeight() const;
HasFkp()458 	sal_Bool HasFkp() { return (0 != pFkp); }
459 };
460 
461 // Iterator fuer Piece Table Exceptions of Fkps arbeitet auf CPs (High-Level)
462 class WW8PLCFx_Cp_FKP : public WW8PLCFx_Fc_FKP
463 {
464 	const WW8ScannerBase& rSBase;
465 	WW8PLCFx_PCD* pPcd;
466 	WW8_CP nAttrStart, nAttrEnd;
467 	sal_Bool bLineEnd : 1;
468 	sal_Bool bComplex : 1;
469 
470 	void SearchParaEnd( long nOldEndCp );
471 
472 public:
473 	WW8PLCFx_Cp_FKP( SvStream* pSt, SvStream* pTblSt, SvStream* pDataSt, const WW8ScannerBase&
474 						rBase,  ePLCFT ePl );
475 	virtual ~WW8PLCFx_Cp_FKP();
476 	void ResetAttrStartEnd();
477 	sal_uLong GetPCDIMax() const;
478 	sal_uLong GetPCDIdx() const;
479 	void SetPCDIdx( sal_uLong nIdx );
480 	virtual sal_uLong GetIdx2() const;
481 	virtual void  SetIdx2( sal_uLong nIdx );
482 	virtual sal_Bool SeekPos( WW8_CP nCpPos );
483 	virtual WW8_CP Where();
484 	virtual void GetSprms( WW8PLCFxDesc* p );
485 	virtual WW8PLCFx& operator ++( int );
486 	virtual void Save(          WW8PLCFxSave1& rSave ) const;
487 	virtual void Restore( const WW8PLCFxSave1& rSave );
488 };
489 
490 
491 
492 class WW8PLCFx_SEPX : public WW8PLCFx   		// Iterator fuer Piece Table Exceptions of Sepx
493 {
494 	SvStream* pStrm;
495 	WW8PLCF* pPLCF;
496 	sal_uInt8* pSprms;
497 	sal_uInt16 nArrMax;
498 	sal_uInt16 nSprmSiz;
499 
500 public:
501 	WW8PLCFx_SEPX( SvStream* pSt, SvStream* pTblxySt, WW8Fib& rFib, WW8_CP nStartCp );
502 	virtual ~WW8PLCFx_SEPX();
503 	virtual sal_uLong GetIdx() const;
504 	virtual void SetIdx( sal_uLong nIdx );
GetIMax() const505 	long GetIMax() const { return ( pPLCF ) ? pPLCF->GetIMax() : 0; }
506 	virtual sal_Bool SeekPos( WW8_CP nCpPos );
507 	virtual long Where();
508 	virtual void GetSprms( WW8PLCFxDesc* p );
509 	virtual WW8PLCFx& operator ++( int );
510 	sal_uInt8* HasSprm( sal_uInt16 nId ) const;
511 	sal_uInt8* HasSprm( sal_uInt16 nId, sal_uInt8 n2nd ) const;
512 	sal_uInt8* HasSprm( sal_uInt16 nId, sal_uInt8* pOtherSprms, long nOtherSprmSiz ) const;
513 	sal_Bool Find4Sprms(sal_uInt16 nId1, sal_uInt16 nId2, sal_uInt16 nId3, sal_uInt16 nId4,
514 					sal_uInt8*& p1,   sal_uInt8*& p2,   sal_uInt8*& p3,   sal_uInt8*& p4 ) const;
515 	sal_Bool CompareSprms( sal_uInt8* pOtherSprms,
516 					   long nOtherSprmSiz,
517 					   const SvUShortsSort* pIgnoreSprms = 0 ) const;
518 };
519 
520 // Iterator fuer Fuss-/Endnoten und Anmerkungen
521 class WW8PLCFx_SubDoc : public WW8PLCFx
522 {
523 	WW8PLCF* pRef;
524 	WW8PLCF* pTxt;
525 
526 public:
527 	WW8PLCFx_SubDoc( SvStream* pSt, sal_uInt8 nVersion, WW8_CP nStartCp,
528 					long nFcRef, long nLenRef,
529 					long nFcTxt, long nLenTxt, long nStruc = 0 );
530 	virtual ~WW8PLCFx_SubDoc();
531 	virtual sal_uLong GetIdx() const;
532 	virtual void SetIdx( sal_uLong nIdx );
533 	virtual sal_Bool SeekPos( WW8_CP nCpPos );
534 	virtual long Where();
535 
536 	// liefert Reference Descriptoren
GetData(long nIdx=-1) const537 	const void* GetData( long nIdx = -1 ) const
538 		{
539 			return pRef ? pRef->GetData( -1L == nIdx ? pRef->GetIdx()
540 													 : nIdx ) : 0;
541 		}
542 
543 	/*
544 		liefert Angabe, wo Kopf und Fusszeilen-Text zu finden ist
545 	*/
546 	sal_Bool Get( long& rStart, void*& rpValue );
547 	virtual long GetNoSprms( long& rStart, long&, long& rLen );
548 	virtual WW8PLCFx& operator ++( int );
Count()549 	long Count() { return ( pRef ) ? pRef->GetIMax() : 0; }
550 };
551 
552 class WW8PLCFx_FLD : public WW8PLCFx			// Iterator fuer Fuss- und Endnoten
553 {
554 	WW8PLCFspecial* pPLCF;
555 	WW8Fib& rFib;
556 
557 public:
558 	WW8PLCFx_FLD( SvStream* pSt, WW8Fib& rMyFib, short nType, WW8_CP nStartCp );
559 	virtual ~WW8PLCFx_FLD();
560 	virtual sal_uLong GetIdx() const;
561 	virtual void SetIdx( sal_uLong nIdx );
562 	virtual sal_Bool SeekPos( WW8_CP nCpPos );
563 	virtual long Where();
564 	virtual long GetNoSprms( long& rStart, long&, long& rLen );
565 	virtual WW8PLCFx& operator ++( int );
566 	sal_Bool GetPara( long nIdx, WW8FieldDesc& rF );
567 };
568 
569 enum eBookStatus { BOOK_NORMAL = 0, BOOK_IGNORE = 0x1, BOOK_ONLY_REF = 0x2 };
570 
571 class WW8PLCFx_Book : public WW8PLCFx			// Iterator fuer Booknotes
572 {
573 	WW8PLCFspecial* pBook[2];			// Start- und EndPosition
574 	SvStrings aBookNames;				// Name
575 	eBookStatus* pStatus;
576 	long nIMax;							// Anzahl der Booknotes
577 	sal_uInt16 nIsEnd;
578 public:
579 	WW8PLCFx_Book( SvStream* pSt, SvStream* pTblSt, WW8Fib& rFib, WW8_CP nStartCp );
580 	virtual ~WW8PLCFx_Book();
GetIMax()581 	long GetIMax(){ return nIMax; }
582 	virtual sal_uLong GetIdx() const;
583 	virtual void SetIdx( sal_uLong nI );
584 	virtual sal_uLong GetIdx2() const;
585 	virtual void SetIdx2( sal_uLong nIdx );
586 	virtual sal_Bool SeekPos( WW8_CP nCpPos );
587 	virtual long Where();
588 	virtual long GetNoSprms( long& rStart, long& rEnd, long& rLen );
589 	virtual WW8PLCFx& operator ++( int );
GetName() const590 	const String* GetName() const
591 		{ return ( !nIsEnd && ( (long)(pBook[0]->GetIdx()) < nIMax ) )
592 						? aBookNames[ pBook[0]->GetIdx() ]
593 						: 0;
594 		}
GetStartPos() const595 	WW8_CP GetStartPos() const
596 		{ return ( nIsEnd ) ? LONG_MAX : pBook[0]->Where(); }
597 	long GetLen() const;
GetIsEnd() const598 	sal_Bool GetIsEnd() const { return ( nIsEnd ) ? sal_True : sal_False; }
599 	long GetHandle() const;
600 	sal_Bool SetStatus( WW8_CP nStartRegion, WW8_CP nEndRegion, const String& rName,
601 					eBookStatus eStat );
602 	eBookStatus GetStatus() const;
603 };
604 
605 /*
606 	hiermit arbeiten wir draussen:
607 */
608 struct WW8PLCFManResult
609 {
610 	WW8_CP nCpPos;		// Attribut-Anfangsposition
611 	long nMemLen;		// Laenge dazu
612 	long nCp2OrIdx;		// footnote-textpos oder Index in PLCF
613 	WW8_CP nAktCp;		// wird nur vom Aufrufer benutzt
614 	sal_uInt8* pMemPos;		// Mem-Pos fuer Sprms
615 	sal_uInt16 nSprmId;		// Sprm-Id ( 0 = ungueltige Id -> ueberspringen! )
616 										// (2..255) oder Pseudo-Sprm-Id (256..260)
617 										// bzw. ab Winword-Ver8 die Sprm-Id (800..)
618 	sal_uInt8 nFlags;		// Absatz- oder Section-Anfang
619 };
620 
621 #define MAN_ANZ_PLCF 12
622 
623 #define MAN_MASK_NEW_PAP 1		// neue Zeile
624 #define MAN_MASK_NEW_SEP 2		// neue Section
625 
626 
627 #define MAN_MAINTEXT 0			// Defines fuer PLCFMan-ctor
628 #define MAN_FTN 1
629 #define MAN_EDN 2
630 #define MAN_HDFT 3
631 #define MAN_AND 4
632 #define MAN_TXBX 5
633 #define MAN_TXBX_HDFT 6
634 
635 struct WW8PLCFxSaveAll
636 {
637 	WW8PLCFxSave1 aS[MAN_ANZ_PLCF];
638 };
639 
640 /*
641 	hiermit arbeitet der Manager drinnen:
642 */
643 struct WW8PLCFxDesc
644 {
645 	WW8PLCFx* pPLCFx;
646 	UShortStk* pIdStk;// Speicher fuer Attr-Id fuer Attr-Ende(n)
647 	sal_uInt8* pMemPos;		// wo liegen die Sprm(s)
648 	long nStartPos;
649 	long nEndPos;
650 	long nCp2OrIdx;		// wo liegen die NoSprm(s)
651 	long nSprmsLen;		// wie viele Bytes fuer weitere Sprms / Laenge Fussnote
652 	long nCpOfs;		// fuer Offset Header .. Footnote
653 	sal_Bool bFirstSprm;	// fuer Erkennung erster Sprm einer Gruppe
654 	sal_Bool bRealLineEnd;	// sal_False bei Pap-Piece-Ende
655 	void Save(          WW8PLCFxSave1& rSave ) const;
656 	void Restore( const WW8PLCFxSave1& rSave );
657 };
658 
659 
660 #ifndef DUMP
661 
662 class WW8PLCFMan
663 {
664 	long nCpO;		// Origin Cp -- the basis for nNewCp
665 
666 	long nLineEnd;					// zeigt *hinter* das <CR>
667 	long nLastWhereIdxCp;			// last result of WhereIdx()
668 	sal_uInt16 nPLCF;				    // so viele PLCFe werden verwaltet
669 	short nManType;
670 
671 	WW8PLCFxDesc aD[MAN_ANZ_PLCF];
672 	WW8PLCFxDesc *pChp, *pPap, *pSep, *pFld, *pFldTxbx, *pFldTxbxHdft,
673 				 *pFtn, *pEdn,
674 				 *pBkm, *pPcd, *pPcdA, *pAnd;
675 	WW8PLCFspecial *pFdoa, *pTxbx, *pTxbxBkd;
676 
677 	WW8Fib* pWwFib;
678 	sal_uInt16* pNoAttrScan; // Attribute komplett(!) ignorieren, die ueber n CPs
679 						// aufgespannt sind; z.B. bei Char #7 (Zellen-/Zeilenende)
680 
681 	short WhereIdx( sal_Bool* pbStart, long* pPos );
682 	void AdjustEnds(    WW8PLCFxDesc& rDesc );
683 	void GetNewSprms(   WW8PLCFxDesc& rDesc );
684 	void GetNewNoSprms( WW8PLCFxDesc& rDesc );
685 	void GetSprmStart( short nIdx, WW8PLCFManResult* pRes );
686 	void GetSprmEnd( short nIdx, WW8PLCFManResult* pRes );
687 	void GetNoSprmStart( short nIdx, WW8PLCFManResult* pRes );
688 	void GetNoSprmEnd( short nIdx, WW8PLCFManResult* pRes );
689 	void AdvSprm(   short nIdx, sal_Bool bStart );
690 	void AdvNoSprm( short nIdx, sal_Bool bStart );
691 
692 public:
693 	WW8PLCFMan( WW8ScannerBase* pBase, short nType, long nStartCp );
694 	~WW8PLCFMan();
695 
696 	/*
697 		Where fragt, an welcher naechsten Position sich irgendein
698 		Attr aendert...
699 	*/
700 	long Where();
701 
702 	sal_Bool Get( WW8PLCFManResult* pResult );
703 	WW8PLCFMan& operator ++( int );
704 	sal_uInt16 GetColl() const;	// liefert aktuellen Style
705 	WW8PLCFx_FLD* GetFld() const;
GetEdn() const706 	WW8PLCFx_SubDoc* GetEdn() const { return (WW8PLCFx_SubDoc*)pEdn->pPLCFx; }
GetFtn() const707 	WW8PLCFx_SubDoc* GetFtn() const { return (WW8PLCFx_SubDoc*)pFtn->pPLCFx; }
GetAtn() const708 	WW8PLCFx_SubDoc* GetAtn() const { return (WW8PLCFx_SubDoc*)pAnd->pPLCFx; }
GetBook() const709 	WW8PLCFx_Book* GetBook() const { return (WW8PLCFx_Book*)pBkm->pPLCFx; }
GetCpOfs() const710 	long GetCpOfs() const { return pChp->nCpOfs; }	// fuer Header/Footer...
711 
712 	/*
713 		fragt, ob *aktueller Absatz* einen Sprm diesen Typs hat
714 	*/
715 	sal_uInt8* HasParaSprm( sal_uInt16 nId ) const;
716 
717 	/*
718 		fragt, ob *aktueller Textrun* einen Sprm diesen Typs hat
719 	*/
720 	sal_uInt8* HasCharSprm( sal_uInt16 nId ) const;
721 
GetChpPLCF()722 	WW8PLCFx_Cp_FKP* GetChpPLCF(){ return (WW8PLCFx_Cp_FKP*)pChp->pPLCFx; }
GetPapPLCF()723 	WW8PLCFx_Cp_FKP* GetPapPLCF(){ return (WW8PLCFx_Cp_FKP*)pPap->pPLCFx; }
GetSepPLCF()724 	WW8PLCFx_SEPX* GetSepPLCF(){   return (WW8PLCFx_SEPX*)pSep->pPLCFx; }
GetPap()725 	WW8PLCFxDesc* GetPap(){ return pPap; }
726 	void SeekPos( long nNewCp );
727 	void SaveAllPLCFx(                   WW8PLCFxSaveAll& rSave ) const;
728 	void RestoreAllPLCFx(          const WW8PLCFxSaveAll& rSave );
GetFdoa()729 	WW8PLCFspecial* GetFdoa()	{ return pFdoa;		}
GetTxbx()730 	WW8PLCFspecial* GetTxbx()	{ return pTxbx;		}
GetTxbxBkd()731 	WW8PLCFspecial* GetTxbxBkd(){ return pTxbxBkd;	}
GetManType()732 	short GetManType() { return nManType; }
733 };
734 
735 #endif // !DUMP
736 
737 class WW8ScannerBase
738 {
739 friend WW8PLCFx_PCDAttrs::WW8PLCFx_PCDAttrs( sal_uInt8 nVersion, WW8PLCFx_PCD* pPLCFx_PCD, WW8ScannerBase* pBase );
740 friend WW8PLCFx_Cp_FKP::WW8PLCFx_Cp_FKP( SvStream*, SvStream*, SvStream*,
741 										const WW8ScannerBase&, ePLCFT );
742 
743 #ifdef DUMP
744 friend static void DumpPLCFText( WW8_FC nPos, long nLen, long nOfs, sal_Char* pName,
745 								WW8ScannerBase* pBase );
746 friend static void DumpFtnShort( short nId, long nPos, long nFieldLen );
747 #else
748 friend WW8PLCFMan::WW8PLCFMan( WW8ScannerBase*, short, long );
749 friend class SwWw8ImplReader;
750 #endif
751 
752 	WW8Fib* pWw8Fib;
753 	WW8PLCFx_Cp_FKP*  pChpPLCF;			// Character-Attrs
754 	WW8PLCFx_Cp_FKP*  pPapPLCF;			// Para-Attrs
755 	WW8PLCFx_SEPX*    pSepPLCF;			// Section-Attrs
756 	WW8PLCFx_SubDoc*  pFtnPLCF;			// Footnotes
757 	WW8PLCFx_SubDoc*  pEdnPLCF;			// EndNotes
758 	WW8PLCFx_SubDoc*  pAndPLCF;			// Anmerkungen
759 	WW8PLCFx_FLD*     pFldPLCF;			// Fields in Main Text
760 	WW8PLCFx_FLD*     pFldHdFtPLCF;		// Fields in Header / Footer
761 	WW8PLCFx_FLD*     pFldTxbxPLCF;		// Fields in Textboxes in Main Text
762 	WW8PLCFx_FLD*     pFldTxbxHdFtPLCF;	// Fields in Textboxes in Header / Footer
763 	WW8PLCFx_FLD*     pFldFtnPLCF;		// Fields in Footnotes
764 	WW8PLCFx_FLD*     pFldEdnPLCF;		// Fields in Endnotes
765 	WW8PLCFx_FLD*     pFldAndPLCF;		// Fields in Anmerkungen
766 	WW8PLCFspecial*   pMainFdoa;		// Graphic Primitives in Main Text
767 	WW8PLCFspecial*   pHdFtFdoa;		// Graphic Primitives in Header / Footer
768 	WW8PLCFspecial*   pMainTxbx;		// Textboxen in Main Text
769 	WW8PLCFspecial*   pMainTxbxBkd;		// Break-Deskriptoren fuer diese
770 	WW8PLCFspecial*   pHdFtTxbx;		// TextBoxen in Header / Footer
771 	WW8PLCFspecial*   pHdFtTxbxBkd;		// Break-Deskriptoren fuer diese
772 	WW8PLCFx_Book*    pBook;			// Bookmarks
773 
774 	WW8PLCFpcd*			pPiecePLCF;	// fuer FastSave ( Basis-PLCF ohne Iterator )
775 	WW8PLCFpcd_Iter*	pPieceIter;	// fuer FastSave ( Iterator dazu )
776 	WW8PLCFx_PCD*		pPLCFx_PCD;		// dito
777 	WW8PLCFx_PCDAttrs*	pPLCFx_PCDAttrs;
778 	sal_uInt8** 				pPieceGrpprls;	// Attribute an Piece-Table
779 	sal_uInt16 				nPieceGrpprls;	// Anzahl davon
780 	sal_uInt16				nNoAttrScan;	// Attribute komplett(!) ignorieren, die ueber n CPs
781 										// aufgespannt sind; z.B. bei Char #7 (Zellen-/Zeilenende)
782 
783 	WW8PLCFpcd* OpenPieceTable( SvStream* pStr, WW8Fib* pWwF );
784 	void DeletePieceTable();
785 
786 public:
787 	WW8ScannerBase( SvStream* pSt, SvStream* pTblSt, SvStream* pDataSt,
788 					WW8Fib* pWwF );
789 	~WW8ScannerBase();
AreThereFootnotes()790 	sal_Bool AreThereFootnotes() { return pFtnPLCF->Count() > 0; };
AreThereEndnotes()791 	sal_Bool AreThereEndnotes()  { return pEdnPLCF->Count() > 0; };
792 	static DateTime WW8DTTM2DateTime(long lDTTM);
793 
794 	WW8_CP WW8Fc2Cp( WW8_FC nFcPos ) const ;
795 	WW8_FC WW8Cp2Fc( WW8_CP nCpPos, sal_Bool* pIsUnicode = 0,
796 					 WW8_CP* pNextPieceCp = 0, sal_Bool* pTestFlag = 0 ) const;
SetNoAttrScan(sal_uInt16 nValue)797 	void SetNoAttrScan( sal_uInt16 nValue ) { nNoAttrScan = nValue; };
798 
799 	sal_uInt16 WW8ReadString( SvStream& rStrm, String& rStr,
800 							WW8_CP nAktStartCp, long nTotalLen,
801 							rtl_TextEncoding eEnc ) const;
802 };
803 
804 
805 
806 /** FIB - File Information Block
807 */
808 class WW8Fib
809 {
810 public:
811 	/*
812 		von uns verlangte Programm-Version:
813 		in Ctor wird geprueft, ob sie zu nFib passt
814 	*/
815 	sal_uInt8 nVersion;	// 6 steht fuer "WinWord 6 oder WinWord 95",
816 									// 7 steht fuer "nur WinWord 95"
817 									// 8 steht fuer "nur WinWord 97"
818 	/*
819 		Fehlerstatus
820 	*/
821 	sal_uLong nFibError;
822 	/*
823 		vom Ctor aus dem FIB gelesene Daten
824 		(entspricht nur ungefaehr der tatsaechlichen Struktur
825 		 des Winword-FIB)
826 	*/
827 	sal_uInt16 wIdent;		// 0x0 int magic number
828 	sal_uInt16 nFib; 		// 0x2 FIB version written
829 	sal_uInt16 nProduct; 	// 0x4 product version written by
830 	sal_Int16 lid; 			// 0x6 language stamp---localized version;
831 	WW8_PN pnNext; 			// 0x8
832 
833 	sal_uInt16 fDot :1; 	// 0xa 0001
834 	sal_uInt16 fGlsy :1;
835 	sal_uInt16 fComplex :1; // 0004 when 1, file is in complex, fast-saved format.
836 	sal_uInt16 fHasPic :1; 	// 0008 file contains 1 or more pictures
837 	sal_uInt16 cQuickSaves :4; // 00F0 count of times file was quicksaved
838 	sal_uInt16 fEncrypted :1; //0100 1 if file is encrypted, 0 if not
839 	sal_uInt16 fWhichTblStm :1; //0200 When 0, this fib refers to the table stream
840 													// named "0Table", when 1, this fib refers to the
841 													// table stream named "1Table". Normally, a file
842 													// will have only one table stream, but under unusual
843 													// circumstances a file may have table streams with
844 													// both names. In that case, this flag must be used
845 													// to decide which table stream is valid.
846 	// sal_uInt16 u1 :2;
847 	sal_uInt16 fExtChar :1; // 1000 =1, when using extended character set in file
848 	// sal_uInt16 u2 :3;
849 
850 	sal_uInt16 nFibBack; 	// 0xc
851 	sal_Int16 lKey1; 			// 0xe  file encrypted key, only valid if fEncrypted.
852 	sal_Int16 lKey2; 			// 0x10  key in 2 Portionen wg. Misalignment
853 	sal_uInt8 envr;			// 0x12 environment in which file was created
854 									//      0 created by Win Word / 1 created by Mac Word
855 	sal_uInt8 fMac              :1;			// 0x13 when 1, this file was last saved in the Mac environment
856 	sal_uInt8 fEmptySpecial     :1;
857 	sal_uInt8 fLoadOverridePage :1;
858 	sal_uInt8 fFuturesavedUndo  :1;
859 	sal_uInt8 fWord97Saved      :1;
860 	sal_uInt8 :3;
861 
862 	sal_uInt16 chse;		// 0x14 default extended character set id for text in document stream. (overidden by chp.chse)
863 						//      0 = ANSI  / 256 Macintosh character set.
864 	sal_uInt16 chseTables;	// 0x16 default extended character set id for text in
865 						//      internal data structures: 0 = ANSI, 256 = Macintosh
866 	WW8_FC fcMin;			// 0x18 file offset of first character of text
867 	WW8_FC fcMac;			// 0x1c file offset of last character of text + 1
868 
869 	// Einschub fuer WW8 *****************************************************
870 	sal_uInt16 csw;				// Count of fields in the array of "shorts"
871 
872 	// Marke: "rgsw" Beginning of the array of shorts
873 	sal_uInt16 wMagicCreated;					// unique number Identifying the File's creator
874 																// 0x6A62 is the creator ID for Word and is reserved.
875 																// Other creators should choose a different value.
876 	sal_uInt16 wMagicRevised;					// identifies the File's last modifier
877   sal_uInt16 wMagicCreatedPrivate;	// private data
878 	sal_uInt16 wMagicRevisedPrivate;	// private data
879 	/*
880 	sal_Int16  pnFbpChpFirst_W6;			// not used
881 	sal_Int16  pnChpFirst_W6;					// not used
882 	sal_Int16  cpnBteChp_W6;					// not used
883 	sal_Int16  pnFbpPapFirst_W6;			// not used
884 	sal_Int16  pnPapFirst_W6;					// not used
885 	sal_Int16  cpnBtePap_W6;					// not used
886 	sal_Int16  pnFbpLvcFirst_W6;			// not used
887 	sal_Int16  pnLvcFirst_W6;					// not used
888 	sal_Int16  cpnBteLvc_W6;					// not used
889 	*/
890 	sal_Int16  lidFE;									// Language id if document was written by Far East version
891 																// of Word (i.e. FIB.fFarEast is on)
892 	sal_uInt16 clw;										// Number of fields in the array of longs
893 
894 	// Ende des Einschubs fuer WW8 *******************************************
895 
896 	// Marke: "rglw" Beginning of the array of longs
897 	WW8_FC cbMac;			// 0x20 file offset of last byte written to file + 1.
898 
899 	// WW8_FC u4[4];			// 0x24
900 	WW8_CP ccpText;			// 0x34 length of main document text stream
901 	WW8_CP ccpFtn;			// 0x38 length of footnote subdocument text stream
902 	WW8_CP ccpHdr;			// 0x3c length of header subdocument text stream
903 	WW8_CP ccpMcr;			// 0x40 length of macro subdocument text stream
904 	WW8_CP ccpAtn;			// 0x44 length of annotation subdocument text stream
905 	WW8_CP ccpEdn;			// 0x48 length of endnote subdocument text stream
906 	WW8_CP ccpTxbx;			// 0x4c length of textbox subdocument text stream
907 	WW8_CP ccpHdrTxbx;		// 0x50 length of header textbox subdocument text stream
908 
909 	// Einschub fuer WW8 *****************************************************
910 	sal_Int32  pnFbpChpFirst;	// when there was insufficient memory for Word to expand
911 												// the PLCFbte at save time, the PLCFbte is written
912 												// to the file in a linked list of 512-byte pieces
913 												// starting with this pn.
914 	/*
915 	// folgende Felder existieren zwar so in der Datei,
916 	// wir benutzen jedoch unten deklarierte General-Variablen
917 	// fuer Ver67 und Ver8 gemeinsam.
918 	sal_Int32  pnChpFirst;		// the page number of the lowest numbered page in the
919 														// document that records CHPX FKP information
920 	sal_Int32  cpnBteChp;			// count of CHPX FKPs recorded in file. In non-complex
921 														// files if the number of entries in the PLCFbteChpx
922 														// is less than this, the PLCFbteChpx is incomplete.
923 	*/
924 	sal_Int32  pnFbpPapFirst;	// when there was insufficient memory for Word to expand
925 												// the PLCFbte at save time, the PLCFbte is written to
926 												// the file in a linked list of 512-byte pieces
927 												// starting with this pn
928 	/*
929 	// folgende Felder existieren zwar so in der Datei,
930 	// wir benutzen jedoch unten deklarierte General-Variablen
931 	// fuer Ver67 und Ver8 gemeinsam.
932 	sal_Int32  pnPapFirst;		// the page number of the lowest numbered page in the
933 														// document that records PAPX FKP information
934 	sal_Int32  cpnBtePap;		// count of PAPX FKPs recorded in file. In non-complex
935 														// files if the number of entries in the PLCFbtePapx is
936 														// less than this, the PLCFbtePapx is incomplete.
937 	*/
938 	sal_Int32  pnFbpLvcFirst;	// when there was insufficient memory for Word to expand
939 												// the PLCFbte at save time, the PLCFbte is written to
940 												// the file in a linked list of 512-byte pieces
941 												// starting with this pn
942 	sal_Int32  pnLvcFirst;			// the page number of the lowest numbered page in the
943 												// document that records LVC FKP information
944 	sal_Int32  cpnBteLvc;			// count of LVC FKPs recorded in file. In non-complex
945 												// files if the number of entries in the PLCFbtePapx is
946 												// less than this, the PLCFbtePapx is incomplete.
947 	sal_Int32  fcIslandFirst;	// ?
948 	sal_Int32  fcIslandLim;		// ?
949 	sal_uInt16 cfclcb;				// Number of fields in the array of FC/LCB pairs.
950 
951 	// Ende des Einschubs fuer WW8 *******************************************
952 
953 	// Marke: "rgfclcb" Beginning of array of FC/LCB pairs.
954 	WW8_FC fcStshfOrig;		// file offset of original allocation for STSH in table
955 												// stream. During fast save Word will attempt to reuse
956 												// this allocation if STSH is small enough to fit.
957 	sal_Int32 lcbStshfOrig;	// 0x5c count of bytes of original STSH allocation
958 	WW8_FC fcStshf;			// 0x60 file offset of STSH in file.
959 	sal_Int32 lcbStshf;		// 0x64 count of bytes of current STSH allocation
960 	WW8_FC fcPlcffndRef;	// 0x68 file offset of footnote reference PLCF.
961 	sal_Int32 lcbPlcffndRef;	// 0x6c count of bytes of footnote reference PLCF
962 						//      == 0 if no footnotes defined in document.
963 
964 	WW8_FC fcPlcffndTxt;	// 0x70 file offset of footnote text PLCF.
965 	sal_Int32 lcbPlcffndTxt;	// 0x74 count of bytes of footnote text PLCF.
966 						//      == 0 if no footnotes defined in document
967 
968 	WW8_FC fcPlcfandRef;	// 0x78 file offset of annotation reference PLCF.
969 	sal_Int32 lcbPlcfandRef;	// 0x7c count of bytes of annotation reference PLCF.
970 
971 	WW8_FC fcPlcfandTxt;	// 0x80 file offset of annotation text PLCF.
972 	sal_Int32 lcbPlcfandTxt;	// 0x84 count of bytes of the annotation text PLCF
973 
974 	WW8_FC fcPlcfsed;		// 8x88 file offset of section descriptor PLCF.
975 	sal_Int32 lcbPlcfsed;	// 0x8c count of bytes of section descriptor PLCF.
976 
977 	WW8_FC fcPlcfpad;		// 0x90 file offset of paragraph descriptor PLCF
978 	sal_Int32 lcbPlcfpad;	// 0x94 count of bytes of paragraph descriptor PLCF.
979 						// ==0 if file was never viewed in Outline view.
980 						// Should not be written by third party creators
981 
982 	WW8_FC fcPlcfphe;		// 0x98 file offset of PLCF of paragraph heights.
983 	sal_Int32 lcbPlcfphe;	// 0x9c count of bytes of paragraph height PLCF.
984 						// ==0 when file is non-complex.
985 
986 	WW8_FC fcSttbfglsy;		// 0xa0 file offset of glossary string table.
987 	sal_Int32 lcbSttbfglsy;	// 0xa4 count of bytes of glossary string table.
988 						//		== 0 for non-glossary documents.
989 						//		!=0 for glossary documents.
990 
991 	WW8_FC fcPlcfglsy;		// 0xa8 file offset of glossary PLCF.
992 	sal_Int32 lcbPlcfglsy;	// 0xac count of bytes of glossary PLCF.
993 						//		== 0 for non-glossary documents.
994 						//		!=0 for glossary documents.
995 
996 	WW8_FC fcPlcfhdd;		// 0xb0 byte offset of header PLCF.
997 	sal_Int32 lcbPlcfhdd;	// 0xb4 count of bytes of header PLCF.
998 						// 		== 0 if document contains no headers
999 
1000 	WW8_FC fcPlcfbteChpx;	// 0xb8 file offset of character property bin table.PLCF.
1001 	sal_Int32 lcbPlcfbteChpx;// 0xbc count of bytes of character property bin table PLCF.
1002 
1003 	WW8_FC fcPlcfbtePapx; 	// 0xc0 file offset of paragraph property bin table.PLCF.
1004 	sal_Int32 lcbPlcfbtePapx;// 0xc4 count of bytes of paragraph  property bin table PLCF.
1005 
1006 	WW8_FC fcPlcfsea;		// 0xc8 file offset of PLCF reserved for private use. The SEA is 6 bytes long.
1007 	sal_Int32 lcbPlcfsea;	// 0xcc	count of bytes of private use PLCF.
1008 
1009 	WW8_FC fcSttbfffn;		// 0xd0	file offset of font information STTBF. See the FFN file structure definition.
1010 	sal_Int32 lcbSttbfffn;	// 0xd4	count of bytes in sttbfffn.
1011 
1012 	WW8_FC fcPlcffldMom;	// 0xd8	offset in doc stream to the PLCF of field positions in the main document.
1013 	sal_Int32 lcbPlcffldMom;	// 0xdc
1014 
1015 	WW8_FC fcPlcffldHdr;	// 0xe0	offset in doc stream to the PLCF of field positions in the header subdocument.
1016 	sal_Int32 lcbPlcffldHdr;	// 0xe4
1017 
1018 	WW8_FC fcPlcffldFtn;	// 0xe8	offset in doc stream to the PLCF of field positions in the footnote subdocument.
1019 	sal_Int32 lcbPlcffldFtn;	// 0xec
1020 
1021 	WW8_FC fcPlcffldAtn;	// 0xf0	offset in doc stream to the PLCF of field positions in the annotation subdocument.
1022 	sal_Int32 lcbPlcffldAtn;	// 0xf4
1023 
1024 	WW8_FC fcPlcffldMcr;	// 0xf8	offset in doc stream to the PLCF of field positions in the macro subdocument.
1025 	sal_Int32 lcbPlcffldMcr;	// 9xfc
1026 
1027 	WW8_FC fcSttbfbkmk;	// 0x100 offset in document stream of the STTBF that records bookmark names in the main document
1028 	sal_Int32 lcbSttbfbkmk;	// 0x104
1029 
1030 	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
1031 	sal_Int32 lcbPlcfbkf;	// 0x10c
1032 
1033 	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.
1034 	sal_Int32 lcbPlcfbkl;	// 0x114 sal_Int32
1035 
1036 	WW8_FC fcCmds;		// 0x118 FC
1037 	sal_Int32 lcbCmds;		// 0x11c
1038 
1039 	WW8_FC fcPlcfmcr;		// 0x120 FC
1040 	sal_Int32 lcbPlcfmcr;		// 0x124
1041 
1042 	WW8_FC fcSttbfmcr;	// 0x128 FC
1043 	sal_Int32 lcbSttbfmcr;	// 0x12c
1044 
1045 	WW8_FC fcPrDrvr;		// 0x130 file offset of the printer driver information (names of drivers, port etc...)
1046 	sal_Int32 lcbPrDrvr;		// 0x134 count of bytes of the printer driver information (names of drivers, port etc...)
1047 
1048 	WW8_FC fcPrEnvPort;	// 0x138 file offset of the print environment in portrait mode.
1049 	sal_Int32 lcbPrEnvPort;	// 0x13c count of bytes of the print environment in portrait mode.
1050 
1051 	WW8_FC fcPrEnvLand;	// 0x140 file offset of the print environment in landscape mode.
1052 	sal_Int32 lcbPrEnvLand;	// 0x144 count of bytes of the print environment in landscape mode.
1053 
1054 	WW8_FC fcWss;		// 0x148 file offset of Window Save State data structure. See WSS.
1055 	sal_Int32 lcbWss;		// 0x14c count of bytes of WSS. ==0 if unable to store the window state.
1056 
1057 	WW8_FC fcDop;		// 0x150 file offset of document property data structure.
1058 	sal_Int32 lcbDop;		// 0x154 count of bytes of document properties.
1059 		// cbDOP is 84 when nFib < 103
1060 
1061 
1062 	WW8_FC fcSttbfAssoc;	// 0x158 offset to STTBF of associated strings. See STTBFASSOC.
1063 	sal_Int32 cbSttbfAssoc;	// 0x15C
1064 
1065 	WW8_FC fcClx;			// 0x160 file  offset of beginning of information for complex files.
1066 	sal_Int32 lcbClx;		// 0x164 count of bytes of complex file information. 0 if file is non-complex.
1067 
1068 	WW8_FC fcPlcfpgdFtn;	// 0x168 file offset of page descriptor PLCF for footnote subdocument.
1069 	sal_Int32 lcbPlcfpgdFtn;	// 0x16C count of bytes of page descriptor PLCF for footnote subdocument.
1070 						//	==0 if document has not been paginated. The length of the PGD is 8 bytes.
1071 
1072 	WW8_FC fcAutosaveSource;	// 0x170 file offset of the name of the original file.
1073 	sal_Int32 lcbAutosaveSource;	// 0x174 count of bytes of the name of the original file.
1074 
1075 	WW8_FC fcGrpStAtnOwners;	// 0x178 group of strings recording the names of the owners of annotations
1076 	sal_Int32 lcbGrpStAtnOwners;	// 0x17C count of bytes of the group of strings
1077 
1078 	WW8_FC fcSttbfAtnbkmk;	// 0x180 file offset of the sttbf that records names of bookmarks in the annotation subdocument
1079 	sal_Int32 lcbSttbfAtnbkmk;	// 0x184 length in bytes of the sttbf that records names of bookmarks in the annotation subdocument
1080 
1081 	// Einschubs fuer WW67 ***************************************************
1082 
1083 	// sal_Int16 wSpare4Fib;	// Reserve, muss hier nicht deklariert werden
1084 
1085 	/*
1086 	// folgende Felder existieren zwar so in der Datei,
1087 	// wir benutzen jedoch unten deklarierte General-Variablen
1088 	// fuer Ver67 und Ver8 gemeinsam.
1089 	WW8_PN pnChpFirst;	// the page number of the lowest numbered page in
1090 														// the document that records CHPX FKP information
1091 	WW8_PN pnPapFirst;	// the page number of the lowest numbered page in
1092 														// the document that records PAPX FKP information
1093 
1094 	WW8_PN cpnBteChp;		// count of CHPX FKPs recorded in file. In non-complex
1095 														// files if the number of entries in the PLCFbteChpx is
1096 														// less than this, the PLCFbteChpx  is incomplete.
1097 	WW8_PN cpnBtePap;		// count of PAPX FKPs recorded in file. In non-complex
1098 														// files if the number of entries in the PLCFbtePapx is
1099 														// less than this, the PLCFbtePapx  is incomplete.
1100 	*/
1101 
1102 	// Ende des Einschubs fuer WW67 ******************************************
1103 
1104 	WW8_FC fcPlcfdoaMom;	// 0x192 file offset of the  FDOA (drawn object) PLCF for main document.
1105 						//	==0 if document has no drawn objects. The length of the FDOA is 6 bytes.
1106 						// ab Ver8 unused
1107 	sal_Int32 lcbPlcfdoaMom;	// 0x196 length in bytes of the FDOA PLCF of the main document
1108 												// ab Ver8 unused
1109 	WW8_FC fcPlcfdoaHdr;	// 0x19A file offset of the  FDOA (drawn object) PLCF for the header document.
1110 						//	==0 if document has no drawn objects. The length of the FDOA is 6 bytes.
1111 						// ab Ver8 unused
1112 	sal_Int32 lcbPlcfdoaHdr;	// 0x19E length in bytes of the FDOA PLCF of the header document
1113 												// ab Ver8 unused
1114 
1115 	WW8_FC fcPlcfspaMom;		// offset in table stream of the FSPA PLCF for main document.
1116 												// == 0 if document has no office art objects
1117 														// war in Ver67 nur leere Reserve
1118 	sal_Int32 lcbPlcfspaMom;		// length in bytes of the FSPA PLCF of the main document
1119 														// war in Ver67 nur leere Reserve
1120 	WW8_FC fcPlcfspaHdr;		// offset in table stream of the FSPA PLCF for header document.
1121 												// == 0 if document has no office art objects
1122 														// war in Ver67 nur leere Reserve
1123 	sal_Int32 lcbPlcfspaHdr;		// length in bytes of the FSPA PLCF of the header document
1124 														// war in Ver67 nur leere Reserve
1125 
1126 	WW8_FC fcPlcfAtnbkf;	// 0x1B2 file offset of BKF (bookmark first) PLCF of the annotation subdocument
1127 	sal_Int32 lcbPlcfAtnbkf;	// 0x1B6 length in bytes of BKF (bookmark first) PLCF of the annotation subdocument
1128 
1129 	WW8_FC fcPlcfAtnbkl;	// 0x1BA file offset of BKL (bookmark last) PLCF of the annotation subdocument
1130 	sal_Int32 lcbPlcfAtnbkl;	// 0x1BE length in bytes of BKL (bookmark first) PLCF of the annotation subdocument
1131 
1132 	WW8_FC fcPms;		// 0x1C2 file offset of PMS (Print Merge State) information block
1133 	sal_Int32 lcbPMS;		// 0x1C6 length in bytes of PMS
1134 
1135 	WW8_FC fcFormFldSttbf;	// 0x1CA file offset of form field Sttbf which contains strings used in form field dropdown controls
1136 	sal_Int32 lcbFormFldSttbf;	// 0x1CE length in bytes of form field Sttbf
1137 
1138 	WW8_FC fcPlcfendRef;	// 0x1D2 file offset of PLCFendRef which points to endnote references in the main document stream
1139 	sal_Int32 lcbPlcfendRef;	// 0x1D6
1140 
1141 	WW8_FC fcPlcfendTxt;	// 0x1DA file offset of PLCFendRef which points to endnote text  in the endnote document
1142 						//		 stream which corresponds with the PLCFendRef
1143 	sal_Int32 lcbPlcfendTxt;	// 0x1DE
1144 
1145 	WW8_FC fcPlcffldEdn;	// 0x1E2 offset to PLCF of field positions in the endnote subdoc
1146 	sal_Int32 lcbPlcffldEdn;	// 0x1E6
1147 
1148 	WW8_FC  fcPlcfpgdEdn; 	// 0x1EA offset to PLCF of page boundaries in the endnote subdoc.
1149 	sal_Int32 lcbPlcfpgdEdn;		// 0x1EE
1150 
1151 
1152 	WW8_FC fcDggInfo;			// offset in table stream of the office art object table data.
1153 												// The format of office art object table data is found in a separate document.
1154 														// war in Ver67 nur leere Reserve
1155 	sal_Int32 lcbDggInfo;			// length in bytes of the office art object table data
1156 														// war in Ver67 nur leere Reserve
1157 
1158 	WW8_FC fcSttbfRMark;		// 0x1fa offset to STTBF that records the author abbreviations...
1159 	sal_Int32 lcbSttbfRMark;		// 0x1fe
1160 	WW8_FC fcSttbfCaption;	// 0x202 offset to STTBF that records caption titles...
1161 	sal_Int32 lcbSttbfCaption;	// 0x206
1162 	WW8_FC fcSttbAutoCaption;	// offset in table stream to the STTBF that records the object names and
1163 														// indices into the caption STTBF for objects which get auto captions.
1164 	sal_Int32 lcbSttbAutoCaption;	// 0x20e
1165 
1166 	WW8_FC fcPlcfwkb;		// 0x212 offset to PLCF that describes the boundaries of contributing documents...
1167 	sal_Int32 lcbPlcfwkb;		// 0x216
1168 
1169 	WW8_FC fcPlcfspl;		// offset in table stream of PLCF (of SPLS structures) that records spell check state
1170 														// war in Ver67 nur leere Reserve
1171 	sal_Int32 lcbPlcfspl;					// war in Ver67 nur leere Reserve
1172 
1173 	WW8_FC fcPlcftxbxTxt;	// 0x222 ...PLCF of beginning CP in the text box subdoc
1174 	sal_Int32 lcbPlcftxbxTxt;	// 0x226
1175 	WW8_FC fcPlcffldTxbx;	// 0x22a ...PLCF of field boundaries recorded in the textbox subdoc.
1176 	sal_Int32 lcbPlcffldTxbx;	// 0x22e
1177 	WW8_FC fcPlcfHdrtxbxTxt;// 0x232 ...PLCF of beginning CP in the header text box subdoc
1178 	sal_Int32 lcbPlcfHdrtxbxTxt;// 0x236
1179 	WW8_FC fcPlcffldHdrTxbx;// 0x23a ...PLCF of field boundaries recorded in the header textbox subdoc.
1180 	sal_Int32 lcbPlcffldHdrTxbx;// 0x23e
1181 
1182 	/*
1183 		spezielle Listenverwaltung fuer WW8
1184 	*/
1185 	WW8_FC fcPlcfLst;		// 0x02e2 offset in the table stream of list format information.
1186 	sal_Int32 lcbPlcfLst;		// 0x02e6 length
1187 	WW8_FC fcPlfLfo;		// 0x02ea offset in the table stream of list format override information.
1188 	sal_Int32 lcbPlfLfo;		// 0x02ee length
1189 	/*
1190 		spezielle Break-Verwaltung fuer Text-Box-Stories in WW8
1191 	*/
1192 	WW8_FC fcPlcftxbxBkd;	// 0x02f2 PLCF fuer TextBox-Break-Deskriptoren im Maintext
1193 	sal_Int32 lcbPlcftxbxBkd;	// 0x02f6
1194 	WW8_FC fcPlcfHdrtxbxBkd;// 0x02fa PLCF fuer TextBox-Break-Deskriptoren im Header-/Footer-Bereich
1195 	sal_Int32 lcbPlcfHdrtxbxBkd;// 0x02fe
1196 
1197 	// 0x302 - 372 == ignore
1198 	/*
1199 		ListNames (skip to here!)
1200 	*/
1201 	WW8_FC fcSttbListNames;// 0x0372 PLCF for Listname Table
1202 	sal_Int32 lcbSttbListNames;// 0x0376
1203 	/*
1204 		General-Varaiblen, die fuer Ver67 und Ver8 verwendet werden,
1205 		obwohl sie in der jeweiligen DATEI verschiedene Groesse haben:
1206 	*/
1207 	sal_Int32 pnChpFirst;
1208 	sal_Int32 pnPapFirst;
1209 	sal_Int32 cpnBteChp;
1210 	sal_Int32 cpnBtePap;
1211 	/*
1212 		nun wird lediglich noch ein Ctor benoetigt
1213 	*/
1214 	WW8Fib( SvStream& rStrm, sal_uInt8 nWantedVersion,sal_uInt32 nOffset=0 );
1215 
1216 	/* leider falsch, man braucht auch noch einen fuer den Export */
1217 	WW8Fib( sal_uInt8 nVersion = 6 );
1218 	sal_Bool Write( SvStream& rStrm );
1219 };
1220 
1221 
1222 class WW8Style
1223 {
1224 protected:
1225 	WW8Fib& rFib;
1226 	SvStream& rSt;
1227 	long nStyleStart;
1228 	long nStyleLen;
1229 //	WW8_STSHI* pStishi;
1230 
1231 	sal_uInt16	cstd;								// Count of styles in stylesheet
1232 	sal_uInt16	cbSTDBaseInFile;		// Length of STD Base as stored in a file
1233 	sal_uInt16	fStdStylenamesWritten : 1;	// Are built-in stylenames stored?
1234 	sal_uInt16	: 15;					// Spare flags
1235 	sal_uInt16	stiMaxWhenSaved;		// Max sti known when this file was written
1236 	sal_uInt16	istdMaxFixedWhenSaved;	// How many fixed-index istds are there?
1237 	sal_uInt16	nVerBuiltInNamesWhenSaved;	// Current version of built-in stylenames
1238 	sal_uInt16	ftcStandardChpStsh;		// ftc used by StandardChpStsh for this document
1239 
1240 public:
1241 	WW8Style( SvStream& rSt, WW8Fib& rFibPara );
1242 //	~WW8Style(){ delete( pStishi ); pStishi = 0; }
1243 	WW8_STD* Read1STDFixed( short& rSkip, short* pcbStd );
1244 	WW8_STD* Read1Style( short& rSkip, String* pString, short* pcbStd );
GetCount() const1245 	const sal_uInt16 GetCount() const { return cstd; }
1246 };
1247 
1248 
1249 class WW8Fonts
1250 {
1251 protected:
1252 	WW8_FFN* pFontA;		// Array of Pointers to Font Description
1253 	// Hilfs-Vari
1254 	sal_uInt16 nMax;		// Array-Groesse
1255 public:
1256 	WW8Fonts( SvStream& rSt, WW8Fib& rFib );
~WW8Fonts()1257 	~WW8Fonts(){ if( pFontA ) delete [] pFontA; }
1258 	const WW8_FFN* GetFont( sal_uInt16 nNum ) const;
GetMax() const1259 	sal_uInt16 GetMax() const { return nMax; }
1260 };
1261 
1262 
1263 /** Document Properties
1264 */
1265 class WW8Dop
1266 {
1267 public:
1268 	/*
1269 		Fehlerstatus
1270 	*/
1271 	sal_uLong nDopError;
1272 	/*
1273 		vom Ctor aus dem FIB gelesene Daten
1274 		(entspricht nur ungefaehr der tatsaechlichen Struktur
1275 		 des Winword-FIB)
1276 	*/
1277 	// Initialisier-Dummy:
1278 	sal_uInt8    nDataStart;
1279 	//-------------------------
1280 	sal_uInt16	fFacingPages : 1;	// 1 when facing pages should be printed
1281 	sal_uInt16	fWidowControl : 1;	// 1 when widow control is in effect. 0 when widow control disabled.
1282 	sal_uInt16	fPMHMainDoc	: 1;	// 1 when doc is a main doc for Print Merge Helper, 0 when not; default=0
1283 	sal_uInt16	grfSuppression : 2;	// 0 Default line suppression storage; 0= form letter line suppression; 1= no line suppression; default=0
1284 	sal_uInt16	fpc : 2;			// 1 footnote position code: 0 as endnotes, 1 at bottom of page, 2 immediately beneath text
1285 	sal_uInt16	: 1;				// 0 unused
1286 	//-------------------------
1287 	sal_uInt16	grpfIhdt : 8;			// 0 specification of document headers and footers. See explanation under Headers and Footers topic.
1288 	//-------------------------
1289 	sal_uInt16	rncFtn : 2;			// 0 restart index for footnotes, 0 don't restart note numbering, 1	section, 2 page
1290 	sal_uInt16	nFtn : 14;			// 1 initial footnote number for document
1291 	sal_uInt16	fOutlineDirtySave : 1; // when 1, indicates that information in the hPLCFpad should be refreshed since outline has been dirtied
1292 	sal_uInt16	: 7;				//	 reserved
1293 	sal_uInt16	fOnlyMacPics : 1;	//   when 1, Word believes all pictures recorded in the document were created on a Macintosh
1294 	sal_uInt16	fOnlyWinPics : 1;	//	 when 1, Word believes all pictures recorded in the document were created in Windows
1295 	sal_uInt16	fLabelDoc : 1;		//	 when 1, document was created as a print merge labels document
1296 	sal_uInt16	fHyphCapitals : 1;	//	 when 1, Word is allowed to hyphenate words that are capitalized. When 0, capitalized may not be hyphenated
1297 	sal_uInt16	fAutoHyphen	: 1;	//	 when 1, Word will hyphenate newly typed text as a background task
1298 	sal_uInt16	fFormNoFields : 1;
1299 	sal_uInt16	fLinkStyles	: 1;	//	 when 1, Word will merge styles from its template
1300 	sal_uInt16	fRevMarking	: 1;	//	 when 1, Word will mark revisions as the document is edited
1301 	sal_uInt16	fBackup : 1;		//	 always make backup when document saved when 1.
1302 	sal_uInt16	fExactCWords : 1;
1303 	sal_uInt16	fPagHidden : 1;		//
1304 	sal_uInt16	fPagResults : 1;
1305 	sal_uInt16	fLockAtn : 1;		//	 when 1, annotations are locked for editing
1306 	sal_uInt16	fMirrorMargins : 1;	//	 swap margins on left/right pages when 1.
1307 	sal_uInt16	fReadOnlyRecommended : 1;// user has recommended that this doc be opened read-only when 1
1308 	sal_uInt16	fDfltTrueType : 1;	//	 when 1, use TrueType fonts by default (flag obeyed only when doc was created by WinWord 2.x)
1309 	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).
1310 	sal_uInt16	fProtEnabled : 1;	//	 when 1, document is protected from edit operations
1311 	sal_uInt16	fDispFormFldSel : 1;//	 when 1, restrict selections to occur only within form fields
1312 	sal_uInt16	fRMView : 1;		//	 when 1, show revision markings on screen
1313 	sal_uInt16	fRMPrint : 1;		//	 when 1, print revision marks when document is printed
1314 	sal_uInt16	fWriteReservation : 1;
1315 	sal_uInt16	fLockRev : 1;		//	 when 1, the current revision marking state is locked
1316 	sal_uInt16	fEmbedFonts : 1;	//	 when 1, document contains embedded True Type fonts
1317 	//	  compatibility options
1318 	sal_uInt16 copts_fNoTabForInd : 1;			//	  when 1, don�t add automatic tab stops for hanging indent
1319 	sal_uInt16 copts_fNoSpaceRaiseLower : 1;		//	  when 1, don�t add extra space for raised or lowered characters
1320 	sal_uInt16 copts_fSupressSpbfAfterPgBrk : 1;	// when 1, suppress the paragraph Space Before and Space After options after a page break
1321 	sal_uInt16 copts_fWrapTrailSpaces : 1;		//	  when 1, wrap trailing spaces at the end of a line to the next line
1322 	sal_uInt16 copts_fMapPrintTextColor : 1;		//	  when 1, print colors as black on non-color printers
1323 	sal_uInt16 copts_fNoColumnBalance : 1;		//	  when 1, don�t balance columns for Continuous Section starts
1324 	sal_uInt16 copts_fConvMailMergeEsc : 1;
1325 	sal_uInt16 copts_fSupressTopSpacing : 1;		//	  when 1, suppress extra line spacing at top of page
1326 	sal_uInt16 copts_fOrigWordTableRules : 1;	//	  when 1, combine table borders like Word 5.x for the Macintosh
1327 	sal_uInt16 copts_fTransparentMetafiles : 1;	//	  when 1, don�t blank area between metafile pictures
1328 	sal_uInt16 copts_fShowBreaksInFrames : 1;	//	  when 1, show hard page or column breaks in frames
1329 	sal_uInt16 copts_fSwapBordersFacingPgs : 1;	//	  when 1, swap left and right pages on odd facing pages
1330 
1331 	sal_Int16  dxaTab;				// 720 twips	default tab width
1332 	sal_uInt16 wSpare;				//
1333 	sal_uInt16 dxaHotZ;			//		width of hyphenation hot zone measured in twips
1334 	sal_uInt16 cConsecHypLim;		//		number of lines allowed to have consecutive hyphens
1335 	sal_uInt16 wSpare2;			//		reserved
1336 	sal_Int32	dttmCreated;		// DTTM date and time document was created
1337 	sal_Int32	dttmRevised;		// DTTM date and time document was last revised
1338 	sal_Int32	dttmLastPrint;		// DTTM date and time document was last printed
1339 	sal_Int16	nRevision;			//		number of times document has been revised since its creation
1340 	sal_Int32	tmEdited;			//		time document was last edited
1341 	sal_Int32	cWords;				//		count of words tallied by last Word Count execution
1342 	sal_Int32	cCh;				//		count of characters tallied by last Word Count execution
1343 	sal_Int16	cPg;				//		count of pages tallied by last Word Count execution
1344 	sal_Int32	cParas;				//		count of paragraphs tallied by last Word Count execution
1345 	sal_uInt16 rncEdn : 2;			//		restart endnote number code: 0 don�t restart endnote numbering, 1 section, 2 page
1346 	sal_uInt16 nEdn : 14;			//		beginning endnote number
1347 	sal_uInt16 epc : 2;			//		endnote position code: 0 at end of section, 3 at end of	document
1348 	// sal_uInt16 nfcFtnRef : 4;		//		number format code for auto footnotes: 0 Arabic, 1 Upper case Roman, 2 Lower case Roman
1349 								//		3 Upper case Letter, 4 Lower case Letter
1350 								// ersetzt durch gleichlautendes Feld unten
1351 	// sal_uInt16 nfcEdnRef : 4;		//		number format code for auto endnotes: 0 Arabic, 1 Upper case Roman, 2 Lower case Roman
1352 								//		3 Upper case Letter, 4 Lower case Letter
1353 								// ersetzt durch gleichlautendes Feld unten
1354 	sal_uInt16 fPrintFormData : 1;	//		only print data inside of form fields
1355 	sal_uInt16 fSaveFormData : 1;	//		only save document data that is inside of a form field.
1356 	sal_uInt16 fShadeFormData : 1;	//		shade form fields
1357 	sal_uInt16 : 2;				//		reserved
1358 	sal_uInt16 fWCFtnEdn : 1;		//		when 1, include footnotes and endnotes in word count
1359 	sal_Int32	cLines;				//		count of lines tallied by last Word Count operation
1360 	sal_Int32	cWordsFtnEnd;		//		count of words in footnotes and endnotes tallied by last Word Count operation
1361 	sal_Int32	cChFtnEdn;			//		count of characters in footnotes and endnotes tallied by last Word Count operation
1362 	sal_Int16	cPgFtnEdn;			//		count of pages in footnotes and endnotes tallied by last Word Count operation
1363 	sal_Int32	cParasFtnEdn;		//		count of paragraphs in footnotes and endnotes tallied by last Word Count operation
1364 	sal_Int32	cLinesFtnEdn;		//		count of paragraphs in footnotes and endnotes tallied by last Word Count operation
1365 	sal_Int32	lKeyProtDoc;		//		document protection password key, only valid if dop.fProtEnabled, dop.fLockAtn or dop.fLockRev are 1.
1366 	sal_uInt16	wvkSaved : 3;		//		document view kind: 0 Normal view, 1 Outline view, 2 Page View
1367 	sal_uInt16	wScaleSaved : 9;	//
1368 	sal_uInt16	zkSaved : 2;
1369 
1370 	// hier sollte bei nFib < 103	Schluss sein, sonst ist Datei fehlerhaft!
1371 
1372 	/*
1373 		bei nFib >= 103 gehts weiter:
1374 	*/
1375 	sal_uInt32 fNoTabForInd								:1; // see above in compatibility options
1376 	sal_uInt32 fNoSpaceRaiseLower					:1;	// see above
1377 	sal_uInt32 fSupressSpbfAfterPageBreak	:1;	// see above
1378 	sal_uInt32 fWrapTrailSpaces						:1;	// see above
1379 	sal_uInt32 fMapPrintTextColor					:1;	// see above
1380 	sal_uInt32 fNoColumnBalance						:1;	// see above
1381 	sal_uInt32 fConvMailMergeEsc					:1;	// see above
1382 	sal_uInt32 fSupressTopSpacing					:1;	// see above
1383 	sal_uInt32 fOrigWordTableRules				:1;	// see above
1384 	sal_uInt32 fTransparentMetafiles			:1;	// see above
1385 	sal_uInt32 fShowBreaksInFrames				:1;	// see above
1386 	sal_uInt32 fSwapBordersFacingPgs			:1;	// see above
1387 	sal_uInt32														:4;	// reserved
1388 	sal_uInt32 fSuppressTopSpacingMac5		:1;	// Suppress extra line spacing at top
1389 																				// of page like MacWord 5.x
1390 	sal_uInt32 fTruncDxaExpand						:1;	// Expand/Condense by whole number of points
1391 	sal_uInt32 fPrintBodyBeforeHdr				:1;	// Print body text before header/footer
1392 	sal_uInt32 fNoLeading									:1;	// Don't add extra spacebetween rows of text
1393 	sal_uInt32														:1;	// reserved
1394 	sal_uInt32 fMWSmallCaps								:1;	// Use larger small caps like MacWord 5.x
1395 	sal_uInt32													 :10;// reserved
1396 
1397 	// hier sollte bei nFib <= 105	Schluss sein, sonst ist Datei fehlerhaft!
1398 
1399 	/*
1400 		bei nFib > 105 gehts weiter:
1401 	*/
1402 	sal_Int16	adt;							// Autoformat Document Type:
1403 													// 0 for normal. 1 for letter, and 2 for email.
1404 	WW8_DOPTYPOGRAPHY doptypography;	// siehe WW8STRUC.HXX
1405 	WW8_DOGRID        dogrid;					// siehe WW8STRUC.HXX
1406 	sal_uInt16 						:1; // reserved
1407 	sal_uInt16 lvl					:4; // Which outline levels are showing in outline view
1408 	sal_uInt16 						:4; // reserved
1409 	sal_uInt16 fHtmlDoc				:1; // This file is based upon an HTML file
1410 	sal_uInt16						:1;	// reserved
1411 	sal_uInt16 fSnapBorder			:1;	// Snap table and page borders to page border
1412 	sal_uInt16 fIncludeHeader		:1;	// Place header inside page border
1413 	sal_uInt16 fIncludeFooter		:1;	// Place footer inside page border
1414 	sal_uInt16 fForcePageSizePag	:1;	// Are we in online view
1415 	sal_uInt16 fMinFontSizePag		:1;	// Are we auto-promoting
1416 																// fonts to >= hpsZoonFontPag?
1417 	sal_uInt16 fHaveVersions			:1; // versioning is turned on
1418 	sal_uInt16 fAutoVersion				:1;	// autoversioning is enabled
1419 	sal_uInt16									 :14;	// reserved
1420 	// hier 12 Byte ueberspringen: ASUMI
1421 	sal_Int32 cChWS;
1422 	sal_Int32 cChWSFtnEdn;
1423 	sal_Int32 grfDocEvents;
1424 	// hier 4+30+8 Bytes ueberspringen
1425 	sal_Int32 cDBC;
1426 	sal_Int32 cDBCFtnEdn;
1427 	// hier 4 Bytes ueberspringen
1428 	sal_Int16 nfcFtnRef;
1429 	sal_Int16 nfcEdnRef;
1430 	sal_Int16 hpsZoonFontPag;
1431 	sal_Int16 dywDispPag;
1432 
1433 	// 2. Initialisier-Dummy:
1434 	sal_uInt8    nDataEnd;
1435 
1436 	/*
1437 		nun wird lediglich noch ein Ctor benoetigt,
1438 		dem die FIB-Nummer uebergeben werden muss
1439 	*/
1440 	WW8Dop( SvStream& rSt, sal_Int16 nFib, sal_Int32 nPos, sal_Int32 nSize );
1441 
1442 	/* leider falsch, man braucht auch noch einen fuer den Export */
1443 	WW8Dop();
1444 	sal_Bool Write( SvStream& rStrm, WW8Fib& rFib );
1445 };
1446 
1447 
WW8SkipOdd(SvStream * pSt)1448 inline short WW8SkipOdd(SvStream* pSt )
1449 {
1450 #if defined HP9000 || defined SINIX
1451 	short bRet = pSt->Tell() & 0x1;
1452 	if (bRet) {
1453 		sal_uInt8 c;
1454 		pSt->Read( &c, 1 );
1455 	}
1456 	return bRet;
1457 #else
1458 	if ( pSt->Tell() & 0x1 ){
1459 		sal_uInt8 c;
1460 		pSt->Read( &c, 1 );
1461 		return 1;
1462 	}
1463 	return 0;
1464 #endif
1465 }
1466 
1467 
1468 class WW8PLCF_HdFt
1469 {
1470 	WW8PLCF aPLCF;
1471 	long nTextOfs;
1472 	short nIdxOffset;
1473 
1474 public:
1475 	WW8PLCF_HdFt( SvStream* pSt, WW8Fib& rFib, WW8Dop& rDop );
1476 //	~WW8PLCF_HdFt() {}
1477 	sal_Bool GetTextPos( sal_uInt8 grpfIhdt, sal_uInt8 nWhich, WW8_CP& rStart, long& rLen );
1478 	sal_Bool GetTextPosExact( short nIdx, WW8_CP& rStart, long& rLen );
1479 	void UpdateIndex( sal_uInt8 grpfIhdt );
1480 };
1481 
1482 
1483 #endif
1484 
1485