LCOV - code coverage report
Current view: top level - libreoffice/sw/source/filter/ww1 - w1class.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 446 0.0 %
Date: 2012-12-27 Functions: 0 233 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10