1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #include <tools/string.hxx>
22 #include <w1struct.hxx>
30 namespace editeng
{ class SvxBorderLine
; }
51 class Ww1PlcAnnotationRef
;
52 class Ww1PlcAnnotationTxt
;
55 class Ww1PlcFootnoteRef
;
56 class Ww1PlcFootnoteTxt
;
68 ///////////////////////////////////////////////////////////////////////
70 // nach moeglichkeit wurden in diesem modul methoden aehnlicher
71 // funktionalitaet gleich benannt. Die namen wurden wenn moeglich vom
72 // ww-filter uebernommen.
73 // Where() gibt die position eines elements. dies kann sowohl eine
74 // seek-position im stream als auch ein relativer offset sein, da dies
75 // bei word durcheinander geht. die methoden sind durch kommentare
76 // gekennzeichnet, ob sie sich auf positionen in der datei oder
77 // innerhalb des textes beziehen. vorsicht: innerhalb des textes kann
78 // verschiedene texte in der datei bedeuten.
79 // Count() gibt die anzahl der elemente zurueck. vorsicht bei
80 // n/n-1-feldern (word speichert strukturen gern in doppel-arrays, in
81 // denen das erste n elemente, das zweite jedoch n-1 elemente
83 // Fill() fuellt uebergebene referenzen mit daten aus den
85 // GetData() gibt zeiger auf den datenbereich zurueck
86 // GetError() gibt zurueck, ob fehler aufgetreten ist
87 // Start(), Stop(), Out(), op<< siehe modul w1filter
88 // Dump() siehe modul w1dump
91 /////////////////////////////////////////////////////////////////// Fib
93 // file information block: wurzel des uebels: steht am beginn der
94 // datei (seek(0)) und enthaelt alle positionen der strukturen der
104 friend std::ostream
& operator <<(std::ostream
&, Ww1Fib
&);
105 W1_FIB
& GetFIB() { return aFib
; }
106 sal_Bool
GetError() { return !bOK
; }
107 SvStream
& GetStream() { return rStream
; }
110 /////////////////////////////////////////////////////////////////// Dop
112 // document property: eigenschaften des gesamten dokuments
121 sal_Bool
GetError() {
125 friend std::ostream
& operator <<(std::ostream
&, Ww1Dop
&);
129 ///////////////////////////////////////////////////////////// PlainText
131 // ww-dateien koennen mehrere textbloecke enthalten (main-text,
132 // fusznoten etc). PlainText vereinigt die gemeinsamkeiten
139 sal_uLong ulCountBytes
;
143 Ww1PlainText(Ww1Fib
& rWwFib
, sal_uLong nFilePos
, sal_uLong nCountBytes
);
144 // innerhalb des textes
145 sal_uLong
Where() const { return ulSeek
; }
146 void Seek( sal_uLong ulNew
)
148 OSL_ENSURE(ulNew
< ulCountBytes
, "Ww1PlainText");
149 if (ulNew
< ulCountBytes
)
153 sal_uLong
Count() const { return ulCountBytes
; }
154 void SetCount(sal_uLong ulNew
)
157 if (ulCountBytes
> ulNew
)
158 ulCountBytes
= ulNew
;
162 OSL_ENSURE(ulSeek
+1<ulCountBytes
, "Ww1PlainText");
165 sal_Bool
GetError() { return !bOK
; }
166 sal_Unicode
Out( Ww1Shell
&, sal_uLong
& );
167 sal_Unicode
Out( String
&, sal_uLong
=0xffffffff);
168 sal_Unicode
Out( sal_Unicode
& );
169 friend std::ostream
& operator <<(std::ostream
&, Ww1PlainText
&);
170 String
& Fill( String
&, sal_uLong
=0, sal_uLong
=0xffffffff );
171 sal_Unicode
operator []( sal_uLong
);
172 String
GetText( sal_uLong ulOffset
, sal_uLong nLen
) const;
174 enum Consts
{ MinChar
= 32 };
175 static bool IsChar( sal_Unicode c
) { return c
>= MinChar
; }
178 /////////////////////////////////////////////////////////////// DocText
179 class Ww1DocText
: public Ww1PlainText
182 Ww1DocText(Ww1Fib
& rFibL
) :
183 Ww1PlainText(rFibL
, rFibL
.GetFIB().fcMinGet(),
184 rFibL
.GetFIB().ccpTextGet()) {
188 /////////////////////////////////////////////////////////////// FtnText
189 class Ww1FtnText
: public Ww1PlainText
192 sal_uLong
Offset(Ww1Fib
& rFibL
) {
193 return rFibL
.GetFIB().ccpTextGet(); }
194 Ww1FtnText(Ww1Fib
& rFibL
) :
195 Ww1PlainText(rFibL
, rFibL
.GetFIB().fcMinGet() +
196 Offset(rFibL
), rFibL
.GetFIB().ccpFtnGet()) {
200 /////////////////////////////////////////////////////////////// HddText
201 class Ww1HddText
: public Ww1PlainText
204 sal_uLong
Offset(Ww1Fib
& rFibL
) {
205 return rFibL
.GetFIB().ccpTextGet() + rFibL
.GetFIB().ccpFtnGet(); }
206 Ww1HddText(Ww1Fib
& rFibL
) :
207 Ww1PlainText(rFibL
, rFibL
.GetFIB().fcMinGet() +
208 Offset(rFibL
), rFibL
.GetFIB().ccpHddGet()) {
212 /////////////////////////////////////////////////////////////// McrText
213 class Ww1McrText
: public Ww1PlainText
216 sal_uLong
Offset(Ww1Fib
& rFibL
) {
217 return rFibL
.GetFIB().ccpTextGet() + rFibL
.GetFIB().ccpFtnGet()
218 + rFibL
.GetFIB().ccpHddGet(); }
219 Ww1McrText(Ww1Fib
& rFibL
) :
220 Ww1PlainText(rFibL
, rFibL
.GetFIB().fcMinGet() +
221 Offset(rFibL
), rFibL
.GetFIB().ccpMcrGet()) {
225 /////////////////////////////////////////////////////////////// AtnText
226 class Ww1AtnText
: public Ww1PlainText
229 sal_uLong
Offset(Ww1Fib
& rFibL
) {
230 return rFibL
.GetFIB().ccpTextGet() + rFibL
.GetFIB().ccpFtnGet()
231 + rFibL
.GetFIB().ccpHddGet() + rFibL
.GetFIB().ccpMcrGet(); }
232 Ww1AtnText(Ww1Fib
& rFibL
) :
233 Ww1PlainText(rFibL
, rFibL
.GetFIB().fcMinGet() +
234 Offset(rFibL
), rFibL
.GetFIB().ccpAtnGet()) {
238 ///////////////////////////////////////////////////////////////// Style
240 // ein einzelner style oder vorlage
247 Ww1StyleSheet
* pParent
;
254 bool IsUsed() const { return bUsed
; }
255 void SetDefaults(sal_uInt8
);
256 void SetParent(Ww1StyleSheet
* newParent
) { pParent
= newParent
; }
257 void SetName(const String
& rName
) { bUsed
= sal_True
; aName
= rName
; }
258 const String
& GetName() const { return aName
; }
260 sal_uInt16
GetnBase() const { return stcBase
; }
261 sal_uInt16
GetnNext() const { return stcNext
; }
262 sal_uInt16
ReadName(sal_uInt8
*&, sal_uInt16
&, sal_uInt16 stc
);
263 sal_uInt16
ReadChpx(sal_uInt8
*&, sal_uInt16
&);
264 sal_uInt16
ReadPapx(sal_uInt8
*&, sal_uInt16
&);
265 sal_uInt16
ReadEstcp(sal_uInt8
*&, sal_uInt16
&);
266 friend std::ostream
& operator <<(std::ostream
&, Ww1Style
&);
267 void Out(Ww1Shell
&, Ww1Manager
&);
270 //////////////////////////////////////////////////////////// StyleSheet
272 // die sammlung aller vorlagen (max. 256)
276 Ww1Style aStyles
[256];
277 sal_uInt16 cstcStd
; // count style code standard
280 sal_uInt16
ReadNames(sal_uInt8
*&, sal_uInt16
&);
281 sal_uInt16
ReadChpx(sal_uInt8
*&, sal_uInt16
&);
282 sal_uInt16
ReadPapx(sal_uInt8
*&, sal_uInt16
&);
283 sal_uInt16
ReadEstcp(sal_uInt8
*&, sal_uInt16
&);
285 void OutDefaults(Ww1Shell
& rOut
, Ww1Manager
& rMan
, sal_uInt16 stc
);
286 void OutOne(Ww1Shell
& rOut
, Ww1Manager
& rMan
, sal_uInt16 stc
);
287 void OutOneWithBase(Ww1Shell
& rOut
, Ww1Manager
& rMan
, sal_uInt16 stc
,
288 sal_uInt8
* pbStopRecur
);
290 Ww1StyleSheet(Ww1Fib
& rFib
);
291 Ww1Style
& GetStyle(sal_uInt16 stc
) {
292 return aStyles
[stc
]; }
295 friend std::ostream
& operator <<(std::ostream
&, Ww1StyleSheet
&);
296 void Out(Ww1Shell
&, Ww1Manager
&);
297 friend class Ww1Style
;
298 sal_Bool
GetError() {
302 ///////////////////////////////////////////////////////////////// Fonts
304 // ww kennt nur font-nummern beim formatieren. nebenher gibts ein
305 // array von fonts, damit man aus der nummer einen konkreten font
311 W1_FFN
** pFontA
; // Array of Pointers to Font Description
313 sal_uLong nFieldFlags
;
314 sal_uInt16 nMax
; // Array-Groesse
317 Ww1Fonts(Ww1Fib
&, sal_uLong nFieldFlgs
);
322 W1_FFN
* GetFFN(sal_uInt16 nNum
);
325 friend std::ostream
& operator <<(std::ostream
&, Ww1Fonts
&);
326 sal_Bool
GetError() {
328 SvxFontItem
GetFont(sal_uInt16
);
331 //////////////////////////////////////////////////////////// SingleSprm
333 // diese klassen ersetzen die aSprmTab etc des ww6-filters. die
334 // funktionspointer sind hier virtuale methoden, fuer die typen (byte,
335 // word, var-sized etc) gibt es abgeleitete klassen. diese haben
336 // methoden zum bestimmen der groesze, dumpen und shell-ausgeben der
338 // die klassen werden mit new (in InitTab()) erzeugt und nach ihrem
339 // code in die tabelle gestellt. zum aktivieren ruft man nun nur noch
340 // die entsprechende methode des objektes in der tabelle auf.
341 // wohlgemerkt: SingleSprms sind die _beschreibung_ und _funktion_ der
342 // Sprms, nicht deren inhalt. dieser musz uebergeben werden an die
343 // einzelnen methoden wie Size, Dump und Start/Stop.
350 // allein die virtuellen methoden stehen in der vtab, also je nachdem,
351 // ob fuer dumper oder filter uebersetzt wird ausblenden: das spart
352 // platz. ausserdem stehen die methoden fuer dumper bzw filter in
353 // verschiedenen modulen, die im jeweils anderen projekt nicht
354 // uebersetzt werden. das diese dann beim linken nicht zur verfuegung
355 // stehen faellt dann auch nicht auf. Der Namensstring ist nur im
356 // Dumper noetig: weg damit im Filter.
358 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
359 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
360 virtual std::ostream
& Dump(std::ostream
&, sal_uInt8
*, sal_uInt16
);
361 const sal_Char
* sName
;
363 virtual void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
364 virtual void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
365 std::ostream
& Dump(std::ostream
&, sal_uInt8
*, sal_uInt16
);
367 virtual sal_uInt16
Size(sal_uInt8
*);
368 sal_uInt16 nCountBytes
;
370 Ww1SingleSprm(sal_uInt16 nBytes
, const sal_Char
* /*pName*/ = 0 )
371 : nCountBytes(nBytes
)
377 virtual ~Ww1SingleSprm();
380 class Ww1SingleSprmByteSized
: public Ww1SingleSprm
{
382 sal_uInt16
Size(sal_uInt8
*);
383 Ww1SingleSprmByteSized(sal_uInt16 nBytes
, sal_Char
* sName
= 0) :
384 Ww1SingleSprm(nBytes
, sName
) {
388 class Ww1SingleSprmWordSized
: public Ww1SingleSprm
{
390 sal_uInt16
Size(sal_uInt8
*);
391 Ww1SingleSprmWordSized(sal_uInt16 nBytes
, sal_Char
* sName
= 0) :
392 Ww1SingleSprm(nBytes
, sName
) {
396 class Ww1SingleSprmByte
: public Ww1SingleSprm
{
398 std::ostream
& Dump(std::ostream
&, sal_uInt8
*, sal_uInt16
);
399 Ww1SingleSprmByte(sal_Char
* sName
= 0) :
400 Ww1SingleSprm(1, sName
) {
404 class Ww1SingleSprmBool
: public Ww1SingleSprmByte
{
406 std::ostream
& Dump(std::ostream
&, sal_uInt8
*, sal_uInt16
);
407 Ww1SingleSprmBool(sal_Char
* sName
= 0) :
408 Ww1SingleSprmByte(sName
) {
412 class Ww1SingleSprm4State
: public Ww1SingleSprmByte
{
414 std::ostream
& Dump(std::ostream
&, sal_uInt8
*, sal_uInt16
);
415 Ww1SingleSprm4State(sal_Char
* sName
= 0) :
416 Ww1SingleSprmByte(sName
) {
420 class Ww1SingleSprmWord
: public Ww1SingleSprm
{
422 std::ostream
& Dump(std::ostream
&, sal_uInt8
*, sal_uInt16
);
423 Ww1SingleSprmWord(sal_Char
* sName
= 0)
424 : Ww1SingleSprm(2, sName
) {}
427 class Ww1SingleSprmLong
: public Ww1SingleSprm
{
429 std::ostream
& Dump(std::ostream
&, sal_uInt8
*, sal_uInt16
);
430 Ww1SingleSprmLong(sal_Char
* sName
= 0) :
431 Ww1SingleSprm(4, sName
) {
435 class Ww1SingleSprmTab
: public Ww1SingleSprm
{
437 std::ostream
& Dump(std::ostream
&, sal_uInt8
*, sal_uInt16
);
438 sal_uInt16
Size(sal_uInt8
*);
439 Ww1SingleSprmTab(sal_uInt16 nBytes
, sal_Char
* sName
= 0) :
440 Ww1SingleSprm(nBytes
, sName
) {
444 class Ww1SingleSprmPJc
: public Ww1SingleSprmByte
{
446 Ww1SingleSprmPJc(sal_Char
* sName
) :
447 Ww1SingleSprmByte(sName
) {
449 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
450 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
453 class Ww1SingleSprmPDxa
: public Ww1SingleSprmWord
{
455 Ww1SingleSprmPDxa(sal_Char
* sName
) :
456 Ww1SingleSprmWord(sName
) {
458 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
461 class Ww1SingleSprmPDxaRight
: public Ww1SingleSprmPDxa
{
463 Ww1SingleSprmPDxaRight(sal_Char
* sName
) :
464 Ww1SingleSprmPDxa(sName
) {
466 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
469 class Ww1SingleSprmPDxaLeft
: public Ww1SingleSprmPDxa
{
471 Ww1SingleSprmPDxaLeft(sal_Char
* sName
) :
472 Ww1SingleSprmPDxa(sName
) {
474 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
477 class Ww1SingleSprmPDxaLeft1
: public Ww1SingleSprmPDxa
{
479 Ww1SingleSprmPDxaLeft1(sal_Char
* sName
) :
480 Ww1SingleSprmPDxa(sName
) {
482 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
485 class Ww1SingleSprmPFKeep
: public Ww1SingleSprmBool
{
487 Ww1SingleSprmPFKeep(sal_Char
* sName
) :
488 Ww1SingleSprmBool(sName
) {
490 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
491 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
494 class Ww1SingleSprmPFKeepFollow
: public Ww1SingleSprmBool
{
496 Ww1SingleSprmPFKeepFollow(sal_Char
* sName
) :
497 Ww1SingleSprmBool(sName
) {
499 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
500 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
503 class Ww1SingleSprmPPageBreakBefore
: public Ww1SingleSprmBool
{
505 Ww1SingleSprmPPageBreakBefore(sal_Char
* sName
) :
506 Ww1SingleSprmBool(sName
) {
508 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
509 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
512 class Ww1SingleSprmPBrc
: public Ww1SingleSprmWord
{
514 // spezielle start-routine, je nach sprm verschieden versorgt
515 // mit einem BoxItem.
516 void Start(Ww1Shell
&, sal_uInt8
, W1_BRC10
*, sal_uInt16
, Ww1Manager
&, SvxBoxItem
&);
517 void Start(Ww1Shell
&, sal_uInt8
, W1_BRC
*, sal_uInt16
, Ww1Manager
&, SvxBoxItem
&);
519 using Ww1SingleSprm::Start
;
522 Ww1SingleSprmPBrc(sal_Char
* sName
) :
523 Ww1SingleSprmWord(sName
) {
525 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
526 // SetBorder() wird auch fuer Tabellen gebraucht, deshalb public
527 static editeng::SvxBorderLine
* SetBorder(editeng::SvxBorderLine
*, W1_BRC10
*);
530 #define BRC_TOP ((sal_uInt16)0)
531 #define BRC_LEFT ((sal_uInt16)1)
532 #define BRC_BOTTOM ((sal_uInt16)2)
533 #define BRC_RIGHT ((sal_uInt16)3)
534 #define BRC_ANZ ((sal_uInt16)BRC_RIGHT-BRC_TOP+1)
536 // Die BRC-struktur fuer 1.0 versionen von word sind verschieden von
537 // denen der folgenden versionen. diese werden zum glueck aber auch
538 // von anderen sprms abgerufen.
539 // SH: Ab sofort alle 4 Umrandungen ueber nur 1 Klasse.
540 class Ww1SingleSprmPBrc10
: public Ww1SingleSprmPBrc
542 sal_uInt16 nLine
; // BRC_TOP, BRC_LEFT, ...
544 using Ww1SingleSprmPBrc::Start
;
547 Ww1SingleSprmPBrc10(sal_uInt16 nL
, sal_Char
* sName
)
548 : Ww1SingleSprmPBrc(sName
), nLine(nL
) {}
550 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
553 class Ww1SingleSprmParaSpace
: public Ww1SingleSprmWord
{
555 Ww1SingleSprmParaSpace(sal_Char
* sName
)
556 : Ww1SingleSprmWord(sName
) {}
557 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
560 class Ww1SingleSprmPDyaBefore
: public Ww1SingleSprmParaSpace
{
562 Ww1SingleSprmPDyaBefore(sal_Char
* sName
)
563 : Ww1SingleSprmParaSpace(sName
) {}
564 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
567 class Ww1SingleSprmPDyaAfter
: public Ww1SingleSprmParaSpace
{
569 Ww1SingleSprmPDyaAfter(sal_Char
* sName
) :
570 Ww1SingleSprmParaSpace(sName
) {
572 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
575 class Ww1SingleSprmPDyaLine
: public Ww1SingleSprmWord
{
577 Ww1SingleSprmPDyaLine(sal_Char
* sName
) :
578 Ww1SingleSprmWord(sName
) {
580 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
581 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
584 class Ww1SingleSprmPChgTabsPapx
: public Ww1SingleSprmByteSized
{
586 Ww1SingleSprmPChgTabsPapx(sal_Char
* sName
) :
587 Ww1SingleSprmByteSized(0, sName
) {
589 // Size() ist noch nicht aktiviert !!
590 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
591 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
594 class Ww1SingleSprmSGprfIhdt
: public Ww1SingleSprmByte
{
596 Ww1SingleSprmSGprfIhdt(sal_Char
* sName
) :
597 Ww1SingleSprmByte(sName
) {
599 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
602 class Ww1SingleSprmSColumns
: public Ww1SingleSprmWord
{
604 Ww1SingleSprmSColumns(sal_Char
* sName
) :
605 Ww1SingleSprmWord(sName
) {
607 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
610 class Ww1SingleSprmPFInTable
: public Ww1SingleSprmBool
{
612 Ww1SingleSprmPFInTable(sal_Char
* sName
) :
613 Ww1SingleSprmBool(sName
) {
615 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
616 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
619 class Ww1SingleSprmPTtp
: public Ww1SingleSprmBool
{
621 Ww1SingleSprmPTtp(sal_Char
* sName
) :
622 Ww1SingleSprmBool(sName
) {
624 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
625 void Stop(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
628 class Ww1SingleSprmTJc
: public Ww1SingleSprmWord
{
630 Ww1SingleSprmTJc(sal_Char
* sName
)
631 : Ww1SingleSprmWord(sName
) {}
634 class Ww1SingleSprmTDxaGapHalf
: public Ww1SingleSprmWord
{
636 Ww1SingleSprmTDxaGapHalf(sal_Char
* sName
) :
637 Ww1SingleSprmWord(sName
) {
639 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
642 class Ww1SingleSprmTDefTable10
: public Ww1SingleSprmWordSized
{
644 Ww1SingleSprmTDefTable10(sal_Char
* sName
) :
645 Ww1SingleSprmWordSized(0, sName
) {
647 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
650 class Ww1SingleSprmTDyaRowHeight
: public Ww1SingleSprmWord
{
652 Ww1SingleSprmTDyaRowHeight(sal_Char
* sName
) :
653 Ww1SingleSprmWord(sName
) {
655 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
658 // Klassendefinitionen fuer Tabellen-Fastsave-Attribute
659 // Da wir kein Fastsave unterstuetzen, brauchen wir's nicht
661 // Klassendefinitionen fuer Apos ( == Flys )
663 class Ww1SingleSprmPpc
: public Ww1SingleSprmByte
{
665 Ww1SingleSprmPpc(sal_Char
* sName
) :
666 Ww1SingleSprmByte(sName
) {
668 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
671 class Ww1SingleSprmPDxaAbs
: public Ww1SingleSprmWord
{
673 Ww1SingleSprmPDxaAbs(sal_Char
* sName
) :
674 Ww1SingleSprmWord(sName
) {
676 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
679 class Ww1SingleSprmPDyaAbs
: public Ww1SingleSprmWord
{
681 Ww1SingleSprmPDyaAbs(sal_Char
* sName
) :
682 Ww1SingleSprmWord(sName
) {
684 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
687 class Ww1SingleSprmPDxaWidth
: public Ww1SingleSprmWord
{
689 Ww1SingleSprmPDxaWidth(sal_Char
* sName
) :
690 Ww1SingleSprmWord(sName
) {
692 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
695 class Ww1SingleSprmPFromText
: public Ww1SingleSprmWord
{
697 Ww1SingleSprmPFromText(sal_Char
* sName
) :
698 Ww1SingleSprmWord(sName
) {
700 void Start(Ww1Shell
&, sal_uInt8
, sal_uInt8
*, sal_uInt16
, Ww1Manager
&);
703 ////////////////////////////////////////////////////////////////// Sprm
705 // der tatsaechlich in der datei auftretende datentyp Sprm
710 static Ww1SingleSprm
* aTab
[256];
711 static Ww1SingleSprm
* pSingleSprm
;
713 static void InitTab();
714 Ww1SingleSprm
& GetTab(sal_uInt16 nId
)
718 return aTab
[ nId
] ? *aTab
[nId
] : *pSingleSprm
;
722 sal_uInt16 nCountBytes
;
726 // ohne Token, mit laengen-byte/word
727 sal_uInt16
GetSize(sal_uInt8 nId
, sal_uInt8
* pSprm
);
728 // mit Token und LaengenByte
729 sal_uInt16
GetSizeBrutto(sal_uInt8
* pSprm
) {
730 sal_uInt8 nId
= *pSprm
++;
731 return GetSize(nId
, pSprm
) + 1; }
732 // gibt fuer nTh element id, size & zeiger auf daten:
733 // sal_Bool Fill(sal_uInt16, sal_uInt8&, sal_uInt16&, sal_uInt8*&);
735 // SH: brauche ich public
736 // gibt fuer nTh element id, size & zeiger auf daten:
737 sal_Bool
Fill(sal_uInt16
, sal_uInt8
&, sal_uInt16
&, sal_uInt8
*&);
739 Ww1Sprm(sal_uInt8
*, sal_uInt16
);
740 Ww1Sprm(SvStream
&, sal_uLong
);
742 friend std::ostream
& operator <<(std::ostream
&, Ww1Sprm
&);
743 void Start(Ww1Shell
&, Ww1Manager
&);
744 void Start(Ww1Shell
&, Ww1Manager
&, sal_uInt16
);
745 void Stop(Ww1Shell
&, Ww1Manager
&);
747 return nCountBytes
!= 255; }
750 sal_Bool
GetError() {
752 static void DeinitTab();
755 /////////////////////////////////////////////////////////////// Picture
757 // der wrapper um den datentyp PIC, eine struktur, die am beginn eines
758 // bild-dateinamens oder eines eingebetteten bildes steht.
765 Ww1Picture(SvStream
&, sal_uLong
);
768 sal_Bool
GetError() {
770 friend std::ostream
& operator <<(std::ostream
&, Ww1Picture
&);
771 void Out(Ww1Shell
&, Ww1Manager
&);
772 void WriteBmp(SvStream
&);
775 /////////////////////////////////////////////////////////////////// Plc
777 // eine der wichtigen array-strukturen der ww-dateien. sie beinhalten
778 // n+1 dateipositionen und n attribute, die zwischen den
779 // dateipositionen gelten.
784 sal_uInt16 nCountBytes
;
786 sal_uInt16 nItemSize
;
790 sal_uInt8
* GetData(sal_uInt16
);
792 Ww1Plc(Ww1Fib
&, sal_uLong
, sal_uInt16
, sal_uInt16
);
794 friend std::ostream
& operator <<(std::ostream
&, Ww1Plc
&);
795 sal_uLong
Where(sal_uInt16
); // wie im jeweiligen plc
796 void Seek(sal_uLong
, sal_uInt16
&);
797 void Fill(sal_uInt16 nIndex
, sal_uLong
& begin
, sal_uLong
& end
) {
798 begin
= Where(nIndex
);
799 end
= Where(nIndex
+1); }
802 sal_Bool
GetError() {
806 // Size Tabs from Sven:
807 // CHP, PAP, SEP, HED, FNR, FNT
808 //Plc 2, 2, 6, 0, 2, 0
809 //Fkp 1, 1, 0, 0, 0, 0
811 /////////////////////////////////////////////////////////// PlcGlossary
812 class Ww1PlcGlossary
: public Ww1Plc
815 Ww1PlcGlossary(Ww1Fib
& rFibL
) :
816 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfglsyGet(),
817 rFibL
.GetFIB().cbPlcfglsyGet(), 0) {
821 ////////////////////////////////////////////////////// PlcAnnotationRef
822 class Ww1PlcAnnotationRef
: public Ww1Plc
825 Ww1PlcAnnotationRef(Ww1Fib
& rFibL
) :
826 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfandRefGet(),
827 rFibL
.GetFIB().cbPlcfandRefGet(), 0) {
831 ////////////////////////////////////////////////////// PlcAnnotationTxt
832 class Ww1PlcAnnotationTxt
: public Ww1Plc
835 Ww1PlcAnnotationTxt(Ww1Fib
& rFibL
) :
836 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfandTxtGet(),
837 rFibL
.GetFIB().cbPlcfandTxtGet(), 0) {
841 ///////////////////////////////////////////////////////// PlcAnnotation
842 class Ww1Annotation
{
843 Ww1PlcAnnotationRef aRef
;
844 Ww1PlcAnnotationTxt aTxt
;
846 Ww1Annotation(Ww1Fib
& rFib
) :
850 friend std::ostream
& operator <<(std::ostream
&, Ww1Annotation
&);
853 //////////////////////////////////////////////////////////////// PlcSep
854 class Ww1PlcSep
: public Ww1Plc
857 Ww1PlcSep(Ww1Fib
& rFibL
):
858 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfsedGet(),
859 rFibL
.GetFIB().cbPlcfsedGet(), 6) {
861 friend std::ostream
& operator <<(std::ostream
&, Ww1PlcSep
&);
864 //////////////////////////////////////////////////////////////// PlcChp
865 class Ww1PlcChp
: public Ww1Plc
868 Ww1PlcChp(Ww1Fib
& rFibL
) :
869 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfbteChpxGet(),
870 rFibL
.GetFIB().cbPlcfbteChpxGet(), 2) {
872 friend std::ostream
& operator <<(std::ostream
&, Ww1PlcChp
&);
875 //////////////////////////////////////////////////////////////// PlcPap
876 class Ww1PlcPap
: public Ww1Plc
879 Ww1PlcPap(Ww1Fib
& rFibL
) :
880 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfbtePapxGet(),
881 rFibL
.GetFIB().cbPlcfbtePapxGet(), 2) {
883 friend std::ostream
& operator <<(std::ostream
&, Ww1PlcPap
&);
886 //////////////////////////////////////////////////////// PlcFootnoteRef
887 class Ww1PlcFootnoteRef
: public Ww1Plc
890 Ww1PlcFootnoteRef(Ww1Fib
& rFibL
) :
891 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcffndRefGet(),
892 rFibL
.GetFIB().cbPlcffndRefGet(), 2) {
894 friend std::ostream
& operator <<(std::ostream
&, Ww1PlcFootnoteRef
&);
897 //////////////////////////////////////////////////////// PlcFootnoteTxt
898 class Ww1PlcFootnoteTxt
: public Ww1Plc
901 Ww1PlcFootnoteTxt(Ww1Fib
& rFibL
) :
902 Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcffndTxtGet(),
903 rFibL
.GetFIB().cbPlcffndTxtGet(), 0) {
905 friend std::ostream
& operator <<(std::ostream
&, Ww1PlcFootnoteTxt
&);
908 ///////////////////////////////////////////////////////////// PlcFields
909 class Ww1PlcFields
: public Ww1Plc
912 Ww1PlcFields(Ww1Fib
& rFibL
, sal_uLong start
, sal_uInt16 nBytes
)
913 : Ww1Plc(rFibL
, start
, nBytes
, 2)
915 W1_FLD
* GetData(sal_uInt16 nIndex
)
916 { return (W1_FLD
*)Ww1Plc::GetData(nIndex
); }
917 sal_uLong
Where(sal_uInt16 nIndex
) // absolut im file
918 { return Ww1Plc::Where(nIndex
) + rFib
.GetFIB().fcMinGet(); }
919 friend std::ostream
& operator <<(std::ostream
&, Ww1PlcFields
&);
922 ///////////////////////////////////////////////////////////// PlcBookmarks
928 Ww1StringList( SvStream
& rSt
, sal_uLong nFc
, sal_uInt16 nCb
);
930 { if( pIdxA
) { delete pIdxA
[0]; delete pIdxA
; } }
931 const String
GetStr( sal_uInt16 nNum
) const;
932 sal_uInt16
Count() const { return nMax
; }
933 sal_Bool
GetError() const { return (nMax
!= 0) && !pIdxA
; }
936 class Ww1PlcBookmarkTxt
: public Ww1StringList
939 Ww1PlcBookmarkTxt(Ww1Fib
& rFib
) :
940 Ww1StringList( rFib
.GetStream(), rFib
.GetFIB().fcSttbfbkmkGet(),
941 rFib
.GetFIB().cbSttbfbkmkGet() )
945 class Ww1PlcBookmarkPos
: public Ww1Plc
948 Ww1PlcBookmarkPos(Ww1Fib
& _rFib
, sal_uLong start
, sal_uInt16 nBytes
, sal_Bool bEnd
)
949 : Ww1Plc(_rFib
, start
, nBytes
, (bEnd
) ? 0 : 2)
952 sal_uInt8
* GetData(sal_uInt16 nIndex
) { return Ww1Plc::GetData(nIndex
); }
954 sal_uLong
WhereCP(sal_uInt16 nIndex
) { return Ww1Plc::Where(nIndex
); }
956 sal_uLong
Where(sal_uInt16 nIndex
)
958 return ( nIndex
< Count() )
959 ? Ww1Plc::Where(nIndex
) + rFib
.GetFIB().fcMinGet()
964 //////////////////////////////////////////////////////////////// PlcHdd
965 class Ww1PlcHdd
: public Ww1Plc
968 Ww1PlcHdd(Ww1Fib
& rFibL
)
969 : Ww1Plc(rFibL
, rFibL
.GetFIB().fcPlcfhddGet(),
970 rFibL
.GetFIB().cbPlcfhddGet(), 0)
974 /////////////////////////////////////////////////////////////////// Fkp
976 // aehnlich den plcs aufgebaute arrays, die sich auf eine groesze von
977 // 512 byte beschraenken.
983 sal_uInt16 nItemSize
;
985 sal_uInt8
* GetData(sal_uInt16
);
987 Ww1Fkp(SvStream
&, sal_uLong
, sal_uInt16
);
988 friend std::ostream
& operator <<(std::ostream
&, Ww1Fkp
&);
989 sal_uInt16
Count() const { return SVBT8ToByte(aFkp
+511); }
990 sal_uLong
Where(sal_uInt16
); // wie im entsprechenden fkp
993 //////////////////////////////////////////////////////////////// FkpPap
994 class Ww1FkpPap
: public Ww1Fkp
997 Ww1FkpPap(SvStream
& rStream
, sal_uLong ulFilePos
)
998 : Ww1Fkp(rStream
, ulFilePos
, 1)
1000 friend std::ostream
& operator <<(std::ostream
&, Ww1FkpPap
&);
1001 sal_Bool
Fill(sal_uInt16
, sal_uInt8
*&, sal_uInt16
&);
1004 //////////////////////////////////////////////////////////////// FkpChp
1005 class Ww1FkpChp
: public Ww1Fkp
1009 SvStream
& GetStream() { return rStream
; }
1012 Ww1FkpChp(SvStream
& rStream
, sal_uLong ulFilePos
)
1013 : Ww1Fkp(rStream
, ulFilePos
, 1)
1019 friend std::ostream
& operator <<(std::ostream
&, Ww1FkpChp
&);
1020 sal_Bool
Fill(sal_uInt16
, W1_CHP
&);
1023 ////////////////////////////////////////////////////////////// SprmPapx
1024 class Ww1SprmPapx
: public Ww1Sprm
1027 sal_uInt8
* Sprm(sal_uInt8
* p
, sal_uInt16 nSize
);
1028 sal_uInt16
SprmSize(sal_uInt8
* p
, sal_uInt16 nSize
);
1030 Ww1SprmPapx(sal_uInt8
* p
, sal_uInt16 nSize
);
1031 friend std::ostream
& operator <<(std::ostream
&, Ww1SprmPapx
&);
1032 void Start(Ww1Shell
&, Ww1Manager
&);
1033 void Stop(Ww1Shell
&, Ww1Manager
&);
1036 /////////////////////////////////////////////////////////////// SprmSep
1037 class Ww1SprmSep
: public Ww1Sprm
1040 Ww1SprmSep(Ww1Fib
& rFib
, sal_uLong ulFilePos
)
1041 : Ww1Sprm(rFib
.GetStream(), ulFilePos
)
1043 friend std::ostream
& operator <<(std::ostream
&, Ww1SprmSep
&);
1046 ///////////////////////////////////////////////////////////////// Assoc
1049 enum fields
{ FileNext
, Dot
, Title
, Subject
, KeyWords
, Comments
,
1050 Author
, LastRevBy
, DataDoc
, HeaderDoc
, Criteria1
, Criteria2
,
1051 Criteria3
, Criteria4
, Criteria5
, Criteria6
, Criteria7
, MaxFields
};
1055 sal_Char
* pStrTbl
[ MaxFields
];
1058 String
GetStr(sal_uInt16
);
1062 ~Ww1Assoc() { delete pBuffer
; }
1063 sal_Bool
GetError() const { return !bOK
; }
1064 friend std::ostream
& operator <<(std::ostream
&, Ww1Assoc
&);
1065 void Out(Ww1Shell
&);
1068 ////////////////////////////////////////////////////////// HeaderFooter
1070 // Header/Footer/Footnoteseparators sind einer nach dem naechsten in
1071 // einem eigenen text gespeichert. ein plc trennt diesen text in
1072 // einzelne teile. diese werden durchnummeriert als ihdd. nun gibt es
1073 // 9 verschiedene funktionen fuer diese texte. wird eine davon
1074 // angefordert, ist es der erste, beim naechstern der 2 ihdd und so
1075 // weiter. welcher textteil also welcher typ sein wird laeszt sich
1076 // nur bei sequenziellem lesen der datei bestimmen. die 9 typen sind:
1077 // fusznoten-trenner, folge-fusznoten-trenner, folge-fusznoten-notiz,
1078 // gerade-seiten kopfzeilen, ungerade seiten kopfzeilen, dto 2*
1079 // fuszzeilen, kopf & fuszzeilen, wenn erste seite andere zeilen hat.
1080 // HeaderFooter merkt sich fuer jede der 9 die momentane einstellung
1081 // (jedoch nicht die alten) und den naechstvergebbaren ihdd. ist ein
1082 // teil nicht vorhanden bekommt er den wert 0xffff.
1084 class Ww1HeaderFooter
: public Ww1PlcHdd
1086 sal_uInt16 nextIhdd
; // naechster textteil im HddText
1087 sal_uInt16 nFtnSep
; // fusznoten trenner
1088 sal_uInt16 nFtnFollowSep
; // folge fusznoten trenner
1089 sal_uInt16 nFtnNote
; // folgefunsznotennotiz
1090 sal_uInt16 nEvenHeadL
; // kopfzeilen grader seiten
1091 sal_uInt16 nOddHeadL
; // kopfzeilen ungrader seiten
1092 sal_uInt16 nEvenFootL
; // fuszzeilen grader seiten
1093 sal_uInt16 nOddFootL
; // fuszzeilen ungerader seiten
1094 sal_uInt16 nFirstHeadL
; // kopfzeilen der ersten seite
1095 sal_uInt16 nFirstFootL
; // fuszzeilen der ersten seite
1096 enum HeaderFooterMode
{
1097 None
, FtnSep
, FtnFollowSep
, FtnNote
, EvenHeadL
, OddHeadL
,
1098 EvenFootL
, OddFootL
, FirstHeadL
, MaxHeaderFooterMode
1099 } eHeaderFooterMode
;
1102 Ww1HeaderFooter(Ww1Fib
& rFibL
, sal_uInt16 grpfIhdt
)
1106 nFtnFollowSep(0xffff),
1112 nFirstHeadL(0xffff),
1113 nFirstFootL(0xffff),
1114 eHeaderFooterMode(None
)
1116 if (grpfIhdt
& 0x0001) nFtnSep
= nextIhdd
++;
1117 if (grpfIhdt
& 0x0002) nFtnFollowSep
= nextIhdd
++;
1118 if (grpfIhdt
& 0x0004) nFtnNote
= nextIhdd
++;
1120 void SetGrpfIhdt(sal_uInt16 grpfIhdt
)
1122 if (grpfIhdt
& 0x0001) nEvenHeadL
= nextIhdd
++;
1123 if (grpfIhdt
& 0x0002) nOddHeadL
= nextIhdd
++;
1124 if (grpfIhdt
& 0x0004) nEvenFootL
= nextIhdd
++;
1125 if (grpfIhdt
& 0x0008) nOddFootL
= nextIhdd
++;
1126 if (grpfIhdt
& 0x0010) nFirstHeadL
= nextIhdd
++;
1127 if (grpfIhdt
& 0x0020) nFirstFootL
= nextIhdd
++;
1128 OSL_ENSURE(nextIhdd
<=Count(), "Ww1HeaderFooter");
1130 sal_Bool
operator++()
1132 sal_Bool bRet
= sal_True
;
1133 eHeaderFooterMode
= (HeaderFooterMode
)((short)eHeaderFooterMode
+ 1);
1134 if( eHeaderFooterMode
== MaxHeaderFooterMode
)
1136 eHeaderFooterMode
= None
;
1141 sal_Bool
FillFtnSep(sal_uLong
& begin
, sal_uLong
& end
)
1143 if (nFtnSep
== 0xffff)
1145 Fill(nFtnSep
, begin
, end
);
1148 sal_Bool
FillFtnFollowSep(sal_uLong
& begin
, sal_uLong
& end
)
1150 if (nFtnFollowSep
== 0xffff)
1152 Fill(nFtnFollowSep
, begin
, end
);
1155 sal_Bool
FillFtnNote(sal_uLong
& begin
, sal_uLong
& end
)
1157 if (nFtnNote
== 0xffff)
1159 Fill(nFtnNote
, begin
, end
);
1162 sal_Bool
FillEvenHeadL(sal_uLong
& begin
, sal_uLong
& end
)
1164 if (nEvenHeadL
== 0xffff)
1166 Fill(nEvenHeadL
, begin
, end
);
1169 sal_Bool
FillOddHeadL(sal_uLong
& begin
, sal_uLong
& end
)
1171 if (nOddHeadL
== 0xffff)
1173 Fill(nOddHeadL
, begin
, end
);
1176 sal_Bool
FillEvenFootL(sal_uLong
& begin
, sal_uLong
& end
)
1178 if (nEvenFootL
== 0xffff)
1180 Fill(nEvenFootL
, begin
, end
);
1183 sal_Bool
FillOddFootL(sal_uLong
& begin
, sal_uLong
& end
)
1185 if (nOddFootL
== 0xffff)
1187 Fill(nOddFootL
, begin
, end
);
1190 sal_Bool
FillFirstHeadL(sal_uLong
& begin
, sal_uLong
& end
)
1192 if (nFirstHeadL
== 0xffff)
1194 Fill(nFirstHeadL
, begin
, end
);
1197 sal_Bool
FillFirstFootL(sal_uLong
& begin
, sal_uLong
& end
)
1199 if (nFirstFootL
== 0xffff)
1201 Fill(nFirstFootL
, begin
, end
);
1204 void Start(Ww1Shell
&, Ww1Manager
&);
1205 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1208 //////////////////////////////////////////////////////////////// Fields
1209 class Ww1Fields
: public Ww1PlcFields
1211 sal_uInt16 nPlcIndex
;
1212 String sErgebnis
; // das von word errechnete ergebniss
1214 sal_uLong
Where(sal_uInt16 nIndex
) // innerhalb des textes
1215 { return Ww1PlcFields::Where(nIndex
) - rFib
.GetFIB().fcMinGet(); }
1218 Ww1Fields(Ww1Fib
& rFibL
, sal_uLong ulFilePos
, sal_uInt16 nBytes
)
1219 : Ww1PlcFields(rFibL
, ulFilePos
, nBytes
), nPlcIndex(0), pField(0)
1221 // innerhalb des textes
1222 sal_uLong
Where() { return Where(nPlcIndex
); }
1225 OSL_ENSURE(nPlcIndex
+1 <= Count(), "Ww1Fields");
1228 void Seek(sal_uLong ulNew
) { Ww1PlcFields::Seek(ulNew
, nPlcIndex
); }
1231 OSL_ENSURE(nPlcIndex
< Count(), "Ww1Fields");
1232 return Ww1PlcFields::GetData(nPlcIndex
);
1234 sal_uLong
GetLength();
1235 friend std::ostream
& operator <<(std::ostream
&, Ww1Manager
&);
1236 void Start(Ww1Shell
&, Ww1Manager
&);
1237 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1238 void Out(Ww1Shell
&, Ww1Manager
&, sal_uInt16
=0);
1241 class Ww1TextFields
: public Ww1Fields
1244 Ww1TextFields(Ww1Fib
& rFibL
)
1245 : Ww1Fields(rFibL
, rFibL
.GetFIB().fcPlcffldMomGet(),
1246 rFibL
.GetFIB().cbPlcffldMomGet())
1250 class Ww1FootnoteFields
: public Ww1Fields
1253 Ww1FootnoteFields(Ww1Fib
& rFibL
)
1254 : Ww1Fields(rFibL
, rFibL
.GetFIB().fcPlcffldFtnGet(),
1255 rFibL
.GetFIB().cbPlcffldFtnGet())
1259 class Ww1HeaderFooterFields
: public Ww1Fields
1262 Ww1HeaderFooterFields(Ww1Fib
& rFibL
)
1263 : Ww1Fields(rFibL
, rFibL
.GetFIB().fcPlcffldHdrGet(),
1264 rFibL
.GetFIB().cbPlcffldHdrGet())
1268 class Ww1MacroFields
: public Ww1Fields
1271 Ww1MacroFields(Ww1Fib
& rFibL
)
1272 : Ww1Fields(rFibL
, rFibL
.GetFIB().fcPlcffldMcrGet(),
1273 rFibL
.GetFIB().cbPlcffldMcrGet())
1277 //////////////////////////////////////////////////////////////// Bookmarks
1280 Ww1PlcBookmarkTxt aNames
;
1281 Ww1PlcBookmarkPos
* pPos
[2];
1284 sal_uInt16 nPlcIdx
[2];
1288 Ww1Bookmarks(Ww1Fib
& rFib
);
1294 sal_uLong
Where() const { return pPos
[nIsEnd
]->WhereCP(nPlcIdx
[nIsEnd
]); }
1296 sal_Bool
GetError() const { return !bOK
; }
1297 long GetHandle() const;
1298 sal_Bool
GetIsEnd() const { return ( nIsEnd
) ? sal_True
: sal_False
; }
1299 const String
GetName() const;
1301 friend std::ostream
& operator <<(std::ostream
&, Ww1Bookmarks
&);
1302 void Start(Ww1Shell
&, Ww1Manager
&);
1303 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1304 void Out(Ww1Shell
&, Ww1Manager
&, sal_uInt16
=0);
1307 ///////////////////////////////////////////////////////////// Footnotes
1308 class Ww1Footnotes
: public Ww1PlcFootnoteRef
1310 sal_uInt16 nPlcIndex
;
1311 Ww1PlcFootnoteTxt aText
;
1314 Ww1Footnotes(Ww1Fib
& rFibL
)
1315 : Ww1PlcFootnoteRef(rFibL
), nPlcIndex(0), aText(rFibL
), bStarted(sal_False
)
1317 // innerhalb des textes
1320 sal_uLong ulRet
= 0xffffffff;
1322 ulRet
= Ww1PlcFootnoteRef::Where(nPlcIndex
);
1327 OSL_ENSURE(nPlcIndex
+1 <= Count(), "Ww1Footnotes");
1330 void Start(Ww1Shell
&, Ww1Manager
&);
1331 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1334 /////////////////////////////////////////////////////////////////// Sep
1335 class Ww1Sep
: public Ww1PlcSep
1337 Ww1HeaderFooter aHdd
;
1338 sal_uInt16 nPlcIndex
;
1340 Ww1Sep(Ww1Fib
& rFibL
, sal_uInt16 grpfIhdt
)
1341 : Ww1PlcSep(rFibL
), aHdd(rFibL
, grpfIhdt
), nPlcIndex(0) {}
1343 Ww1HeaderFooter
& GetHdd() { return aHdd
; }
1344 void operator++() { nPlcIndex
++; }
1345 sal_uInt8
* GetData() { return Ww1PlcSep::GetData(nPlcIndex
); }
1346 // innerhalb des textes
1347 sal_uLong
Where() { return Ww1PlcSep::Where(nPlcIndex
); }
1348 void SetGrpfIhdt(sal_uInt8 grpfIhdt
)
1350 GetHdd().SetGrpfIhdt(grpfIhdt
);
1352 void Start(Ww1Shell
&, Ww1Manager
&);
1353 void Stop(Ww1Shell
& rOut
, Ww1Manager
& rMan
, sal_Unicode
& c
)
1354 { aHdd
.Stop(rOut
, rMan
, c
); }
1357 /////////////////////////////////////////////////////////////////// Pap
1358 class Ww1Pap
: public Ww1PlcPap
1360 sal_uInt16 nPlcIndex
;
1361 sal_uInt16 nPushedPlcIndex
;
1362 sal_uInt16 nFkpIndex
;
1363 sal_uInt16 nPushedFkpIndex
;
1367 sal_Bool
FindSprm(sal_uInt16 nId
, sal_uInt8
* pStart
, sal_uInt8
* pEnd
);
1370 if (pPap
&& nFkpIndex
>= pPap
->Count() )
1379 sal_Bool
HasId0(sal_uInt16 nId
);
1382 Ww1Pap(Ww1Fib
& rFib
);
1383 ~Ww1Pap() { delete pPap
; }
1384 sal_uLong
Where( sal_Bool bSetIndex
= sal_True
); // innerhalb des textes
1386 sal_Bool
FillStart(sal_uInt8
*& pB
, sal_uInt16
& nSize
)
1389 return pPap
->Fill(nFkpIndex
, pB
, nSize
);
1391 sal_Bool
FillStop(sal_uInt8
*& pB
, sal_uInt16
& nSize
)
1393 return nFkpIndex
? pPap
->Fill(nFkpIndex
-1, pB
, nSize
) : sal_False
;
1395 void Start(Ww1Shell
&, Ww1Manager
&);
1396 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1397 void Seek(sal_uLong
);
1398 void Push(sal_uLong ulOffsetTmp
= 0)
1400 OSL_ENSURE(!Pushed(), "Ww1Pap");
1401 nPushedPlcIndex
= nPlcIndex
;
1402 nPushedFkpIndex
= nFkpIndex
;
1404 ulOffset
= ulOffsetTmp
;
1410 return nPushedPlcIndex
!= 0xffff;
1414 OSL_ENSURE(Pushed(), "Ww1Pap");
1416 nPlcIndex
= nPushedPlcIndex
;
1417 nFkpIndex
= nPushedFkpIndex
;
1418 nPushedPlcIndex
= 0xffff;
1419 nPushedFkpIndex
= 0xffff;
1424 sal_Bool
HasId(sal_uInt16 nId
);
1427 /////////////////////////////////////////////////////////////////// Chp
1428 class Ww1Chp
: public Ww1PlcChp
1430 sal_uInt16 nPlcIndex
;
1431 sal_uInt16 nPushedPlcIndex
;
1432 sal_uInt16 nFkpIndex
;
1433 sal_uInt16 nPushedFkpIndex
;
1438 if (pChp
&& nFkpIndex
>= pChp
->Count() )
1449 Ww1Chp( Ww1Fib
& rFib
);
1450 ~Ww1Chp() { delete pChp
; }
1451 sal_uLong
Where( sal_Bool bSetIndex
= sal_True
); // innerhalb des textes
1453 sal_Bool
FillStart(W1_CHP
& rChp
)
1456 return pChp
->Fill(nFkpIndex
, rChp
);
1458 sal_Bool
FillStop(W1_CHP
& rChp
)
1459 { return nFkpIndex
? pChp
->Fill(nFkpIndex
-1, rChp
) : sal_False
; }
1460 void Start(Ww1Shell
&, Ww1Manager
&);
1461 void Stop(Ww1Shell
&, Ww1Manager
&, sal_Unicode
&);
1462 void Seek(sal_uLong
);
1463 void Push(sal_uLong ulOffsetTmp
= 0)
1465 OSL_ENSURE(!Pushed(), "Ww1Chp");
1466 nPushedPlcIndex
= nPlcIndex
;
1467 nPushedFkpIndex
= nFkpIndex
;
1469 ulOffset
= ulOffsetTmp
;
1473 sal_Bool
Pushed() { return nPushedPlcIndex
!= 0xffff; }
1476 OSL_ENSURE(Pushed(), "Ww1Chp");
1478 nPlcIndex
= nPushedPlcIndex
;
1479 nFkpIndex
= nPushedFkpIndex
;
1480 nPushedPlcIndex
= 0xffff;
1481 nPushedFkpIndex
= 0xffff;
1488 /////////////////////////////////////////////////////////////// Manager
1490 // zentraler aufhaenger der ww-seite des filters, konstruiert aus dem
1491 // inputstream (ww-datei) enthaelt er alles, was noetig ist, um in die
1492 // shell (pm-seite) gepiped zu werden.
1503 // ab jetzt alles paarig, fuer 'pushed':
1506 sal_uLong ulDocSeek
;
1510 // selbst 'push'bar:
1513 // nicht in textbereichen vorhanden, wenn ge'pushed'
1515 Ww1Bookmarks aBooks
;
1518 void OutStop( Ww1Shell
&, sal_Unicode
);
1519 void OutStart( Ww1Shell
& );
1520 void Out(Ww1Shell
&, sal_Unicode
);
1523 Ww1Manager(SvStream
& rStrm
, sal_uLong nFieldFlgs
);
1524 sal_Bool
GetError() const { return !bOK
; }
1527 void SetInTtp(bool bSet
= true) { bInTtp
= bSet
; }
1528 bool IsInTtp() const { return bInTtp
; }
1529 void SetInStyle(bool bSet
= true) { bInStyle
= bSet
; }
1530 bool IsInStyle() const { return bInStyle
; }
1531 void SetStopAll(bool bSet
= true) { bStopAll
= bSet
; }
1532 bool IsStopAll() const { return bStopAll
; }
1533 sal_Bool
HasInTable();
1535 sal_Bool
LastHasTtp();
1539 sal_Bool
HasPDxaAbs();
1541 Ww1Fib
& GetFib() { return aFib
; }
1542 Ww1PlainText
& GetText() { return *pDoc
; }
1543 Ww1Dop
& GetDop() { return aDop
; }
1544 Ww1Sep
& GetSep() { return aSep
; }
1545 // innerhalb des textes
1546 sal_uLong
Where() { return pDoc
->Where(); }
1547 void Fill( sal_Unicode
& rChr
) { pDoc
->Out( rChr
); }
1548 sal_uInt8
Fill( String
& rStr
, sal_uLong ulLen
)
1550 ulLen
+= pDoc
->Where();
1551 return sal::static_int_cast
< sal_uInt8
>(pDoc
->Out(rStr
, ulLen
));
1553 SvxFontItem
GetFont(sal_uInt16 nFCode
);
1554 friend Ww1Shell
& operator <<(Ww1Shell
&, Ww1Manager
&);
1555 friend std::ostream
& operator <<(std::ostream
&, Ww1Manager
&);
1556 sal_Bool
Pushed() { return pDoc
!= &aDoc
; }
1558 void Push0(Ww1PlainText
* pDoc
, sal_uLong
, Ww1Fields
* = 0);
1559 void Push1(Ww1PlainText
* pDoc
, sal_uLong ulSeek
, sal_uLong ulSeek2
= 0,
1563 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */