LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/filter/ww1 - w1class.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 444 0.0 %
Date: 2013-07-09 Functions: 0 229 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             : namespace editeng { class SvxBorderLine; }
      31             : 
      32             : class SvxFontItem;
      33             : class SvxBoxItem;
      34             : class SvStream;
      35             : class SwField;
      36             : class Ww1Annotation;
      37             : class Ww1AtnText;
      38             : class Ww1Chp;
      39             : class Ww1DocText;
      40             : class Ww1Dop;
      41             : class Ww1Fib;
      42             : class Ww1Fkp;
      43             : class Ww1FkpChp;
      44             : class Ww1FkpPap;
      45             : class Ww1Fonts;
      46             : class Ww1Manager;
      47             : class Ww1McrText;
      48             : class Ww1Pap;
      49             : class Ww1PlainText;
      50             : class Ww1Plc;
      51             : class Ww1PlcAnnotationRef;
      52             : class Ww1PlcAnnotationTxt;
      53             : class Ww1PlcChp;
      54             : class Ww1PlcFields;
      55             : class Ww1PlcFootnoteRef;
      56             : class Ww1PlcFootnoteTxt;
      57             : class Ww1PlcGlossary;
      58             : class Ww1PlcHdd;
      59             : class Ww1PlcPap;
      60             : class Ww1PlcSep;
      61             : class Ww1Shell;
      62             : class Ww1Sprm;
      63             : class Ww1SprmPapx;
      64             : class Ww1SprmSep;
      65             : class Ww1Style;
      66             : class Ww1StyleSheet;
      67             : 
      68             : ///////////////////////////////////////////////////////////////////////
      69             : //
      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
      82             : // enthaelt.
      83             : // Fill() fuellt uebergebene referenzen mit daten aus den
      84             : // word-strukturen.
      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
      89             : //
      90             : 
      91             : /////////////////////////////////////////////////////////////////// Fib
      92             : //
      93             : // file information block: wurzel des uebels: steht am beginn der
      94             : // datei (seek(0)) und enthaelt alle positionen der strukturen der
      95             : // datei
      96             : //
      97             : class Ww1Fib
      98             : {
      99             :     W1_FIB aFib;
     100             :     sal_Bool bOK;
     101             :     SvStream& rStream;
     102             : public:
     103             :     Ww1Fib(SvStream&);
     104             :     friend std::ostream& operator <<(std::ostream&, Ww1Fib&);
     105           0 :     W1_FIB& GetFIB()        { return aFib; }
     106           0 :     sal_Bool GetError()         { return !bOK; }
     107           0 :     SvStream& GetStream()   { return rStream; }
     108             : };
     109             : 
     110             : /////////////////////////////////////////////////////////////////// Dop
     111             : //
     112             : // document property: eigenschaften des gesamten dokuments
     113             : //
     114             : class Ww1Dop
     115             : {
     116             :     W1_DOP aDop;
     117             :     Ww1Fib& rFib;
     118             :     sal_Bool bOK;
     119             : public:
     120             :     Ww1Dop(Ww1Fib&);
     121             :     sal_Bool GetError() {
     122             :         return !bOK; }
     123           0 :     W1_DOP& GetDOP() {
     124           0 :         return aDop; }
     125             :     friend std::ostream& operator <<(std::ostream&, Ww1Dop&);
     126             :     void Out(Ww1Shell&);
     127             : };
     128             : 
     129             : ///////////////////////////////////////////////////////////// PlainText
     130             : //
     131             : // ww-dateien koennen mehrere textbloecke enthalten (main-text,
     132             : // fusznoten etc). PlainText vereinigt die gemeinsamkeiten
     133             : //
     134             : class Ww1PlainText
     135             : {
     136             : protected:
     137             :     Ww1Fib& rFib;
     138             :     sal_uLong ulFilePos;
     139             :     sal_uLong ulCountBytes;
     140             :     sal_uLong ulSeek;
     141             :     sal_Bool bOK;
     142             : public:
     143             :     Ww1PlainText(Ww1Fib& rWwFib, sal_uLong nFilePos, sal_uLong nCountBytes);
     144             :     // innerhalb des textes
     145           0 :     sal_uLong Where() const                 { return ulSeek; }
     146           0 :     void Seek( sal_uLong ulNew )
     147             :         {
     148             :             OSL_ENSURE(ulNew < ulCountBytes, "Ww1PlainText");
     149           0 :             if (ulNew < ulCountBytes)
     150           0 :                 ulSeek = ulNew;
     151           0 :         }
     152             : 
     153           0 :     sal_uLong Count() const                 { return ulCountBytes; }
     154           0 :     void SetCount(sal_uLong ulNew)
     155             :         {
     156           0 :             ulNew += ulSeek;
     157           0 :             if (ulCountBytes > ulNew)
     158           0 :                 ulCountBytes = ulNew;
     159           0 :         }
     160           0 :     void operator++()
     161             :     {
     162             :         OSL_ENSURE(ulSeek+1<ulCountBytes, "Ww1PlainText");
     163           0 :         ulSeek++;
     164           0 :     }
     165           0 :     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;
     173             : 
     174             :     enum Consts { MinChar = 32 };
     175           0 :     static bool IsChar( sal_Unicode c )     { return c >= MinChar; }
     176             : };
     177             : 
     178             : /////////////////////////////////////////////////////////////// DocText
     179             : class Ww1DocText : public Ww1PlainText
     180             : {
     181             : public:
     182           0 :     Ww1DocText(Ww1Fib& rFibL) :
     183           0 :         Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet(),
     184           0 :          rFibL.GetFIB().ccpTextGet()) {
     185           0 :         }
     186             : };
     187             : 
     188             : /////////////////////////////////////////////////////////////// FtnText
     189             : class Ww1FtnText : public Ww1PlainText
     190             : {
     191             : public:
     192           0 :     sal_uLong Offset(Ww1Fib& rFibL) {
     193           0 :         return rFibL.GetFIB().ccpTextGet(); }
     194           0 :     Ww1FtnText(Ww1Fib& rFibL) :
     195           0 :         Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
     196           0 :          Offset(rFibL), rFibL.GetFIB().ccpFtnGet()) {
     197           0 :         }
     198             : };
     199             : 
     200             : /////////////////////////////////////////////////////////////// HddText
     201             : class Ww1HddText : public Ww1PlainText
     202             : {
     203             : public:
     204           0 :     sal_uLong Offset(Ww1Fib& rFibL) {
     205           0 :         return rFibL.GetFIB().ccpTextGet() + rFibL.GetFIB().ccpFtnGet(); }
     206           0 :     Ww1HddText(Ww1Fib& rFibL) :
     207           0 :         Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
     208           0 :          Offset(rFibL), rFibL.GetFIB().ccpHddGet()) {
     209           0 :         }
     210             : };
     211             : 
     212             : /////////////////////////////////////////////////////////////// McrText
     213             : class Ww1McrText : public Ww1PlainText
     214             : {
     215             : public:
     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()) {
     222             :         }
     223             : };
     224             : 
     225             : /////////////////////////////////////////////////////////////// AtnText
     226             : class Ww1AtnText : public Ww1PlainText
     227             : {
     228             : public:
     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()) {
     235             :         }
     236             : };
     237             : 
     238             : ///////////////////////////////////////////////////////////////// Style
     239             : //
     240             : // ein einzelner style oder vorlage
     241             : //
     242             : class Ww1Style
     243             : {
     244             :     String aName;
     245             :     W1_CHP aChpx;
     246             :     Ww1SprmPapx* pPapx;
     247             :     Ww1StyleSheet* pParent;
     248             :     sal_uInt8 stcBase;
     249             :     sal_uInt8 stcNext;
     250             :     sal_Bool bUsed;
     251             : public:
     252             :     Ww1Style();
     253             :     ~Ww1Style();
     254           0 :     bool IsUsed() const                 { return bUsed; }
     255             :     void SetDefaults(sal_uInt8);
     256           0 :     void SetParent(Ww1StyleSheet* newParent)    { pParent = newParent; }
     257           0 :     void SetName(const String& rName)   { bUsed = sal_True; aName = rName; }
     258           0 :     const String& GetName() const       { return aName; }
     259             :     Ww1Style& GetBase();
     260           0 :     sal_uInt16 GetnBase() const             { return stcBase; }
     261           0 :     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&);
     268             : };
     269             : 
     270             : //////////////////////////////////////////////////////////// StyleSheet
     271             : //
     272             : // die sammlung aller vorlagen (max. 256)
     273             : //
     274           0 : class Ww1StyleSheet
     275             : {
     276             :     Ww1Style aStyles[256];
     277             :     sal_uInt16 cstcStd; // count style code standard
     278             :     Ww1Fib& rFib;
     279             :     sal_Bool bOK;
     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&);
     284             : 
     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 );
     289             : public:
     290             :     Ww1StyleSheet(Ww1Fib& rFib);
     291           0 :     Ww1Style& GetStyle(sal_uInt16 stc) {
     292           0 :         return aStyles[stc]; }
     293           0 :     sal_uInt16 Count() {
     294           0 :         return 256; }
     295             :     friend std::ostream& operator <<(std::ostream&, Ww1StyleSheet&);
     296             :     void Out(Ww1Shell&, Ww1Manager&);
     297             :     friend class Ww1Style;
     298             :     sal_Bool GetError() {
     299             :         return !bOK; }
     300             : };
     301             : 
     302             : ///////////////////////////////////////////////////////////////// Fonts
     303             : //
     304             : // ww kennt nur font-nummern beim formatieren. nebenher gibts ein
     305             : // array von fonts, damit man aus der nummer einen konkreten font
     306             : // machen kann.
     307             : //
     308             : class Ww1Fonts
     309             : {
     310             : protected:
     311             :     W1_FFN** pFontA; // Array of Pointers to Font Description
     312             :     Ww1Fib& rFib;
     313             :     sal_uLong nFieldFlags;
     314             :     sal_uInt16 nMax; // Array-Groesse
     315             :     sal_Bool bOK;
     316             : public:
     317             :     Ww1Fonts(Ww1Fib&, sal_uLong nFieldFlgs);
     318           0 :     ~Ww1Fonts() {
     319           0 :         if (pFontA)
     320           0 :             DELETEZ(pFontA[0]);
     321           0 :         DELETEZ(pFontA); }
     322             :     W1_FFN* GetFFN(sal_uInt16 nNum);
     323             :     sal_uInt16 Count() {
     324             :         return nMax; }
     325             :     friend std::ostream& operator <<(std::ostream&, Ww1Fonts&);
     326             :     sal_Bool GetError() {
     327             :         return !bOK; }
     328             :     SvxFontItem GetFont(sal_uInt16);
     329             : };
     330             : 
     331             : //////////////////////////////////////////////////////////// SingleSprm
     332             : //
     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
     337             : // Sprms.
     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.
     344             : //
     345             : class Ww1SingleSprm
     346             : {
     347             : public:
     348             : #ifdef DUMP
     349             : //
     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.
     357             : //
     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;
     362             : #else
     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);
     366             : #endif
     367             :     virtual sal_uInt16 Size(sal_uInt8*);
     368             :     sal_uInt16 nCountBytes;
     369             : 
     370           0 :     Ww1SingleSprm(sal_uInt16 nBytes, const sal_Char* /*pName*/ = 0 )
     371           0 :         : nCountBytes(nBytes)
     372             : #ifdef DUMP
     373             :         , sName( pName)
     374             : #endif
     375             :         {
     376           0 :         }
     377             :     virtual ~Ww1SingleSprm();
     378             : };
     379             : 
     380           0 : class Ww1SingleSprmByteSized : public Ww1SingleSprm {
     381             : public:
     382             :     sal_uInt16 Size(sal_uInt8*);
     383           0 :     Ww1SingleSprmByteSized(sal_uInt16 nBytes, sal_Char* sName = 0) :
     384           0 :         Ww1SingleSprm(nBytes, sName) {
     385           0 :         }
     386             : };
     387             : 
     388           0 : class Ww1SingleSprmWordSized : public Ww1SingleSprm {
     389             : public:
     390             :     sal_uInt16 Size(sal_uInt8*);
     391           0 :     Ww1SingleSprmWordSized(sal_uInt16 nBytes, sal_Char* sName = 0) :
     392           0 :         Ww1SingleSprm(nBytes, sName) {
     393           0 :         }
     394             : };
     395             : 
     396           0 : class Ww1SingleSprmByte : public Ww1SingleSprm {
     397             : public:
     398             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     399           0 :     Ww1SingleSprmByte(sal_Char* sName = 0) :
     400           0 :         Ww1SingleSprm(1, sName) {
     401           0 :         }
     402             : };
     403             : 
     404           0 : class Ww1SingleSprmBool : public Ww1SingleSprmByte {
     405             : public:
     406             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     407           0 :     Ww1SingleSprmBool(sal_Char* sName = 0) :
     408           0 :         Ww1SingleSprmByte(sName) {
     409           0 :         }
     410             : };
     411             : 
     412           0 : class Ww1SingleSprm4State : public Ww1SingleSprmByte {
     413             : public:
     414             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     415           0 :     Ww1SingleSprm4State(sal_Char* sName = 0) :
     416           0 :         Ww1SingleSprmByte(sName) {
     417           0 :         }
     418             : };
     419             : 
     420           0 : class Ww1SingleSprmWord : public Ww1SingleSprm {
     421             : public:
     422             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     423           0 :     Ww1SingleSprmWord(sal_Char* sName = 0)
     424           0 :     : Ww1SingleSprm(2, sName) {}
     425             : };
     426             : 
     427             : class Ww1SingleSprmLong : public Ww1SingleSprm {
     428             : public:
     429             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     430             :     Ww1SingleSprmLong(sal_Char* sName = 0) :
     431             :         Ww1SingleSprm(4, sName) {
     432             :         }
     433             : };
     434             : 
     435           0 : class Ww1SingleSprmTab : public Ww1SingleSprm {
     436             : public:
     437             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     438             :     sal_uInt16 Size(sal_uInt8*);
     439           0 :     Ww1SingleSprmTab(sal_uInt16 nBytes, sal_Char* sName = 0) :
     440           0 :         Ww1SingleSprm(nBytes, sName) {
     441           0 :         }
     442             : };
     443             : 
     444           0 : class Ww1SingleSprmPJc : public Ww1SingleSprmByte {
     445             : public:
     446           0 :     Ww1SingleSprmPJc(sal_Char* sName) :
     447           0 :         Ww1SingleSprmByte(sName) {
     448           0 :         }
     449             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     450             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     451             : };
     452             : 
     453           0 : class Ww1SingleSprmPDxa : public Ww1SingleSprmWord {
     454             : public:
     455           0 :     Ww1SingleSprmPDxa(sal_Char* sName) :
     456           0 :         Ww1SingleSprmWord(sName) {
     457           0 :         }
     458             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     459             : };
     460             : 
     461           0 : class Ww1SingleSprmPDxaRight : public Ww1SingleSprmPDxa {
     462             : public:
     463           0 :     Ww1SingleSprmPDxaRight(sal_Char* sName) :
     464           0 :         Ww1SingleSprmPDxa(sName) {
     465           0 :         }
     466             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     467             : };
     468             : 
     469           0 : class Ww1SingleSprmPDxaLeft : public Ww1SingleSprmPDxa {
     470             : public:
     471           0 :     Ww1SingleSprmPDxaLeft(sal_Char* sName) :
     472           0 :         Ww1SingleSprmPDxa(sName) {
     473           0 :         }
     474             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     475             : };
     476             : 
     477           0 : class Ww1SingleSprmPDxaLeft1 : public Ww1SingleSprmPDxa {
     478             : public:
     479           0 :     Ww1SingleSprmPDxaLeft1(sal_Char* sName) :
     480           0 :         Ww1SingleSprmPDxa(sName) {
     481           0 :         }
     482             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     483             : };
     484             : 
     485           0 : class Ww1SingleSprmPFKeep : public Ww1SingleSprmBool {
     486             : public:
     487           0 :     Ww1SingleSprmPFKeep(sal_Char* sName) :
     488           0 :         Ww1SingleSprmBool(sName) {
     489           0 :         }
     490             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     491             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     492             : };
     493             : 
     494           0 : class Ww1SingleSprmPFKeepFollow : public Ww1SingleSprmBool {
     495             : public:
     496           0 :     Ww1SingleSprmPFKeepFollow(sal_Char* sName) :
     497           0 :         Ww1SingleSprmBool(sName) {
     498           0 :         }
     499             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     500             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     501             : };
     502             : 
     503           0 : class Ww1SingleSprmPPageBreakBefore : public Ww1SingleSprmBool {
     504             : public:
     505           0 :     Ww1SingleSprmPPageBreakBefore(sal_Char* sName) :
     506           0 :         Ww1SingleSprmBool(sName) {
     507           0 :         }
     508             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     509             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     510             : };
     511             : 
     512           0 : class Ww1SingleSprmPBrc : public Ww1SingleSprmWord {
     513             : protected:
     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&);
     518             : 
     519             :     using Ww1SingleSprm::Start;
     520             : 
     521             : public:
     522           0 :     Ww1SingleSprmPBrc(sal_Char* sName) :
     523           0 :         Ww1SingleSprmWord(sName) {
     524           0 :         }
     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*);
     528             : };
     529             : 
     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)
     535             : 
     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           0 : class Ww1SingleSprmPBrc10 : public Ww1SingleSprmPBrc
     541             : {
     542             :     sal_uInt16 nLine;   // BRC_TOP, BRC_LEFT, ...
     543             : 
     544             :     using Ww1SingleSprmPBrc::Start;
     545             : 
     546             : public:
     547           0 :     Ww1SingleSprmPBrc10(sal_uInt16 nL, sal_Char* sName)
     548           0 :     : Ww1SingleSprmPBrc(sName), nLine(nL) {}
     549             : 
     550             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     551             : };
     552             : 
     553           0 : class Ww1SingleSprmParaSpace : public Ww1SingleSprmWord {
     554             : public:
     555           0 :     Ww1SingleSprmParaSpace(sal_Char* sName)
     556           0 :     : Ww1SingleSprmWord(sName) {}
     557             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     558             : };
     559             : 
     560           0 : class Ww1SingleSprmPDyaBefore : public Ww1SingleSprmParaSpace {
     561             : public:
     562           0 :     Ww1SingleSprmPDyaBefore(sal_Char* sName)
     563           0 :     : Ww1SingleSprmParaSpace(sName) {}
     564             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     565             : };
     566             : 
     567           0 : class Ww1SingleSprmPDyaAfter : public Ww1SingleSprmParaSpace {
     568             : public:
     569           0 :     Ww1SingleSprmPDyaAfter(sal_Char* sName) :
     570           0 :         Ww1SingleSprmParaSpace(sName) {
     571           0 :         }
     572             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     573             : };
     574             : 
     575           0 : class Ww1SingleSprmPDyaLine : public Ww1SingleSprmWord {
     576             : public:
     577           0 :     Ww1SingleSprmPDyaLine(sal_Char* sName) :
     578           0 :         Ww1SingleSprmWord(sName) {
     579           0 :         }
     580             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     581             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     582             : };
     583             : 
     584           0 : class Ww1SingleSprmPChgTabsPapx : public Ww1SingleSprmByteSized {
     585             : public:
     586           0 :     Ww1SingleSprmPChgTabsPapx(sal_Char* sName) :
     587           0 :         Ww1SingleSprmByteSized(0, sName) {
     588           0 :         }
     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&);
     592             : };
     593             : 
     594           0 : class Ww1SingleSprmSGprfIhdt : public Ww1SingleSprmByte {
     595             : public:
     596           0 :     Ww1SingleSprmSGprfIhdt(sal_Char* sName) :
     597           0 :         Ww1SingleSprmByte(sName) {
     598           0 :         }
     599             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     600             : };
     601             : 
     602           0 : class Ww1SingleSprmSColumns : public Ww1SingleSprmWord {
     603             : public:
     604           0 :     Ww1SingleSprmSColumns(sal_Char* sName) :
     605           0 :         Ww1SingleSprmWord(sName) {
     606           0 :         }
     607             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     608             : };
     609             : 
     610           0 : class Ww1SingleSprmPFInTable : public Ww1SingleSprmBool {
     611             : public:
     612           0 :     Ww1SingleSprmPFInTable(sal_Char* sName) :
     613           0 :         Ww1SingleSprmBool(sName) {
     614           0 :         }
     615             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     616             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     617             : };
     618             : 
     619           0 : class Ww1SingleSprmPTtp : public Ww1SingleSprmBool {
     620             : public:
     621           0 :     Ww1SingleSprmPTtp(sal_Char* sName) :
     622           0 :         Ww1SingleSprmBool(sName) {
     623           0 :         }
     624             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     625             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     626             : };
     627             : 
     628             : class Ww1SingleSprmTJc : public Ww1SingleSprmWord {
     629             : public:
     630             :     Ww1SingleSprmTJc(sal_Char* sName)
     631             :     : Ww1SingleSprmWord(sName) {}
     632             : };
     633             : 
     634           0 : class Ww1SingleSprmTDxaGapHalf : public Ww1SingleSprmWord {
     635             : public:
     636             :     Ww1SingleSprmTDxaGapHalf(sal_Char* sName) :
     637             :         Ww1SingleSprmWord(sName) {
     638             :         }
     639             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     640             : };
     641             : 
     642           0 : class Ww1SingleSprmTDefTable10 : public Ww1SingleSprmWordSized {
     643             : public:
     644           0 :     Ww1SingleSprmTDefTable10(sal_Char* sName) :
     645           0 :         Ww1SingleSprmWordSized(0, sName) {
     646           0 :         }
     647             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     648             : };
     649             : 
     650           0 : class Ww1SingleSprmTDyaRowHeight : public Ww1SingleSprmWord {
     651             : public:
     652             :     Ww1SingleSprmTDyaRowHeight(sal_Char* sName) :
     653             :         Ww1SingleSprmWord(sName) {
     654             :         }
     655             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     656             : };
     657             : 
     658             : // Klassendefinitionen fuer Tabellen-Fastsave-Attribute
     659             : // Da wir kein Fastsave unterstuetzen, brauchen wir's nicht
     660             : 
     661             : // Klassendefinitionen fuer Apos ( == Flys )
     662             : 
     663           0 : class Ww1SingleSprmPpc : public Ww1SingleSprmByte {
     664             : public:
     665           0 :     Ww1SingleSprmPpc(sal_Char* sName) :
     666           0 :         Ww1SingleSprmByte(sName) {
     667           0 :         }
     668             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     669             : };
     670             : 
     671           0 : class Ww1SingleSprmPDxaAbs : public Ww1SingleSprmWord {
     672             : public:
     673           0 :     Ww1SingleSprmPDxaAbs(sal_Char* sName) :
     674           0 :         Ww1SingleSprmWord(sName) {
     675           0 :         }
     676             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     677             : };
     678             : 
     679           0 : class Ww1SingleSprmPDyaAbs : public Ww1SingleSprmWord {
     680             : public:
     681           0 :     Ww1SingleSprmPDyaAbs(sal_Char* sName) :
     682           0 :         Ww1SingleSprmWord(sName) {
     683           0 :         }
     684             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     685             : };
     686             : 
     687           0 : class Ww1SingleSprmPDxaWidth : public Ww1SingleSprmWord {
     688             : public:
     689           0 :     Ww1SingleSprmPDxaWidth(sal_Char* sName) :
     690           0 :         Ww1SingleSprmWord(sName) {
     691           0 :         }
     692             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     693             : };
     694             : 
     695           0 : class Ww1SingleSprmPFromText : public Ww1SingleSprmWord {
     696             : public:
     697           0 :     Ww1SingleSprmPFromText(sal_Char* sName) :
     698           0 :         Ww1SingleSprmWord(sName) {
     699           0 :         }
     700             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     701             : };
     702             : 
     703             : ////////////////////////////////////////////////////////////////// Sprm
     704             : //
     705             : // der tatsaechlich in der datei auftretende datentyp Sprm
     706             : //
     707             : class Ww1Sprm
     708             : {
     709             :     sal_Bool ReCalc();
     710             :     static Ww1SingleSprm* aTab[256];
     711             :     static Ww1SingleSprm* pSingleSprm;
     712             : protected:
     713             :     static void InitTab();
     714           0 :     Ww1SingleSprm& GetTab(sal_uInt16 nId)
     715             :     {
     716           0 :         if( !pSingleSprm )
     717           0 :             InitTab();
     718           0 :         return aTab[ nId ] ? *aTab[nId] : *pSingleSprm;
     719             :     }
     720             : 
     721             :     sal_uInt8* p;
     722             :     sal_uInt16 nCountBytes;
     723             :     sal_Bool bOK;
     724             :     sal_uInt16* pArr;
     725             :     sal_uInt16 count;
     726             : // ohne Token, mit laengen-byte/word
     727             :     sal_uInt16 GetSize(sal_uInt8 nId, sal_uInt8* pSprm);
     728             : // mit Token und LaengenByte
     729           0 :     sal_uInt16 GetSizeBrutto(sal_uInt8* pSprm) {
     730           0 :         sal_uInt8 nId = *pSprm++;
     731           0 :         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*&);
     734             : public:
     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*&);
     738             : 
     739             :     Ww1Sprm(sal_uInt8*, sal_uInt16);
     740             :     Ww1Sprm(SvStream&, sal_uLong);
     741             :     ~Ww1Sprm();
     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&);
     746           0 :     bool IsUsed() {
     747           0 :         return nCountBytes != 255; }
     748           0 :     sal_uInt16 Count() {
     749           0 :         return count; }
     750             :     sal_Bool GetError() {
     751             :         return !bOK; }
     752             :     static void DeinitTab();
     753             : };
     754             : 
     755             : /////////////////////////////////////////////////////////////// Picture
     756             : //
     757             : // der wrapper um den datentyp PIC, eine struktur, die am beginn eines
     758             : // bild-dateinamens oder eines eingebetteten bildes steht.
     759             : //
     760             : class Ww1Picture
     761             : {
     762             :     sal_Bool bOK;
     763             :     W1_PIC* pPic;
     764             : public:
     765             :     Ww1Picture(SvStream&, sal_uLong);
     766           0 :     ~Ww1Picture() {
     767           0 :         }
     768           0 :     sal_Bool GetError() {
     769           0 :         return !bOK; }
     770             :     friend std::ostream& operator <<(std::ostream&, Ww1Picture&);
     771             :     void Out(Ww1Shell&, Ww1Manager&);
     772             :     void WriteBmp(SvStream&);
     773             : };
     774             : 
     775             : /////////////////////////////////////////////////////////////////// Plc
     776             : //
     777             : // eine der wichtigen array-strukturen der ww-dateien. sie beinhalten
     778             : // n+1 dateipositionen und n attribute, die zwischen den
     779             : // dateipositionen gelten.
     780             : //
     781             : class Ww1Plc
     782             : {
     783             :     sal_uInt8* p;
     784             :     sal_uInt16 nCountBytes;
     785             :     sal_uInt16 iMac;
     786             :     sal_uInt16 nItemSize;
     787             :     sal_Bool bOK;
     788             : protected:
     789             :     Ww1Fib& rFib;
     790             :     sal_uInt8* GetData(sal_uInt16);
     791             : public:
     792             :     Ww1Plc(Ww1Fib&, sal_uLong, sal_uInt16, sal_uInt16);
     793             :     ~Ww1Plc();
     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           0 :     void Fill(sal_uInt16 nIndex, sal_uLong& begin, sal_uLong& end) {
     798           0 :         begin = Where(nIndex);
     799           0 :         end = Where(nIndex+1); }
     800           0 :     sal_uInt16 Count() {
     801           0 :         return iMac; }
     802           0 :     sal_Bool GetError() {
     803           0 :         return !bOK; }
     804             : };
     805             : 
     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
     810             : 
     811             : /////////////////////////////////////////////////////////// PlcGlossary
     812             : class Ww1PlcGlossary : public Ww1Plc
     813             : {
     814             : public:
     815             :     Ww1PlcGlossary(Ww1Fib& rFibL) :
     816             :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfglsyGet(),
     817             :          rFibL.GetFIB().cbPlcfglsyGet(), 0) {
     818             :         }
     819             : };
     820             : 
     821             : ////////////////////////////////////////////////////// PlcAnnotationRef
     822             : class Ww1PlcAnnotationRef : public Ww1Plc
     823             : {
     824             : public:
     825             :     Ww1PlcAnnotationRef(Ww1Fib& rFibL) :
     826             :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfandRefGet(),
     827             :          rFibL.GetFIB().cbPlcfandRefGet(), 0) {
     828             :         }
     829             : };
     830             : 
     831             : ////////////////////////////////////////////////////// PlcAnnotationTxt
     832             : class Ww1PlcAnnotationTxt : public Ww1Plc
     833             : {
     834             : public:
     835             :     Ww1PlcAnnotationTxt(Ww1Fib& rFibL) :
     836             :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfandTxtGet(),
     837             :          rFibL.GetFIB().cbPlcfandTxtGet(), 0) {
     838             :         }
     839             : };
     840             : 
     841             : ///////////////////////////////////////////////////////// PlcAnnotation
     842             : class Ww1Annotation {
     843             :     Ww1PlcAnnotationRef aRef;
     844             :     Ww1PlcAnnotationTxt aTxt;
     845             : public:
     846             :     Ww1Annotation(Ww1Fib& rFib) :
     847             :         aRef(rFib),
     848             :         aTxt(rFib) {
     849             :         }
     850             :     friend std::ostream& operator <<(std::ostream&, Ww1Annotation&);
     851             : };
     852             : 
     853             : //////////////////////////////////////////////////////////////// PlcSep
     854           0 : class Ww1PlcSep : public Ww1Plc
     855             : {
     856             : public:
     857           0 :     Ww1PlcSep(Ww1Fib& rFibL):
     858           0 :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfsedGet(),
     859           0 :          rFibL.GetFIB().cbPlcfsedGet(), 6) {
     860           0 :         }
     861             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcSep&);
     862             : };
     863             : 
     864             : //////////////////////////////////////////////////////////////// PlcChp
     865           0 : class Ww1PlcChp : public Ww1Plc
     866             : {
     867             : public:
     868           0 :     Ww1PlcChp(Ww1Fib& rFibL) :
     869           0 :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfbteChpxGet(),
     870           0 :          rFibL.GetFIB().cbPlcfbteChpxGet(), 2) {
     871           0 :         }
     872             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcChp&);
     873             : };
     874             : 
     875             : //////////////////////////////////////////////////////////////// PlcPap
     876           0 : class Ww1PlcPap : public Ww1Plc
     877             : {
     878             : public:
     879           0 :     Ww1PlcPap(Ww1Fib& rFibL) :
     880           0 :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfbtePapxGet(),
     881           0 :          rFibL.GetFIB().cbPlcfbtePapxGet(), 2) {
     882           0 :         }
     883             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcPap&);
     884             : };
     885             : 
     886             : //////////////////////////////////////////////////////// PlcFootnoteRef
     887           0 : class Ww1PlcFootnoteRef : public Ww1Plc
     888             : {
     889             : public:
     890           0 :     Ww1PlcFootnoteRef(Ww1Fib& rFibL) :
     891           0 :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcffndRefGet(),
     892           0 :          rFibL.GetFIB().cbPlcffndRefGet(), 2) {
     893           0 :         }
     894             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcFootnoteRef&);
     895             : };
     896             : 
     897             : //////////////////////////////////////////////////////// PlcFootnoteTxt
     898           0 : class Ww1PlcFootnoteTxt : public Ww1Plc
     899             : {
     900             : public:
     901           0 :     Ww1PlcFootnoteTxt(Ww1Fib& rFibL) :
     902           0 :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcffndTxtGet(),
     903           0 :          rFibL.GetFIB().cbPlcffndTxtGet(), 0) {
     904           0 :         }
     905             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcFootnoteTxt&);
     906             : };
     907             : 
     908             : ///////////////////////////////////////////////////////////// PlcFields
     909           0 : class Ww1PlcFields : public Ww1Plc
     910             : {
     911             : public:
     912           0 :     Ww1PlcFields(Ww1Fib& rFibL, sal_uLong start, sal_uInt16 nBytes)
     913           0 :         : Ww1Plc(rFibL, start, nBytes, 2)
     914           0 :     {}
     915           0 :     W1_FLD* GetData(sal_uInt16 nIndex)
     916           0 :         { return (W1_FLD*)Ww1Plc::GetData(nIndex); }
     917           0 :     sal_uLong Where(sal_uInt16 nIndex)  // absolut im file
     918           0 :         { return Ww1Plc::Where(nIndex) + rFib.GetFIB().fcMinGet(); }
     919             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcFields&);
     920             : };
     921             : 
     922             : ///////////////////////////////////////////////////////////// PlcBookmarks
     923             : class Ww1StringList
     924             : {
     925             :     sal_Char** pIdxA;
     926             :     sal_uInt16 nMax;
     927             : public:
     928             :     Ww1StringList( SvStream& rSt, sal_uLong nFc, sal_uInt16 nCb );
     929           0 :     ~Ww1StringList()
     930           0 :         {   if( pIdxA ) { delete pIdxA[0]; delete pIdxA; } }
     931             :     const String GetStr( sal_uInt16 nNum ) const;
     932             :     sal_uInt16 Count() const    { return nMax; }
     933           0 :     sal_Bool GetError() const   { return (nMax != 0) && !pIdxA; }
     934             : };
     935             : 
     936           0 : class Ww1PlcBookmarkTxt: public Ww1StringList
     937             : {
     938             : public:
     939           0 :     Ww1PlcBookmarkTxt(Ww1Fib& rFib) :
     940           0 :         Ww1StringList( rFib.GetStream(), rFib.GetFIB().fcSttbfbkmkGet(),
     941           0 :                        rFib.GetFIB().cbSttbfbkmkGet() )
     942           0 :     {}
     943             : };
     944             : 
     945           0 : class Ww1PlcBookmarkPos : public Ww1Plc
     946             : {
     947             : public:
     948           0 :     Ww1PlcBookmarkPos(Ww1Fib& _rFib, sal_uLong start, sal_uInt16 nBytes, sal_Bool bEnd)
     949           0 :         : Ww1Plc(_rFib, start, nBytes, (bEnd) ? 0 : 2)
     950           0 :     {}
     951             : 
     952           0 :     sal_uInt8* GetData(sal_uInt16 nIndex)   {   return Ww1Plc::GetData(nIndex); }
     953             :     // Position als CP
     954           0 :     sal_uLong WhereCP(sal_uInt16 nIndex)    { return Ww1Plc::Where(nIndex); }
     955             :     // absolut im file
     956           0 :     sal_uLong Where(sal_uInt16 nIndex)
     957             :     {
     958           0 :         return ( nIndex < Count() )
     959           0 :                ? Ww1Plc::Where(nIndex) + rFib.GetFIB().fcMinGet()
     960           0 :                : 0xffffffff;
     961             :     }
     962             : };
     963             : 
     964             : //////////////////////////////////////////////////////////////// PlcHdd
     965           0 : class Ww1PlcHdd : public Ww1Plc
     966             : {
     967             : public:
     968           0 :     Ww1PlcHdd(Ww1Fib& rFibL)
     969           0 :         : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfhddGet(),
     970           0 :                     rFibL.GetFIB().cbPlcfhddGet(), 0)
     971           0 :     {}
     972             : };
     973             : 
     974             : /////////////////////////////////////////////////////////////////// Fkp
     975             : //
     976             : // aehnlich den plcs aufgebaute arrays, die sich auf eine groesze von
     977             : // 512 byte beschraenken.
     978             : //
     979             : class Ww1Fkp
     980             : {
     981             : protected:
     982             :     sal_uInt8 aFkp[512];
     983             :     sal_uInt16 nItemSize;
     984             :     sal_Bool bOK;
     985             :     sal_uInt8* GetData(sal_uInt16);
     986             : public:
     987             :     Ww1Fkp(SvStream&, sal_uLong, sal_uInt16);
     988             :     friend std::ostream& operator <<(std::ostream&, Ww1Fkp&);
     989           0 :     sal_uInt16 Count() const            { return SVBT8ToByte(aFkp+511); }
     990             :     sal_uLong Where(sal_uInt16); // wie im entsprechenden fkp
     991             : };
     992             : 
     993             : //////////////////////////////////////////////////////////////// FkpPap
     994             : class Ww1FkpPap : public Ww1Fkp
     995             : {
     996             : public:
     997           0 :     Ww1FkpPap(SvStream& rStream, sal_uLong ulFilePos)
     998           0 :         : Ww1Fkp(rStream, ulFilePos, 1)
     999           0 :     {}
    1000             :     friend std::ostream& operator <<(std::ostream&, Ww1FkpPap&);
    1001             :     sal_Bool Fill(sal_uInt16,  sal_uInt8*&, sal_uInt16&);
    1002             : };
    1003             : 
    1004             : //////////////////////////////////////////////////////////////// FkpChp
    1005             : class Ww1FkpChp : public Ww1Fkp
    1006             : {
    1007             : #ifdef DUMP
    1008             :     SvStream& rStream;
    1009             :     SvStream& GetStream()   { return rStream; }
    1010             : #endif
    1011             : public:
    1012           0 :     Ww1FkpChp(SvStream& rStream, sal_uLong ulFilePos)
    1013           0 :         : Ww1Fkp(rStream, ulFilePos, 1)
    1014             : #ifdef DUMP
    1015             :         , rStream(rStream)
    1016             : #endif
    1017           0 :     {}
    1018             : 
    1019             :     friend std::ostream& operator <<(std::ostream&, Ww1FkpChp&);
    1020             :     sal_Bool Fill(sal_uInt16, W1_CHP&);
    1021             : };
    1022             : 
    1023             : ////////////////////////////////////////////////////////////// SprmPapx
    1024           0 : class Ww1SprmPapx : public Ww1Sprm
    1025             : {
    1026             :     W1_PAPX aPapx;
    1027             :     sal_uInt8* Sprm(sal_uInt8* p, sal_uInt16 nSize);
    1028             :     sal_uInt16 SprmSize(sal_uInt8* p, sal_uInt16 nSize);
    1029             : public:
    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&);
    1034             : };
    1035             : 
    1036             : /////////////////////////////////////////////////////////////// SprmSep
    1037           0 : class Ww1SprmSep : public Ww1Sprm
    1038             : {
    1039             : public:
    1040           0 :     Ww1SprmSep(Ww1Fib& rFib, sal_uLong ulFilePos)
    1041           0 :         : Ww1Sprm(rFib.GetStream(), ulFilePos)
    1042           0 :     {}
    1043             :     friend std::ostream& operator <<(std::ostream&, Ww1SprmSep&);
    1044             : };
    1045             : 
    1046             : ///////////////////////////////////////////////////////////////// Assoc
    1047             : class Ww1Assoc
    1048             : {
    1049             :     enum fields { FileNext, Dot, Title, Subject, KeyWords, Comments,
    1050             :         Author, LastRevBy, DataDoc, HeaderDoc, Criteria1, Criteria2,
    1051             :         Criteria3, Criteria4, Criteria5, Criteria6, Criteria7, MaxFields };
    1052             : 
    1053             :     Ww1Fib& rFib;
    1054             :     sal_Char* pBuffer;
    1055             :     sal_Char* pStrTbl[ MaxFields ];
    1056             :     sal_Bool bOK;
    1057             : 
    1058             :     String GetStr(sal_uInt16);
    1059             : 
    1060             : public:
    1061             :     Ww1Assoc(Ww1Fib&);
    1062           0 :     ~Ww1Assoc()             { delete pBuffer; }
    1063             :     sal_Bool GetError() const   { return !bOK; }
    1064             :     friend std::ostream& operator <<(std::ostream&, Ww1Assoc&);
    1065             :     void Out(Ww1Shell&);
    1066             : };
    1067             : 
    1068             : ////////////////////////////////////////////////////////// HeaderFooter
    1069             : //
    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.
    1083             : //
    1084           0 : class Ww1HeaderFooter : public Ww1PlcHdd
    1085             : {
    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;
    1100             : 
    1101             : public:
    1102           0 :     Ww1HeaderFooter(Ww1Fib& rFibL, sal_uInt16 grpfIhdt)
    1103             :         : Ww1PlcHdd(rFibL),
    1104             :         nextIhdd(0),
    1105             :         nFtnSep(0xffff),
    1106             :         nFtnFollowSep(0xffff),
    1107             :         nFtnNote(0xffff),
    1108             :         nEvenHeadL(0xffff),
    1109             :         nOddHeadL(0xffff),
    1110             :         nEvenFootL(0xffff),
    1111             :         nOddFootL(0xffff),
    1112             :         nFirstHeadL(0xffff),
    1113             :         nFirstFootL(0xffff),
    1114           0 :         eHeaderFooterMode(None)
    1115             :     {
    1116           0 :         if (grpfIhdt & 0x0001) nFtnSep = nextIhdd++;
    1117           0 :         if (grpfIhdt & 0x0002) nFtnFollowSep = nextIhdd++;
    1118           0 :         if (grpfIhdt & 0x0004) nFtnNote = nextIhdd++;
    1119           0 :     }
    1120           0 :     void SetGrpfIhdt(sal_uInt16 grpfIhdt)
    1121             :     {
    1122           0 :         if (grpfIhdt & 0x0001) nEvenHeadL = nextIhdd++;
    1123           0 :         if (grpfIhdt & 0x0002) nOddHeadL = nextIhdd++;
    1124           0 :         if (grpfIhdt & 0x0004) nEvenFootL = nextIhdd++;
    1125           0 :         if (grpfIhdt & 0x0008) nOddFootL = nextIhdd++;
    1126           0 :         if (grpfIhdt & 0x0010) nFirstHeadL = nextIhdd++;
    1127           0 :         if (grpfIhdt & 0x0020) nFirstFootL = nextIhdd++;
    1128             :         OSL_ENSURE(nextIhdd<=Count(), "Ww1HeaderFooter");
    1129           0 :     }
    1130           0 :     sal_Bool operator++()
    1131             :     {
    1132           0 :         sal_Bool bRet = sal_True;
    1133           0 :         eHeaderFooterMode = (HeaderFooterMode)((short)eHeaderFooterMode + 1);
    1134           0 :         if( eHeaderFooterMode == MaxHeaderFooterMode)
    1135             :         {
    1136           0 :             eHeaderFooterMode = None;
    1137           0 :             bRet = sal_False;
    1138             :         }
    1139           0 :         return bRet;
    1140             :     }
    1141             :     sal_Bool FillFtnSep(sal_uLong& begin, sal_uLong& end)
    1142             :     {
    1143             :         if (nFtnSep == 0xffff)
    1144             :             return sal_False;
    1145             :         Fill(nFtnSep, begin, end);
    1146             :         return sal_True;
    1147             :     }
    1148             :     sal_Bool FillFtnFollowSep(sal_uLong& begin, sal_uLong& end)
    1149             :     {
    1150             :         if (nFtnFollowSep == 0xffff)
    1151             :             return sal_False;
    1152             :         Fill(nFtnFollowSep, begin, end);
    1153             :         return sal_True;
    1154             :     }
    1155             :     sal_Bool FillFtnNote(sal_uLong& begin, sal_uLong& end)
    1156             :     {
    1157             :         if (nFtnNote == 0xffff)
    1158             :             return sal_False;
    1159             :         Fill(nFtnNote, begin, end);
    1160             :         return sal_True;
    1161             :     }
    1162             :     sal_Bool FillEvenHeadL(sal_uLong& begin, sal_uLong& end)
    1163             :     {
    1164             :         if (nEvenHeadL == 0xffff)
    1165             :             return sal_False;
    1166             :         Fill(nEvenHeadL, begin, end);
    1167             :         return sal_True;
    1168             :     }
    1169           0 :     sal_Bool FillOddHeadL(sal_uLong& begin, sal_uLong& end)
    1170             :     {
    1171           0 :         if (nOddHeadL == 0xffff)
    1172           0 :             return sal_False;
    1173           0 :         Fill(nOddHeadL, begin, end);
    1174           0 :         return sal_True;
    1175             :     }
    1176             :     sal_Bool FillEvenFootL(sal_uLong& begin, sal_uLong& end)
    1177             :     {
    1178             :         if (nEvenFootL == 0xffff)
    1179             :             return sal_False;
    1180             :         Fill(nEvenFootL, begin, end);
    1181             :         return sal_True;
    1182             :     }
    1183           0 :     sal_Bool FillOddFootL(sal_uLong& begin, sal_uLong& end)
    1184             :     {
    1185           0 :         if (nOddFootL == 0xffff)
    1186           0 :             return sal_False;
    1187           0 :         Fill(nOddFootL, begin, end);
    1188           0 :         return sal_True;
    1189             :     }
    1190             :     sal_Bool FillFirstHeadL(sal_uLong& begin, sal_uLong& end)
    1191             :     {
    1192             :         if (nFirstHeadL == 0xffff)
    1193             :             return sal_False;
    1194             :         Fill(nFirstHeadL, begin, end);
    1195             :         return sal_True;
    1196             :     }
    1197             :     sal_Bool FillFirstFootL(sal_uLong& begin, sal_uLong& end)
    1198             :     {
    1199             :         if (nFirstFootL == 0xffff)
    1200             :             return sal_False;
    1201             :         Fill(nFirstFootL, begin, end);
    1202             :         return sal_True;
    1203             :     }
    1204             :     void Start(Ww1Shell&, Ww1Manager&);
    1205             :     void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
    1206             : };
    1207             : 
    1208             : //////////////////////////////////////////////////////////////// Fields
    1209           0 : class Ww1Fields : public Ww1PlcFields
    1210             : {
    1211             :     sal_uInt16 nPlcIndex;
    1212             :     String sErgebnis; // das von word errechnete ergebniss
    1213             :     SwField* pField;
    1214           0 :     sal_uLong Where(sal_uInt16 nIndex)  // innerhalb des textes
    1215           0 :         { return Ww1PlcFields::Where(nIndex) - rFib.GetFIB().fcMinGet(); }
    1216             : 
    1217             : public:
    1218           0 :     Ww1Fields(Ww1Fib& rFibL, sal_uLong ulFilePos, sal_uInt16 nBytes)
    1219           0 :         : Ww1PlcFields(rFibL, ulFilePos, nBytes), nPlcIndex(0), pField(0)
    1220           0 :     {}
    1221             :     // innerhalb des textes
    1222           0 :     sal_uLong Where()       { return Where(nPlcIndex); }
    1223           0 :     void operator++()
    1224             :     {
    1225             :         OSL_ENSURE(nPlcIndex+1 <= Count(), "Ww1Fields");
    1226           0 :         nPlcIndex++;
    1227           0 :     }
    1228           0 :     void Seek(sal_uLong ulNew)      { Ww1PlcFields::Seek(ulNew, nPlcIndex); }
    1229           0 :     W1_FLD* GetData()
    1230             :     {
    1231             :         OSL_ENSURE(nPlcIndex < Count(), "Ww1Fields");
    1232           0 :         return Ww1PlcFields::GetData(nPlcIndex);
    1233             :     }
    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);
    1239             : };
    1240             : 
    1241           0 : class Ww1TextFields : public Ww1Fields
    1242             : {
    1243             : public:
    1244           0 :     Ww1TextFields(Ww1Fib& rFibL)
    1245           0 :         : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldMomGet(),
    1246           0 :                     rFibL.GetFIB().cbPlcffldMomGet())
    1247           0 :     {}
    1248             : };
    1249             : 
    1250             : class Ww1FootnoteFields : public Ww1Fields
    1251             : {
    1252             : public:
    1253           0 :     Ww1FootnoteFields(Ww1Fib& rFibL)
    1254           0 :         : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldFtnGet(),
    1255           0 :                     rFibL.GetFIB().cbPlcffldFtnGet())
    1256           0 :     {}
    1257             : };
    1258             : 
    1259             : class Ww1HeaderFooterFields : public Ww1Fields
    1260             : {
    1261             : public:
    1262           0 :     Ww1HeaderFooterFields(Ww1Fib& rFibL)
    1263           0 :         : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldHdrGet(),
    1264           0 :                     rFibL.GetFIB().cbPlcffldHdrGet())
    1265           0 :     {}
    1266             : };
    1267             : 
    1268             : class Ww1MacroFields : public Ww1Fields
    1269             : {
    1270             : public:
    1271             :     Ww1MacroFields(Ww1Fib& rFibL)
    1272             :         : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldMcrGet(),
    1273             :                     rFibL.GetFIB().cbPlcffldMcrGet())
    1274             :     {}
    1275             : };
    1276             : 
    1277             : //////////////////////////////////////////////////////////////// Bookmarks
    1278             : class Ww1Bookmarks
    1279             : {
    1280             :     Ww1PlcBookmarkTxt aNames;
    1281             :     Ww1PlcBookmarkPos* pPos[2];
    1282             :     Ww1Fib& rFib;
    1283             : 
    1284             :     sal_uInt16 nPlcIdx[2];
    1285             :     sal_uInt16 nIsEnd;
    1286             :     sal_Bool bOK;
    1287             : public:
    1288             :     Ww1Bookmarks(Ww1Fib& rFib);
    1289           0 :     ~Ww1Bookmarks()
    1290           0 :     {
    1291           0 :             delete pPos[1];
    1292           0 :             delete pPos[0];
    1293           0 :     }
    1294           0 :     sal_uLong Where() const     { return pPos[nIsEnd]->WhereCP(nPlcIdx[nIsEnd]); }
    1295             :     void operator++();
    1296           0 :     sal_Bool GetError() const   { return !bOK; }
    1297             :     long GetHandle() const;
    1298           0 :     sal_Bool GetIsEnd() const   { return ( nIsEnd ) ? sal_True : sal_False; }
    1299             :     const String GetName() const;
    1300             :     long Len() 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);
    1305             : };
    1306             : 
    1307             : ///////////////////////////////////////////////////////////// Footnotes
    1308           0 : class Ww1Footnotes : public Ww1PlcFootnoteRef
    1309             : {
    1310             :     sal_uInt16 nPlcIndex;
    1311             :     Ww1PlcFootnoteTxt aText;
    1312             :     sal_Bool bStarted;
    1313             : public:
    1314           0 :     Ww1Footnotes(Ww1Fib& rFibL)
    1315           0 :         : Ww1PlcFootnoteRef(rFibL), nPlcIndex(0), aText(rFibL), bStarted(sal_False)
    1316           0 :     {}
    1317             :     // innerhalb des textes
    1318           0 :     sal_uLong Where()
    1319             :     {
    1320           0 :         sal_uLong ulRet = 0xffffffff;
    1321           0 :         if (Count())
    1322           0 :             ulRet = Ww1PlcFootnoteRef::Where(nPlcIndex);
    1323           0 :         return ulRet;
    1324             :     }
    1325           0 :     void operator++()
    1326             :     {
    1327             :         OSL_ENSURE(nPlcIndex+1 <= Count(), "Ww1Footnotes");
    1328           0 :         nPlcIndex++;
    1329           0 :     }
    1330             :     void Start(Ww1Shell&, Ww1Manager&);
    1331             :     void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
    1332             : };
    1333             : 
    1334             : /////////////////////////////////////////////////////////////////// Sep
    1335           0 : class Ww1Sep : public Ww1PlcSep
    1336             : {
    1337             :     Ww1HeaderFooter aHdd;
    1338             :     sal_uInt16 nPlcIndex;
    1339             : public:
    1340           0 :     Ww1Sep(Ww1Fib& rFibL, sal_uInt16 grpfIhdt)
    1341           0 :     : Ww1PlcSep(rFibL), aHdd(rFibL, grpfIhdt), nPlcIndex(0) {}
    1342             : 
    1343           0 :     Ww1HeaderFooter& GetHdd()   { return aHdd; }
    1344           0 :     void operator++()        { nPlcIndex++; }
    1345           0 :     sal_uInt8* GetData()            { return Ww1PlcSep::GetData(nPlcIndex); }
    1346             :     // innerhalb des textes
    1347           0 :     sal_uLong Where()               { return Ww1PlcSep::Where(nPlcIndex); }
    1348           0 :     void SetGrpfIhdt(sal_uInt8 grpfIhdt)
    1349             :     {
    1350           0 :         GetHdd().SetGrpfIhdt(grpfIhdt);
    1351           0 :     }
    1352             :     void Start(Ww1Shell&, Ww1Manager&);
    1353           0 :     void Stop(Ww1Shell& rOut, Ww1Manager& rMan, sal_Unicode& c)
    1354           0 :         { aHdd.Stop(rOut, rMan, c); }
    1355             : };
    1356             : 
    1357             : /////////////////////////////////////////////////////////////////// Pap
    1358             : class Ww1Pap : public Ww1PlcPap
    1359             : {
    1360             :     sal_uInt16 nPlcIndex;
    1361             :     sal_uInt16 nPushedPlcIndex;
    1362             :     sal_uInt16 nFkpIndex;
    1363             :     sal_uInt16 nPushedFkpIndex;
    1364             :     sal_uLong ulOffset;
    1365             :     Ww1FkpPap* pPap;
    1366             : 
    1367             :     sal_Bool FindSprm(sal_uInt16 nId, sal_uInt8* pStart, sal_uInt8* pEnd);
    1368           0 :     void UpdateIdx()
    1369             :     {
    1370           0 :         if (pPap && nFkpIndex >= pPap->Count() )
    1371             :         {
    1372           0 :             delete pPap;
    1373           0 :             pPap = NULL;
    1374           0 :             nPlcIndex++;
    1375             :         }
    1376           0 :         if( !pPap )
    1377           0 :             Where();
    1378           0 :     }
    1379             :     sal_Bool HasId0(sal_uInt16 nId);
    1380             : 
    1381             : public:
    1382             :     Ww1Pap(Ww1Fib& rFib);
    1383           0 :     ~Ww1Pap()   { delete pPap; }
    1384             :     sal_uLong Where( sal_Bool bSetIndex = sal_True ); // innerhalb des textes
    1385             :     void operator++();
    1386           0 :     sal_Bool FillStart(sal_uInt8*& pB, sal_uInt16& nSize)
    1387             :     {
    1388           0 :         UpdateIdx();
    1389           0 :         return pPap->Fill(nFkpIndex, pB, nSize);
    1390             :     }
    1391           0 :     sal_Bool FillStop(sal_uInt8*& pB, sal_uInt16& nSize)
    1392             :     {
    1393           0 :         return nFkpIndex ? pPap->Fill(nFkpIndex-1, pB, nSize) : sal_False;
    1394             :     }
    1395             :     void Start(Ww1Shell&, Ww1Manager&);
    1396             :     void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
    1397             :     void Seek(sal_uLong);
    1398           0 :     void Push(sal_uLong ulOffsetTmp = 0)
    1399             :     {
    1400             :         OSL_ENSURE(!Pushed(), "Ww1Pap");
    1401           0 :         nPushedPlcIndex = nPlcIndex;
    1402           0 :         nPushedFkpIndex = nFkpIndex;
    1403           0 :         Seek(ulOffsetTmp);
    1404           0 :         ulOffset = ulOffsetTmp;
    1405           0 :         delete pPap;
    1406           0 :         pPap = NULL;
    1407           0 :     }
    1408             :     sal_Bool Pushed()
    1409             :     {
    1410             :         return nPushedPlcIndex != 0xffff;
    1411             :     }
    1412           0 :     void Pop()
    1413             :     {
    1414             :         OSL_ENSURE(Pushed(), "Ww1Pap");
    1415           0 :         ulOffset = 0;
    1416           0 :         nPlcIndex = nPushedPlcIndex;
    1417           0 :         nFkpIndex = nPushedFkpIndex;
    1418           0 :         nPushedPlcIndex = 0xffff;
    1419           0 :         nPushedFkpIndex = 0xffff;
    1420           0 :         delete pPap;
    1421           0 :         pPap = NULL;
    1422           0 :         Where( sal_False );
    1423           0 :     }
    1424             :     sal_Bool HasId(sal_uInt16 nId);
    1425             : };
    1426             : 
    1427             : /////////////////////////////////////////////////////////////////// Chp
    1428             : class Ww1Chp : public Ww1PlcChp
    1429             : {
    1430             :     sal_uInt16 nPlcIndex;
    1431             :     sal_uInt16 nPushedPlcIndex;
    1432             :     sal_uInt16 nFkpIndex;
    1433             :     sal_uInt16 nPushedFkpIndex;
    1434             :     sal_uLong ulOffset;
    1435             :     Ww1FkpChp* pChp;
    1436           0 :     void UpdateIdx()
    1437             :     {
    1438           0 :         if (pChp && nFkpIndex >= pChp->Count() )
    1439             :         {
    1440           0 :             delete pChp;
    1441           0 :             pChp = NULL;
    1442           0 :             nPlcIndex++;
    1443             :         }
    1444           0 :         if( !pChp )
    1445           0 :             Where();
    1446           0 :     }
    1447             : 
    1448             : public:
    1449             :     Ww1Chp( Ww1Fib& rFib );
    1450           0 :     ~Ww1Chp()   { delete pChp; }
    1451             :     sal_uLong Where( sal_Bool bSetIndex = sal_True ); // innerhalb des textes
    1452             :     void operator++();
    1453           0 :     sal_Bool FillStart(W1_CHP& rChp)
    1454             :     {
    1455           0 :         UpdateIdx();
    1456           0 :         return pChp->Fill(nFkpIndex, rChp);
    1457             :     }
    1458           0 :     sal_Bool FillStop(W1_CHP& rChp)
    1459           0 :     { 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           0 :     void Push(sal_uLong ulOffsetTmp = 0)
    1464             :     {
    1465             :         OSL_ENSURE(!Pushed(), "Ww1Chp");
    1466           0 :         nPushedPlcIndex = nPlcIndex;
    1467           0 :         nPushedFkpIndex = nFkpIndex;
    1468           0 :         Seek(ulOffsetTmp);
    1469           0 :         ulOffset = ulOffsetTmp;
    1470           0 :         delete pChp;
    1471           0 :         pChp = NULL;
    1472           0 :     }
    1473             :     sal_Bool Pushed()               { return nPushedPlcIndex != 0xffff; }
    1474           0 :     void Pop()
    1475             :     {
    1476             :         OSL_ENSURE(Pushed(), "Ww1Chp");
    1477           0 :         ulOffset = 0;
    1478           0 :         nPlcIndex = nPushedPlcIndex;
    1479           0 :         nFkpIndex = nPushedFkpIndex;
    1480           0 :         nPushedPlcIndex = 0xffff;
    1481           0 :         nPushedFkpIndex = 0xffff;
    1482           0 :         delete pChp;
    1483           0 :         pChp = NULL;
    1484           0 :         Where( sal_False );
    1485           0 :     }
    1486             : };
    1487             : 
    1488             : /////////////////////////////////////////////////////////////// Manager
    1489             : //
    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.
    1493             : //
    1494           0 : class Ww1Manager
    1495             : {
    1496             :     sal_Bool bOK;
    1497             :     bool bInTtp;
    1498             :     bool bInStyle;
    1499             :     bool bStopAll;
    1500             :     Ww1Fib aFib;
    1501             :     Ww1Dop aDop;
    1502             :     Ww1Fonts aFonts;
    1503             : // ab jetzt alles paarig, fuer 'pushed':
    1504             :     Ww1DocText aDoc;
    1505             :     Ww1PlainText* pDoc;
    1506             :     sal_uLong ulDocSeek;
    1507             :     sal_uLong* pSeek;
    1508             :     Ww1TextFields aFld;
    1509             :     Ww1Fields* pFld;
    1510             : // selbst 'push'bar:
    1511             :     Ww1Chp aChp;
    1512             :     Ww1Pap aPap;
    1513             : // nicht in textbereichen vorhanden, wenn ge'pushed'
    1514             :     Ww1Footnotes aFtn;
    1515             :     Ww1Bookmarks aBooks;
    1516             :     Ww1Sep aSep;
    1517             : 
    1518             :     void OutStop( Ww1Shell&, sal_Unicode );
    1519             :     void OutStart( Ww1Shell& );
    1520             :     void Out(Ww1Shell&, sal_Unicode );
    1521             : 
    1522             : public:
    1523             :     Ww1Manager(SvStream& rStrm, sal_uLong nFieldFlgs);
    1524           0 :     sal_Bool GetError() const       { return !bOK; }
    1525             : 
    1526             : // Fuer Tabellen
    1527           0 :     void SetInTtp(bool bSet = true)     { bInTtp = bSet; }
    1528           0 :     bool IsInTtp() const                { return bInTtp; }
    1529           0 :     void SetInStyle(bool bSet = true)   { bInStyle = bSet; }
    1530           0 :     bool IsInStyle() const              { return bInStyle; }
    1531           0 :     void SetStopAll(bool bSet = true)   { bStopAll = bSet; }
    1532           0 :     bool IsStopAll() const              { return bStopAll; }
    1533             :     sal_Bool HasInTable();
    1534             :     sal_Bool HasTtp();
    1535             :     sal_Bool LastHasTtp();
    1536             : 
    1537             : // Fuer Flys
    1538             :     sal_Bool HasPPc();
    1539             :     sal_Bool HasPDxaAbs();
    1540             : 
    1541           0 :     Ww1Fib& GetFib()                    { return aFib; }
    1542           0 :     Ww1PlainText& GetText()             { return *pDoc; }
    1543           0 :     Ww1Dop& GetDop()                    { return aDop; }
    1544           0 :     Ww1Sep& GetSep()                    { return aSep; }
    1545             :     // innerhalb des textes
    1546           0 :     sal_uLong Where()                       { return pDoc->Where(); }
    1547           0 :     void Fill( sal_Unicode& rChr )      { pDoc->Out( rChr ); }
    1548           0 :     sal_uInt8 Fill( String& rStr, sal_uLong ulLen)
    1549             :     {
    1550           0 :         ulLen += pDoc->Where();
    1551           0 :         return sal::static_int_cast< sal_uInt8 >(pDoc->Out(rStr, ulLen));
    1552             :     }
    1553             :     SvxFontItem GetFont(sal_uInt16 nFCode);
    1554             :     friend Ww1Shell& operator <<(Ww1Shell&, Ww1Manager&);
    1555             :     friend std::ostream& operator <<(std::ostream&, Ww1Manager&);
    1556           0 :     sal_Bool Pushed()                       { return pDoc != &aDoc; }
    1557             :     void Pop();
    1558             :     void Push0(Ww1PlainText* pDoc, sal_uLong, Ww1Fields* = 0);
    1559             :     void Push1(Ww1PlainText* pDoc, sal_uLong ulSeek, sal_uLong ulSeek2 = 0,
    1560             :                Ww1Fields* = 0);
    1561             : };
    1562             : 
    1563             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10