LCOV - code coverage report
Current view: top level - sw/source/filter/ww1 - w1class.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 444 0.0 %
Date: 2014-04-11 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 <rtl/ustring.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             : // If possible, methods with similar functionality were given similar
      69             : // names in this module. The names were taken from ww filter, if
      70             : // possible.
      71             : // Where() returns an element's position. This can be either a seek
      72             : // position in the stream or a relative offset inside the text, since
      73             : // these are mixed up in Word. The methods' comments indicate which of
      74             : // these options they apply to.
      75             : // Count() returns the number of elements. Be careful with n/n-1
      76             : // fields (Word likes to store structures in double arrays, with the
      77             : // first one containing n elements, and the second one n-1.
      78             : // Fill() fills passed references with data from Word structures.
      79             : // GetData() returns pointers to the data range
      80             : // Start(), Stop(), Out(), op<< see module w1filter
      81             : // Dump() see module w1dump
      82             : 
      83             : // file information block: root of the evil: it's at the start of the
      84             : // file (seek(0)) and contains all positions of the structures of the
      85             : // file.
      86             : class Ww1Fib
      87             : {
      88             :     W1_FIB aFib;
      89             :     sal_Bool bOK;
      90             :     SvStream& rStream;
      91             : public:
      92             :     Ww1Fib(SvStream&);
      93             :     friend std::ostream& operator <<(std::ostream&, Ww1Fib&);
      94           0 :     W1_FIB& GetFIB()        { return aFib; }
      95           0 :     sal_Bool GetError()         { return !bOK; }
      96           0 :     SvStream& GetStream()   { return rStream; }
      97             : };
      98             : 
      99             : // document property: properties of the entire document
     100             : class Ww1Dop
     101             : {
     102             :     W1_DOP aDop;
     103             :     Ww1Fib& rFib;
     104             :     sal_Bool bOK;
     105             : public:
     106             :     Ww1Dop(Ww1Fib&);
     107             :     sal_Bool GetError() {
     108             :         return !bOK; }
     109           0 :     W1_DOP& GetDOP() {
     110           0 :         return aDop; }
     111             :     friend std::ostream& operator <<(std::ostream&, Ww1Dop&);
     112             :     void Out(Ww1Shell&);
     113             : };
     114             : 
     115             : // ww-files can contain several blocks of text (main-text,
     116             : // footnotes etc). PlainText unifies the overlaps
     117             : class Ww1PlainText
     118             : {
     119             : protected:
     120             :     Ww1Fib& rFib;
     121             :     sal_uLong ulFilePos;
     122             :     sal_uLong ulCountBytes;
     123             :     sal_uLong ulSeek;
     124             :     sal_Bool bOK;
     125             : public:
     126             :     Ww1PlainText(Ww1Fib& rWwFib, sal_uLong nFilePos, sal_uLong nCountBytes);
     127             :     // within the text
     128           0 :     sal_uLong Where() const                 { return ulSeek; }
     129           0 :     void Seek( sal_uLong ulNew )
     130             :         {
     131             :             OSL_ENSURE(ulNew < ulCountBytes, "Ww1PlainText");
     132           0 :             if (ulNew < ulCountBytes)
     133           0 :                 ulSeek = ulNew;
     134           0 :         }
     135             : 
     136           0 :     sal_uLong Count() const                 { return ulCountBytes; }
     137           0 :     void SetCount(sal_uLong ulNew)
     138             :         {
     139           0 :             ulNew += ulSeek;
     140           0 :             if (ulCountBytes > ulNew)
     141           0 :                 ulCountBytes = ulNew;
     142           0 :         }
     143           0 :     void operator++()
     144             :     {
     145             :         OSL_ENSURE(ulSeek+1<ulCountBytes, "Ww1PlainText");
     146           0 :         ulSeek++;
     147           0 :     }
     148           0 :     sal_Bool GetError()                     { return !bOK; }
     149             :     sal_Unicode Out( Ww1Shell&, sal_uLong& );
     150             :     sal_Unicode Out( OUString&, sal_uLong=0xffffffff);
     151             :     sal_Unicode Out( sal_Unicode& );
     152             :     friend std::ostream& operator <<(std::ostream&, Ww1PlainText&);
     153             :     OUString& Fill( OUString&, sal_uLong=0, sal_uLong=0xffffffff );
     154             :     sal_Unicode operator []( sal_uLong );
     155             :     OUString GetText( sal_uLong ulOffset, sal_uLong nLen ) const;
     156             : 
     157             :     enum Consts { MinChar = 32 };
     158           0 :     static bool IsChar( sal_Unicode c )     { return c >= MinChar; }
     159             : };
     160             : 
     161             : class Ww1DocText : public Ww1PlainText
     162             : {
     163             : public:
     164           0 :     Ww1DocText(Ww1Fib& rFibL) :
     165           0 :         Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet(),
     166           0 :          rFibL.GetFIB().ccpTextGet()) {
     167           0 :         }
     168             : };
     169             : 
     170             : class Ww1FtnText : public Ww1PlainText
     171             : {
     172             : public:
     173           0 :     sal_uLong Offset(Ww1Fib& rFibL) {
     174           0 :         return rFibL.GetFIB().ccpTextGet(); }
     175           0 :     Ww1FtnText(Ww1Fib& rFibL) :
     176           0 :         Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
     177           0 :          Offset(rFibL), rFibL.GetFIB().ccpFtnGet()) {
     178           0 :         }
     179             : };
     180             : 
     181             : class Ww1HddText : public Ww1PlainText
     182             : {
     183             : public:
     184           0 :     sal_uLong Offset(Ww1Fib& rFibL) {
     185           0 :         return rFibL.GetFIB().ccpTextGet() + rFibL.GetFIB().ccpFtnGet(); }
     186           0 :     Ww1HddText(Ww1Fib& rFibL) :
     187           0 :         Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
     188           0 :          Offset(rFibL), rFibL.GetFIB().ccpHddGet()) {
     189           0 :         }
     190             : };
     191             : 
     192             : class Ww1McrText : public Ww1PlainText
     193             : {
     194             : public:
     195             :     sal_uLong Offset(Ww1Fib& rFibL) {
     196             :         return rFibL.GetFIB().ccpTextGet() + rFibL.GetFIB().ccpFtnGet()
     197             :          + rFibL.GetFIB().ccpHddGet(); }
     198             :     Ww1McrText(Ww1Fib& rFibL) :
     199             :         Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
     200             :          Offset(rFibL), rFibL.GetFIB().ccpMcrGet()) {
     201             :         }
     202             : };
     203             : 
     204             : class Ww1AtnText : public Ww1PlainText
     205             : {
     206             : public:
     207             :     sal_uLong Offset(Ww1Fib& rFibL) {
     208             :         return rFibL.GetFIB().ccpTextGet() + rFibL.GetFIB().ccpFtnGet()
     209             :          + rFibL.GetFIB().ccpHddGet() + rFibL.GetFIB().ccpMcrGet(); }
     210             :     Ww1AtnText(Ww1Fib& rFibL) :
     211             :         Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
     212             :          Offset(rFibL), rFibL.GetFIB().ccpAtnGet()) {
     213             :         }
     214             : };
     215             : 
     216             : // a single style or template
     217             : class Ww1Style
     218             : {
     219             :     OUString aName;
     220             :     W1_CHP aChpx;
     221             :     Ww1SprmPapx* pPapx;
     222             :     Ww1StyleSheet* pParent;
     223             :     sal_uInt8 stcBase;
     224             :     sal_uInt8 stcNext;
     225             :     sal_Bool bUsed;
     226             : public:
     227             :     Ww1Style();
     228             :     ~Ww1Style();
     229           0 :     bool IsUsed() const                 { return bUsed; }
     230             :     void SetDefaults(sal_uInt8);
     231           0 :     void SetParent(Ww1StyleSheet* newParent)    { pParent = newParent; }
     232           0 :     void SetName(const OUString& rName)   { bUsed = sal_True; aName = rName; }
     233           0 :     const OUString& GetName() const       { return aName; }
     234             :     Ww1Style& GetBase();
     235           0 :     sal_uInt16 GetnBase() const             { return stcBase; }
     236           0 :     sal_uInt16 GetnNext() const             { return stcNext; }
     237             :     sal_uInt16 ReadName(sal_uInt8*&, sal_uInt16&, sal_uInt16 stc);
     238             :     sal_uInt16 ReadChpx(sal_uInt8*&, sal_uInt16&);
     239             :     sal_uInt16 ReadPapx(sal_uInt8*&, sal_uInt16&);
     240             :     sal_uInt16 ReadEstcp(sal_uInt8*&, sal_uInt16&);
     241             :     friend std::ostream& operator <<(std::ostream&, Ww1Style&);
     242             :     void Out(Ww1Shell&, Ww1Manager&);
     243             : };
     244             : 
     245             : // collection of all templates (max. 256)
     246           0 : class Ww1StyleSheet
     247             : {
     248             :     Ww1Style aStyles[256];
     249             :     sal_uInt16 cstcStd; // count style code standard
     250             :     Ww1Fib& rFib;
     251             :     sal_Bool bOK;
     252             :     sal_uInt16 ReadNames(sal_uInt8*&, sal_uInt16&);
     253             :     sal_uInt16 ReadChpx(sal_uInt8*&, sal_uInt16&);
     254             :     sal_uInt16 ReadPapx(sal_uInt8*&, sal_uInt16&);
     255             :     sal_uInt16 ReadEstcp(sal_uInt8*&, sal_uInt16&);
     256             : 
     257             :     void OutDefaults(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc);
     258             :     void OutOne(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc);
     259             :     void OutOneWithBase(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc,
     260             :                         sal_uInt8* pbStopRecur );
     261             : public:
     262             :     Ww1StyleSheet(Ww1Fib& rFib);
     263           0 :     Ww1Style& GetStyle(sal_uInt16 stc) {
     264           0 :         return aStyles[stc]; }
     265           0 :     sal_uInt16 Count() {
     266           0 :         return 256; }
     267             :     friend std::ostream& operator <<(std::ostream&, Ww1StyleSheet&);
     268             :     void Out(Ww1Shell&, Ww1Manager&);
     269             :     friend class Ww1Style;
     270             :     sal_Bool GetError() {
     271             :         return !bOK; }
     272             : };
     273             : 
     274             : // ww only knows font numbers during formatting. Independently, there
     275             : // is an array of fonts, so that the number can be converted to a
     276             : // specific font.
     277             : class Ww1Fonts
     278             : {
     279             : protected:
     280             :     W1_FFN** pFontA; // Array of Pointers to Font Description
     281             :     Ww1Fib& rFib;
     282             :     sal_uLong nFieldFlags;
     283             :     sal_uInt16 nMax; // Array size
     284             :     sal_Bool bOK;
     285             : public:
     286             :     Ww1Fonts(Ww1Fib&, sal_uLong nFieldFlgs);
     287           0 :     ~Ww1Fonts() {
     288           0 :         if (pFontA)
     289           0 :             DELETEZ(pFontA[0]);
     290           0 :         DELETEZ(pFontA); }
     291             :     W1_FFN* GetFFN(sal_uInt16 nNum);
     292             :     sal_uInt16 Count() {
     293             :         return nMax; }
     294             :     friend std::ostream& operator <<(std::ostream&, Ww1Fonts&);
     295             :     sal_Bool GetError() {
     296             :         return !bOK; }
     297             :     SvxFontItem GetFont(sal_uInt16);
     298             : };
     299             : 
     300             : // SingleSprm
     301             : // These classes replace aSprmTab etc. from ww6 filter. The function
     302             : // pointers are virtual methods. There exist derived classes for
     303             : // specific types (byte, word, var-sized etc.). They have methods for
     304             : // determining their sizes, for dumping and outputting the Sprms to
     305             : // the shell.
     306             : // The classes get created with new (in InitTab()) and added to the
     307             : // table according to their code. For activating them the respective
     308             : // method has to be called on an object in the table.
     309             : // Take note: SingleSprms only describe Sprms, they don't carry their
     310             : // content, which must be passed to the individual methods such as
     311             : // Size, Dump and Start/Stop.
     312             : class Ww1SingleSprm
     313             : {
     314             : public:
     315             : #ifdef DUMP
     316             :     // The vtab only contains the virtual methods; we hide them
     317             :     // depending on what we compile for (dumper or filter). This saves
     318             :     // space. Furthermore, these method's implementations live in
     319             :     // different modules which only get compiled and linked when
     320             :     // required by the respective project. The name string is only
     321             :     // required by the dumper -- let's not include it in the filter.
     322             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     323             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     324             :     virtual std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     325             :     const sal_Char* sName;
     326             : #else
     327             :     virtual void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     328             :     virtual void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
     329             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     330             : #endif
     331             :     virtual sal_uInt16 Size(sal_uInt8*);
     332             :     sal_uInt16 nCountBytes;
     333             : 
     334           0 :     Ww1SingleSprm(sal_uInt16 nBytes, const sal_Char* /*pName*/ = 0 )
     335           0 :         : nCountBytes(nBytes)
     336             : #ifdef DUMP
     337             :         , sName( pName)
     338             : #endif
     339             :         {
     340           0 :         }
     341             :     virtual ~Ww1SingleSprm();
     342             : };
     343             : 
     344           0 : class Ww1SingleSprmByteSized : public Ww1SingleSprm {
     345             : public:
     346             :     sal_uInt16 Size(sal_uInt8*) SAL_OVERRIDE;
     347           0 :     Ww1SingleSprmByteSized(sal_uInt16 nBytes, sal_Char* sName = 0) :
     348           0 :         Ww1SingleSprm(nBytes, sName) {
     349           0 :         }
     350             : };
     351             : 
     352           0 : class Ww1SingleSprmWordSized : public Ww1SingleSprm {
     353             : public:
     354             :     sal_uInt16 Size(sal_uInt8*) SAL_OVERRIDE;
     355           0 :     Ww1SingleSprmWordSized(sal_uInt16 nBytes, sal_Char* sName = 0) :
     356           0 :         Ww1SingleSprm(nBytes, sName) {
     357           0 :         }
     358             : };
     359             : 
     360           0 : class Ww1SingleSprmByte : public Ww1SingleSprm {
     361             : public:
     362             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     363           0 :     Ww1SingleSprmByte(sal_Char* sName = 0) :
     364           0 :         Ww1SingleSprm(1, sName) {
     365           0 :         }
     366             : };
     367             : 
     368           0 : class Ww1SingleSprmBool : public Ww1SingleSprmByte {
     369             : public:
     370             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     371           0 :     Ww1SingleSprmBool(sal_Char* sName = 0) :
     372           0 :         Ww1SingleSprmByte(sName) {
     373           0 :         }
     374             : };
     375             : 
     376           0 : class Ww1SingleSprm4State : public Ww1SingleSprmByte {
     377             : public:
     378             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     379           0 :     Ww1SingleSprm4State(sal_Char* sName = 0) :
     380           0 :         Ww1SingleSprmByte(sName) {
     381           0 :         }
     382             : };
     383             : 
     384           0 : class Ww1SingleSprmWord : public Ww1SingleSprm {
     385             : public:
     386             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     387           0 :     Ww1SingleSprmWord(sal_Char* sName = 0)
     388           0 :     : Ww1SingleSprm(2, sName) {}
     389             : };
     390             : 
     391             : class Ww1SingleSprmLong : public Ww1SingleSprm {
     392             : public:
     393             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     394             :     Ww1SingleSprmLong(sal_Char* sName = 0) :
     395             :         Ww1SingleSprm(4, sName) {
     396             :         }
     397             : };
     398             : 
     399           0 : class Ww1SingleSprmTab : public Ww1SingleSprm {
     400             : public:
     401             :     std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
     402             :     sal_uInt16 Size(sal_uInt8*) SAL_OVERRIDE;
     403           0 :     Ww1SingleSprmTab(sal_uInt16 nBytes, sal_Char* sName = 0) :
     404           0 :         Ww1SingleSprm(nBytes, sName) {
     405           0 :         }
     406             : };
     407             : 
     408           0 : class Ww1SingleSprmPJc : public Ww1SingleSprmByte {
     409             : public:
     410           0 :     Ww1SingleSprmPJc(sal_Char* sName) :
     411           0 :         Ww1SingleSprmByte(sName) {
     412           0 :         }
     413             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     414             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     415             : };
     416             : 
     417           0 : class Ww1SingleSprmPDxa : public Ww1SingleSprmWord {
     418             : public:
     419           0 :     Ww1SingleSprmPDxa(sal_Char* sName) :
     420           0 :         Ww1SingleSprmWord(sName) {
     421           0 :         }
     422             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     423             : };
     424             : 
     425           0 : class Ww1SingleSprmPDxaRight : public Ww1SingleSprmPDxa {
     426             : public:
     427           0 :     Ww1SingleSprmPDxaRight(sal_Char* sName) :
     428           0 :         Ww1SingleSprmPDxa(sName) {
     429           0 :         }
     430             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     431             : };
     432             : 
     433           0 : class Ww1SingleSprmPDxaLeft : public Ww1SingleSprmPDxa {
     434             : public:
     435           0 :     Ww1SingleSprmPDxaLeft(sal_Char* sName) :
     436           0 :         Ww1SingleSprmPDxa(sName) {
     437           0 :         }
     438             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     439             : };
     440             : 
     441           0 : class Ww1SingleSprmPDxaLeft1 : public Ww1SingleSprmPDxa {
     442             : public:
     443           0 :     Ww1SingleSprmPDxaLeft1(sal_Char* sName) :
     444           0 :         Ww1SingleSprmPDxa(sName) {
     445           0 :         }
     446             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     447             : };
     448             : 
     449           0 : class Ww1SingleSprmPFKeep : public Ww1SingleSprmBool {
     450             : public:
     451           0 :     Ww1SingleSprmPFKeep(sal_Char* sName) :
     452           0 :         Ww1SingleSprmBool(sName) {
     453           0 :         }
     454             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     455             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     456             : };
     457             : 
     458           0 : class Ww1SingleSprmPFKeepFollow : public Ww1SingleSprmBool {
     459             : public:
     460           0 :     Ww1SingleSprmPFKeepFollow(sal_Char* sName) :
     461           0 :         Ww1SingleSprmBool(sName) {
     462           0 :         }
     463             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     464             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     465             : };
     466             : 
     467           0 : class Ww1SingleSprmPPageBreakBefore : public Ww1SingleSprmBool {
     468             : public:
     469           0 :     Ww1SingleSprmPPageBreakBefore(sal_Char* sName) :
     470           0 :         Ww1SingleSprmBool(sName) {
     471           0 :         }
     472             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     473             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     474             : };
     475             : 
     476           0 : class Ww1SingleSprmPBrc : public Ww1SingleSprmWord {
     477             : protected:
     478             :     // specific start routines, supplied with different BoxItems
     479             :     // depending on sprm
     480             :     void Start(Ww1Shell&, sal_uInt8, W1_BRC10*, sal_uInt16, Ww1Manager&, SvxBoxItem&);
     481             :     void Start(Ww1Shell&, sal_uInt8, W1_BRC*, sal_uInt16, Ww1Manager&, SvxBoxItem&);
     482             : 
     483             :     using Ww1SingleSprm::Start;
     484             : 
     485             : public:
     486           0 :     Ww1SingleSprmPBrc(sal_Char* sName) :
     487           0 :         Ww1SingleSprmWord(sName) {
     488           0 :         }
     489             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     490             :     // SetBorder() is needed for tables, too. That's why it's public
     491             :     static editeng::SvxBorderLine* SetBorder(editeng::SvxBorderLine*, W1_BRC10*);
     492             : };
     493             : 
     494             : #define BRC_TOP ((sal_uInt16)0)
     495             : #define BRC_LEFT ((sal_uInt16)1)
     496             : #define BRC_BOTTOM ((sal_uInt16)2)
     497             : #define BRC_RIGHT ((sal_uInt16)3)
     498             : #define BRC_ANZ ((sal_uInt16)BRC_RIGHT-BRC_TOP+1)
     499             : 
     500             : // The BRC structure for 1.0 versions of Word differ from the ones in
     501             : // later versions. Luckily, they will be queried by other sprms.
     502             : // SH: From now on, all 4 borders handled by a single class.
     503           0 : class Ww1SingleSprmPBrc10 : public Ww1SingleSprmPBrc
     504             : {
     505             :     sal_uInt16 nLine;   // BRC_TOP, BRC_LEFT, ...
     506             : 
     507             :     using Ww1SingleSprmPBrc::Start;
     508             : 
     509             : public:
     510           0 :     Ww1SingleSprmPBrc10(sal_uInt16 nL, sal_Char* sName)
     511           0 :     : Ww1SingleSprmPBrc(sName), nLine(nL) {}
     512             : 
     513             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     514             : };
     515             : 
     516           0 : class Ww1SingleSprmParaSpace : public Ww1SingleSprmWord {
     517             : public:
     518           0 :     Ww1SingleSprmParaSpace(sal_Char* sName)
     519           0 :     : Ww1SingleSprmWord(sName) {}
     520             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     521             : };
     522             : 
     523           0 : class Ww1SingleSprmPDyaBefore : public Ww1SingleSprmParaSpace {
     524             : public:
     525           0 :     Ww1SingleSprmPDyaBefore(sal_Char* sName)
     526           0 :     : Ww1SingleSprmParaSpace(sName) {}
     527             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     528             : };
     529             : 
     530           0 : class Ww1SingleSprmPDyaAfter : public Ww1SingleSprmParaSpace {
     531             : public:
     532           0 :     Ww1SingleSprmPDyaAfter(sal_Char* sName) :
     533           0 :         Ww1SingleSprmParaSpace(sName) {
     534           0 :         }
     535             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     536             : };
     537             : 
     538           0 : class Ww1SingleSprmPDyaLine : public Ww1SingleSprmWord {
     539             : public:
     540           0 :     Ww1SingleSprmPDyaLine(sal_Char* sName) :
     541           0 :         Ww1SingleSprmWord(sName) {
     542           0 :         }
     543             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     544             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     545             : };
     546             : 
     547           0 : class Ww1SingleSprmPChgTabsPapx : public Ww1SingleSprmByteSized {
     548             : public:
     549           0 :     Ww1SingleSprmPChgTabsPapx(sal_Char* sName) :
     550           0 :         Ww1SingleSprmByteSized(0, sName) {
     551           0 :         }
     552             :     // Size() is not yet activated!
     553             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     554             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     555             : };
     556             : 
     557           0 : class Ww1SingleSprmSGprfIhdt : public Ww1SingleSprmByte {
     558             : public:
     559           0 :     Ww1SingleSprmSGprfIhdt(sal_Char* sName) :
     560           0 :         Ww1SingleSprmByte(sName) {
     561           0 :         }
     562             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     563             : };
     564             : 
     565           0 : class Ww1SingleSprmSColumns : public Ww1SingleSprmWord {
     566             : public:
     567           0 :     Ww1SingleSprmSColumns(sal_Char* sName) :
     568           0 :         Ww1SingleSprmWord(sName) {
     569           0 :         }
     570             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     571             : };
     572             : 
     573           0 : class Ww1SingleSprmPFInTable : public Ww1SingleSprmBool {
     574             : public:
     575           0 :     Ww1SingleSprmPFInTable(sal_Char* sName) :
     576           0 :         Ww1SingleSprmBool(sName) {
     577           0 :         }
     578             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     579             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     580             : };
     581             : 
     582           0 : class Ww1SingleSprmPTtp : public Ww1SingleSprmBool {
     583             : public:
     584           0 :     Ww1SingleSprmPTtp(sal_Char* sName) :
     585           0 :         Ww1SingleSprmBool(sName) {
     586           0 :         }
     587             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     588             :     void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     589             : };
     590             : 
     591             : class Ww1SingleSprmTJc : public Ww1SingleSprmWord {
     592             : public:
     593             :     Ww1SingleSprmTJc(sal_Char* sName)
     594             :     : Ww1SingleSprmWord(sName) {}
     595             : };
     596             : 
     597           0 : class Ww1SingleSprmTDxaGapHalf : public Ww1SingleSprmWord {
     598             : public:
     599             :     Ww1SingleSprmTDxaGapHalf(sal_Char* sName) :
     600             :         Ww1SingleSprmWord(sName) {
     601             :         }
     602             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     603             : };
     604             : 
     605           0 : class Ww1SingleSprmTDefTable10 : public Ww1SingleSprmWordSized {
     606             : public:
     607           0 :     Ww1SingleSprmTDefTable10(sal_Char* sName) :
     608           0 :         Ww1SingleSprmWordSized(0, sName) {
     609           0 :         }
     610             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     611             : };
     612             : 
     613           0 : class Ww1SingleSprmTDyaRowHeight : public Ww1SingleSprmWord {
     614             : public:
     615             :     Ww1SingleSprmTDyaRowHeight(sal_Char* sName) :
     616             :         Ww1SingleSprmWord(sName) {
     617             :         }
     618             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     619             : };
     620             : 
     621             : // Class definitions for table fastsave attributes
     622             : // Because we don't support fastsave, we don't need it
     623             : 
     624             : // Class definitions for Apos ( == Flys )
     625             : 
     626           0 : class Ww1SingleSprmPpc : public Ww1SingleSprmByte {
     627             : public:
     628           0 :     Ww1SingleSprmPpc(sal_Char* sName) :
     629           0 :         Ww1SingleSprmByte(sName) {
     630           0 :         }
     631             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     632             : };
     633             : 
     634           0 : class Ww1SingleSprmPDxaAbs : public Ww1SingleSprmWord {
     635             : public:
     636           0 :     Ww1SingleSprmPDxaAbs(sal_Char* sName) :
     637           0 :         Ww1SingleSprmWord(sName) {
     638           0 :         }
     639             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     640             : };
     641             : 
     642           0 : class Ww1SingleSprmPDyaAbs : public Ww1SingleSprmWord {
     643             : public:
     644           0 :     Ww1SingleSprmPDyaAbs(sal_Char* sName) :
     645           0 :         Ww1SingleSprmWord(sName) {
     646           0 :         }
     647             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     648             : };
     649             : 
     650           0 : class Ww1SingleSprmPDxaWidth : public Ww1SingleSprmWord {
     651             : public:
     652           0 :     Ww1SingleSprmPDxaWidth(sal_Char* sName) :
     653           0 :         Ww1SingleSprmWord(sName) {
     654           0 :         }
     655             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     656             : };
     657             : 
     658           0 : class Ww1SingleSprmPFromText : public Ww1SingleSprmWord {
     659             : public:
     660           0 :     Ww1SingleSprmPFromText(sal_Char* sName) :
     661           0 :         Ww1SingleSprmWord(sName) {
     662           0 :         }
     663             :     void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
     664             : };
     665             : 
     666             : // The data type Sprm actually appearing in the file
     667             : class Ww1Sprm
     668             : {
     669             :     sal_Bool ReCalc();
     670             :     static Ww1SingleSprm* aTab[256];
     671             :     static Ww1SingleSprm* pSingleSprm;
     672             : protected:
     673             :     static void InitTab();
     674           0 :     Ww1SingleSprm& GetTab(sal_uInt16 nId)
     675             :     {
     676           0 :         if( !pSingleSprm )
     677           0 :             InitTab();
     678           0 :         return aTab[ nId ] ? *aTab[nId] : *pSingleSprm;
     679             :     }
     680             : 
     681             :     sal_uInt8* p;
     682             :     sal_uInt16 nCountBytes;
     683             :     sal_Bool bOK;
     684             :     sal_uInt16* pArr;
     685             :     sal_uInt16 count;
     686             :     // without token, with length byte/word
     687             :     sal_uInt16 GetSize(sal_uInt8 nId, sal_uInt8* pSprm);
     688             :     // with token and length byte
     689           0 :     sal_uInt16 GetSizeBrutto(sal_uInt8* pSprm) {
     690           0 :         sal_uInt8 nId = *pSprm++;
     691           0 :         return GetSize(nId, pSprm) + 1; }
     692             :     // returns for the n-th element id, size & pointer to data:
     693             :     // sal_Bool Fill(sal_uInt16, sal_uInt8&, sal_uInt16&, sal_uInt8*&);
     694             : public:
     695             :     // SH: I need it to be public
     696             :     // returns for the n-th element id, size & pointer to data:
     697             :     sal_Bool Fill(sal_uInt16, sal_uInt8&, sal_uInt16&, sal_uInt8*&);
     698             : 
     699             :     Ww1Sprm(sal_uInt8*, sal_uInt16);
     700             :     Ww1Sprm(SvStream&, sal_uLong);
     701             :     ~Ww1Sprm();
     702             :     friend std::ostream& operator <<(std::ostream&, Ww1Sprm&);
     703             :     void Start(Ww1Shell&, Ww1Manager&);
     704             :     void Start(Ww1Shell&, Ww1Manager&, sal_uInt16);
     705             :     void Stop(Ww1Shell&, Ww1Manager&);
     706           0 :     bool IsUsed() {
     707           0 :         return nCountBytes != 255; }
     708           0 :     sal_uInt16 Count() {
     709           0 :         return count; }
     710             :     sal_Bool GetError() {
     711             :         return !bOK; }
     712             :     static void DeinitTab();
     713             : };
     714             : 
     715             : // the wrapper around the type PIC, a structure, which stands at the beginning
     716             : // of a picture filename or an embedded picture
     717             : class Ww1Picture
     718             : {
     719             :     sal_Bool bOK;
     720             :     W1_PIC* pPic;
     721             : public:
     722             :     Ww1Picture(SvStream&, sal_uLong);
     723           0 :     ~Ww1Picture() {
     724           0 :         }
     725           0 :     sal_Bool GetError() {
     726           0 :         return !bOK; }
     727             :     friend std::ostream& operator <<(std::ostream&, Ww1Picture&);
     728             :     void Out(Ww1Shell&, Ww1Manager&);
     729             :     void WriteBmp(SvStream&);
     730             : };
     731             : 
     732             : // One of the important array structures in ww files. They contain n+1
     733             : // file positions and n attributes applying in between them.
     734             : class Ww1Plc
     735             : {
     736             :     sal_uInt8* p;
     737             :     sal_uInt16 nCountBytes;
     738             :     sal_uInt16 iMac;
     739             :     sal_uInt16 nItemSize;
     740             :     sal_Bool bOK;
     741             : protected:
     742             :     Ww1Fib& rFib;
     743             :     sal_uInt8* GetData(sal_uInt16);
     744             : public:
     745             :     Ww1Plc(Ww1Fib&, sal_uLong, sal_uInt16, sal_uInt16);
     746             :     ~Ww1Plc();
     747             :     friend std::ostream& operator <<(std::ostream&, Ww1Plc&);
     748             :     sal_uLong Where(sal_uInt16); // like in each plc
     749             :     void Seek(sal_uLong, sal_uInt16&);
     750           0 :     void Fill(sal_uInt16 nIndex, sal_uLong& begin, sal_uLong& end) {
     751           0 :         begin = Where(nIndex);
     752           0 :         end = Where(nIndex+1); }
     753           0 :     sal_uInt16 Count() {
     754           0 :         return iMac; }
     755           0 :     sal_Bool GetError() {
     756           0 :         return !bOK; }
     757             : };
     758             : 
     759             : // Size Tabs from Sven:
     760             : //    CHP, PAP, SEP, HED, FNR, FNT
     761             : //Plc 2,   2,   6,   0,   2,   0
     762             : //Fkp 1,   1,   0,   0,   0,   0
     763             : 
     764             : class Ww1PlcGlossary : public Ww1Plc
     765             : {
     766             : public:
     767             :     Ww1PlcGlossary(Ww1Fib& rFibL) :
     768             :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfglsyGet(),
     769             :          rFibL.GetFIB().cbPlcfglsyGet(), 0) {
     770             :         }
     771             : };
     772             : 
     773             : class Ww1PlcAnnotationRef : public Ww1Plc
     774             : {
     775             : public:
     776             :     Ww1PlcAnnotationRef(Ww1Fib& rFibL) :
     777             :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfandRefGet(),
     778             :          rFibL.GetFIB().cbPlcfandRefGet(), 0) {
     779             :         }
     780             : };
     781             : 
     782             : class Ww1PlcAnnotationTxt : public Ww1Plc
     783             : {
     784             : public:
     785             :     Ww1PlcAnnotationTxt(Ww1Fib& rFibL) :
     786             :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfandTxtGet(),
     787             :          rFibL.GetFIB().cbPlcfandTxtGet(), 0) {
     788             :         }
     789             : };
     790             : 
     791             : // PlcAnnotation
     792             : class Ww1Annotation {
     793             :     Ww1PlcAnnotationRef aRef;
     794             :     Ww1PlcAnnotationTxt aTxt;
     795             : public:
     796             :     Ww1Annotation(Ww1Fib& rFib) :
     797             :         aRef(rFib),
     798             :         aTxt(rFib) {
     799             :         }
     800             :     friend std::ostream& operator <<(std::ostream&, Ww1Annotation&);
     801             : };
     802             : 
     803           0 : class Ww1PlcSep : public Ww1Plc
     804             : {
     805             : public:
     806           0 :     Ww1PlcSep(Ww1Fib& rFibL):
     807           0 :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfsedGet(),
     808           0 :          rFibL.GetFIB().cbPlcfsedGet(), 6) {
     809           0 :         }
     810             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcSep&);
     811             : };
     812             : 
     813           0 : class Ww1PlcChp : public Ww1Plc
     814             : {
     815             : public:
     816           0 :     Ww1PlcChp(Ww1Fib& rFibL) :
     817           0 :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfbteChpxGet(),
     818           0 :          rFibL.GetFIB().cbPlcfbteChpxGet(), 2) {
     819           0 :         }
     820             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcChp&);
     821             : };
     822             : 
     823           0 : class Ww1PlcPap : public Ww1Plc
     824             : {
     825             : public:
     826           0 :     Ww1PlcPap(Ww1Fib& rFibL) :
     827           0 :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfbtePapxGet(),
     828           0 :          rFibL.GetFIB().cbPlcfbtePapxGet(), 2) {
     829           0 :         }
     830             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcPap&);
     831             : };
     832             : 
     833           0 : class Ww1PlcFootnoteRef : public Ww1Plc
     834             : {
     835             : public:
     836           0 :     Ww1PlcFootnoteRef(Ww1Fib& rFibL) :
     837           0 :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcffndRefGet(),
     838           0 :          rFibL.GetFIB().cbPlcffndRefGet(), 2) {
     839           0 :         }
     840             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcFootnoteRef&);
     841             : };
     842             : 
     843           0 : class Ww1PlcFootnoteTxt : public Ww1Plc
     844             : {
     845             : public:
     846           0 :     Ww1PlcFootnoteTxt(Ww1Fib& rFibL) :
     847           0 :         Ww1Plc(rFibL, rFibL.GetFIB().fcPlcffndTxtGet(),
     848           0 :          rFibL.GetFIB().cbPlcffndTxtGet(), 0) {
     849           0 :         }
     850             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcFootnoteTxt&);
     851             : };
     852             : 
     853           0 : class Ww1PlcFields : public Ww1Plc
     854             : {
     855             : public:
     856           0 :     Ww1PlcFields(Ww1Fib& rFibL, sal_uLong start, sal_uInt16 nBytes)
     857           0 :         : Ww1Plc(rFibL, start, nBytes, 2)
     858           0 :     {}
     859           0 :     W1_FLD* GetData(sal_uInt16 nIndex)
     860           0 :         { return (W1_FLD*)Ww1Plc::GetData(nIndex); }
     861           0 :     sal_uLong Where(sal_uInt16 nIndex)  // absolute within the file
     862           0 :         { return Ww1Plc::Where(nIndex) + rFib.GetFIB().fcMinGet(); }
     863             :     friend std::ostream& operator <<(std::ostream&, Ww1PlcFields&);
     864             : };
     865             : 
     866             : // PlcBookmarks
     867             : class Ww1StringList
     868             : {
     869             :     sal_Char** pIdxA;
     870             :     sal_uInt16 nMax;
     871             : public:
     872             :     Ww1StringList( SvStream& rSt, sal_uLong nFc, sal_uInt16 nCb );
     873           0 :     ~Ww1StringList()
     874           0 :         {   if( pIdxA ) { delete pIdxA[0]; delete pIdxA; } }
     875             :     const OUString GetStr( sal_uInt16 nNum ) const;
     876             :     sal_uInt16 Count() const    { return nMax; }
     877           0 :     sal_Bool GetError() const   { return (nMax != 0) && !pIdxA; }
     878             : };
     879             : 
     880           0 : class Ww1PlcBookmarkTxt: public Ww1StringList
     881             : {
     882             : public:
     883           0 :     Ww1PlcBookmarkTxt(Ww1Fib& rFib) :
     884           0 :         Ww1StringList( rFib.GetStream(), rFib.GetFIB().fcSttbfbkmkGet(),
     885           0 :                        rFib.GetFIB().cbSttbfbkmkGet() )
     886           0 :     {}
     887             : };
     888             : 
     889           0 : class Ww1PlcBookmarkPos : public Ww1Plc
     890             : {
     891             : public:
     892           0 :     Ww1PlcBookmarkPos(Ww1Fib& _rFib, sal_uLong start, sal_uInt16 nBytes, sal_Bool bEnd)
     893           0 :         : Ww1Plc(_rFib, start, nBytes, (bEnd) ? 0 : 2)
     894           0 :     {}
     895             : 
     896           0 :     sal_uInt8* GetData(sal_uInt16 nIndex)   {   return Ww1Plc::GetData(nIndex); }
     897             :     // Position as CP
     898           0 :     sal_uLong WhereCP(sal_uInt16 nIndex)    { return Ww1Plc::Where(nIndex); }
     899             :     // absolute within the file
     900           0 :     sal_uLong Where(sal_uInt16 nIndex)
     901             :     {
     902           0 :         return ( nIndex < Count() )
     903           0 :                ? Ww1Plc::Where(nIndex) + rFib.GetFIB().fcMinGet()
     904           0 :                : 0xffffffff;
     905             :     }
     906             : };
     907             : 
     908           0 : class Ww1PlcHdd : public Ww1Plc
     909             : {
     910             : public:
     911           0 :     Ww1PlcHdd(Ww1Fib& rFibL)
     912           0 :         : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfhddGet(),
     913           0 :                     rFibL.GetFIB().cbPlcfhddGet(), 0)
     914           0 :     {}
     915             : };
     916             : 
     917             : // Arrays very similar to the plcs; limited to a size of 512 bytes
     918             : class Ww1Fkp
     919             : {
     920             : protected:
     921             :     sal_uInt8 aFkp[512];
     922             :     sal_uInt16 nItemSize;
     923             :     sal_Bool bOK;
     924             :     sal_uInt8* GetData(sal_uInt16);
     925             : public:
     926             :     Ww1Fkp(SvStream&, sal_uLong, sal_uInt16);
     927             :     friend std::ostream& operator <<(std::ostream&, Ww1Fkp&);
     928           0 :     sal_uInt16 Count() const            { return *(aFkp+511); }
     929             :     sal_uLong Where(sal_uInt16); // like in the corresponding fkp
     930             : };
     931             : 
     932             : class Ww1FkpPap : public Ww1Fkp
     933             : {
     934             : public:
     935           0 :     Ww1FkpPap(SvStream& rStream, sal_uLong ulFilePos)
     936           0 :         : Ww1Fkp(rStream, ulFilePos, 1)
     937           0 :     {}
     938             :     friend std::ostream& operator <<(std::ostream&, Ww1FkpPap&);
     939             :     sal_Bool Fill(sal_uInt16,  sal_uInt8*&, sal_uInt16&);
     940             : };
     941             : 
     942             : class Ww1FkpChp : public Ww1Fkp
     943             : {
     944             : #ifdef DUMP
     945             :     SvStream& rStream;
     946             :     SvStream& GetStream()   { return rStream; }
     947             : #endif
     948             : public:
     949           0 :     Ww1FkpChp(SvStream& rStream, sal_uLong ulFilePos)
     950           0 :         : Ww1Fkp(rStream, ulFilePos, 1)
     951             : #ifdef DUMP
     952             :         , rStream(rStream)
     953             : #endif
     954           0 :     {}
     955             : 
     956             :     friend std::ostream& operator <<(std::ostream&, Ww1FkpChp&);
     957             :     sal_Bool Fill(sal_uInt16, W1_CHP&);
     958             : };
     959             : 
     960           0 : class Ww1SprmPapx : public Ww1Sprm
     961             : {
     962             :     W1_PAPX aPapx;
     963             :     sal_uInt8* Sprm(sal_uInt8* p, sal_uInt16 nSize);
     964             :     sal_uInt16 SprmSize(sal_uInt8* p, sal_uInt16 nSize);
     965             : public:
     966             :     Ww1SprmPapx(sal_uInt8* p, sal_uInt16 nSize);
     967             :     friend std::ostream& operator <<(std::ostream&, Ww1SprmPapx&);
     968             :     void Start(Ww1Shell&, Ww1Manager&);
     969             :     void Stop(Ww1Shell&, Ww1Manager&);
     970             : };
     971             : 
     972           0 : class Ww1SprmSep : public Ww1Sprm
     973             : {
     974             : public:
     975           0 :     Ww1SprmSep(Ww1Fib& rFib, sal_uLong ulFilePos)
     976           0 :         : Ww1Sprm(rFib.GetStream(), ulFilePos)
     977           0 :     {}
     978             :     friend std::ostream& operator <<(std::ostream&, Ww1SprmSep&);
     979             : };
     980             : 
     981             : class Ww1Assoc
     982             : {
     983             :     enum fields { FileNext, Dot, Title, Subject, KeyWords, Comments,
     984             :         Author, LastRevBy, DataDoc, HeaderDoc, Criteria1, Criteria2,
     985             :         Criteria3, Criteria4, Criteria5, Criteria6, Criteria7, MaxFields };
     986             : 
     987             :     Ww1Fib& rFib;
     988             :     sal_Char* pBuffer;
     989             :     sal_Char* pStrTbl[ MaxFields ];
     990             :     sal_Bool bOK;
     991             : 
     992             :     OUString GetStr(sal_uInt16);
     993             : 
     994             : public:
     995             :     Ww1Assoc(Ww1Fib&);
     996           0 :     ~Ww1Assoc()             { delete pBuffer; }
     997             :     sal_Bool GetError() const   { return !bOK; }
     998             :     friend std::ostream& operator <<(std::ostream&, Ww1Assoc&);
     999             :     void Out(Ww1Shell&);
    1000             : };
    1001             : 
    1002             : // Header/footer/footnote separators are stored in a separate text one
    1003             : // after the other. A plc partitions these texts into several
    1004             : // parts. They are numbered as ihdd. There are 9 different functions
    1005             : // for these texts. When one of them is requested, it applies to the
    1006             : // first ihdd, the next time to the second and so on. Which type a
    1007             : // given text part will be treated as can only be determined by
    1008             : // reading the file sequentially. The 9 types are: footnote separator,
    1009             : // footnote continuation separator, footnote continuation note, even
    1010             : // page header, odd page header, even page footer, odd page footer,
    1011             : // header and footer for the first page. HeaderFooter remembers the
    1012             : // current setting for each of these (but not the previous one) and
    1013             : // the following ihdd. A part of type 0xffff denotes a non-existing
    1014             : // part.
    1015           0 : class Ww1HeaderFooter : public Ww1PlcHdd
    1016             : {
    1017             :     sal_uInt16 nextIhdd;        // next text part in HddText
    1018             :     sal_uInt16 nFtnSep;         // footnote separator
    1019             :     sal_uInt16 nFtnFollowSep;   // footnote continuation separator
    1020             :     sal_uInt16 nFtnNote;        // footnote continuation note
    1021             :     sal_uInt16 nEvenHeadL;
    1022             :     sal_uInt16 nOddHeadL;
    1023             :     sal_uInt16 nEvenFootL;
    1024             :     sal_uInt16 nOddFootL;
    1025             :     sal_uInt16 nFirstHeadL;
    1026             :     sal_uInt16 nFirstFootL;
    1027             :     enum HeaderFooterMode {
    1028             :         None, FtnSep, FtnFollowSep, FtnNote, EvenHeadL, OddHeadL,
    1029             :         EvenFootL, OddFootL, FirstHeadL, MaxHeaderFooterMode
    1030             :     } eHeaderFooterMode;
    1031             : 
    1032             : public:
    1033           0 :     Ww1HeaderFooter(Ww1Fib& rFibL, sal_uInt16 grpfIhdt)
    1034             :         : Ww1PlcHdd(rFibL),
    1035             :         nextIhdd(0),
    1036             :         nFtnSep(0xffff),
    1037             :         nFtnFollowSep(0xffff),
    1038             :         nFtnNote(0xffff),
    1039             :         nEvenHeadL(0xffff),
    1040             :         nOddHeadL(0xffff),
    1041             :         nEvenFootL(0xffff),
    1042             :         nOddFootL(0xffff),
    1043             :         nFirstHeadL(0xffff),
    1044             :         nFirstFootL(0xffff),
    1045           0 :         eHeaderFooterMode(None)
    1046             :     {
    1047           0 :         if (grpfIhdt & 0x0001) nFtnSep = nextIhdd++;
    1048           0 :         if (grpfIhdt & 0x0002) nFtnFollowSep = nextIhdd++;
    1049           0 :         if (grpfIhdt & 0x0004) nFtnNote = nextIhdd++;
    1050           0 :     }
    1051           0 :     void SetGrpfIhdt(sal_uInt16 grpfIhdt)
    1052             :     {
    1053           0 :         if (grpfIhdt & 0x0001) nEvenHeadL = nextIhdd++;
    1054           0 :         if (grpfIhdt & 0x0002) nOddHeadL = nextIhdd++;
    1055           0 :         if (grpfIhdt & 0x0004) nEvenFootL = nextIhdd++;
    1056           0 :         if (grpfIhdt & 0x0008) nOddFootL = nextIhdd++;
    1057           0 :         if (grpfIhdt & 0x0010) nFirstHeadL = nextIhdd++;
    1058           0 :         if (grpfIhdt & 0x0020) nFirstFootL = nextIhdd++;
    1059             :         OSL_ENSURE(nextIhdd<=Count(), "Ww1HeaderFooter");
    1060           0 :     }
    1061           0 :     sal_Bool operator++()
    1062             :     {
    1063           0 :         sal_Bool bRet = sal_True;
    1064           0 :         eHeaderFooterMode = (HeaderFooterMode)((short)eHeaderFooterMode + 1);
    1065           0 :         if( eHeaderFooterMode == MaxHeaderFooterMode)
    1066             :         {
    1067           0 :             eHeaderFooterMode = None;
    1068           0 :             bRet = sal_False;
    1069             :         }
    1070           0 :         return bRet;
    1071             :     }
    1072             :     sal_Bool FillFtnSep(sal_uLong& begin, sal_uLong& end)
    1073             :     {
    1074             :         if (nFtnSep == 0xffff)
    1075             :             return sal_False;
    1076             :         Fill(nFtnSep, begin, end);
    1077             :         return sal_True;
    1078             :     }
    1079             :     sal_Bool FillFtnFollowSep(sal_uLong& begin, sal_uLong& end)
    1080             :     {
    1081             :         if (nFtnFollowSep == 0xffff)
    1082             :             return sal_False;
    1083             :         Fill(nFtnFollowSep, begin, end);
    1084             :         return sal_True;
    1085             :     }
    1086             :     sal_Bool FillFtnNote(sal_uLong& begin, sal_uLong& end)
    1087             :     {
    1088             :         if (nFtnNote == 0xffff)
    1089             :             return sal_False;
    1090             :         Fill(nFtnNote, begin, end);
    1091             :         return sal_True;
    1092             :     }
    1093             :     sal_Bool FillEvenHeadL(sal_uLong& begin, sal_uLong& end)
    1094             :     {
    1095             :         if (nEvenHeadL == 0xffff)
    1096             :             return sal_False;
    1097             :         Fill(nEvenHeadL, begin, end);
    1098             :         return sal_True;
    1099             :     }
    1100           0 :     sal_Bool FillOddHeadL(sal_uLong& begin, sal_uLong& end)
    1101             :     {
    1102           0 :         if (nOddHeadL == 0xffff)
    1103           0 :             return sal_False;
    1104           0 :         Fill(nOddHeadL, begin, end);
    1105           0 :         return sal_True;
    1106             :     }
    1107             :     sal_Bool FillEvenFootL(sal_uLong& begin, sal_uLong& end)
    1108             :     {
    1109             :         if (nEvenFootL == 0xffff)
    1110             :             return sal_False;
    1111             :         Fill(nEvenFootL, begin, end);
    1112             :         return sal_True;
    1113             :     }
    1114           0 :     sal_Bool FillOddFootL(sal_uLong& begin, sal_uLong& end)
    1115             :     {
    1116           0 :         if (nOddFootL == 0xffff)
    1117           0 :             return sal_False;
    1118           0 :         Fill(nOddFootL, begin, end);
    1119           0 :         return sal_True;
    1120             :     }
    1121             :     sal_Bool FillFirstHeadL(sal_uLong& begin, sal_uLong& end)
    1122             :     {
    1123             :         if (nFirstHeadL == 0xffff)
    1124             :             return sal_False;
    1125             :         Fill(nFirstHeadL, begin, end);
    1126             :         return sal_True;
    1127             :     }
    1128             :     sal_Bool FillFirstFootL(sal_uLong& begin, sal_uLong& end)
    1129             :     {
    1130             :         if (nFirstFootL == 0xffff)
    1131             :             return sal_False;
    1132             :         Fill(nFirstFootL, begin, end);
    1133             :         return sal_True;
    1134             :     }
    1135             :     void Start(Ww1Shell&, Ww1Manager&);
    1136             :     void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
    1137             : };
    1138             : 
    1139           0 : class Ww1Fields : public Ww1PlcFields
    1140             : {
    1141             :     sal_uInt16 nPlcIndex;
    1142             :     OUString sResult; // Calculated by Word
    1143             :     SwField* pField;
    1144           0 :     sal_uLong Where(sal_uInt16 nIndex)  // within the text
    1145           0 :         { return Ww1PlcFields::Where(nIndex) - rFib.GetFIB().fcMinGet(); }
    1146             : 
    1147             : public:
    1148           0 :     Ww1Fields(Ww1Fib& rFibL, sal_uLong ulFilePos, sal_uInt16 nBytes)
    1149           0 :         : Ww1PlcFields(rFibL, ulFilePos, nBytes), nPlcIndex(0), pField(0)
    1150           0 :     {}
    1151             :     // within the text
    1152           0 :     sal_uLong Where()       { return Where(nPlcIndex); }
    1153           0 :     void operator++()
    1154             :     {
    1155             :         OSL_ENSURE(nPlcIndex+1 <= Count(), "Ww1Fields");
    1156           0 :         nPlcIndex++;
    1157           0 :     }
    1158           0 :     void Seek(sal_uLong ulNew)      { Ww1PlcFields::Seek(ulNew, nPlcIndex); }
    1159           0 :     W1_FLD* GetData()
    1160             :     {
    1161             :         OSL_ENSURE(nPlcIndex < Count(), "Ww1Fields");
    1162           0 :         return Ww1PlcFields::GetData(nPlcIndex);
    1163             :     }
    1164             :     sal_uLong GetLength();
    1165             :     friend std::ostream& operator <<(std::ostream&, Ww1Manager&);
    1166             :     void Start(Ww1Shell&, Ww1Manager&);
    1167             :     void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
    1168             :     void Out(Ww1Shell&, Ww1Manager&, sal_uInt16=0);
    1169             : };
    1170             : 
    1171           0 : class Ww1TextFields : public Ww1Fields
    1172             : {
    1173             : public:
    1174           0 :     Ww1TextFields(Ww1Fib& rFibL)
    1175           0 :         : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldMomGet(),
    1176           0 :                     rFibL.GetFIB().cbPlcffldMomGet())
    1177           0 :     {}
    1178             : };
    1179             : 
    1180             : class Ww1FootnoteFields : public Ww1Fields
    1181             : {
    1182             : public:
    1183           0 :     Ww1FootnoteFields(Ww1Fib& rFibL)
    1184           0 :         : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldFtnGet(),
    1185           0 :                     rFibL.GetFIB().cbPlcffldFtnGet())
    1186           0 :     {}
    1187             : };
    1188             : 
    1189             : class Ww1HeaderFooterFields : public Ww1Fields
    1190             : {
    1191             : public:
    1192           0 :     Ww1HeaderFooterFields(Ww1Fib& rFibL)
    1193           0 :         : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldHdrGet(),
    1194           0 :                     rFibL.GetFIB().cbPlcffldHdrGet())
    1195           0 :     {}
    1196             : };
    1197             : 
    1198             : class Ww1MacroFields : public Ww1Fields
    1199             : {
    1200             : public:
    1201             :     Ww1MacroFields(Ww1Fib& rFibL)
    1202             :         : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldMcrGet(),
    1203             :                     rFibL.GetFIB().cbPlcffldMcrGet())
    1204             :     {}
    1205             : };
    1206             : 
    1207             : class Ww1Bookmarks
    1208             : {
    1209             :     Ww1PlcBookmarkTxt aNames;
    1210             :     Ww1PlcBookmarkPos* pPos[2];
    1211             :     Ww1Fib& rFib;
    1212             : 
    1213             :     sal_uInt16 nPlcIdx[2];
    1214             :     sal_uInt16 nIsEnd;
    1215             :     sal_Bool bOK;
    1216             : public:
    1217             :     Ww1Bookmarks(Ww1Fib& rFib);
    1218           0 :     ~Ww1Bookmarks()
    1219           0 :     {
    1220           0 :             delete pPos[1];
    1221           0 :             delete pPos[0];
    1222           0 :     }
    1223           0 :     sal_uLong Where() const     { return pPos[nIsEnd]->WhereCP(nPlcIdx[nIsEnd]); }
    1224             :     void operator++();
    1225           0 :     sal_Bool GetError() const   { return !bOK; }
    1226             :     long GetHandle() const;
    1227           0 :     sal_Bool GetIsEnd() const   { return ( nIsEnd ) ? sal_True : sal_False; }
    1228             :     const OUString GetName() const;
    1229             :     long Len() const;
    1230             :     friend std::ostream& operator <<(std::ostream&, Ww1Bookmarks&);
    1231             :     void Start(Ww1Shell&, Ww1Manager&);
    1232             :     void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
    1233             :     void Out(Ww1Shell&, Ww1Manager&, sal_uInt16=0);
    1234             : };
    1235             : 
    1236           0 : class Ww1Footnotes : public Ww1PlcFootnoteRef
    1237             : {
    1238             :     sal_uInt16 nPlcIndex;
    1239             :     Ww1PlcFootnoteTxt aText;
    1240             :     sal_Bool bStarted;
    1241             : public:
    1242           0 :     Ww1Footnotes(Ww1Fib& rFibL)
    1243           0 :         : Ww1PlcFootnoteRef(rFibL), nPlcIndex(0), aText(rFibL), bStarted(sal_False)
    1244           0 :     {}
    1245             :     // within the text
    1246           0 :     sal_uLong Where()
    1247             :     {
    1248           0 :         sal_uLong ulRet = 0xffffffff;
    1249           0 :         if (Count())
    1250           0 :             ulRet = Ww1PlcFootnoteRef::Where(nPlcIndex);
    1251           0 :         return ulRet;
    1252             :     }
    1253           0 :     void operator++()
    1254             :     {
    1255             :         OSL_ENSURE(nPlcIndex+1 <= Count(), "Ww1Footnotes");
    1256           0 :         nPlcIndex++;
    1257           0 :     }
    1258             :     void Start(Ww1Shell&, Ww1Manager&);
    1259             :     void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
    1260             : };
    1261             : 
    1262           0 : class Ww1Sep : public Ww1PlcSep
    1263             : {
    1264             :     Ww1HeaderFooter aHdd;
    1265             :     sal_uInt16 nPlcIndex;
    1266             : public:
    1267           0 :     Ww1Sep(Ww1Fib& rFibL, sal_uInt16 grpfIhdt)
    1268           0 :     : Ww1PlcSep(rFibL), aHdd(rFibL, grpfIhdt), nPlcIndex(0) {}
    1269             : 
    1270           0 :     Ww1HeaderFooter& GetHdd()   { return aHdd; }
    1271           0 :     void operator++()        { nPlcIndex++; }
    1272           0 :     sal_uInt8* GetData()            { return Ww1PlcSep::GetData(nPlcIndex); }
    1273             :     // within the text
    1274           0 :     sal_uLong Where()               { return Ww1PlcSep::Where(nPlcIndex); }
    1275           0 :     void SetGrpfIhdt(sal_uInt8 grpfIhdt)
    1276             :     {
    1277           0 :         GetHdd().SetGrpfIhdt(grpfIhdt);
    1278           0 :     }
    1279             :     void Start(Ww1Shell&, Ww1Manager&);
    1280           0 :     void Stop(Ww1Shell& rOut, Ww1Manager& rMan, sal_Unicode& c)
    1281           0 :         { aHdd.Stop(rOut, rMan, c); }
    1282             : };
    1283             : 
    1284             : class Ww1Pap : public Ww1PlcPap
    1285             : {
    1286             :     sal_uInt16 nPlcIndex;
    1287             :     sal_uInt16 nPushedPlcIndex;
    1288             :     sal_uInt16 nFkpIndex;
    1289             :     sal_uInt16 nPushedFkpIndex;
    1290             :     sal_uLong ulOffset;
    1291             :     Ww1FkpPap* pPap;
    1292             : 
    1293             :     sal_Bool FindSprm(sal_uInt16 nId, sal_uInt8* pStart, sal_uInt8* pEnd);
    1294           0 :     void UpdateIdx()
    1295             :     {
    1296           0 :         if (pPap && nFkpIndex >= pPap->Count() )
    1297             :         {
    1298           0 :             delete pPap;
    1299           0 :             pPap = NULL;
    1300           0 :             nPlcIndex++;
    1301             :         }
    1302           0 :         if( !pPap )
    1303           0 :             Where();
    1304           0 :     }
    1305             :     sal_Bool HasId0(sal_uInt16 nId);
    1306             : 
    1307             : public:
    1308             :     Ww1Pap(Ww1Fib& rFib);
    1309           0 :     ~Ww1Pap()   { delete pPap; }
    1310             :     sal_uLong Where( sal_Bool bSetIndex = sal_True ); // within the text
    1311             :     void operator++();
    1312           0 :     sal_Bool FillStart(sal_uInt8*& pB, sal_uInt16& nSize)
    1313             :     {
    1314           0 :         UpdateIdx();
    1315           0 :         return pPap->Fill(nFkpIndex, pB, nSize);
    1316             :     }
    1317           0 :     sal_Bool FillStop(sal_uInt8*& pB, sal_uInt16& nSize)
    1318             :     {
    1319           0 :         return nFkpIndex ? pPap->Fill(nFkpIndex-1, pB, nSize) : sal_False;
    1320             :     }
    1321             :     void Start(Ww1Shell&, Ww1Manager&);
    1322             :     void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
    1323             :     void Seek(sal_uLong);
    1324           0 :     void Push(sal_uLong ulOffsetTmp = 0)
    1325             :     {
    1326             :         OSL_ENSURE(!Pushed(), "Ww1Pap");
    1327           0 :         nPushedPlcIndex = nPlcIndex;
    1328           0 :         nPushedFkpIndex = nFkpIndex;
    1329           0 :         Seek(ulOffsetTmp);
    1330           0 :         ulOffset = ulOffsetTmp;
    1331           0 :         delete pPap;
    1332           0 :         pPap = NULL;
    1333           0 :     }
    1334             :     sal_Bool Pushed()
    1335             :     {
    1336             :         return nPushedPlcIndex != 0xffff;
    1337             :     }
    1338           0 :     void Pop()
    1339             :     {
    1340             :         OSL_ENSURE(Pushed(), "Ww1Pap");
    1341           0 :         ulOffset = 0;
    1342           0 :         nPlcIndex = nPushedPlcIndex;
    1343           0 :         nFkpIndex = nPushedFkpIndex;
    1344           0 :         nPushedPlcIndex = 0xffff;
    1345           0 :         nPushedFkpIndex = 0xffff;
    1346           0 :         delete pPap;
    1347           0 :         pPap = NULL;
    1348           0 :         Where( sal_False );
    1349           0 :     }
    1350             :     sal_Bool HasId(sal_uInt16 nId);
    1351             : };
    1352             : 
    1353             : class Ww1Chp : public Ww1PlcChp
    1354             : {
    1355             :     sal_uInt16 nPlcIndex;
    1356             :     sal_uInt16 nPushedPlcIndex;
    1357             :     sal_uInt16 nFkpIndex;
    1358             :     sal_uInt16 nPushedFkpIndex;
    1359             :     sal_uLong ulOffset;
    1360             :     Ww1FkpChp* pChp;
    1361           0 :     void UpdateIdx()
    1362             :     {
    1363           0 :         if (pChp && nFkpIndex >= pChp->Count() )
    1364             :         {
    1365           0 :             delete pChp;
    1366           0 :             pChp = NULL;
    1367           0 :             nPlcIndex++;
    1368             :         }
    1369           0 :         if( !pChp )
    1370           0 :             Where();
    1371           0 :     }
    1372             : 
    1373             : public:
    1374             :     Ww1Chp( Ww1Fib& rFib );
    1375           0 :     ~Ww1Chp()   { delete pChp; }
    1376             :     sal_uLong Where( sal_Bool bSetIndex = sal_True ); // within the text
    1377             :     void operator++();
    1378           0 :     sal_Bool FillStart(W1_CHP& rChp)
    1379             :     {
    1380           0 :         UpdateIdx();
    1381           0 :         return pChp->Fill(nFkpIndex, rChp);
    1382             :     }
    1383           0 :     sal_Bool FillStop(W1_CHP& rChp)
    1384           0 :     { return nFkpIndex ? pChp->Fill(nFkpIndex-1, rChp) : sal_False;  }
    1385             :     void Start(Ww1Shell&, Ww1Manager&);
    1386             :     void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
    1387             :     void Seek(sal_uLong);
    1388           0 :     void Push(sal_uLong ulOffsetTmp = 0)
    1389             :     {
    1390             :         OSL_ENSURE(!Pushed(), "Ww1Chp");
    1391           0 :         nPushedPlcIndex = nPlcIndex;
    1392           0 :         nPushedFkpIndex = nFkpIndex;
    1393           0 :         Seek(ulOffsetTmp);
    1394           0 :         ulOffset = ulOffsetTmp;
    1395           0 :         delete pChp;
    1396           0 :         pChp = NULL;
    1397           0 :     }
    1398             :     sal_Bool Pushed()               { return nPushedPlcIndex != 0xffff; }
    1399           0 :     void Pop()
    1400             :     {
    1401             :         OSL_ENSURE(Pushed(), "Ww1Chp");
    1402           0 :         ulOffset = 0;
    1403           0 :         nPlcIndex = nPushedPlcIndex;
    1404           0 :         nFkpIndex = nPushedFkpIndex;
    1405           0 :         nPushedPlcIndex = 0xffff;
    1406           0 :         nPushedFkpIndex = 0xffff;
    1407           0 :         delete pChp;
    1408           0 :         pChp = NULL;
    1409           0 :         Where( sal_False );
    1410           0 :     }
    1411             : };
    1412             : 
    1413             : // Central point of access for the ww side of the filter, constructed
    1414             : // from the input stream (ww file). It contains everything necessary
    1415             : // for being piped into the shell (pm side).
    1416           0 : class Ww1Manager
    1417             : {
    1418             :     sal_Bool bOK;
    1419             :     bool bInTtp;
    1420             :     bool bInStyle;
    1421             :     bool bStopAll;
    1422             :     Ww1Fib aFib;
    1423             :     Ww1Dop aDop;
    1424             :     Ww1Fonts aFonts;
    1425             :     // from now on, everything in pairs, for 'pushed':
    1426             :     Ww1DocText aDoc;
    1427             :     Ww1PlainText* pDoc;
    1428             :     sal_uLong ulDocSeek;
    1429             :     sal_uLong* pSeek;
    1430             :     Ww1TextFields aFld;
    1431             :     Ww1Fields* pFld;
    1432             :     // 'push'able itself:
    1433             :     Ww1Chp aChp;
    1434             :     Ww1Pap aPap;
    1435             :     // not present in text ranges if 'pushed'
    1436             :     Ww1Footnotes aFtn;
    1437             :     Ww1Bookmarks aBooks;
    1438             :     Ww1Sep aSep;
    1439             : 
    1440             :     void OutStop( Ww1Shell&, sal_Unicode );
    1441             :     void OutStart( Ww1Shell& );
    1442             :     void Out(Ww1Shell&, sal_Unicode );
    1443             : 
    1444             : public:
    1445             :     Ww1Manager(SvStream& rStrm, sal_uLong nFieldFlgs);
    1446           0 :     sal_Bool GetError() const       { return !bOK; }
    1447             : 
    1448             :     // for tables
    1449           0 :     void SetInTtp(bool bSet = true)     { bInTtp = bSet; }
    1450           0 :     bool IsInTtp() const                { return bInTtp; }
    1451           0 :     void SetInStyle(bool bSet = true)   { bInStyle = bSet; }
    1452           0 :     bool IsInStyle() const              { return bInStyle; }
    1453           0 :     void SetStopAll(bool bSet = true)   { bStopAll = bSet; }
    1454           0 :     bool IsStopAll() const              { return bStopAll; }
    1455             :     sal_Bool HasInTable();
    1456             :     sal_Bool HasTtp();
    1457             :     sal_Bool LastHasTtp();
    1458             : 
    1459             :     // for flys
    1460             :     sal_Bool HasPPc();
    1461             :     sal_Bool HasPDxaAbs();
    1462             : 
    1463           0 :     Ww1Fib& GetFib()                    { return aFib; }
    1464           0 :     Ww1PlainText& GetText()             { return *pDoc; }
    1465           0 :     Ww1Dop& GetDop()                    { return aDop; }
    1466           0 :     Ww1Sep& GetSep()                    { return aSep; }
    1467             :     // within the text
    1468           0 :     sal_uLong Where()                       { return pDoc->Where(); }
    1469           0 :     void Fill( sal_Unicode& rChr )      { pDoc->Out( rChr ); }
    1470           0 :     sal_uInt8 Fill( OUString& rStr, sal_uLong ulLen)
    1471             :     {
    1472           0 :         ulLen += pDoc->Where();
    1473           0 :         return sal::static_int_cast< sal_uInt8 >(pDoc->Out(rStr, ulLen));
    1474             :     }
    1475             :     SvxFontItem GetFont(sal_uInt16 nFCode);
    1476             :     friend Ww1Shell& operator <<(Ww1Shell&, Ww1Manager&);
    1477             :     friend std::ostream& operator <<(std::ostream&, Ww1Manager&);
    1478           0 :     sal_Bool Pushed()                       { return pDoc != &aDoc; }
    1479             :     void Pop();
    1480             :     void Push0(Ww1PlainText* pDoc, sal_uLong, Ww1Fields* = 0);
    1481             :     void Push1(Ww1PlainText* pDoc, sal_uLong ulSeek, sal_uLong ulSeek2 = 0,
    1482             :                Ww1Fields* = 0);
    1483             : };
    1484             : 
    1485             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10