1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: w1class.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include <tools/string.hxx>
31 #include <tools/debug.hxx>
35 #include <w1struct.hxx>
66 class Ww1PlcAnnotationRef
;
67 class Ww1PlcAnnotationTxt
;
70 class Ww1PlcFootnoteRef
;
71 class Ww1PlcFootnoteTxt
;
83 ///////////////////////////////////////////////////////////////////////
85 // nach moeglichkeit wurden in diesem modul methoden aehnlicher
86 // funktionalitaet gleich benannt. Die namen wurden wenn moeglich vom
87 // ww-filter uebernommen.
88 // Where() gibt die position eines elements. dies kann sowohl eine
89 // seek-position im stream als auch ein relativer offset sein, da dies
90 // bei word durcheinander geht. die methoden sind durch kommentare
91 // gekennzeichnet, ob sie sich auf positionen in der datei oder
92 // innerhalb des textes beziehen. vorsicht: innerhalb des textes kann
93 // verschiedene texte in der datei bedeuten.
94 // Count() gibt die anzahl der elemente zurueck. vorsicht bei
95 // n/n-1-feldern (word speichert strukturen gern in doppel-arrays, in
96 // denen das erste n elemente, das zweite jedoch n-1 elemente
98 // Fill() fuellt uebergebene referenzen mit daten aus den
100 // GetData() gibt zeiger auf den datenbereich zurueck
101 // GetError() gibt zurueck, ob fehler aufgetreten ist
102 // Start(), Stop(), Out(), op<< siehe modul w1filter
103 // Dump() siehe modul w1dump
106 /////////////////////////////////////////////////////////////////// Fib
108 // file information block: wurzel des uebels: steht am beginn der
109 // datei (seek(0)) und enthaelt alle positionen der strukturen der
119 friend ostream
& operator <<(ostream
&, Ww1Fib
&);
120 W1_FIB
& GetFIB() { return aFib
; }
121 BOOL
GetError() { return !bOK
; }
122 SvStream
& GetStream() { return rStream
; }
125 /////////////////////////////////////////////////////////////////// Dop
127 // document property: eigenschaften des gesamten dokuments
140 friend ostream
& operator <<(ostream
&, Ww1Dop
&);
144 ///////////////////////////////////////////////////////////// PlainText
146 // ww-dateien koennen mehrere textbloecke enthalten (main-text,
147 // fusznoten etc). PlainText vereinigt die gemeinsamkeiten
158 Ww1PlainText(Ww1Fib
& rWwFib
, ULONG nFilePos
, ULONG nCountBytes
);
159 // innerhalb des textes
160 ULONG
Where() const { return ulSeek
; }
161 void Seek( ULONG ulNew
)
163 DBG_ASSERT(ulNew
< ulCountBytes
, "Ww1PlainText");
164 if (ulNew
< ulCountBytes
)
168 ULONG
Count() const { return ulCountBytes
; }
169 void SetCount(ULONG ulNew
)
172 if (ulCountBytes
> ulNew
)
173 ulCountBytes
= ulNew
;
177 DBG_ASSERT(ulSeek
+1<ulCountBytes
, "Ww1PlainText");
180 BOOL
GetError() { return !bOK
; }
181 sal_Unicode
Out( Ww1Shell
&, ULONG
& );
182 sal_Unicode
Out( String
&, ULONG
=0xffffffff);
183 sal_Unicode
Out( sal_Unicode
& );
184 friend ostream
& operator <<(ostream
&, Ww1PlainText
&);
185 String
& Fill( String
&, ULONG
=0, ULONG
=0xffffffff );
186 sal_Unicode
operator []( ULONG
);
187 String
GetText( ULONG ulOffset
, ULONG nLen
) const;
189 enum Consts
{ MinChar
= 32 };
190 static BOOL
IsChar( sal_Unicode c
) { return c
>= MinChar
; }
193 /////////////////////////////////////////////////////////////// DocText
194 class Ww1DocText
: public Ww1PlainText
197 Ww1DocText(Ww1Fib
& rFibL
) :
198 Ww1PlainText(rFibL
, rFibL
.GetFIB().fcMinGet(),
199 rFibL
.GetFIB().ccpTextGet()) {
203 /////////////////////////////////////////////////////////////// FtnText
204 class Ww1FtnText
: public Ww1PlainText
207 ULONG
Offset(Ww1Fib
& rFibL
) {
208 return rFibL
.GetFIB().ccpTextGet(); }
209 Ww1FtnText(Ww1Fib
& rFibL
) :
210 Ww1PlainText(rFibL
, rFibL
.GetFIB().fcMinGet() +
211 Offset(rFibL
), rFibL
.GetFIB().ccpFtnGet()) {
215 /////////////////////////////////////////////////////////////// HddText
216 class Ww1HddText
: public Ww1PlainText
219 ULONG
Offset(Ww1Fib
& rFibL
) {
220 return rFibL
.GetFIB().ccpTextGet() + rFibL
.GetFIB().ccpFtnGet(); }
221 Ww1HddText(Ww1Fib
& rFibL
) :
222 Ww1PlainText(rFibL
, rFibL
.GetFIB().fcMinGet() +
223 Offset(rFibL
), rFibL
.GetFIB().ccpHddGet()) {
227 /////////////////////////////////////////////////////////////// McrText
228 class Ww1McrText
: public Ww1PlainText
231 ULONG
Offset(Ww1Fib
& rFibL
) {
232 return rFibL
.GetFIB().ccpTextGet() + rFibL
.GetFIB().ccpFtnGet()
233 + rFibL
.GetFIB().ccpHddGet(); }
234 Ww1McrText(Ww1Fib
& rFibL
) :
235 Ww1PlainText(rFibL
, rFibL
.GetFIB().fcMinGet() +
236 Offset(rFibL
), rFibL
.GetFIB().ccpMcrGet()) {
240 /////////////////////////////////////////////////////////////// AtnText
241 class Ww1AtnText
: public Ww1PlainText
244 ULONG
Offset(Ww1Fib
& rFibL
) {
245 return rFibL
.GetFIB().ccpTextGet() + rFibL
.GetFIB().ccpFtnGet()
246 + rFibL
.GetFIB().ccpHddGet() + rFibL
.GetFIB().ccpMcrGet(); }
247 Ww1AtnText(Ww1Fib
& rFibL
) :
248 Ww1PlainText(rFibL
, rFibL
.GetFIB().fcMinGet() +
249 Offset(rFibL
), rFibL
.GetFIB().ccpAtnGet()) {
253 ///////////////////////////////////////////////////////////////// Style
255 // ein einzelner style oder vorlage
262 Ww1StyleSheet
* pParent
;
269 BOOL
IsUsed() const { return bUsed
; }
270 void SetDefaults(BYTE
);
271 void SetParent(Ww1StyleSheet
* newParent
) { pParent
= newParent
; }
272 void SetName(const String
& rName
) { bUsed
= TRUE
; aName
= rName
; }
273 const String
& GetName() const { return aName
; }
274 // Ww1Style& GetNext();
276 USHORT
GetnBase() const { return stcBase
; }
277 USHORT
GetnNext() const { return stcNext
; }
278 USHORT
ReadName(BYTE
*&, USHORT
&, USHORT stc
);
279 USHORT
ReadChpx(BYTE
*&, USHORT
&);
280 USHORT
ReadPapx(BYTE
*&, USHORT
&);
281 USHORT
ReadEstcp(BYTE
*&, USHORT
&);
282 friend ostream
& operator <<(ostream
&, Ww1Style
&);
283 void Out(Ww1Shell
&, Ww1Manager
&);
286 //////////////////////////////////////////////////////////// StyleSheet
288 // die sammlung aller vorlagen (max. 256)
292 Ww1Style aStyles
[256];
293 USHORT cstcStd
; // count style code standard
296 USHORT
ReadNames(BYTE
*&, USHORT
&);
297 USHORT
ReadChpx(BYTE
*&, USHORT
&);
298 USHORT
ReadPapx(BYTE
*&, USHORT
&);
299 USHORT
ReadEstcp(BYTE
*&, USHORT
&);
301 void OutDefaults(Ww1Shell
& rOut
, Ww1Manager
& rMan
, USHORT stc
);
302 void OutOne(Ww1Shell
& rOut
, Ww1Manager
& rMan
, USHORT stc
);
303 void OutOneWithBase(Ww1Shell
& rOut
, Ww1Manager
& rMan
, USHORT stc
,
306 Ww1StyleSheet(Ww1Fib
& rFib
);
307 Ww1Style
& GetStyle(USHORT stc
) {
308 return aStyles
[stc
]; }
311 friend ostream
& operator <<(ostream
&, Ww1StyleSheet
&);
312 void Out(Ww1Shell
&, Ww1Manager
&);
313 friend class Ww1Style
;
318 ///////////////////////////////////////////////////////////////// Fonts
320 // ww kennt nur font-nummern beim formatieren. nebenher gibts ein
321 // array von fonts, damit man aus der nummer einen konkreten font
327 W1_FFN
** pFontA
; // Array of Pointers to Font Description
330 USHORT nMax
; // Array-Groesse
333 Ww1Fonts(Ww1Fib
&, ULONG nFieldFlgs
);
338 W1_FFN
* GetFFN(USHORT nNum
);
341 friend ostream
& operator <<(ostream
&, Ww1Fonts
&);
344 SvxFontItem
GetFont(USHORT
);
347 //////////////////////////////////////////////////////////// SingleSprm
349 // diese klassen ersetzen die aSprmTab etc des ww6-filters. die
350 // funktionspointer sind hier virtuale methoden, fuer die typen (byte,
351 // word, var-sized etc) gibt es abgeleitete klassen. diese haben
352 // methoden zum bestimmen der groesze, dumpen und shell-ausgeben der
354 // die klassen werden mit new (in InitTab()) erzeugt und nach ihrem
355 // code in die tabelle gestellt. zum aktivieren ruft man nun nur noch
356 // die entsprechende methode des objektes in der tabelle auf.
357 // wohlgemerkt: SingleSprms sind die _beschreibung_ und _funktion_ der
358 // Sprms, nicht deren inhalt. dieser musz uebergeben werden an die
359 // einzelnen methoden wie Size, Dump und Start/Stop.
366 // allein die virtuellen methoden stehen in der vtab, also je nachdem,
367 // ob fuer dumper oder filter uebersetzt wird ausblenden: das spart
368 // platz. ausserdem stehen die methoden fuer dumper bzw filter in
369 // verschiedenen modulen, die im jeweils anderen projekt nicht
370 // uebersetzt werden. das diese dann beim linken nicht zur verfuegung
371 // stehen faellt dann auch nicht auf. Der Namensstring ist nur im
372 // Dumper noetig: weg damit im Filter.
374 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
375 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
376 virtual ostream
& Dump(ostream
&, BYTE
*, USHORT
);
377 const sal_Char
* sName
;
379 virtual void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
380 virtual void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
381 ostream
& Dump(ostream
&, BYTE
*, USHORT
);
383 virtual USHORT
Size(BYTE
*);
386 Ww1SingleSprm(USHORT nBytes
, const sal_Char
* /*pName*/ = 0 )
387 : nCountBytes(nBytes
)
395 class Ww1SingleSprmByteSized
: public Ww1SingleSprm
{
397 // ostream& Dump(ostream&, BYTE*, USHORT);
399 Ww1SingleSprmByteSized(USHORT nBytes
, sal_Char
* sName
= 0) :
400 Ww1SingleSprm(nBytes
, sName
) {
404 class Ww1SingleSprmWordSized
: public Ww1SingleSprm
{
406 // ostream& Dump(ostream&, BYTE*, USHORT);
408 Ww1SingleSprmWordSized(USHORT nBytes
, sal_Char
* sName
= 0) :
409 Ww1SingleSprm(nBytes
, sName
) {
413 class Ww1SingleSprmByte
: public Ww1SingleSprm
{
415 ostream
& Dump(ostream
&, BYTE
*, USHORT
);
416 // USHORT Size(BYTE*);
417 Ww1SingleSprmByte(sal_Char
* sName
= 0) :
418 Ww1SingleSprm(1, sName
) {
422 class Ww1SingleSprmBool
: public Ww1SingleSprmByte
{
424 ostream
& Dump(ostream
&, BYTE
*, USHORT
);
425 // USHORT Size(BYTE*);
426 Ww1SingleSprmBool(sal_Char
* sName
= 0) :
427 Ww1SingleSprmByte(sName
) {
431 class Ww1SingleSprm4State
: public Ww1SingleSprmByte
{
433 ostream
& Dump(ostream
&, BYTE
*, USHORT
);
434 // USHORT Size(BYTE*);
435 Ww1SingleSprm4State(sal_Char
* sName
= 0) :
436 Ww1SingleSprmByte(sName
) {
440 class Ww1SingleSprmWord
: public Ww1SingleSprm
{
442 ostream
& Dump(ostream
&, BYTE
*, USHORT
);
443 // USHORT Size(BYTE*);
444 Ww1SingleSprmWord(sal_Char
* sName
= 0)
445 : Ww1SingleSprm(2, sName
) {}
448 class Ww1SingleSprmLong
: public Ww1SingleSprm
{
450 ostream
& Dump(ostream
&, BYTE
*, USHORT
);
451 // USHORT Size(BYTE*);
452 Ww1SingleSprmLong(sal_Char
* sName
= 0) :
453 Ww1SingleSprm(4, sName
) {
457 class Ww1SingleSprmTab
: public Ww1SingleSprm
{
459 ostream
& Dump(ostream
&, BYTE
*, USHORT
);
461 Ww1SingleSprmTab(USHORT nBytes
, sal_Char
* sName
= 0) :
462 Ww1SingleSprm(nBytes
, sName
) {
466 class Ww1SingleSprmPJc
: public Ww1SingleSprmByte
{
468 Ww1SingleSprmPJc(sal_Char
* sName
) :
469 Ww1SingleSprmByte(sName
) {
471 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
472 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
475 class Ww1SingleSprmPDxa
: public Ww1SingleSprmWord
{
477 Ww1SingleSprmPDxa(sal_Char
* sName
) :
478 Ww1SingleSprmWord(sName
) {
480 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
483 class Ww1SingleSprmPDxaRight
: public Ww1SingleSprmPDxa
{
485 Ww1SingleSprmPDxaRight(sal_Char
* sName
) :
486 Ww1SingleSprmPDxa(sName
) {
488 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
491 class Ww1SingleSprmPDxaLeft
: public Ww1SingleSprmPDxa
{
493 Ww1SingleSprmPDxaLeft(sal_Char
* sName
) :
494 Ww1SingleSprmPDxa(sName
) {
496 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
499 class Ww1SingleSprmPDxaLeft1
: public Ww1SingleSprmPDxa
{
501 Ww1SingleSprmPDxaLeft1(sal_Char
* sName
) :
502 Ww1SingleSprmPDxa(sName
) {
504 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
507 class Ww1SingleSprmPFKeep
: public Ww1SingleSprmBool
{
509 Ww1SingleSprmPFKeep(sal_Char
* sName
) :
510 Ww1SingleSprmBool(sName
) {
512 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
513 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
516 class Ww1SingleSprmPFKeepFollow
: public Ww1SingleSprmBool
{
518 Ww1SingleSprmPFKeepFollow(sal_Char
* sName
) :
519 Ww1SingleSprmBool(sName
) {
521 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
522 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
525 class Ww1SingleSprmPPageBreakBefore
: public Ww1SingleSprmBool
{
527 Ww1SingleSprmPPageBreakBefore(sal_Char
* sName
) :
528 Ww1SingleSprmBool(sName
) {
530 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
531 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
534 class Ww1SingleSprmPBrc
: public Ww1SingleSprmWord
{
536 // SvxBorderLine* SetBorder(SvxBorderLine*, W1_BRC*);
537 // spezielle start-routine, je nach sprm verschieden versorgt
538 // mit einem BoxItem.
539 void Start(Ww1Shell
&, BYTE
, W1_BRC10
*, USHORT
, Ww1Manager
&, SvxBoxItem
&);
540 void Start(Ww1Shell
&, BYTE
, W1_BRC
*, USHORT
, Ww1Manager
&, SvxBoxItem
&);
542 using Ww1SingleSprm::Start
;
545 Ww1SingleSprmPBrc(sal_Char
* sName
) :
546 Ww1SingleSprmWord(sName
) {
548 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
549 // SetBorder() wird auch fuer Tabellen gebraucht, deshalb public
550 static SvxBorderLine
* SetBorder(SvxBorderLine
*, W1_BRC10
*);
553 #define BRC_TOP ((USHORT)0)
554 #define BRC_LEFT ((USHORT)1)
555 #define BRC_BOTTOM ((USHORT)2)
556 #define BRC_RIGHT ((USHORT)3)
557 #define BRC_ANZ ((USHORT)BRC_RIGHT-BRC_TOP+1)
559 // Die BRC-struktur fuer 1.0 versionen von word sind verschieden von
560 // denen der folgenden versionen. diese werden zum glueck aber auch
561 // von anderen sprms abgerufen.
562 // SH: Ab sofort alle 4 Umrandungen ueber nur 1 Klasse.
563 class Ww1SingleSprmPBrc10
: public Ww1SingleSprmPBrc
565 USHORT nLine
; // BRC_TOP, BRC_LEFT, ...
567 using Ww1SingleSprmPBrc::Start
;
570 Ww1SingleSprmPBrc10(USHORT nL
, sal_Char
* sName
)
571 : Ww1SingleSprmPBrc(sName
), nLine(nL
) {}
573 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
576 class Ww1SingleSprmParaSpace
: public Ww1SingleSprmWord
{
578 Ww1SingleSprmParaSpace(sal_Char
* sName
)
579 : Ww1SingleSprmWord(sName
) {}
580 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
583 class Ww1SingleSprmPDyaBefore
: public Ww1SingleSprmParaSpace
{
585 Ww1SingleSprmPDyaBefore(sal_Char
* sName
)
586 : Ww1SingleSprmParaSpace(sName
) {}
587 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
590 class Ww1SingleSprmPDyaAfter
: public Ww1SingleSprmParaSpace
{
592 Ww1SingleSprmPDyaAfter(sal_Char
* sName
) :
593 Ww1SingleSprmParaSpace(sName
) {
595 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
598 class Ww1SingleSprmPDyaLine
: public Ww1SingleSprmWord
{
600 Ww1SingleSprmPDyaLine(sal_Char
* sName
) :
601 Ww1SingleSprmWord(sName
) {
603 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
604 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
607 class Ww1SingleSprmPChgTabsPapx
: public Ww1SingleSprmByteSized
{
609 Ww1SingleSprmPChgTabsPapx(sal_Char
* sName
) :
610 Ww1SingleSprmByteSized(0, sName
) {
612 // Size() ist noch nicht aktiviert !!
613 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
614 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
617 class Ww1SingleSprmSGprfIhdt
: public Ww1SingleSprmByte
{
619 Ww1SingleSprmSGprfIhdt(sal_Char
* sName
) :
620 Ww1SingleSprmByte(sName
) {
622 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
625 class Ww1SingleSprmSColumns
: public Ww1SingleSprmWord
{
627 Ww1SingleSprmSColumns(sal_Char
* sName
) :
628 Ww1SingleSprmWord(sName
) {
630 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
633 class Ww1SingleSprmPFInTable
: public Ww1SingleSprmBool
{
635 Ww1SingleSprmPFInTable(sal_Char
* sName
) :
636 Ww1SingleSprmBool(sName
) {
638 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
639 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
642 class Ww1SingleSprmPTtp
: public Ww1SingleSprmBool
{
644 Ww1SingleSprmPTtp(sal_Char
* sName
) :
645 Ww1SingleSprmBool(sName
) {
647 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
648 void Stop(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
651 class Ww1SingleSprmTJc
: public Ww1SingleSprmWord
{
653 Ww1SingleSprmTJc(sal_Char
* sName
)
654 : Ww1SingleSprmWord(sName
) {}
657 //class Ww1SingleSprmTDxaLeft : public Ww1SingleSprmWord {
659 // Ww1SingleSprmTDxaLeft(sal_Char* sName) :
660 // Ww1SingleSprmWord(sName) {
662 // void Start(Ww1Shell&, BYTE, BYTE*, USHORT, Ww1Manager&);
665 class Ww1SingleSprmTDxaGapHalf
: public Ww1SingleSprmWord
{
667 Ww1SingleSprmTDxaGapHalf(sal_Char
* sName
) :
668 Ww1SingleSprmWord(sName
) {
670 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
673 class Ww1SingleSprmTDefTable10
: public Ww1SingleSprmWordSized
{
675 Ww1SingleSprmTDefTable10(sal_Char
* sName
) :
676 Ww1SingleSprmWordSized(0, sName
) {
678 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
681 class Ww1SingleSprmTDyaRowHeight
: public Ww1SingleSprmWord
{
683 Ww1SingleSprmTDyaRowHeight(sal_Char
* sName
) :
684 Ww1SingleSprmWord(sName
) {
686 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
689 // Klassendefinitionen fuer Tabellen-Fastsave-Attribute
690 // Da wir kein Fastsave unterstuetzen, brauchen wir's nicht
694 class Ww1SingleSprmTInsert
: public Ww1SingleSprm
{
696 Ww1SingleSprmTInsert(sal_Char
* sName
) :
697 Ww1SingleSprm(4, sName
) {
699 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
702 class Ww1SingleSprmTDelete
: public Ww1SingleSprmWord
{
704 Ww1SingleSprmTDelete(sal_Char
* sName
) :
705 Ww1SingleSprmWord(sName
) {
707 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
710 class Ww1SingleSprmTDxaCol
: public Ww1SingleSprm
{
712 Ww1SingleSprmTDxaCol(sal_Char
* sName
) :
713 Ww1SingleSprm(4, sName
) {
715 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
718 class Ww1SingleSprmTMerge
: public Ww1SingleSprmWord
{
720 Ww1SingleSprmTMerge(sal_Char
* sName
) :
721 Ww1SingleSprmWord(sName
) {
723 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
726 class Ww1SingleSprmTSplit
: public Ww1SingleSprmWord
{
728 Ww1SingleSprmTSplit(sal_Char
* sName
) :
729 Ww1SingleSprmWord(sName
) {
731 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
734 class Ww1SingleSprmTSetBrc10
: public Ww1SingleSprm
{
736 Ww1SingleSprmTSetBrc10(sal_Char
* sName
) :
737 Ww1SingleSprm(5, sName
) {
739 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
743 // Klassendefinitionen fuer Apos ( == Flys )
745 class Ww1SingleSprmPpc
: public Ww1SingleSprmByte
{
747 Ww1SingleSprmPpc(sal_Char
* sName
) :
748 Ww1SingleSprmByte(sName
) {
750 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
753 class Ww1SingleSprmPDxaAbs
: public Ww1SingleSprmWord
{
755 Ww1SingleSprmPDxaAbs(sal_Char
* sName
) :
756 Ww1SingleSprmWord(sName
) {
758 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
761 class Ww1SingleSprmPDyaAbs
: public Ww1SingleSprmWord
{
763 Ww1SingleSprmPDyaAbs(sal_Char
* sName
) :
764 Ww1SingleSprmWord(sName
) {
766 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
769 class Ww1SingleSprmPDxaWidth
: public Ww1SingleSprmWord
{
771 Ww1SingleSprmPDxaWidth(sal_Char
* sName
) :
772 Ww1SingleSprmWord(sName
) {
774 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
777 class Ww1SingleSprmPFromText
: public Ww1SingleSprmWord
{
779 Ww1SingleSprmPFromText(sal_Char
* sName
) :
780 Ww1SingleSprmWord(sName
) {
782 void Start(Ww1Shell
&, BYTE
, BYTE
*, USHORT
, Ww1Manager
&);
785 ////////////////////////////////////////////////////////////////// Sprm
787 // der tatsaechlich in der datei auftretende datentyp Sprm
792 static Ww1SingleSprm
* aTab
[256];
793 static Ww1SingleSprm
* pSingleSprm
;
795 static void InitTab();
796 Ww1SingleSprm
& GetTab(USHORT nId
)
800 return aTab
[ nId
] ? *aTab
[nId
] : *pSingleSprm
;
808 // ohne Token, mit laengen-byte/word
809 USHORT
GetSize(BYTE nId
, BYTE
* pSprm
);
810 // mit Token und LaengenByte
811 USHORT
GetSizeBrutto(BYTE
* pSprm
) {
813 return GetSize(nId
, pSprm
) + 1; }
814 // gibt fuer nTh element id, size & zeiger auf daten:
815 // BOOL Fill(USHORT, BYTE&, USHORT&, BYTE*&);
817 // SH: brauche ich public
818 // gibt fuer nTh element id, size & zeiger auf daten:
819 BOOL
Fill(USHORT
, BYTE
&, USHORT
&, BYTE
*&);
821 Ww1Sprm(BYTE
*, USHORT
);
822 Ww1Sprm(SvStream
&, ULONG
);
824 friend ostream
& operator <<(ostream
&, Ww1Sprm
&);
825 void Start(Ww1Shell
&, Ww1Manager
&);
826 void Start(Ww1Shell
&, Ww1Manager
&, USHORT
);
827 void Stop(Ww1Shell
&, Ww1Manager
&);
829 return nCountBytes
!= 255; }
834 static void DeinitTab();
837 /////////////////////////////////////////////////////////////// Picture
839 // der wrapper um den datentyp PIC, eine struktur, die am beginn eines
840 // bild-dateinamens oder eines eingebetteten bildes steht.
847 Ww1Picture(SvStream
&, ULONG
);
852 friend ostream
& operator <<(ostream
&, Ww1Picture
&);
853 void Out(Ww1Shell
&, Ww1Manager
&);
854 void WriteBmp(SvStream
&);
857 /////////////////////////////////////////////////////////////////// Plc
859 // eine der wichtigen array-strukturen der ww-dateien. sie beinhalten
860 // n+1 dateipositionen und n attribute, die zwischen den
861 // dateipositionen gelten.
872 BYTE
* GetData(USHORT
);
874 Ww1Plc(Ww1Fib
&, ULONG
, USHORT
, USHORT
);
876 friend ostream
& operator <<(ostream
&, Ww1Plc
&);
877 ULONG
Where(USHORT
); // wie im jeweiligen plc
878 void Seek(ULONG
, USHORT
&);
879 void Fill(USHORT nIndex
, ULONG
& begin
, ULONG
& end
) {
880 begin
= Where(nIndex
);
881 end
= Where(nIndex
+1); }
888 // Size Tabs from Sven:
889 // CHP, PAP, SEP, HED, FNR, FNT
890 //Plc 2, 2, 6, 0, 2, 0
891 //Fkp 1, 1, 0, 0, 0, 0
893 /////////////////////////////////////////////////////////// PlcGlossary
894 class Ww1PlcGlossary
: public Ww1Plc
897 Ww1PlcGlossary(Ww1Fib
& rFibL
) :
898 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfglsyGet(),
899 rFibL
.GetFIB().cbPlcfglsyGet(), 0) {
903 ////////////////////////////////////////////////////// PlcAnnotationRef
904 class Ww1PlcAnnotationRef
: public Ww1Plc
907 Ww1PlcAnnotationRef(Ww1Fib
& rFibL
) :
908 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfandRefGet(),
909 rFibL
.GetFIB().cbPlcfandRefGet(), 0) {
913 ////////////////////////////////////////////////////// PlcAnnotationTxt
914 class Ww1PlcAnnotationTxt
: public Ww1Plc
917 Ww1PlcAnnotationTxt(Ww1Fib
& rFibL
) :
918 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfandTxtGet(),
919 rFibL
.GetFIB().cbPlcfandTxtGet(), 0) {
923 ///////////////////////////////////////////////////////// PlcAnnotation
924 class Ww1Annotation
{
925 Ww1PlcAnnotationRef aRef
;
926 Ww1PlcAnnotationTxt aTxt
;
928 Ww1Annotation(Ww1Fib
& rFib
) :
932 friend ostream
& operator <<(ostream
&, Ww1Annotation
&);
935 //////////////////////////////////////////////////////////////// PlcSep
936 class Ww1PlcSep
: public Ww1Plc
939 Ww1PlcSep(Ww1Fib
& rFibL
):
940 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfsedGet(),
941 rFibL
.GetFIB().cbPlcfsedGet(), 6) {
943 friend ostream
& operator <<(ostream
&, Ww1PlcSep
&);
946 //////////////////////////////////////////////////////////////// PlcChp
947 class Ww1PlcChp
: public Ww1Plc
950 Ww1PlcChp(Ww1Fib
& rFibL
) :
951 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfbteChpxGet(),
952 rFibL
.GetFIB().cbPlcfbteChpxGet(), 2) {
954 friend ostream
& operator <<(ostream
&, Ww1PlcChp
&);
957 //////////////////////////////////////////////////////////////// PlcPap
958 class Ww1PlcPap
: public Ww1Plc
961 Ww1PlcPap(Ww1Fib
& rFibL
) :
962 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfbtePapxGet(),
963 rFibL
.GetFIB().cbPlcfbtePapxGet(), 2) {
965 friend ostream
& operator <<(ostream
&, Ww1PlcPap
&);
968 //////////////////////////////////////////////////////// PlcFootnoteRef
969 class Ww1PlcFootnoteRef
: public Ww1Plc
972 Ww1PlcFootnoteRef(Ww1Fib
& rFibL
) :
973 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcffndRefGet(),
974 rFibL
.GetFIB().cbPlcffndRefGet(), 2) {
976 friend ostream
& operator <<(ostream
&, Ww1PlcFootnoteRef
&);
979 //////////////////////////////////////////////////////// PlcFootnoteTxt
980 class Ww1PlcFootnoteTxt
: public Ww1Plc
983 Ww1PlcFootnoteTxt(Ww1Fib
& rFibL
) :
984 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcffndTxtGet(),
985 rFibL
.GetFIB().cbPlcffndTxtGet(), 0) {
987 friend ostream
& operator <<(ostream
&, Ww1PlcFootnoteTxt
&);
990 ///////////////////////////////////////////////////////////// PlcFields
991 class Ww1PlcFields
: public Ww1Plc
993 //USHORT Fill(USHORT, BYTE&, String&, String&, String&);
995 Ww1PlcFields(Ww1Fib
& rFibL
, ULONG start
, USHORT nBytes
)
996 : Ww1Plc(rFibL
, start
, nBytes
, 2)
998 W1_FLD
* GetData(USHORT nIndex
)
999 { return (W1_FLD
*)Ww1Plc::GetData(nIndex
); }
1000 ULONG
Where(USHORT nIndex
) // absolut im file
1001 { return Ww1Plc::Where(nIndex
) + rFib
.GetFIB().fcMinGet(); }
1002 friend ostream
& operator <<(ostream
&, Ww1PlcFields
&);
1005 ///////////////////////////////////////////////////////////// PlcBookmarks
1011 Ww1StringList( SvStream
& rSt
, ULONG nFc
, USHORT nCb
);
1013 { if( pIdxA
) { delete pIdxA
[0]; delete pIdxA
; } }
1014 const String
GetStr( USHORT nNum
) const;
1015 USHORT
Count() const { return nMax
; }
1016 BOOL
GetError() const { return (nMax
!= 0) && !pIdxA
; }
1019 class Ww1PlcBookmarkTxt
: public Ww1StringList
1022 Ww1PlcBookmarkTxt(Ww1Fib
& rFib
) :
1023 Ww1StringList( rFib
.GetStream(), rFib
.GetFIB().fcSttbfbkmkGet(),
1024 rFib
.GetFIB().cbSttbfbkmkGet() )
1028 class Ww1PlcBookmarkPos
: public Ww1Plc
1030 // USHORT Fill(USHORT, BYTE&, String&, String&, String&);
1032 Ww1PlcBookmarkPos(Ww1Fib
& _rFib
, ULONG start
, USHORT nBytes
, BOOL bEnd
)
1033 : Ww1Plc(_rFib
, start
, nBytes
, (bEnd
) ? 0 : 2)
1036 BYTE
* GetData(USHORT nIndex
) { return Ww1Plc::GetData(nIndex
); }
1038 ULONG
WhereCP(USHORT nIndex
) { return Ww1Plc::Where(nIndex
); }
1040 ULONG
Where(USHORT nIndex
)
1042 return ( nIndex
< Count() )
1043 ? Ww1Plc::Where(nIndex
) + rFib
.GetFIB().fcMinGet()
1046 // friend ostream& operator <<(ostream&, Ww1PlcBookmarks&);
1049 //////////////////////////////////////////////////////////////// PlcHdd
1050 class Ww1PlcHdd
: public Ww1Plc
1053 Ww1PlcHdd(Ww1Fib
& rFibL
)
1054 : Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfhddGet(),
1055 rFibL
.GetFIB().cbPlcfhddGet(), 0)
1059 /////////////////////////////////////////////////////////////////// Fkp
1061 // aehnlich den plcs aufgebaute arrays, die sich auf eine groesze von
1062 // 512 byte beschraenken.
1070 BYTE
* GetData(USHORT
);
1072 Ww1Fkp(SvStream
&, ULONG
, USHORT
);
1073 friend ostream
& operator <<(ostream
&, Ww1Fkp
&);
1074 USHORT
Count() const { return SVBT8ToByte(aFkp
+511); }
1075 ULONG
Where(USHORT
); // wie im entsprechenden fkp
1078 //////////////////////////////////////////////////////////////// FkpPap
1079 class Ww1FkpPap
: public Ww1Fkp
1082 Ww1FkpPap(SvStream
& rStream
, ULONG ulFilePos
)
1083 : Ww1Fkp(rStream
, ulFilePos
, 1)
1085 friend ostream
& operator <<(ostream
&, Ww1FkpPap
&);
1086 BOOL
Fill(USHORT
, BYTE
*&, USHORT
&);
1089 //////////////////////////////////////////////////////////////// FkpChp
1090 class Ww1FkpChp
: public Ww1Fkp
1094 SvStream
& GetStream() { return rStream
; }
1097 Ww1FkpChp(SvStream
& rStream
, ULONG ulFilePos
)
1098 : Ww1Fkp(rStream
, ulFilePos
, 1)
1104 friend ostream
& operator <<(ostream
&, Ww1FkpChp
&);
1105 BOOL
Fill(USHORT
, W1_CHP
&);
1108 ////////////////////////////////////////////////////////////// SprmPapx
1109 class Ww1SprmPapx
: public Ww1Sprm
1112 BYTE
* Sprm(BYTE
* p
, USHORT nSize
);
1113 USHORT
SprmSize(BYTE
* p
, USHORT nSize
);
1115 Ww1SprmPapx(BYTE
* p
, USHORT nSize
);
1116 friend ostream
& operator <<(ostream
&, Ww1SprmPapx
&);
1117 void Start(Ww1Shell
&, Ww1Manager
&);
1118 void Stop(Ww1Shell
&, Ww1Manager
&);
1121 /////////////////////////////////////////////////////////////// SprmSep
1122 class Ww1SprmSep
: public Ww1Sprm
1125 Ww1SprmSep(Ww1Fib
& rFib
, ULONG ulFilePos
)
1126 : Ww1Sprm(rFib
.GetStream(), ulFilePos
)
1128 friend ostream
& operator <<(ostream
&, Ww1SprmSep
&);
1131 ///////////////////////////////////////////////////////////////// Assoc
1134 enum fields
{ FileNext
, Dot
, Title
, Subject
, KeyWords
, Comments
,
1135 Author
, LastRevBy
, DataDoc
, HeaderDoc
, Criteria1
, Criteria2
,
1136 Criteria3
, Criteria4
, Criteria5
, Criteria6
, Criteria7
, MaxFields
};
1140 sal_Char
* pStrTbl
[ MaxFields
];
1143 String
GetStr(USHORT
);
1147 ~Ww1Assoc() { delete pBuffer
; }
1148 BOOL
GetError() const { return !bOK
; }
1149 friend ostream
& operator <<(ostream
&, Ww1Assoc
&);
1150 void Out(Ww1Shell
&);
1153 ////////////////////////////////////////////////////////// HeaderFooter
1155 // Header/Footer/Footnoteseparators sind einer nach dem naechsten in
1156 // einem eigenen text gespeichert. ein plc trennt diesen text in
1157 // einzelne teile. diese werden durchnummeriert als ihdd. nun gibt es
1158 // 9 verschiedene funktionen fuer diese texte. wird eine davon
1159 // angefordert, ist es der erste, beim naechstern der 2 ihdd und so
1160 // weiter. welcher textteil also welcher typ sein wird laeszt sich
1161 // nur bei sequenziellem lesen der datei bestimmen. die 9 typen sind:
1162 // fusznoten-trenner, folge-fusznoten-trenner, folge-fusznoten-notiz,
1163 // gerade-seiten kopfzeilen, ungerade seiten kopfzeilen, dto 2*
1164 // fuszzeilen, kopf & fuszzeilen, wenn erste seite andere zeilen hat.
1165 // HeaderFooter merkt sich fuer jede der 9 die momentane einstellung
1166 // (jedoch nicht die alten) und den naechstvergebbaren ihdd. ist ein
1167 // teil nicht vorhanden bekommt er den wert 0xffff.
1169 class Ww1HeaderFooter
: public Ww1PlcHdd
1171 USHORT nextIhdd
; // naechster textteil im HddText
1172 USHORT nFtnSep
; // fusznoten trenner
1173 USHORT nFtnFollowSep
; // folge fusznoten trenner
1174 USHORT nFtnNote
; // folgefunsznotennotiz
1175 USHORT nEvenHeadL
; // kopfzeilen grader seiten
1176 USHORT nOddHeadL
; // kopfzeilen ungrader seiten
1177 USHORT nEvenFootL
; // fuszzeilen grader seiten
1178 USHORT nOddFootL
; // fuszzeilen ungerader seiten
1179 USHORT nFirstHeadL
; // kopfzeilen der ersten seite
1180 USHORT nFirstFootL
; // fuszzeilen der ersten seite
1181 enum HeaderFooterMode
{
1182 None
, FtnSep
, FtnFollowSep
, FtnNote
, EvenHeadL
, OddHeadL
,
1183 EvenFootL
, OddFootL
, FirstHeadL
, MaxHeaderFooterMode
1184 } eHeaderFooterMode
;
1187 Ww1HeaderFooter(Ww1Fib
& rFibL
, USHORT grpfIhdt
)
1191 nFtnFollowSep(0xffff),
1197 nFirstHeadL(0xffff),
1198 nFirstFootL(0xffff),
1199 eHeaderFooterMode(None
)
1201 if (grpfIhdt
& 0x0001) nFtnSep
= nextIhdd
++;
1202 if (grpfIhdt
& 0x0002) nFtnFollowSep
= nextIhdd
++;
1203 if (grpfIhdt
& 0x0004) nFtnNote
= nextIhdd
++;
1205 // ~Ww1HeaderFooter() {}
1206 void SetGrpfIhdt(USHORT grpfIhdt
)
1208 if (grpfIhdt
& 0x0001) nEvenHeadL
= nextIhdd
++;
1209 if (grpfIhdt
& 0x0002) nOddHeadL
= nextIhdd
++;
1210 if (grpfIhdt
& 0x0004) nEvenFootL
= nextIhdd
++;
1211 if (grpfIhdt
& 0x0008) nOddFootL
= nextIhdd
++;
1212 if (grpfIhdt
& 0x0010) nFirstHeadL
= nextIhdd
++;
1213 if (grpfIhdt
& 0x0020) nFirstFootL
= nextIhdd
++;
1214 DBG_ASSERT(nextIhdd
<=Count(), "Ww1HeaderFooter");
1216 BOOL
operator++(int)
1219 eHeaderFooterMode
= (HeaderFooterMode
)((short)eHeaderFooterMode
+ 1);
1220 if( eHeaderFooterMode
== MaxHeaderFooterMode
)
1222 eHeaderFooterMode
= None
;
1227 BOOL
FillFtnSep(ULONG
& begin
, ULONG
& end
)
1229 if (nFtnSep
== 0xffff)
1231 Fill(nFtnSep
, begin
, end
);
1234 BOOL
FillFtnFollowSep(ULONG
& begin
, ULONG
& end
)
1236 if (nFtnFollowSep
== 0xffff)
1238 Fill(nFtnFollowSep
, begin
, end
);
1241 BOOL
FillFtnNote(ULONG
& begin
, ULONG
& end
)
1243 if (nFtnNote
== 0xffff)
1245 Fill(nFtnNote
, begin
, end
);
1248 BOOL
FillEvenHeadL(ULONG
& begin
, ULONG
& end
)
1250 if (nEvenHeadL
== 0xffff)
1252 Fill(nEvenHeadL
, begin
, end
);
1255 BOOL
FillOddHeadL(ULONG
& begin
, ULONG
& end
)
1257 if (nOddHeadL
== 0xffff)
1259 Fill(nOddHeadL
, begin
, end
);
1262 BOOL
FillEvenFootL(ULONG
& begin
, ULONG
& end
)
1264 if (nEvenFootL
== 0xffff)
1266 Fill(nEvenFootL
, begin
, end
);
1269 BOOL
FillOddFootL(ULONG
& begin
, ULONG
& end
)
1271 if (nOddFootL
== 0xffff)
1273 Fill(nOddFootL
, begin
, end
);
1276 BOOL
FillFirstHeadL(ULONG
& begin
, ULONG
& end
)
1278 if (nFirstHeadL
== 0xffff)
1280 Fill(nFirstHeadL
, begin
, end
);
1283 BOOL
FillFirstFootL(ULONG
& begin
, ULONG
& end
)
1285 if (nFirstFootL
== 0xffff)
1287 Fill(nFirstFootL
, begin
, end
);
1290 void Start(Ww1Shell
&, Ww1Manager
&);
1291 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1294 //////////////////////////////////////////////////////////////// Fields
1295 class Ww1Fields
: public Ww1PlcFields
1298 String sErgebnis
; // das von word errechnete ergebniss
1300 ULONG
Where(USHORT nIndex
) // innerhalb des textes
1301 { return Ww1PlcFields::Where(nIndex
) - rFib
.GetFIB().fcMinGet(); }
1304 Ww1Fields(Ww1Fib
& rFibL
, ULONG ulFilePos
, USHORT nBytes
)
1305 : Ww1PlcFields(rFibL
, ulFilePos
, nBytes
), nPlcIndex(0), pField(0)
1308 // innerhalb des textes
1309 ULONG
Where() { return Where(nPlcIndex
); }
1310 void operator++(int)
1312 DBG_ASSERT(nPlcIndex
+1 <= Count(), "Ww1Fields");
1315 void Seek(ULONG ulNew
) { Ww1PlcFields::Seek(ulNew
, nPlcIndex
); }
1318 DBG_ASSERT(nPlcIndex
< Count(), "Ww1Fields");
1319 return Ww1PlcFields::GetData(nPlcIndex
);
1322 friend ostream
& operator <<(ostream
&, Ww1Manager
&);
1323 void Start(Ww1Shell
&, Ww1Manager
&);
1324 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1325 void Out(Ww1Shell
&, Ww1Manager
&, USHORT
=0);
1328 class Ww1TextFields
: public Ww1Fields
1331 Ww1TextFields(Ww1Fib
& rFibL
)
1332 : Ww1Fields(rFibL
, rFibL
.GetFIB().fcPlcffldMomGet(),
1333 rFibL
.GetFIB().cbPlcffldMomGet())
1337 class Ww1FootnoteFields
: public Ww1Fields
1340 Ww1FootnoteFields(Ww1Fib
& rFibL
)
1341 : Ww1Fields(rFibL
, rFibL
.GetFIB().fcPlcffldFtnGet(),
1342 rFibL
.GetFIB().cbPlcffldFtnGet())
1346 class Ww1HeaderFooterFields
: public Ww1Fields
1349 Ww1HeaderFooterFields(Ww1Fib
& rFibL
)
1350 : Ww1Fields(rFibL
, rFibL
.GetFIB().fcPlcffldHdrGet(),
1351 rFibL
.GetFIB().cbPlcffldHdrGet())
1355 class Ww1MacroFields
: public Ww1Fields
1358 Ww1MacroFields(Ww1Fib
& rFibL
)
1359 : Ww1Fields(rFibL
, rFibL
.GetFIB().fcPlcffldMcrGet(),
1360 rFibL
.GetFIB().cbPlcffldMcrGet())
1364 //////////////////////////////////////////////////////////////// Bookmarks
1367 Ww1PlcBookmarkTxt aNames
;
1368 Ww1PlcBookmarkPos
* pPos
[2];
1374 // ULONG Where(USHORT nIndex) { // innerhalb des textes
1375 // return Ww1PlcFields::Where(nIndex) - rFib.GetFIB().fcMinGet(); }
1377 Ww1Bookmarks(Ww1Fib
& rFib
);
1383 ULONG
Where() const { return pPos
[nIsEnd
]->WhereCP(nPlcIdx
[nIsEnd
]); }
1384 void operator++(int);
1385 BOOL
GetError() const { return !bOK
; }
1386 long GetHandle() const;
1387 BOOL
GetIsEnd() const { return ( nIsEnd
) ? TRUE
: FALSE
; }
1388 const String
GetName() const;
1390 friend ostream
& operator <<(ostream
&, Ww1Bookmarks
&);
1391 void Start(Ww1Shell
&, Ww1Manager
&);
1392 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1393 void Out(Ww1Shell
&, Ww1Manager
&, USHORT
=0);
1396 ///////////////////////////////////////////////////////////// Footnotes
1397 class Ww1Footnotes
: public Ww1PlcFootnoteRef
1400 Ww1PlcFootnoteTxt aText
;
1403 Ww1Footnotes(Ww1Fib
& rFibL
)
1404 : Ww1PlcFootnoteRef(rFibL
), nPlcIndex(0), aText(rFibL
), bStarted(FALSE
)
1406 // ~Ww1Footnotes() {}
1407 // innerhalb des textes
1410 ULONG ulRet
= 0xffffffff;
1412 ulRet
= Ww1PlcFootnoteRef::Where(nPlcIndex
);
1415 void operator++(int)
1417 DBG_ASSERT(nPlcIndex
+1 <= Count(), "Ww1Footnotes");
1420 void Start(Ww1Shell
&, Ww1Manager
&);
1421 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1424 /////////////////////////////////////////////////////////////////// Sep
1425 class Ww1Sep
: public Ww1PlcSep
1427 Ww1HeaderFooter aHdd
;
1430 Ww1Sep(Ww1Fib
& rFibL
, USHORT grpfIhdt
)
1431 : Ww1PlcSep(rFibL
), aHdd(rFibL
, grpfIhdt
), nPlcIndex(0) {}
1433 Ww1HeaderFooter
& GetHdd() { return aHdd
; }
1434 void operator++(int) { nPlcIndex
++; }
1435 BYTE
* GetData() { return Ww1PlcSep::GetData(nPlcIndex
); }
1436 // innerhalb des textes
1437 ULONG
Where() { return Ww1PlcSep::Where(nPlcIndex
); }
1438 void SetGrpfIhdt(BYTE grpfIhdt
)
1440 GetHdd().SetGrpfIhdt(grpfIhdt
);
1441 // GetHdd().Start(rOut, rMan);
1443 void Start(Ww1Shell
&, Ww1Manager
&);
1444 void Stop(Ww1Shell
& rOut
, Ww1Manager
& rMan
, sal_Unicode
& c
)
1445 { aHdd
.Stop(rOut
, rMan
, c
); }
1448 /////////////////////////////////////////////////////////////////// Pap
1449 class Ww1Pap
: public Ww1PlcPap
1452 USHORT nPushedPlcIndex
;
1454 USHORT nPushedFkpIndex
;
1458 BOOL
FindSprm(USHORT nId
, BYTE
* pStart
, BYTE
* pEnd
);
1461 if (pPap
&& nFkpIndex
>= pPap
->Count() )
1470 BOOL
HasId0(USHORT nId
);
1473 Ww1Pap(Ww1Fib
& rFib
);
1474 ~Ww1Pap() { delete pPap
; }
1475 ULONG
Where( BOOL bSetIndex
= TRUE
); // innerhalb des textes
1476 void operator++(int);
1477 BOOL
FillStart(BYTE
*& pB
, USHORT
& nSize
)
1480 return pPap
->Fill(nFkpIndex
, pB
, nSize
);
1482 BOOL
FillStop(BYTE
*& pB
, USHORT
& nSize
)
1484 return nFkpIndex
? pPap
->Fill(nFkpIndex
-1, pB
, nSize
) : FALSE
;
1486 void Start(Ww1Shell
&, Ww1Manager
&);
1487 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1489 void Push(ULONG ulOffsetTmp
= 0)
1491 DBG_ASSERT(!Pushed(), "Ww1Pap");
1492 nPushedPlcIndex
= nPlcIndex
;
1493 nPushedFkpIndex
= nFkpIndex
;
1495 ulOffset
= ulOffsetTmp
;
1501 return nPushedPlcIndex
!= 0xffff;
1505 DBG_ASSERT(Pushed(), "Ww1Pap");
1507 nPlcIndex
= nPushedPlcIndex
;
1508 nFkpIndex
= nPushedFkpIndex
;
1509 nPushedPlcIndex
= 0xffff;
1510 nPushedFkpIndex
= 0xffff;
1515 BOOL
HasId(USHORT nId
);
1518 /////////////////////////////////////////////////////////////////// Chp
1519 class Ww1Chp
: public Ww1PlcChp
1522 USHORT nPushedPlcIndex
;
1524 USHORT nPushedFkpIndex
;
1529 if (pChp
&& nFkpIndex
>= pChp
->Count() )
1540 Ww1Chp( Ww1Fib
& rFib
);
1541 ~Ww1Chp() { delete pChp
; }
1542 ULONG
Where( BOOL bSetIndex
= TRUE
); // innerhalb des textes
1543 void operator++(int);
1544 BOOL
FillStart(W1_CHP
& rChp
)
1547 return pChp
->Fill(nFkpIndex
, rChp
);
1549 BOOL
FillStop(W1_CHP
& rChp
)
1550 { return nFkpIndex
? pChp
->Fill(nFkpIndex
-1, rChp
) : FALSE
; }
1551 void Start(Ww1Shell
&, Ww1Manager
&);
1552 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1554 void Push(ULONG ulOffsetTmp
= 0)
1556 DBG_ASSERT(!Pushed(), "Ww1Chp");
1557 nPushedPlcIndex
= nPlcIndex
;
1558 nPushedFkpIndex
= nFkpIndex
;
1560 ulOffset
= ulOffsetTmp
;
1564 BOOL
Pushed() { return nPushedPlcIndex
!= 0xffff; }
1567 DBG_ASSERT(Pushed(), "Ww1Chp");
1569 nPlcIndex
= nPushedPlcIndex
;
1570 nFkpIndex
= nPushedFkpIndex
;
1571 nPushedPlcIndex
= 0xffff;
1572 nPushedFkpIndex
= 0xffff;
1579 /////////////////////////////////////////////////////////////// Manager
1581 // zentraler aufhaenger der ww-seite des filters, konstruiert aus dem
1582 // inputstream (ww-datei) enthaelt er alles, was noetig ist, um in die
1583 // shell (pm-seite) gepiped zu werden.
1594 // ab jetzt alles paarig, fuer 'pushed':
1601 // selbst 'push'bar:
1604 // nicht in textbereichen vorhanden, wenn ge'pushed'
1606 Ww1Bookmarks aBooks
;
1609 void OutStop( Ww1Shell
&, sal_Unicode
);
1610 void OutStart( Ww1Shell
& );
1611 void Out(Ww1Shell
&, sal_Unicode
);
1614 Ww1Manager(SvStream
& rStrm
, ULONG nFieldFlgs
);
1615 BOOL
GetError() const { return !bOK
; }
1618 void SetInTtp(BOOL bSet
= TRUE
) { bInTtp
= bSet
; }
1619 BOOL
IsInTtp() const { return bInTtp
; }
1620 void SetInStyle(BOOL bSet
= TRUE
) { bInStyle
= bSet
; }
1621 BOOL
IsInStyle() const { return bInStyle
; }
1622 void SetStopAll(BOOL bSet
= TRUE
) { bStopAll
= bSet
; }
1623 BOOL
IsStopAll() const { return bStopAll
; }
1632 Ww1Fib
& GetFib() { return aFib
; }
1633 Ww1PlainText
& GetText() { return *pDoc
; }
1634 Ww1Dop
& GetDop() { return aDop
; }
1635 Ww1Sep
& GetSep() { return aSep
; }
1636 // innerhalb des textes
1637 ULONG
Where() { return pDoc
->Where(); }
1638 void Fill( sal_Unicode
& rChr
) { pDoc
->Out( rChr
); }
1639 BYTE
Fill( String
& rStr
, ULONG ulLen
)
1641 ulLen
+= pDoc
->Where();
1642 return sal::static_int_cast
< BYTE
>(pDoc
->Out(rStr
, ulLen
));
1644 SvxFontItem
GetFont(USHORT nFCode
);
1645 friend Ww1Shell
& operator <<(Ww1Shell
&, Ww1Manager
&);
1646 friend ostream
& operator <<(ostream
&, Ww1Manager
&);
1647 BOOL
Pushed() { return pDoc
!= &aDoc
; }
1649 void Push0(Ww1PlainText
* pDoc
, ULONG
, Ww1Fields
* = 0);
1650 void Push1(Ww1PlainText
* pDoc
, ULONG ulSeek
, ULONG ulSeek2
= 0,