Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #include <tools/string.hxx>
29 : :
30 : : // local
31 : : #include <w1struct.hxx>
32 : :
33 : : #ifdef DUMP
34 : : #include <fstream.h>
35 : : #endif
36 : :
37 : : #include <ostream>
38 : :
39 : : using std::ostream;
40 : :
41 : : namespace editeng { class SvxBorderLine; }
42 : :
43 : : class SvxFontItem;
44 : : class SvxBoxItem;
45 : : class SvStream;
46 : : class SwField;
47 : : class Ww1Annotation;
48 : : class Ww1AtnText;
49 : : class Ww1Chp;
50 : : class Ww1DocText;
51 : : class Ww1Dop;
52 : : class Ww1Fib;
53 : : class Ww1Fkp;
54 : : class Ww1FkpChp;
55 : : class Ww1FkpPap;
56 : : class Ww1Fonts;
57 : : class Ww1Manager;
58 : : class Ww1McrText;
59 : : class Ww1Pap;
60 : : class Ww1PlainText;
61 : : class Ww1Plc;
62 : : class Ww1PlcAnnotationRef;
63 : : class Ww1PlcAnnotationTxt;
64 : : class Ww1PlcChp;
65 : : class Ww1PlcFields;
66 : : class Ww1PlcFootnoteRef;
67 : : class Ww1PlcFootnoteTxt;
68 : : class Ww1PlcGlossary;
69 : : class Ww1PlcHdd;
70 : : class Ww1PlcPap;
71 : : class Ww1PlcSep;
72 : : class Ww1Shell;
73 : : class Ww1Sprm;
74 : : class Ww1SprmPapx;
75 : : class Ww1SprmSep;
76 : : class Ww1Style;
77 : : class Ww1StyleSheet;
78 : :
79 : : ///////////////////////////////////////////////////////////////////////
80 : : //
81 : : // nach moeglichkeit wurden in diesem modul methoden aehnlicher
82 : : // funktionalitaet gleich benannt. Die namen wurden wenn moeglich vom
83 : : // ww-filter uebernommen.
84 : : // Where() gibt die position eines elements. dies kann sowohl eine
85 : : // seek-position im stream als auch ein relativer offset sein, da dies
86 : : // bei word durcheinander geht. die methoden sind durch kommentare
87 : : // gekennzeichnet, ob sie sich auf positionen in der datei oder
88 : : // innerhalb des textes beziehen. vorsicht: innerhalb des textes kann
89 : : // verschiedene texte in der datei bedeuten.
90 : : // Count() gibt die anzahl der elemente zurueck. vorsicht bei
91 : : // n/n-1-feldern (word speichert strukturen gern in doppel-arrays, in
92 : : // denen das erste n elemente, das zweite jedoch n-1 elemente
93 : : // enthaelt.
94 : : // Fill() fuellt uebergebene referenzen mit daten aus den
95 : : // word-strukturen.
96 : : // GetData() gibt zeiger auf den datenbereich zurueck
97 : : // GetError() gibt zurueck, ob fehler aufgetreten ist
98 : : // Start(), Stop(), Out(), op<< siehe modul w1filter
99 : : // Dump() siehe modul w1dump
100 : : //
101 : :
102 : : /////////////////////////////////////////////////////////////////// Fib
103 : : //
104 : : // file information block: wurzel des uebels: steht am beginn der
105 : : // datei (seek(0)) und enthaelt alle positionen der strukturen der
106 : : // datei
107 : : //
108 : : class Ww1Fib
109 : : {
110 : : W1_FIB aFib;
111 : : sal_Bool bOK;
112 : : SvStream& rStream;
113 : : public:
114 : : Ww1Fib(SvStream&);
115 : : friend ostream& operator <<(ostream&, Ww1Fib&);
116 : 0 : W1_FIB& GetFIB() { return aFib; }
117 : 0 : sal_Bool GetError() { return !bOK; }
118 : 0 : SvStream& GetStream() { return rStream; }
119 : : };
120 : :
121 : : /////////////////////////////////////////////////////////////////// Dop
122 : : //
123 : : // document property: eigenschaften des gesamten dokuments
124 : : //
125 : : class Ww1Dop
126 : : {
127 : : W1_DOP aDop;
128 : : Ww1Fib& rFib;
129 : : sal_Bool bOK;
130 : : public:
131 : : Ww1Dop(Ww1Fib&);
132 : : sal_Bool GetError() {
133 : : return !bOK; }
134 : 0 : W1_DOP& GetDOP() {
135 : 0 : return aDop; }
136 : : friend ostream& operator <<(ostream&, Ww1Dop&);
137 : : void Out(Ww1Shell&);
138 : : };
139 : :
140 : : ///////////////////////////////////////////////////////////// PlainText
141 : : //
142 : : // ww-dateien koennen mehrere textbloecke enthalten (main-text,
143 : : // fusznoten etc). PlainText vereinigt die gemeinsamkeiten
144 : : //
145 : : class Ww1PlainText
146 : : {
147 : : protected:
148 : : Ww1Fib& rFib;
149 : : sal_uLong ulFilePos;
150 : : sal_uLong ulCountBytes;
151 : : sal_uLong ulSeek;
152 : : sal_Bool bOK;
153 : : public:
154 : : Ww1PlainText(Ww1Fib& rWwFib, sal_uLong nFilePos, sal_uLong nCountBytes);
155 : : // innerhalb des textes
156 : 0 : sal_uLong Where() const { return ulSeek; }
157 : 0 : void Seek( sal_uLong ulNew )
158 : : {
159 : : OSL_ENSURE(ulNew < ulCountBytes, "Ww1PlainText");
160 [ # # ]: 0 : if (ulNew < ulCountBytes)
161 : 0 : ulSeek = ulNew;
162 : 0 : }
163 : :
164 : 0 : sal_uLong Count() const { return ulCountBytes; }
165 : 0 : void SetCount(sal_uLong ulNew)
166 : : {
167 : 0 : ulNew += ulSeek;
168 [ # # ]: 0 : if (ulCountBytes > ulNew)
169 : 0 : ulCountBytes = ulNew;
170 : 0 : }
171 : 0 : void operator++(int)
172 : : {
173 : : OSL_ENSURE(ulSeek+1<ulCountBytes, "Ww1PlainText");
174 : 0 : ulSeek++;
175 : 0 : }
176 : 0 : sal_Bool GetError() { return !bOK; }
177 : : sal_Unicode Out( Ww1Shell&, sal_uLong& );
178 : : sal_Unicode Out( String&, sal_uLong=0xffffffff);
179 : : sal_Unicode Out( sal_Unicode& );
180 : : friend ostream& operator <<(ostream&, Ww1PlainText&);
181 : : String& Fill( String&, sal_uLong=0, sal_uLong=0xffffffff );
182 : : sal_Unicode operator []( sal_uLong );
183 : : String GetText( sal_uLong ulOffset, sal_uLong nLen ) const;
184 : :
185 : : enum Consts { MinChar = 32 };
186 : 0 : static sal_Bool IsChar( sal_Unicode c ) { return c >= MinChar; }
187 : : };
188 : :
189 : : /////////////////////////////////////////////////////////////// DocText
190 : : class Ww1DocText : public Ww1PlainText
191 : : {
192 : : public:
193 : 0 : Ww1DocText(Ww1Fib& rFibL) :
194 : 0 : Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet(),
195 : 0 : rFibL.GetFIB().ccpTextGet()) {
196 : 0 : }
197 : : };
198 : :
199 : : /////////////////////////////////////////////////////////////// FtnText
200 : : class Ww1FtnText : public Ww1PlainText
201 : : {
202 : : public:
203 : 0 : sal_uLong Offset(Ww1Fib& rFibL) {
204 : 0 : return rFibL.GetFIB().ccpTextGet(); }
205 : 0 : Ww1FtnText(Ww1Fib& rFibL) :
206 : 0 : Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
207 : 0 : Offset(rFibL), rFibL.GetFIB().ccpFtnGet()) {
208 : 0 : }
209 : : };
210 : :
211 : : /////////////////////////////////////////////////////////////// HddText
212 : : class Ww1HddText : public Ww1PlainText
213 : : {
214 : : public:
215 : 0 : sal_uLong Offset(Ww1Fib& rFibL) {
216 : 0 : return rFibL.GetFIB().ccpTextGet() + rFibL.GetFIB().ccpFtnGet(); }
217 : 0 : Ww1HddText(Ww1Fib& rFibL) :
218 : 0 : Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
219 : 0 : Offset(rFibL), rFibL.GetFIB().ccpHddGet()) {
220 : 0 : }
221 : : };
222 : :
223 : : /////////////////////////////////////////////////////////////// McrText
224 : : class Ww1McrText : public Ww1PlainText
225 : : {
226 : : public:
227 : : sal_uLong Offset(Ww1Fib& rFibL) {
228 : : return rFibL.GetFIB().ccpTextGet() + rFibL.GetFIB().ccpFtnGet()
229 : : + rFibL.GetFIB().ccpHddGet(); }
230 : : Ww1McrText(Ww1Fib& rFibL) :
231 : : Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
232 : : Offset(rFibL), rFibL.GetFIB().ccpMcrGet()) {
233 : : }
234 : : };
235 : :
236 : : /////////////////////////////////////////////////////////////// AtnText
237 : : class Ww1AtnText : public Ww1PlainText
238 : : {
239 : : public:
240 : : sal_uLong Offset(Ww1Fib& rFibL) {
241 : : return rFibL.GetFIB().ccpTextGet() + rFibL.GetFIB().ccpFtnGet()
242 : : + rFibL.GetFIB().ccpHddGet() + rFibL.GetFIB().ccpMcrGet(); }
243 : : Ww1AtnText(Ww1Fib& rFibL) :
244 : : Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
245 : : Offset(rFibL), rFibL.GetFIB().ccpAtnGet()) {
246 : : }
247 : : };
248 : :
249 : : ///////////////////////////////////////////////////////////////// Style
250 : : //
251 : : // ein einzelner style oder vorlage
252 : : //
253 : : class Ww1Style
254 : : {
255 : : String aName;
256 : : W1_CHP aChpx;
257 : : Ww1SprmPapx* pPapx;
258 : : Ww1StyleSheet* pParent;
259 : : sal_uInt8 stcBase;
260 : : sal_uInt8 stcNext;
261 : : sal_Bool bUsed;
262 : : public:
263 : : Ww1Style();
264 : : ~Ww1Style();
265 : 0 : sal_Bool IsUsed() const { return bUsed; }
266 : : void SetDefaults(sal_uInt8);
267 : 0 : void SetParent(Ww1StyleSheet* newParent) { pParent = newParent; }
268 : 0 : void SetName(const String& rName) { bUsed = sal_True; aName = rName; }
269 : 0 : const String& GetName() const { return aName; }
270 : : Ww1Style& GetBase();
271 : 0 : sal_uInt16 GetnBase() const { return stcBase; }
272 : 0 : sal_uInt16 GetnNext() const { return stcNext; }
273 : : sal_uInt16 ReadName(sal_uInt8*&, sal_uInt16&, sal_uInt16 stc);
274 : : sal_uInt16 ReadChpx(sal_uInt8*&, sal_uInt16&);
275 : : sal_uInt16 ReadPapx(sal_uInt8*&, sal_uInt16&);
276 : : sal_uInt16 ReadEstcp(sal_uInt8*&, sal_uInt16&);
277 : : friend ostream& operator <<(ostream&, Ww1Style&);
278 : : void Out(Ww1Shell&, Ww1Manager&);
279 : : };
280 : :
281 : : //////////////////////////////////////////////////////////// StyleSheet
282 : : //
283 : : // die sammlung aller vorlagen (max. 256)
284 : : //
285 [ # # ][ # # ]: 0 : class Ww1StyleSheet
286 : : {
287 : : Ww1Style aStyles[256];
288 : : sal_uInt16 cstcStd; // count style code standard
289 : : Ww1Fib& rFib;
290 : : sal_Bool bOK;
291 : : sal_uInt16 ReadNames(sal_uInt8*&, sal_uInt16&);
292 : : sal_uInt16 ReadChpx(sal_uInt8*&, sal_uInt16&);
293 : : sal_uInt16 ReadPapx(sal_uInt8*&, sal_uInt16&);
294 : : sal_uInt16 ReadEstcp(sal_uInt8*&, sal_uInt16&);
295 : :
296 : : void OutDefaults(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc);
297 : : void OutOne(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc);
298 : : void OutOneWithBase(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc,
299 : : sal_uInt8* pbStopRecur );
300 : : public:
301 : : Ww1StyleSheet(Ww1Fib& rFib);
302 : 0 : Ww1Style& GetStyle(sal_uInt16 stc) {
303 : 0 : return aStyles[stc]; }
304 : 0 : sal_uInt16 Count() {
305 : 0 : return 256; }
306 : : friend ostream& operator <<(ostream&, Ww1StyleSheet&);
307 : : void Out(Ww1Shell&, Ww1Manager&);
308 : : friend class Ww1Style;
309 : : sal_Bool GetError() {
310 : : return !bOK; }
311 : : };
312 : :
313 : : ///////////////////////////////////////////////////////////////// Fonts
314 : : //
315 : : // ww kennt nur font-nummern beim formatieren. nebenher gibts ein
316 : : // array von fonts, damit man aus der nummer einen konkreten font
317 : : // machen kann.
318 : : //
319 : : class Ww1Fonts
320 : : {
321 : : protected:
322 : : W1_FFN** pFontA; // Array of Pointers to Font Description
323 : : Ww1Fib& rFib;
324 : : sal_uLong nFieldFlags;
325 : : sal_uInt16 nMax; // Array-Groesse
326 : : sal_Bool bOK;
327 : : public:
328 : : Ww1Fonts(Ww1Fib&, sal_uLong nFieldFlgs);
329 : 0 : ~Ww1Fonts() {
330 [ # # ]: 0 : if (pFontA)
331 : 0 : DELETEZ(pFontA[0]);
332 : 0 : DELETEZ(pFontA); }
333 : : W1_FFN* GetFFN(sal_uInt16 nNum);
334 : : sal_uInt16 Count() {
335 : : return nMax; }
336 : : friend ostream& operator <<(ostream&, Ww1Fonts&);
337 : : sal_Bool GetError() {
338 : : return !bOK; }
339 : : SvxFontItem GetFont(sal_uInt16);
340 : : };
341 : :
342 : : //////////////////////////////////////////////////////////// SingleSprm
343 : : //
344 : : // diese klassen ersetzen die aSprmTab etc des ww6-filters. die
345 : : // funktionspointer sind hier virtuale methoden, fuer die typen (byte,
346 : : // word, var-sized etc) gibt es abgeleitete klassen. diese haben
347 : : // methoden zum bestimmen der groesze, dumpen und shell-ausgeben der
348 : : // Sprms.
349 : : // die klassen werden mit new (in InitTab()) erzeugt und nach ihrem
350 : : // code in die tabelle gestellt. zum aktivieren ruft man nun nur noch
351 : : // die entsprechende methode des objektes in der tabelle auf.
352 : : // wohlgemerkt: SingleSprms sind die _beschreibung_ und _funktion_ der
353 : : // Sprms, nicht deren inhalt. dieser musz uebergeben werden an die
354 : : // einzelnen methoden wie Size, Dump und Start/Stop.
355 : : //
356 : : class Ww1SingleSprm
357 : : {
358 : : public:
359 : : #ifdef DUMP
360 : : //
361 : : // allein die virtuellen methoden stehen in der vtab, also je nachdem,
362 : : // ob fuer dumper oder filter uebersetzt wird ausblenden: das spart
363 : : // platz. ausserdem stehen die methoden fuer dumper bzw filter in
364 : : // verschiedenen modulen, die im jeweils anderen projekt nicht
365 : : // uebersetzt werden. das diese dann beim linken nicht zur verfuegung
366 : : // stehen faellt dann auch nicht auf. Der Namensstring ist nur im
367 : : // Dumper noetig: weg damit im Filter.
368 : : //
369 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
370 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
371 : : virtual ostream& Dump(ostream&, sal_uInt8*, sal_uInt16);
372 : : const sal_Char* sName;
373 : : #else
374 : : virtual void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
375 : : virtual void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
376 : : ostream& Dump(ostream&, sal_uInt8*, sal_uInt16);
377 : : #endif
378 : : virtual sal_uInt16 Size(sal_uInt8*);
379 : : sal_uInt16 nCountBytes;
380 : :
381 : 0 : Ww1SingleSprm(sal_uInt16 nBytes, const sal_Char* /*pName*/ = 0 )
382 : 0 : : nCountBytes(nBytes)
383 : : #ifdef DUMP
384 : : , sName( pName)
385 : : #endif
386 : : {
387 : 0 : }
388 : : virtual ~Ww1SingleSprm();
389 : : };
390 : :
391 [ # # ]: 0 : class Ww1SingleSprmByteSized : public Ww1SingleSprm {
392 : : public:
393 : : sal_uInt16 Size(sal_uInt8*);
394 : 0 : Ww1SingleSprmByteSized(sal_uInt16 nBytes, sal_Char* sName = 0) :
395 : 0 : Ww1SingleSprm(nBytes, sName) {
396 : 0 : }
397 : : };
398 : :
399 [ # # ]: 0 : class Ww1SingleSprmWordSized : public Ww1SingleSprm {
400 : : public:
401 : : sal_uInt16 Size(sal_uInt8*);
402 : 0 : Ww1SingleSprmWordSized(sal_uInt16 nBytes, sal_Char* sName = 0) :
403 : 0 : Ww1SingleSprm(nBytes, sName) {
404 : 0 : }
405 : : };
406 : :
407 [ # # ]: 0 : class Ww1SingleSprmByte : public Ww1SingleSprm {
408 : : public:
409 : : ostream& Dump(ostream&, sal_uInt8*, sal_uInt16);
410 : 0 : Ww1SingleSprmByte(sal_Char* sName = 0) :
411 : 0 : Ww1SingleSprm(1, sName) {
412 : 0 : }
413 : : };
414 : :
415 [ # # ]: 0 : class Ww1SingleSprmBool : public Ww1SingleSprmByte {
416 : : public:
417 : : ostream& Dump(ostream&, sal_uInt8*, sal_uInt16);
418 : 0 : Ww1SingleSprmBool(sal_Char* sName = 0) :
419 : 0 : Ww1SingleSprmByte(sName) {
420 : 0 : }
421 : : };
422 : :
423 [ # # ]: 0 : class Ww1SingleSprm4State : public Ww1SingleSprmByte {
424 : : public:
425 : : ostream& Dump(ostream&, sal_uInt8*, sal_uInt16);
426 : 0 : Ww1SingleSprm4State(sal_Char* sName = 0) :
427 : 0 : Ww1SingleSprmByte(sName) {
428 : 0 : }
429 : : };
430 : :
431 [ # # ]: 0 : class Ww1SingleSprmWord : public Ww1SingleSprm {
432 : : public:
433 : : ostream& Dump(ostream&, sal_uInt8*, sal_uInt16);
434 : 0 : Ww1SingleSprmWord(sal_Char* sName = 0)
435 : 0 : : Ww1SingleSprm(2, sName) {}
436 : : };
437 : :
438 [ # # ]: 0 : class Ww1SingleSprmLong : public Ww1SingleSprm {
439 : : public:
440 : : ostream& Dump(ostream&, sal_uInt8*, sal_uInt16);
441 : : Ww1SingleSprmLong(sal_Char* sName = 0) :
442 : : Ww1SingleSprm(4, sName) {
443 : : }
444 : : };
445 : :
446 [ # # ]: 0 : class Ww1SingleSprmTab : public Ww1SingleSprm {
447 : : public:
448 : : ostream& Dump(ostream&, sal_uInt8*, sal_uInt16);
449 : : sal_uInt16 Size(sal_uInt8*);
450 : 0 : Ww1SingleSprmTab(sal_uInt16 nBytes, sal_Char* sName = 0) :
451 : 0 : Ww1SingleSprm(nBytes, sName) {
452 : 0 : }
453 : : };
454 : :
455 [ # # ]: 0 : class Ww1SingleSprmPJc : public Ww1SingleSprmByte {
456 : : public:
457 : 0 : Ww1SingleSprmPJc(sal_Char* sName) :
458 : 0 : Ww1SingleSprmByte(sName) {
459 : 0 : }
460 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
461 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
462 : : };
463 : :
464 [ # # ]: 0 : class Ww1SingleSprmPDxa : public Ww1SingleSprmWord {
465 : : public:
466 : 0 : Ww1SingleSprmPDxa(sal_Char* sName) :
467 : 0 : Ww1SingleSprmWord(sName) {
468 : 0 : }
469 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
470 : : };
471 : :
472 [ # # ]: 0 : class Ww1SingleSprmPDxaRight : public Ww1SingleSprmPDxa {
473 : : public:
474 : 0 : Ww1SingleSprmPDxaRight(sal_Char* sName) :
475 : 0 : Ww1SingleSprmPDxa(sName) {
476 : 0 : }
477 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
478 : : };
479 : :
480 [ # # ]: 0 : class Ww1SingleSprmPDxaLeft : public Ww1SingleSprmPDxa {
481 : : public:
482 : 0 : Ww1SingleSprmPDxaLeft(sal_Char* sName) :
483 : 0 : Ww1SingleSprmPDxa(sName) {
484 : 0 : }
485 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
486 : : };
487 : :
488 [ # # ]: 0 : class Ww1SingleSprmPDxaLeft1 : public Ww1SingleSprmPDxa {
489 : : public:
490 : 0 : Ww1SingleSprmPDxaLeft1(sal_Char* sName) :
491 : 0 : Ww1SingleSprmPDxa(sName) {
492 : 0 : }
493 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
494 : : };
495 : :
496 [ # # ]: 0 : class Ww1SingleSprmPFKeep : public Ww1SingleSprmBool {
497 : : public:
498 : 0 : Ww1SingleSprmPFKeep(sal_Char* sName) :
499 : 0 : Ww1SingleSprmBool(sName) {
500 : 0 : }
501 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
502 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
503 : : };
504 : :
505 [ # # ]: 0 : class Ww1SingleSprmPFKeepFollow : public Ww1SingleSprmBool {
506 : : public:
507 : 0 : Ww1SingleSprmPFKeepFollow(sal_Char* sName) :
508 : 0 : Ww1SingleSprmBool(sName) {
509 : 0 : }
510 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
511 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
512 : : };
513 : :
514 [ # # ]: 0 : class Ww1SingleSprmPPageBreakBefore : public Ww1SingleSprmBool {
515 : : public:
516 : 0 : Ww1SingleSprmPPageBreakBefore(sal_Char* sName) :
517 : 0 : Ww1SingleSprmBool(sName) {
518 : 0 : }
519 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
520 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
521 : : };
522 : :
523 [ # # ]: 0 : class Ww1SingleSprmPBrc : public Ww1SingleSprmWord {
524 : : protected:
525 : : // spezielle start-routine, je nach sprm verschieden versorgt
526 : : // mit einem BoxItem.
527 : : void Start(Ww1Shell&, sal_uInt8, W1_BRC10*, sal_uInt16, Ww1Manager&, SvxBoxItem&);
528 : : void Start(Ww1Shell&, sal_uInt8, W1_BRC*, sal_uInt16, Ww1Manager&, SvxBoxItem&);
529 : :
530 : : using Ww1SingleSprm::Start;
531 : :
532 : : public:
533 : 0 : Ww1SingleSprmPBrc(sal_Char* sName) :
534 : 0 : Ww1SingleSprmWord(sName) {
535 : 0 : }
536 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
537 : : // SetBorder() wird auch fuer Tabellen gebraucht, deshalb public
538 : : static editeng::SvxBorderLine* SetBorder(editeng::SvxBorderLine*, W1_BRC10*);
539 : : };
540 : :
541 : : #define BRC_TOP ((sal_uInt16)0)
542 : : #define BRC_LEFT ((sal_uInt16)1)
543 : : #define BRC_BOTTOM ((sal_uInt16)2)
544 : : #define BRC_RIGHT ((sal_uInt16)3)
545 : : #define BRC_ANZ ((sal_uInt16)BRC_RIGHT-BRC_TOP+1)
546 : :
547 : : // Die BRC-struktur fuer 1.0 versionen von word sind verschieden von
548 : : // denen der folgenden versionen. diese werden zum glueck aber auch
549 : : // von anderen sprms abgerufen.
550 : : // SH: Ab sofort alle 4 Umrandungen ueber nur 1 Klasse.
551 [ # # ]: 0 : class Ww1SingleSprmPBrc10 : public Ww1SingleSprmPBrc
552 : : {
553 : : sal_uInt16 nLine; // BRC_TOP, BRC_LEFT, ...
554 : :
555 : : using Ww1SingleSprmPBrc::Start;
556 : :
557 : : public:
558 : 0 : Ww1SingleSprmPBrc10(sal_uInt16 nL, sal_Char* sName)
559 : 0 : : Ww1SingleSprmPBrc(sName), nLine(nL) {}
560 : :
561 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
562 : : };
563 : :
564 [ # # ]: 0 : class Ww1SingleSprmParaSpace : public Ww1SingleSprmWord {
565 : : public:
566 : 0 : Ww1SingleSprmParaSpace(sal_Char* sName)
567 : 0 : : Ww1SingleSprmWord(sName) {}
568 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
569 : : };
570 : :
571 [ # # ]: 0 : class Ww1SingleSprmPDyaBefore : public Ww1SingleSprmParaSpace {
572 : : public:
573 : 0 : Ww1SingleSprmPDyaBefore(sal_Char* sName)
574 : 0 : : Ww1SingleSprmParaSpace(sName) {}
575 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
576 : : };
577 : :
578 [ # # ]: 0 : class Ww1SingleSprmPDyaAfter : public Ww1SingleSprmParaSpace {
579 : : public:
580 : 0 : Ww1SingleSprmPDyaAfter(sal_Char* sName) :
581 : 0 : Ww1SingleSprmParaSpace(sName) {
582 : 0 : }
583 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
584 : : };
585 : :
586 [ # # ]: 0 : class Ww1SingleSprmPDyaLine : public Ww1SingleSprmWord {
587 : : public:
588 : 0 : Ww1SingleSprmPDyaLine(sal_Char* sName) :
589 : 0 : Ww1SingleSprmWord(sName) {
590 : 0 : }
591 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
592 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
593 : : };
594 : :
595 [ # # ]: 0 : class Ww1SingleSprmPChgTabsPapx : public Ww1SingleSprmByteSized {
596 : : public:
597 : 0 : Ww1SingleSprmPChgTabsPapx(sal_Char* sName) :
598 : 0 : Ww1SingleSprmByteSized(0, sName) {
599 : 0 : }
600 : : // Size() ist noch nicht aktiviert !!
601 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
602 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
603 : : };
604 : :
605 [ # # ]: 0 : class Ww1SingleSprmSGprfIhdt : public Ww1SingleSprmByte {
606 : : public:
607 : 0 : Ww1SingleSprmSGprfIhdt(sal_Char* sName) :
608 : 0 : Ww1SingleSprmByte(sName) {
609 : 0 : }
610 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
611 : : };
612 : :
613 [ # # ]: 0 : class Ww1SingleSprmSColumns : public Ww1SingleSprmWord {
614 : : public:
615 : 0 : Ww1SingleSprmSColumns(sal_Char* sName) :
616 : 0 : Ww1SingleSprmWord(sName) {
617 : 0 : }
618 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
619 : : };
620 : :
621 [ # # ]: 0 : class Ww1SingleSprmPFInTable : public Ww1SingleSprmBool {
622 : : public:
623 : 0 : Ww1SingleSprmPFInTable(sal_Char* sName) :
624 : 0 : Ww1SingleSprmBool(sName) {
625 : 0 : }
626 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
627 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
628 : : };
629 : :
630 [ # # ]: 0 : class Ww1SingleSprmPTtp : public Ww1SingleSprmBool {
631 : : public:
632 : 0 : Ww1SingleSprmPTtp(sal_Char* sName) :
633 : 0 : Ww1SingleSprmBool(sName) {
634 : 0 : }
635 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
636 : : void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
637 : : };
638 : :
639 [ # # ]: 0 : class Ww1SingleSprmTJc : public Ww1SingleSprmWord {
640 : : public:
641 : : Ww1SingleSprmTJc(sal_Char* sName)
642 : : : Ww1SingleSprmWord(sName) {}
643 : : };
644 : :
645 [ # # ]: 0 : class Ww1SingleSprmTDxaGapHalf : public Ww1SingleSprmWord {
646 : : public:
647 : : Ww1SingleSprmTDxaGapHalf(sal_Char* sName) :
648 : : Ww1SingleSprmWord(sName) {
649 : : }
650 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
651 : : };
652 : :
653 [ # # ]: 0 : class Ww1SingleSprmTDefTable10 : public Ww1SingleSprmWordSized {
654 : : public:
655 : 0 : Ww1SingleSprmTDefTable10(sal_Char* sName) :
656 : 0 : Ww1SingleSprmWordSized(0, sName) {
657 : 0 : }
658 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
659 : : };
660 : :
661 [ # # ]: 0 : class Ww1SingleSprmTDyaRowHeight : public Ww1SingleSprmWord {
662 : : public:
663 : : Ww1SingleSprmTDyaRowHeight(sal_Char* sName) :
664 : : Ww1SingleSprmWord(sName) {
665 : : }
666 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
667 : : };
668 : :
669 : : // Klassendefinitionen fuer Tabellen-Fastsave-Attribute
670 : : // Da wir kein Fastsave unterstuetzen, brauchen wir's nicht
671 : :
672 : : // Klassendefinitionen fuer Apos ( == Flys )
673 : :
674 [ # # ]: 0 : class Ww1SingleSprmPpc : public Ww1SingleSprmByte {
675 : : public:
676 : 0 : Ww1SingleSprmPpc(sal_Char* sName) :
677 : 0 : Ww1SingleSprmByte(sName) {
678 : 0 : }
679 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
680 : : };
681 : :
682 [ # # ]: 0 : class Ww1SingleSprmPDxaAbs : public Ww1SingleSprmWord {
683 : : public:
684 : 0 : Ww1SingleSprmPDxaAbs(sal_Char* sName) :
685 : 0 : Ww1SingleSprmWord(sName) {
686 : 0 : }
687 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
688 : : };
689 : :
690 [ # # ]: 0 : class Ww1SingleSprmPDyaAbs : public Ww1SingleSprmWord {
691 : : public:
692 : 0 : Ww1SingleSprmPDyaAbs(sal_Char* sName) :
693 : 0 : Ww1SingleSprmWord(sName) {
694 : 0 : }
695 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
696 : : };
697 : :
698 [ # # ]: 0 : class Ww1SingleSprmPDxaWidth : public Ww1SingleSprmWord {
699 : : public:
700 : 0 : Ww1SingleSprmPDxaWidth(sal_Char* sName) :
701 : 0 : Ww1SingleSprmWord(sName) {
702 : 0 : }
703 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
704 : : };
705 : :
706 [ # # ]: 0 : class Ww1SingleSprmPFromText : public Ww1SingleSprmWord {
707 : : public:
708 : 0 : Ww1SingleSprmPFromText(sal_Char* sName) :
709 : 0 : Ww1SingleSprmWord(sName) {
710 : 0 : }
711 : : void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
712 : : };
713 : :
714 : : ////////////////////////////////////////////////////////////////// Sprm
715 : : //
716 : : // der tatsaechlich in der datei auftretende datentyp Sprm
717 : : //
718 : : class Ww1Sprm
719 : : {
720 : : sal_Bool ReCalc();
721 : : static Ww1SingleSprm* aTab[256];
722 : : static Ww1SingleSprm* pSingleSprm;
723 : : protected:
724 : : static void InitTab();
725 : 0 : Ww1SingleSprm& GetTab(sal_uInt16 nId)
726 : : {
727 [ # # ]: 0 : if( !pSingleSprm )
728 : 0 : InitTab();
729 [ # # ]: 0 : return aTab[ nId ] ? *aTab[nId] : *pSingleSprm;
730 : : }
731 : :
732 : : sal_uInt8* p;
733 : : sal_uInt16 nCountBytes;
734 : : sal_Bool bOK;
735 : : sal_uInt16* pArr;
736 : : sal_uInt16 count;
737 : : // ohne Token, mit laengen-byte/word
738 : : sal_uInt16 GetSize(sal_uInt8 nId, sal_uInt8* pSprm);
739 : : // mit Token und LaengenByte
740 : 0 : sal_uInt16 GetSizeBrutto(sal_uInt8* pSprm) {
741 : 0 : sal_uInt8 nId = *pSprm++;
742 : 0 : return GetSize(nId, pSprm) + 1; }
743 : : // gibt fuer nTh element id, size & zeiger auf daten:
744 : : // sal_Bool Fill(sal_uInt16, sal_uInt8&, sal_uInt16&, sal_uInt8*&);
745 : : public:
746 : : // SH: brauche ich public
747 : : // gibt fuer nTh element id, size & zeiger auf daten:
748 : : sal_Bool Fill(sal_uInt16, sal_uInt8&, sal_uInt16&, sal_uInt8*&);
749 : :
750 : : Ww1Sprm(sal_uInt8*, sal_uInt16);
751 : : Ww1Sprm(SvStream&, sal_uLong);
752 : : ~Ww1Sprm();
753 : : friend ostream& operator <<(ostream&, Ww1Sprm&);
754 : : void Start(Ww1Shell&, Ww1Manager&);
755 : : void Start(Ww1Shell&, Ww1Manager&, sal_uInt16);
756 : : void Stop(Ww1Shell&, Ww1Manager&);
757 : 0 : sal_Bool IsUsed() {
758 : 0 : return nCountBytes != 255; }
759 : 0 : sal_uInt16 Count() {
760 : 0 : return count; }
761 : : sal_Bool GetError() {
762 : : return !bOK; }
763 : : static void DeinitTab();
764 : : };
765 : :
766 : : /////////////////////////////////////////////////////////////// Picture
767 : : //
768 : : // der wrapper um den datentyp PIC, eine struktur, die am beginn eines
769 : : // bild-dateinamens oder eines eingebetteten bildes steht.
770 : : //
771 : : class Ww1Picture
772 : : {
773 : : sal_Bool bOK;
774 : : W1_PIC* pPic;
775 : : public:
776 : : Ww1Picture(SvStream&, sal_uLong);
777 : 0 : ~Ww1Picture() {
778 : 0 : }
779 : 0 : sal_Bool GetError() {
780 : 0 : return !bOK; }
781 : : friend ostream& operator <<(ostream&, Ww1Picture&);
782 : : void Out(Ww1Shell&, Ww1Manager&);
783 : : void WriteBmp(SvStream&);
784 : : };
785 : :
786 : : /////////////////////////////////////////////////////////////////// Plc
787 : : //
788 : : // eine der wichtigen array-strukturen der ww-dateien. sie beinhalten
789 : : // n+1 dateipositionen und n attribute, die zwischen den
790 : : // dateipositionen gelten.
791 : : //
792 : : class Ww1Plc
793 : : {
794 : : sal_uInt8* p;
795 : : sal_uInt16 nCountBytes;
796 : : sal_uInt16 iMac;
797 : : sal_uInt16 nItemSize;
798 : : sal_Bool bOK;
799 : : protected:
800 : : Ww1Fib& rFib;
801 : : sal_uInt8* GetData(sal_uInt16);
802 : : public:
803 : : Ww1Plc(Ww1Fib&, sal_uLong, sal_uInt16, sal_uInt16);
804 : : ~Ww1Plc();
805 : : friend ostream& operator <<(ostream&, Ww1Plc&);
806 : : sal_uLong Where(sal_uInt16); // wie im jeweiligen plc
807 : : void Seek(sal_uLong, sal_uInt16&);
808 : 0 : void Fill(sal_uInt16 nIndex, sal_uLong& begin, sal_uLong& end) {
809 : 0 : begin = Where(nIndex);
810 : 0 : end = Where(nIndex+1); }
811 : 0 : sal_uInt16 Count() {
812 : 0 : return iMac; }
813 : 0 : sal_Bool GetError() {
814 : 0 : return !bOK; }
815 : : };
816 : :
817 : : // Size Tabs from Sven:
818 : : // CHP, PAP, SEP, HED, FNR, FNT
819 : : //Plc 2, 2, 6, 0, 2, 0
820 : : //Fkp 1, 1, 0, 0, 0, 0
821 : :
822 : : /////////////////////////////////////////////////////////// PlcGlossary
823 : : class Ww1PlcGlossary : public Ww1Plc
824 : : {
825 : : public:
826 : : Ww1PlcGlossary(Ww1Fib& rFibL) :
827 : : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfglsyGet(),
828 : : rFibL.GetFIB().cbPlcfglsyGet(), 0) {
829 : : }
830 : : };
831 : :
832 : : ////////////////////////////////////////////////////// PlcAnnotationRef
833 : : class Ww1PlcAnnotationRef : public Ww1Plc
834 : : {
835 : : public:
836 : : Ww1PlcAnnotationRef(Ww1Fib& rFibL) :
837 : : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfandRefGet(),
838 : : rFibL.GetFIB().cbPlcfandRefGet(), 0) {
839 : : }
840 : : };
841 : :
842 : : ////////////////////////////////////////////////////// PlcAnnotationTxt
843 : : class Ww1PlcAnnotationTxt : public Ww1Plc
844 : : {
845 : : public:
846 : : Ww1PlcAnnotationTxt(Ww1Fib& rFibL) :
847 : : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfandTxtGet(),
848 : : rFibL.GetFIB().cbPlcfandTxtGet(), 0) {
849 : : }
850 : : };
851 : :
852 : : ///////////////////////////////////////////////////////// PlcAnnotation
853 : : class Ww1Annotation {
854 : : Ww1PlcAnnotationRef aRef;
855 : : Ww1PlcAnnotationTxt aTxt;
856 : : public:
857 : : Ww1Annotation(Ww1Fib& rFib) :
858 : : aRef(rFib),
859 : : aTxt(rFib) {
860 : : }
861 : : friend ostream& operator <<(ostream&, Ww1Annotation&);
862 : : };
863 : :
864 : : //////////////////////////////////////////////////////////////// PlcSep
865 : 0 : class Ww1PlcSep : public Ww1Plc
866 : : {
867 : : public:
868 : 0 : Ww1PlcSep(Ww1Fib& rFibL):
869 : 0 : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfsedGet(),
870 : 0 : rFibL.GetFIB().cbPlcfsedGet(), 6) {
871 : 0 : }
872 : : friend ostream& operator <<(ostream&, Ww1PlcSep&);
873 : : };
874 : :
875 : : //////////////////////////////////////////////////////////////// PlcChp
876 : 0 : class Ww1PlcChp : public Ww1Plc
877 : : {
878 : : public:
879 : 0 : Ww1PlcChp(Ww1Fib& rFibL) :
880 : 0 : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfbteChpxGet(),
881 : 0 : rFibL.GetFIB().cbPlcfbteChpxGet(), 2) {
882 : 0 : }
883 : : friend ostream& operator <<(ostream&, Ww1PlcChp&);
884 : : };
885 : :
886 : : //////////////////////////////////////////////////////////////// PlcPap
887 : 0 : class Ww1PlcPap : public Ww1Plc
888 : : {
889 : : public:
890 : 0 : Ww1PlcPap(Ww1Fib& rFibL) :
891 : 0 : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfbtePapxGet(),
892 : 0 : rFibL.GetFIB().cbPlcfbtePapxGet(), 2) {
893 : 0 : }
894 : : friend ostream& operator <<(ostream&, Ww1PlcPap&);
895 : : };
896 : :
897 : : //////////////////////////////////////////////////////// PlcFootnoteRef
898 : 0 : class Ww1PlcFootnoteRef : public Ww1Plc
899 : : {
900 : : public:
901 : 0 : Ww1PlcFootnoteRef(Ww1Fib& rFibL) :
902 : 0 : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcffndRefGet(),
903 : 0 : rFibL.GetFIB().cbPlcffndRefGet(), 2) {
904 : 0 : }
905 : : friend ostream& operator <<(ostream&, Ww1PlcFootnoteRef&);
906 : : };
907 : :
908 : : //////////////////////////////////////////////////////// PlcFootnoteTxt
909 : 0 : class Ww1PlcFootnoteTxt : public Ww1Plc
910 : : {
911 : : public:
912 : 0 : Ww1PlcFootnoteTxt(Ww1Fib& rFibL) :
913 : 0 : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcffndTxtGet(),
914 : 0 : rFibL.GetFIB().cbPlcffndTxtGet(), 0) {
915 : 0 : }
916 : : friend ostream& operator <<(ostream&, Ww1PlcFootnoteTxt&);
917 : : };
918 : :
919 : : ///////////////////////////////////////////////////////////// PlcFields
920 : 0 : class Ww1PlcFields : public Ww1Plc
921 : : {
922 : : public:
923 : 0 : Ww1PlcFields(Ww1Fib& rFibL, sal_uLong start, sal_uInt16 nBytes)
924 : 0 : : Ww1Plc(rFibL, start, nBytes, 2)
925 : 0 : {}
926 : 0 : W1_FLD* GetData(sal_uInt16 nIndex)
927 : 0 : { return (W1_FLD*)Ww1Plc::GetData(nIndex); }
928 : 0 : sal_uLong Where(sal_uInt16 nIndex) // absolut im file
929 : 0 : { return Ww1Plc::Where(nIndex) + rFib.GetFIB().fcMinGet(); }
930 : : friend ostream& operator <<(ostream&, Ww1PlcFields&);
931 : : };
932 : :
933 : : ///////////////////////////////////////////////////////////// PlcBookmarks
934 : : class Ww1StringList
935 : : {
936 : : sal_Char** pIdxA;
937 : : sal_uInt16 nMax;
938 : : public:
939 : : Ww1StringList( SvStream& rSt, sal_uLong nFc, sal_uInt16 nCb );
940 : 0 : ~Ww1StringList()
941 [ # # ]: 0 : { if( pIdxA ) { delete pIdxA[0]; delete pIdxA; } }
942 : : const String GetStr( sal_uInt16 nNum ) const;
943 : : sal_uInt16 Count() const { return nMax; }
944 [ # # ][ # # ]: 0 : sal_Bool GetError() const { return (nMax != 0) && !pIdxA; }
945 : : };
946 : :
947 : 0 : class Ww1PlcBookmarkTxt: public Ww1StringList
948 : : {
949 : : public:
950 : 0 : Ww1PlcBookmarkTxt(Ww1Fib& rFib) :
951 : 0 : Ww1StringList( rFib.GetStream(), rFib.GetFIB().fcSttbfbkmkGet(),
952 : 0 : rFib.GetFIB().cbSttbfbkmkGet() )
953 : 0 : {}
954 : : };
955 : :
956 : 0 : class Ww1PlcBookmarkPos : public Ww1Plc
957 : : {
958 : : public:
959 : 0 : Ww1PlcBookmarkPos(Ww1Fib& _rFib, sal_uLong start, sal_uInt16 nBytes, sal_Bool bEnd)
960 [ # # ]: 0 : : Ww1Plc(_rFib, start, nBytes, (bEnd) ? 0 : 2)
961 : 0 : {}
962 : :
963 : 0 : sal_uInt8* GetData(sal_uInt16 nIndex) { return Ww1Plc::GetData(nIndex); }
964 : : // Position als CP
965 : 0 : sal_uLong WhereCP(sal_uInt16 nIndex) { return Ww1Plc::Where(nIndex); }
966 : : // absolut im file
967 : 0 : sal_uLong Where(sal_uInt16 nIndex)
968 : : {
969 : 0 : return ( nIndex < Count() )
970 : 0 : ? Ww1Plc::Where(nIndex) + rFib.GetFIB().fcMinGet()
971 [ # # ]: 0 : : 0xffffffff;
972 : : }
973 : : };
974 : :
975 : : //////////////////////////////////////////////////////////////// PlcHdd
976 : 0 : class Ww1PlcHdd : public Ww1Plc
977 : : {
978 : : public:
979 : 0 : Ww1PlcHdd(Ww1Fib& rFibL)
980 : 0 : : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfhddGet(),
981 : 0 : rFibL.GetFIB().cbPlcfhddGet(), 0)
982 : 0 : {}
983 : : };
984 : :
985 : : /////////////////////////////////////////////////////////////////// Fkp
986 : : //
987 : : // aehnlich den plcs aufgebaute arrays, die sich auf eine groesze von
988 : : // 512 byte beschraenken.
989 : : //
990 : : class Ww1Fkp
991 : : {
992 : : protected:
993 : : sal_uInt8 aFkp[512];
994 : : sal_uInt16 nItemSize;
995 : : sal_Bool bOK;
996 : : sal_uInt8* GetData(sal_uInt16);
997 : : public:
998 : : Ww1Fkp(SvStream&, sal_uLong, sal_uInt16);
999 : : friend ostream& operator <<(ostream&, Ww1Fkp&);
1000 : 0 : sal_uInt16 Count() const { return SVBT8ToByte(aFkp+511); }
1001 : : sal_uLong Where(sal_uInt16); // wie im entsprechenden fkp
1002 : : };
1003 : :
1004 : : //////////////////////////////////////////////////////////////// FkpPap
1005 : : class Ww1FkpPap : public Ww1Fkp
1006 : : {
1007 : : public:
1008 : 0 : Ww1FkpPap(SvStream& rStream, sal_uLong ulFilePos)
1009 : 0 : : Ww1Fkp(rStream, ulFilePos, 1)
1010 : 0 : {}
1011 : : friend ostream& operator <<(ostream&, Ww1FkpPap&);
1012 : : sal_Bool Fill(sal_uInt16, sal_uInt8*&, sal_uInt16&);
1013 : : };
1014 : :
1015 : : //////////////////////////////////////////////////////////////// FkpChp
1016 : : class Ww1FkpChp : public Ww1Fkp
1017 : : {
1018 : : #ifdef DUMP
1019 : : SvStream& rStream;
1020 : : SvStream& GetStream() { return rStream; }
1021 : : #endif
1022 : : public:
1023 : 0 : Ww1FkpChp(SvStream& rStream, sal_uLong ulFilePos)
1024 : 0 : : Ww1Fkp(rStream, ulFilePos, 1)
1025 : : #ifdef DUMP
1026 : : , rStream(rStream)
1027 : : #endif
1028 : 0 : {}
1029 : :
1030 : : friend ostream& operator <<(ostream&, Ww1FkpChp&);
1031 : : sal_Bool Fill(sal_uInt16, W1_CHP&);
1032 : : };
1033 : :
1034 : : ////////////////////////////////////////////////////////////// SprmPapx
1035 : 0 : class Ww1SprmPapx : public Ww1Sprm
1036 : : {
1037 : : W1_PAPX aPapx;
1038 : : sal_uInt8* Sprm(sal_uInt8* p, sal_uInt16 nSize);
1039 : : sal_uInt16 SprmSize(sal_uInt8* p, sal_uInt16 nSize);
1040 : : public:
1041 : : Ww1SprmPapx(sal_uInt8* p, sal_uInt16 nSize);
1042 : : friend ostream& operator <<(ostream&, Ww1SprmPapx&);
1043 : : void Start(Ww1Shell&, Ww1Manager&);
1044 : : void Stop(Ww1Shell&, Ww1Manager&);
1045 : : };
1046 : :
1047 : : /////////////////////////////////////////////////////////////// SprmSep
1048 : 0 : class Ww1SprmSep : public Ww1Sprm
1049 : : {
1050 : : public:
1051 : 0 : Ww1SprmSep(Ww1Fib& rFib, sal_uLong ulFilePos)
1052 : 0 : : Ww1Sprm(rFib.GetStream(), ulFilePos)
1053 : 0 : {}
1054 : : friend ostream& operator <<(ostream&, Ww1SprmSep&);
1055 : : };
1056 : :
1057 : : ///////////////////////////////////////////////////////////////// Assoc
1058 : : class Ww1Assoc
1059 : : {
1060 : : enum fields { FileNext, Dot, Title, Subject, KeyWords, Comments,
1061 : : Author, LastRevBy, DataDoc, HeaderDoc, Criteria1, Criteria2,
1062 : : Criteria3, Criteria4, Criteria5, Criteria6, Criteria7, MaxFields };
1063 : :
1064 : : Ww1Fib& rFib;
1065 : : sal_Char* pBuffer;
1066 : : sal_Char* pStrTbl[ MaxFields ];
1067 : : sal_Bool bOK;
1068 : :
1069 : : String GetStr(sal_uInt16);
1070 : :
1071 : : public:
1072 : : Ww1Assoc(Ww1Fib&);
1073 : 0 : ~Ww1Assoc() { delete pBuffer; }
1074 : : sal_Bool GetError() const { return !bOK; }
1075 : : friend ostream& operator <<(ostream&, Ww1Assoc&);
1076 : : void Out(Ww1Shell&);
1077 : : };
1078 : :
1079 : : ////////////////////////////////////////////////////////// HeaderFooter
1080 : : //
1081 : : // Header/Footer/Footnoteseparators sind einer nach dem naechsten in
1082 : : // einem eigenen text gespeichert. ein plc trennt diesen text in
1083 : : // einzelne teile. diese werden durchnummeriert als ihdd. nun gibt es
1084 : : // 9 verschiedene funktionen fuer diese texte. wird eine davon
1085 : : // angefordert, ist es der erste, beim naechstern der 2 ihdd und so
1086 : : // weiter. welcher textteil also welcher typ sein wird laeszt sich
1087 : : // nur bei sequenziellem lesen der datei bestimmen. die 9 typen sind:
1088 : : // fusznoten-trenner, folge-fusznoten-trenner, folge-fusznoten-notiz,
1089 : : // gerade-seiten kopfzeilen, ungerade seiten kopfzeilen, dto 2*
1090 : : // fuszzeilen, kopf & fuszzeilen, wenn erste seite andere zeilen hat.
1091 : : // HeaderFooter merkt sich fuer jede der 9 die momentane einstellung
1092 : : // (jedoch nicht die alten) und den naechstvergebbaren ihdd. ist ein
1093 : : // teil nicht vorhanden bekommt er den wert 0xffff.
1094 : : //
1095 : 0 : class Ww1HeaderFooter : public Ww1PlcHdd
1096 : : {
1097 : : sal_uInt16 nextIhdd; // naechster textteil im HddText
1098 : : sal_uInt16 nFtnSep; // fusznoten trenner
1099 : : sal_uInt16 nFtnFollowSep; // folge fusznoten trenner
1100 : : sal_uInt16 nFtnNote; // folgefunsznotennotiz
1101 : : sal_uInt16 nEvenHeadL; // kopfzeilen grader seiten
1102 : : sal_uInt16 nOddHeadL; // kopfzeilen ungrader seiten
1103 : : sal_uInt16 nEvenFootL; // fuszzeilen grader seiten
1104 : : sal_uInt16 nOddFootL; // fuszzeilen ungerader seiten
1105 : : sal_uInt16 nFirstHeadL; // kopfzeilen der ersten seite
1106 : : sal_uInt16 nFirstFootL; // fuszzeilen der ersten seite
1107 : : enum HeaderFooterMode {
1108 : : None, FtnSep, FtnFollowSep, FtnNote, EvenHeadL, OddHeadL,
1109 : : EvenFootL, OddFootL, FirstHeadL, MaxHeaderFooterMode
1110 : : } eHeaderFooterMode;
1111 : :
1112 : : public:
1113 : 0 : Ww1HeaderFooter(Ww1Fib& rFibL, sal_uInt16 grpfIhdt)
1114 : : : Ww1PlcHdd(rFibL),
1115 : : nextIhdd(0),
1116 : : nFtnSep(0xffff),
1117 : : nFtnFollowSep(0xffff),
1118 : : nFtnNote(0xffff),
1119 : : nEvenHeadL(0xffff),
1120 : : nOddHeadL(0xffff),
1121 : : nEvenFootL(0xffff),
1122 : : nOddFootL(0xffff),
1123 : : nFirstHeadL(0xffff),
1124 : : nFirstFootL(0xffff),
1125 : 0 : eHeaderFooterMode(None)
1126 : : {
1127 [ # # ]: 0 : if (grpfIhdt & 0x0001) nFtnSep = nextIhdd++;
1128 [ # # ]: 0 : if (grpfIhdt & 0x0002) nFtnFollowSep = nextIhdd++;
1129 [ # # ]: 0 : if (grpfIhdt & 0x0004) nFtnNote = nextIhdd++;
1130 : 0 : }
1131 : 0 : void SetGrpfIhdt(sal_uInt16 grpfIhdt)
1132 : : {
1133 [ # # ]: 0 : if (grpfIhdt & 0x0001) nEvenHeadL = nextIhdd++;
1134 [ # # ]: 0 : if (grpfIhdt & 0x0002) nOddHeadL = nextIhdd++;
1135 [ # # ]: 0 : if (grpfIhdt & 0x0004) nEvenFootL = nextIhdd++;
1136 [ # # ]: 0 : if (grpfIhdt & 0x0008) nOddFootL = nextIhdd++;
1137 [ # # ]: 0 : if (grpfIhdt & 0x0010) nFirstHeadL = nextIhdd++;
1138 [ # # ]: 0 : if (grpfIhdt & 0x0020) nFirstFootL = nextIhdd++;
1139 : : OSL_ENSURE(nextIhdd<=Count(), "Ww1HeaderFooter");
1140 : 0 : }
1141 : 0 : sal_Bool operator++(int)
1142 : : {
1143 : 0 : sal_Bool bRet = sal_True;
1144 : 0 : eHeaderFooterMode = (HeaderFooterMode)((short)eHeaderFooterMode + 1);
1145 [ # # ]: 0 : if( eHeaderFooterMode == MaxHeaderFooterMode)
1146 : : {
1147 : 0 : eHeaderFooterMode = None;
1148 : 0 : bRet = sal_False;
1149 : : }
1150 : 0 : return bRet;
1151 : : }
1152 : : sal_Bool FillFtnSep(sal_uLong& begin, sal_uLong& end)
1153 : : {
1154 : : if (nFtnSep == 0xffff)
1155 : : return sal_False;
1156 : : Fill(nFtnSep, begin, end);
1157 : : return sal_True;
1158 : : }
1159 : : sal_Bool FillFtnFollowSep(sal_uLong& begin, sal_uLong& end)
1160 : : {
1161 : : if (nFtnFollowSep == 0xffff)
1162 : : return sal_False;
1163 : : Fill(nFtnFollowSep, begin, end);
1164 : : return sal_True;
1165 : : }
1166 : : sal_Bool FillFtnNote(sal_uLong& begin, sal_uLong& end)
1167 : : {
1168 : : if (nFtnNote == 0xffff)
1169 : : return sal_False;
1170 : : Fill(nFtnNote, begin, end);
1171 : : return sal_True;
1172 : : }
1173 : : sal_Bool FillEvenHeadL(sal_uLong& begin, sal_uLong& end)
1174 : : {
1175 : : if (nEvenHeadL == 0xffff)
1176 : : return sal_False;
1177 : : Fill(nEvenHeadL, begin, end);
1178 : : return sal_True;
1179 : : }
1180 : 0 : sal_Bool FillOddHeadL(sal_uLong& begin, sal_uLong& end)
1181 : : {
1182 [ # # ]: 0 : if (nOddHeadL == 0xffff)
1183 : 0 : return sal_False;
1184 : 0 : Fill(nOddHeadL, begin, end);
1185 : 0 : return sal_True;
1186 : : }
1187 : : sal_Bool FillEvenFootL(sal_uLong& begin, sal_uLong& end)
1188 : : {
1189 : : if (nEvenFootL == 0xffff)
1190 : : return sal_False;
1191 : : Fill(nEvenFootL, begin, end);
1192 : : return sal_True;
1193 : : }
1194 : 0 : sal_Bool FillOddFootL(sal_uLong& begin, sal_uLong& end)
1195 : : {
1196 [ # # ]: 0 : if (nOddFootL == 0xffff)
1197 : 0 : return sal_False;
1198 : 0 : Fill(nOddFootL, begin, end);
1199 : 0 : return sal_True;
1200 : : }
1201 : : sal_Bool FillFirstHeadL(sal_uLong& begin, sal_uLong& end)
1202 : : {
1203 : : if (nFirstHeadL == 0xffff)
1204 : : return sal_False;
1205 : : Fill(nFirstHeadL, begin, end);
1206 : : return sal_True;
1207 : : }
1208 : : sal_Bool FillFirstFootL(sal_uLong& begin, sal_uLong& end)
1209 : : {
1210 : : if (nFirstFootL == 0xffff)
1211 : : return sal_False;
1212 : : Fill(nFirstFootL, begin, end);
1213 : : return sal_True;
1214 : : }
1215 : : void Start(Ww1Shell&, Ww1Manager&);
1216 : : void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
1217 : : };
1218 : :
1219 : : //////////////////////////////////////////////////////////////// Fields
1220 [ # # ]: 0 : class Ww1Fields : public Ww1PlcFields
1221 : : {
1222 : : sal_uInt16 nPlcIndex;
1223 : : String sErgebnis; // das von word errechnete ergebniss
1224 : : SwField* pField;
1225 : 0 : sal_uLong Where(sal_uInt16 nIndex) // innerhalb des textes
1226 : 0 : { return Ww1PlcFields::Where(nIndex) - rFib.GetFIB().fcMinGet(); }
1227 : :
1228 : : public:
1229 : 0 : Ww1Fields(Ww1Fib& rFibL, sal_uLong ulFilePos, sal_uInt16 nBytes)
1230 [ # # ]: 0 : : Ww1PlcFields(rFibL, ulFilePos, nBytes), nPlcIndex(0), pField(0)
1231 : 0 : {}
1232 : : // innerhalb des textes
1233 : 0 : sal_uLong Where() { return Where(nPlcIndex); }
1234 : 0 : void operator++(int)
1235 : : {
1236 : : OSL_ENSURE(nPlcIndex+1 <= Count(), "Ww1Fields");
1237 : 0 : nPlcIndex++;
1238 : 0 : }
1239 : 0 : void Seek(sal_uLong ulNew) { Ww1PlcFields::Seek(ulNew, nPlcIndex); }
1240 : 0 : W1_FLD* GetData()
1241 : : {
1242 : : OSL_ENSURE(nPlcIndex < Count(), "Ww1Fields");
1243 : 0 : return Ww1PlcFields::GetData(nPlcIndex);
1244 : : }
1245 : : sal_uLong GetLength();
1246 : : friend ostream& operator <<(ostream&, Ww1Manager&);
1247 : : void Start(Ww1Shell&, Ww1Manager&);
1248 : : void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
1249 : : void Out(Ww1Shell&, Ww1Manager&, sal_uInt16=0);
1250 : : };
1251 : :
1252 : 0 : class Ww1TextFields : public Ww1Fields
1253 : : {
1254 : : public:
1255 : 0 : Ww1TextFields(Ww1Fib& rFibL)
1256 : 0 : : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldMomGet(),
1257 : 0 : rFibL.GetFIB().cbPlcffldMomGet())
1258 : 0 : {}
1259 : : };
1260 : :
1261 : : class Ww1FootnoteFields : public Ww1Fields
1262 : : {
1263 : : public:
1264 : 0 : Ww1FootnoteFields(Ww1Fib& rFibL)
1265 : 0 : : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldFtnGet(),
1266 : 0 : rFibL.GetFIB().cbPlcffldFtnGet())
1267 : 0 : {}
1268 : : };
1269 : :
1270 : : class Ww1HeaderFooterFields : public Ww1Fields
1271 : : {
1272 : : public:
1273 : 0 : Ww1HeaderFooterFields(Ww1Fib& rFibL)
1274 : 0 : : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldHdrGet(),
1275 : 0 : rFibL.GetFIB().cbPlcffldHdrGet())
1276 : 0 : {}
1277 : : };
1278 : :
1279 : : class Ww1MacroFields : public Ww1Fields
1280 : : {
1281 : : public:
1282 : : Ww1MacroFields(Ww1Fib& rFibL)
1283 : : : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldMcrGet(),
1284 : : rFibL.GetFIB().cbPlcffldMcrGet())
1285 : : {}
1286 : : };
1287 : :
1288 : : //////////////////////////////////////////////////////////////// Bookmarks
1289 : : class Ww1Bookmarks
1290 : : {
1291 : : Ww1PlcBookmarkTxt aNames;
1292 : : Ww1PlcBookmarkPos* pPos[2];
1293 : : Ww1Fib& rFib;
1294 : :
1295 : : sal_uInt16 nPlcIdx[2];
1296 : : sal_uInt16 nIsEnd;
1297 : : sal_Bool bOK;
1298 : : public:
1299 : : Ww1Bookmarks(Ww1Fib& rFib);
1300 : 0 : ~Ww1Bookmarks()
1301 : 0 : {
1302 [ # # ][ # # ]: 0 : delete pPos[1];
1303 [ # # ][ # # ]: 0 : delete pPos[0];
1304 : 0 : }
1305 : 0 : sal_uLong Where() const { return pPos[nIsEnd]->WhereCP(nPlcIdx[nIsEnd]); }
1306 : : void operator++(int);
1307 : 0 : sal_Bool GetError() const { return !bOK; }
1308 : : long GetHandle() const;
1309 [ # # ]: 0 : sal_Bool GetIsEnd() const { return ( nIsEnd ) ? sal_True : sal_False; }
1310 : : const String GetName() const;
1311 : : long Len() const;
1312 : : friend ostream& operator <<(ostream&, Ww1Bookmarks&);
1313 : : void Start(Ww1Shell&, Ww1Manager&);
1314 : : void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
1315 : : void Out(Ww1Shell&, Ww1Manager&, sal_uInt16=0);
1316 : : };
1317 : :
1318 : : ///////////////////////////////////////////////////////////// Footnotes
1319 [ # # ]: 0 : class Ww1Footnotes : public Ww1PlcFootnoteRef
1320 : : {
1321 : : sal_uInt16 nPlcIndex;
1322 : : Ww1PlcFootnoteTxt aText;
1323 : : sal_Bool bStarted;
1324 : : public:
1325 : 0 : Ww1Footnotes(Ww1Fib& rFibL)
1326 [ # # ]: 0 : : Ww1PlcFootnoteRef(rFibL), nPlcIndex(0), aText(rFibL), bStarted(sal_False)
1327 : 0 : {}
1328 : : // innerhalb des textes
1329 : 0 : sal_uLong Where()
1330 : : {
1331 : 0 : sal_uLong ulRet = 0xffffffff;
1332 [ # # ]: 0 : if (Count())
1333 : 0 : ulRet = Ww1PlcFootnoteRef::Where(nPlcIndex);
1334 : 0 : return ulRet;
1335 : : }
1336 : 0 : void operator++(int)
1337 : : {
1338 : : OSL_ENSURE(nPlcIndex+1 <= Count(), "Ww1Footnotes");
1339 : 0 : nPlcIndex++;
1340 : 0 : }
1341 : : void Start(Ww1Shell&, Ww1Manager&);
1342 : : void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
1343 : : };
1344 : :
1345 : : /////////////////////////////////////////////////////////////////// Sep
1346 [ # # ]: 0 : class Ww1Sep : public Ww1PlcSep
1347 : : {
1348 : : Ww1HeaderFooter aHdd;
1349 : : sal_uInt16 nPlcIndex;
1350 : : public:
1351 : 0 : Ww1Sep(Ww1Fib& rFibL, sal_uInt16 grpfIhdt)
1352 [ # # ]: 0 : : Ww1PlcSep(rFibL), aHdd(rFibL, grpfIhdt), nPlcIndex(0) {}
1353 : :
1354 : 0 : Ww1HeaderFooter& GetHdd() { return aHdd; }
1355 : 0 : void operator++(int) { nPlcIndex++; }
1356 : 0 : sal_uInt8* GetData() { return Ww1PlcSep::GetData(nPlcIndex); }
1357 : : // innerhalb des textes
1358 : 0 : sal_uLong Where() { return Ww1PlcSep::Where(nPlcIndex); }
1359 : 0 : void SetGrpfIhdt(sal_uInt8 grpfIhdt)
1360 : : {
1361 : 0 : GetHdd().SetGrpfIhdt(grpfIhdt);
1362 : 0 : }
1363 : : void Start(Ww1Shell&, Ww1Manager&);
1364 : 0 : void Stop(Ww1Shell& rOut, Ww1Manager& rMan, sal_Unicode& c)
1365 : 0 : { aHdd.Stop(rOut, rMan, c); }
1366 : : };
1367 : :
1368 : : /////////////////////////////////////////////////////////////////// Pap
1369 : : class Ww1Pap : public Ww1PlcPap
1370 : : {
1371 : : sal_uInt16 nPlcIndex;
1372 : : sal_uInt16 nPushedPlcIndex;
1373 : : sal_uInt16 nFkpIndex;
1374 : : sal_uInt16 nPushedFkpIndex;
1375 : : sal_uLong ulOffset;
1376 : : Ww1FkpPap* pPap;
1377 : :
1378 : : sal_Bool FindSprm(sal_uInt16 nId, sal_uInt8* pStart, sal_uInt8* pEnd);
1379 : 0 : void UpdateIdx()
1380 : : {
1381 [ # # ][ # # ]: 0 : if (pPap && nFkpIndex >= pPap->Count() )
[ # # ]
1382 : : {
1383 : 0 : delete pPap;
1384 : 0 : pPap = NULL;
1385 : 0 : nPlcIndex++;
1386 : : }
1387 [ # # ]: 0 : if( !pPap )
1388 : 0 : Where();
1389 : 0 : }
1390 : : sal_Bool HasId0(sal_uInt16 nId);
1391 : :
1392 : : public:
1393 : : Ww1Pap(Ww1Fib& rFib);
1394 : 0 : ~Ww1Pap() { delete pPap; }
1395 : : sal_uLong Where( sal_Bool bSetIndex = sal_True ); // innerhalb des textes
1396 : : void operator++(int);
1397 : 0 : sal_Bool FillStart(sal_uInt8*& pB, sal_uInt16& nSize)
1398 : : {
1399 : 0 : UpdateIdx();
1400 : 0 : return pPap->Fill(nFkpIndex, pB, nSize);
1401 : : }
1402 : 0 : sal_Bool FillStop(sal_uInt8*& pB, sal_uInt16& nSize)
1403 : : {
1404 [ # # ]: 0 : return nFkpIndex ? pPap->Fill(nFkpIndex-1, pB, nSize) : sal_False;
1405 : : }
1406 : : void Start(Ww1Shell&, Ww1Manager&);
1407 : : void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
1408 : : void Seek(sal_uLong);
1409 : 0 : void Push(sal_uLong ulOffsetTmp = 0)
1410 : : {
1411 : : OSL_ENSURE(!Pushed(), "Ww1Pap");
1412 : 0 : nPushedPlcIndex = nPlcIndex;
1413 : 0 : nPushedFkpIndex = nFkpIndex;
1414 : 0 : Seek(ulOffsetTmp);
1415 : 0 : ulOffset = ulOffsetTmp;
1416 : 0 : delete pPap;
1417 : 0 : pPap = NULL;
1418 : 0 : }
1419 : : sal_Bool Pushed()
1420 : : {
1421 : : return nPushedPlcIndex != 0xffff;
1422 : : }
1423 : 0 : void Pop()
1424 : : {
1425 : : OSL_ENSURE(Pushed(), "Ww1Pap");
1426 : 0 : ulOffset = 0;
1427 : 0 : nPlcIndex = nPushedPlcIndex;
1428 : 0 : nFkpIndex = nPushedFkpIndex;
1429 : 0 : nPushedPlcIndex = 0xffff;
1430 : 0 : nPushedFkpIndex = 0xffff;
1431 : 0 : delete pPap;
1432 : 0 : pPap = NULL;
1433 : 0 : Where( sal_False );
1434 : 0 : }
1435 : : sal_Bool HasId(sal_uInt16 nId);
1436 : : };
1437 : :
1438 : : /////////////////////////////////////////////////////////////////// Chp
1439 : : class Ww1Chp : public Ww1PlcChp
1440 : : {
1441 : : sal_uInt16 nPlcIndex;
1442 : : sal_uInt16 nPushedPlcIndex;
1443 : : sal_uInt16 nFkpIndex;
1444 : : sal_uInt16 nPushedFkpIndex;
1445 : : sal_uLong ulOffset;
1446 : : Ww1FkpChp* pChp;
1447 : 0 : void UpdateIdx()
1448 : : {
1449 [ # # ][ # # ]: 0 : if (pChp && nFkpIndex >= pChp->Count() )
[ # # ]
1450 : : {
1451 : 0 : delete pChp;
1452 : 0 : pChp = NULL;
1453 : 0 : nPlcIndex++;
1454 : : }
1455 [ # # ]: 0 : if( !pChp )
1456 : 0 : Where();
1457 : 0 : }
1458 : :
1459 : : public:
1460 : : Ww1Chp( Ww1Fib& rFib );
1461 : 0 : ~Ww1Chp() { delete pChp; }
1462 : : sal_uLong Where( sal_Bool bSetIndex = sal_True ); // innerhalb des textes
1463 : : void operator++(int);
1464 : 0 : sal_Bool FillStart(W1_CHP& rChp)
1465 : : {
1466 : 0 : UpdateIdx();
1467 : 0 : return pChp->Fill(nFkpIndex, rChp);
1468 : : }
1469 : 0 : sal_Bool FillStop(W1_CHP& rChp)
1470 [ # # ]: 0 : { return nFkpIndex ? pChp->Fill(nFkpIndex-1, rChp) : sal_False; }
1471 : : void Start(Ww1Shell&, Ww1Manager&);
1472 : : void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
1473 : : void Seek(sal_uLong);
1474 : 0 : void Push(sal_uLong ulOffsetTmp = 0)
1475 : : {
1476 : : OSL_ENSURE(!Pushed(), "Ww1Chp");
1477 : 0 : nPushedPlcIndex = nPlcIndex;
1478 : 0 : nPushedFkpIndex = nFkpIndex;
1479 : 0 : Seek(ulOffsetTmp);
1480 : 0 : ulOffset = ulOffsetTmp;
1481 : 0 : delete pChp;
1482 : 0 : pChp = NULL;
1483 : 0 : }
1484 : : sal_Bool Pushed() { return nPushedPlcIndex != 0xffff; }
1485 : 0 : void Pop()
1486 : : {
1487 : : OSL_ENSURE(Pushed(), "Ww1Chp");
1488 : 0 : ulOffset = 0;
1489 : 0 : nPlcIndex = nPushedPlcIndex;
1490 : 0 : nFkpIndex = nPushedFkpIndex;
1491 : 0 : nPushedPlcIndex = 0xffff;
1492 : 0 : nPushedFkpIndex = 0xffff;
1493 : 0 : delete pChp;
1494 : 0 : pChp = NULL;
1495 : 0 : Where( sal_False );
1496 : 0 : }
1497 : : };
1498 : :
1499 : : /////////////////////////////////////////////////////////////// Manager
1500 : : //
1501 : : // zentraler aufhaenger der ww-seite des filters, konstruiert aus dem
1502 : : // inputstream (ww-datei) enthaelt er alles, was noetig ist, um in die
1503 : : // shell (pm-seite) gepiped zu werden.
1504 : : //
1505 [ # # ][ # # ]: 0 : class Ww1Manager
[ # # ][ # # ]
[ # # ][ # # ]
1506 : : {
1507 : : sal_Bool bOK;
1508 : : sal_Bool bInTtp;
1509 : : sal_Bool bInStyle;
1510 : : sal_Bool bStopAll;
1511 : : Ww1Fib aFib;
1512 : : Ww1Dop aDop;
1513 : : Ww1Fonts aFonts;
1514 : : // ab jetzt alles paarig, fuer 'pushed':
1515 : : Ww1DocText aDoc;
1516 : : Ww1PlainText* pDoc;
1517 : : sal_uLong ulDocSeek;
1518 : : sal_uLong* pSeek;
1519 : : Ww1TextFields aFld;
1520 : : Ww1Fields* pFld;
1521 : : // selbst 'push'bar:
1522 : : Ww1Chp aChp;
1523 : : Ww1Pap aPap;
1524 : : // nicht in textbereichen vorhanden, wenn ge'pushed'
1525 : : Ww1Footnotes aFtn;
1526 : : Ww1Bookmarks aBooks;
1527 : : Ww1Sep aSep;
1528 : :
1529 : : void OutStop( Ww1Shell&, sal_Unicode );
1530 : : void OutStart( Ww1Shell& );
1531 : : void Out(Ww1Shell&, sal_Unicode );
1532 : :
1533 : : public:
1534 : : Ww1Manager(SvStream& rStrm, sal_uLong nFieldFlgs);
1535 : 0 : sal_Bool GetError() const { return !bOK; }
1536 : :
1537 : : // Fuer Tabellen
1538 : 0 : void SetInTtp(sal_Bool bSet = sal_True) { bInTtp = bSet; }
1539 : 0 : sal_Bool IsInTtp() const { return bInTtp; }
1540 : 0 : void SetInStyle(sal_Bool bSet = sal_True) { bInStyle = bSet; }
1541 : 0 : sal_Bool IsInStyle() const { return bInStyle; }
1542 : 0 : void SetStopAll(sal_Bool bSet = sal_True) { bStopAll = bSet; }
1543 : 0 : sal_Bool IsStopAll() const { return bStopAll; }
1544 : : sal_Bool HasInTable();
1545 : : sal_Bool HasTtp();
1546 : : sal_Bool LastHasTtp();
1547 : :
1548 : : // Fuer Flys
1549 : : sal_Bool HasPPc();
1550 : : sal_Bool HasPDxaAbs();
1551 : :
1552 : 0 : Ww1Fib& GetFib() { return aFib; }
1553 : 0 : Ww1PlainText& GetText() { return *pDoc; }
1554 : 0 : Ww1Dop& GetDop() { return aDop; }
1555 : 0 : Ww1Sep& GetSep() { return aSep; }
1556 : : // innerhalb des textes
1557 : 0 : sal_uLong Where() { return pDoc->Where(); }
1558 : 0 : void Fill( sal_Unicode& rChr ) { pDoc->Out( rChr ); }
1559 : 0 : sal_uInt8 Fill( String& rStr, sal_uLong ulLen)
1560 : : {
1561 : 0 : ulLen += pDoc->Where();
1562 : 0 : return sal::static_int_cast< sal_uInt8 >(pDoc->Out(rStr, ulLen));
1563 : : }
1564 : : SvxFontItem GetFont(sal_uInt16 nFCode);
1565 : : friend Ww1Shell& operator <<(Ww1Shell&, Ww1Manager&);
1566 : : friend ostream& operator <<(ostream&, Ww1Manager&);
1567 : 0 : sal_Bool Pushed() { return pDoc != &aDoc; }
1568 : : void Pop();
1569 : : void Push0(Ww1PlainText* pDoc, sal_uLong, Ww1Fields* = 0);
1570 : : void Push1(Ww1PlainText* pDoc, sal_uLong ulSeek, sal_uLong ulSeek2 = 0,
1571 : : Ww1Fields* = 0);
1572 : : };
1573 : :
1574 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|