LCOV - code coverage report
Current view: top level - libreoffice/sw/source/filter/inc - fltshell.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 145 18.6 %
Date: 2012-12-27 Functions: 19 82 23.2 %
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             : #ifndef _FLTSHELL_HXX
      20             : #define _FLTSHELL_HXX
      21             : 
      22             : #include <com/sun/star/text/HoriOrientation.hpp>
      23             : #include <com/sun/star/text/VertOrientation.hpp>
      24             : #include <com/sun/star/text/RelOrientation.hpp>
      25             : #include <hintids.hxx>
      26             : #include <vcl/keycod.hxx>
      27             : #include <tools/datetime.hxx>
      28             : #include <editeng/brkitem.hxx>
      29             : #include <poolfmt.hxx>
      30             : #include <fmtornt.hxx>
      31             : #include <ndindex.hxx>
      32             : #include <pam.hxx>
      33             : #include <IDocumentRedlineAccess.hxx>
      34             : 
      35             : #include <boost/noncopyable.hpp>
      36             : #include <boost/ptr_container/ptr_deque.hpp>
      37             : 
      38             : class SwTOXBase;
      39             : class SwFltShell;
      40             : class SwField;
      41             : class SwFieldType;
      42             : class Graphic;
      43             : class SwTableBox;
      44             : class SwDoc;
      45             : class SwPaM;
      46             : 
      47             : using namespace com::sun::star;
      48             : 
      49             : inline void SwFltClearFlag(sal_uLong& rFieldFlags, int no)
      50             :     { rFieldFlags &= ~(1L << no); }
      51             : 
      52           0 : inline void SwFltSetFlag(sal_uLong& rFieldFlags, int no)
      53           0 :     { rFieldFlags |= 1L << no; }
      54             : 
      55          14 : inline bool SwFltGetFlag(sal_uLong nFieldFlags, int no)
      56          14 :     { return (nFieldFlags & (1L << no)) != 0; }
      57             : 
      58             : //Subvert the Node/Content system to get positions which don't update as
      59             : //content is appended to them
      60       66097 : struct SW_DLLPUBLIC SwFltPosition
      61             : {
      62             : public:
      63             :     SwNodeIndex m_nNode;
      64             :     xub_StrLen m_nCntnt;
      65             : public:
      66           0 :     SwFltPosition(const SwFltPosition &rOther)
      67             :         : m_nNode(rOther.m_nNode)
      68           0 :         , m_nCntnt(rOther.m_nCntnt)
      69             :     {
      70           0 :     }
      71           0 :     SwFltPosition &operator=(const SwFltPosition &rOther)
      72             :     {
      73           0 :         m_nNode = rOther.m_nNode;
      74           0 :         m_nCntnt = rOther.m_nCntnt;
      75           0 :         return *this;
      76             :     }
      77       12624 :     bool operator==(const SwFltPosition &rOther) const
      78             :     {
      79             :         return (m_nCntnt == rOther.m_nCntnt &&
      80       12624 :                 m_nNode == rOther.m_nNode);
      81             :     }
      82           0 :     void SetPos(SwNodeIndex &rNode, sal_uInt16 nIdx)
      83             :     {
      84           0 :         m_nNode = rNode;
      85           0 :         m_nCntnt = nIdx;
      86           0 :     }
      87             :     //operators with SwPosition, where the node is hacked to the previous one,
      88             :     //and the offset to content is de-dynamic-ified
      89       66097 :     SwFltPosition(const SwPosition &rPos)
      90             :         : m_nNode(rPos.nNode, -1)
      91       66097 :         , m_nCntnt(rPos.nContent.GetIndex())
      92             :     {
      93       66097 :     }
      94       12906 :     void SetPos(const SwPosition &rPos)
      95             :     {
      96       12906 :         m_nNode = rPos.nNode.GetIndex()-1;
      97       12906 :         m_nCntnt = rPos.nContent.GetIndex();
      98       12906 :     }
      99             : };
     100             : 
     101             : // Stack-Eintrag fuer die Attribute Es werden immer Pointer auf neue Attribute uebergeben.
     102             : class SwFltStackEntry : private ::boost::noncopyable
     103             : {
     104             : public:
     105             :     SwFltPosition m_aMkPos;
     106             :     SwFltPosition m_aPtPos;
     107             : 
     108             :     SfxPoolItem * pAttr;// Format Attribute
     109             : 
     110             :     sal_Bool bOld;          // to mark Attributes *before* skipping field results
     111             :     sal_Bool bOpen;     //Entry open, awaiting being closed
     112             :     sal_Bool bConsumedByField;
     113             : 
     114             :     SW_DLLPUBLIC SwFltStackEntry(const SwPosition & rStartPos, SfxPoolItem* pHt );
     115             :     SW_DLLPUBLIC ~SwFltStackEntry();
     116             : 
     117             :     void SetStartPos(const SwPosition & rStartPos);
     118             :     SW_DLLPUBLIC void SetEndPos(  const SwPosition & rEndPos);
     119             :     SW_DLLPUBLIC bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck) const;
     120             :     SW_DLLPUBLIC static bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion,
     121             :         bool bCheck, const SwFltPosition &rMkPos, const SwFltPosition &rPtPos,
     122             :         sal_uInt16 nWhich=0);
     123             : };
     124             : 
     125             : class SW_DLLPUBLIC SwFltControlStack : private ::boost::noncopyable
     126             : {
     127             :     typedef boost::ptr_deque<SwFltStackEntry> Entries;
     128             :     typedef Entries::iterator myEIter;
     129             :     Entries maEntries;
     130             :     friend class SwFltShell;
     131             : 
     132             :     sal_uLong nFieldFlags;
     133             :     KeyCode aEmptyKeyCode; // fuer Bookmarks
     134             : 
     135             : protected:
     136             :     SwDoc* pDoc;
     137             :     bool bIsEndStack;
     138             : 
     139             :     void MoveAttrs( const SwPosition&  rPos );
     140             :     virtual void SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry& rEntry);
     141             : 
     142             : public:
     143             :     enum Flags
     144             :     {
     145             :         HYPO,
     146             :         TAGS_DO_ID,
     147             :         TAGS_VISIBLE,
     148             :         BOOK_TO_VAR_REF,
     149             :         BOOK_AND_REF,
     150             :         TAGS_IN_TEXT,
     151             :         ALLOW_FLD_CR,
     152             :         NO_FLD_CR,
     153             :         DONT_HARD_PROTECT
     154             :     };
     155             : 
     156             :     SwFltControlStack(SwDoc* pDo, sal_uLong nFieldFl);
     157             :     virtual ~SwFltControlStack();
     158             : 
     159           8 :     bool IsFlagSet(Flags no) const  { return ::SwFltGetFlag(nFieldFlags, no);}
     160             : 
     161             :     void NewAttr(const SwPosition& rPos, const SfxPoolItem & rAttr );
     162             : 
     163             :     virtual SwFltStackEntry* SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, sal_Bool bTstEnde=sal_True, long nHand = LONG_MAX, sal_Bool consumedByField=sal_False);
     164             : 
     165             :     void StealAttr(const SwNodeIndex& rNode, sal_uInt16 nAttrId = 0);
     166             :     void MarkAllAttrsOld();
     167             :     void KillUnlockedAttrs(const SwPosition& pPos);
     168             :     SfxPoolItem* GetFmtStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos = 0);
     169             :     const SfxPoolItem* GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich);
     170             :     void Delete(const SwPaM &rPam);
     171             : 
     172          34 :     bool empty() const { return maEntries.empty(); }
     173       17959 :     Entries::size_type size() const { return maEntries.size(); }
     174      216138 :     SwFltStackEntry& operator[](Entries::size_type nIndex)
     175      216138 :          { return maEntries[nIndex]; }
     176             :     void DeleteAndDestroy(Entries::size_type nCnt);
     177             : };
     178             : 
     179             : class SwFltAnchorClient;
     180             : 
     181             : class SW_DLLPUBLIC SwFltAnchor : public SfxPoolItem
     182             : {
     183             :     SwFrmFmt* pFrmFmt;
     184             :     SwFltAnchorClient * pClient;
     185             : 
     186             : public:
     187             :     SwFltAnchor(SwFrmFmt* pFlyFmt);
     188             :     SwFltAnchor(const SwFltAnchor&);
     189             :     virtual ~SwFltAnchor();
     190             : 
     191             :     // "pure virtual Methoden" vom SfxPoolItem
     192             :     virtual int operator==(const SfxPoolItem&) const;
     193             :     virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
     194             :     void SetFrmFmt(SwFrmFmt * _pFrmFmt);
     195             :     const SwFrmFmt* GetFrmFmt() const;
     196             :           SwFrmFmt* GetFrmFmt();
     197             : };
     198             : 
     199         216 : class SwFltAnchorClient : public SwClient
     200             : {
     201             :     SwFltAnchor * m_pFltAnchor;
     202             : 
     203             : public:
     204             :     SwFltAnchorClient(SwFltAnchor * pFltAnchor);
     205             : 
     206             :     virtual void Modify (const SfxPoolItem *pOld, const SfxPoolItem *pNew);
     207             : };
     208             : 
     209             : 
     210           0 : class SW_DLLPUBLIC SwFltRedline : public SfxPoolItem
     211             : {
     212             : public:
     213             :     DateTime        aStamp;
     214             :     DateTime        aStampPrev;
     215             :     RedlineType_t   eType;
     216             :     RedlineType_t   eTypePrev;
     217             :     sal_uInt16          nAutorNo;
     218             :     sal_uInt16          nAutorNoPrev;
     219             : 
     220           0 :     SwFltRedline(RedlineType_t   eType_,
     221             :                  sal_uInt16          nAutorNo_,
     222             :                  const DateTime& rStamp_,
     223             :                  RedlineType_t   eTypePrev_    = nsRedlineType_t::REDLINE_INSERT,
     224             :                  sal_uInt16          nAutorNoPrev_ = USHRT_MAX,
     225             :                  const DateTime* pStampPrev_   = 0)
     226             :         : SfxPoolItem(RES_FLTR_REDLINE), aStamp(rStamp_),
     227             :         aStampPrev( DateTime::EMPTY ),
     228             :         eType(eType_),
     229           0 :         eTypePrev(eTypePrev_), nAutorNo(nAutorNo_), nAutorNoPrev(nAutorNoPrev_)
     230             :     {
     231           0 :             if( pStampPrev_ )
     232           0 :                 aStampPrev = *pStampPrev_;
     233           0 :     }
     234             : 
     235           0 :     SwFltRedline(const SwFltRedline& rCpy):
     236             :         SfxPoolItem(RES_FLTR_REDLINE),
     237             :         aStamp(         rCpy.aStamp       ),
     238             :         aStampPrev(     rCpy.aStampPrev   ),
     239             :         eType(          rCpy.eType        ),
     240             :         eTypePrev(      rCpy.eTypePrev    ),
     241             :         nAutorNo(       rCpy.nAutorNo     ),
     242           0 :         nAutorNoPrev(   rCpy.nAutorNoPrev )
     243           0 :         {}
     244             :     // "pure virtual Methoden" vom SfxPoolItem
     245             :     virtual int operator==(const SfxPoolItem& rItem) const;
     246             :     virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
     247             : };
     248             : 
     249          14 : class SW_DLLPUBLIC SwFltBookmark : public SfxPoolItem
     250             : {
     251             :     friend class SwFltShell;    // darf aName und aVal uebersetzen
     252             :     long nHandle;
     253             :     String aName;
     254             :     String aVal;
     255             :     sal_Bool bOnlyRef;          // "FRAGE"-Feld, Ref/Seitenrf oder nichts
     256             :     sal_Bool bRef;
     257             :     sal_Bool bPgRef;
     258             : public:
     259             :     SwFltBookmark( const String& rNa, const String& rVa,
     260             :                     long nHand, sal_Bool bOnlyR );
     261             :     SwFltBookmark( const SwFltBookmark& );
     262             :     // "pure virtual Methoden" vom SfxPoolItem
     263             :     virtual int operator==(const SfxPoolItem&) const;
     264             :     virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
     265           4 :     const String& GetName() const       { return aName; }
     266           0 :     const String& GetValSys() const     { return aVal; }
     267           4 :     sal_Bool IsOnlyRef() const              { return bOnlyRef; }
     268           0 :     sal_Bool IsRef() const                  { return bRef; }
     269             :     void SetRef(sal_Bool b = sal_True)          { bRef = b; }
     270           0 :     sal_Bool IsPgRef() const                { return bPgRef; }
     271             :     void SetPgRef(sal_Bool b = sal_True)        { bPgRef = b; }
     272           4 :     long GetHandle() const              { return nHandle; }
     273             : };
     274             : 
     275           0 : class SW_DLLPUBLIC SwFltTOX : public SfxPoolItem
     276             : {
     277             :     SwTOXBase* pTOXBase;
     278             :     sal_uInt16 nCols;
     279             :     sal_Bool bHadBreakItem; // there was a break item BEFORE insertion of the TOX
     280             :     sal_Bool bHadPageDescItem; // ...
     281             : public:
     282             :     SwFltTOX(SwTOXBase* pBase, sal_uInt16 _nCols = 0);
     283             :     SwFltTOX(const SwFltTOX&);
     284             :     // "pure virtual Methoden" vom SfxPoolItem
     285             :     virtual int operator==(const SfxPoolItem&) const;
     286             :     virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
     287           0 :     SwTOXBase* GetBase()            { return pTOXBase; }
     288             :     sal_uInt16 GetCols() const          { return nCols; }
     289           0 :     void SetHadBreakItem(    sal_Bool bVal ) { bHadBreakItem    = bVal; }
     290           0 :     void SetHadPageDescItem( sal_Bool bVal ) { bHadPageDescItem = bVal; }
     291           0 :     sal_Bool HadBreakItem()    const { return bHadBreakItem; }
     292           0 :     sal_Bool HadPageDescItem() const { return bHadPageDescItem; }
     293             : };
     294             : 
     295           0 : class SwFltSection : public SfxPoolItem
     296             : {
     297             :     SwSectionData * m_pSection;
     298             : 
     299             : public:
     300             :     SwFltSection( SwSectionData *const pSect );
     301             :     SwFltSection( const SwFltSection& );
     302             :     // "pure virtual Methoden" vom SfxPoolItem
     303             :     virtual int operator==(const SfxPoolItem&) const;
     304             :     virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
     305           0 :     SwSectionData * GetSectionData()    { return m_pSection; }
     306             : };
     307             : // Der WWEndStack verhaelt sich wie der WWControlStck, nur dass die Attribute
     308             : // auf ihm bis ans Ende des Dokuments gehortet werden, falls auf sie noch
     309             : // zugegriffen werden muss (z.B. Book/RefMarks, Index u.s.w.)
     310         111 : class SwFltEndStack : public SwFltControlStack
     311             : {
     312             : public:
     313          74 :     SwFltEndStack(SwDoc* pDo, sal_uLong nFieldFl)
     314          74 :         :SwFltControlStack(pDo, nFieldFl)
     315             :     {
     316          74 :         bIsEndStack = true;
     317          74 :     }
     318             : };
     319             : 
     320             : ///////////////////////////////////////////////////////////////////////////////////////////
     321             : //
     322             : // hier beginnen die fuer ww1-filter neu erstellten klassen. diese
     323             : // sollen eine simple oberflaeche fuer die komplexen strukturen des
     324             : // writers speziell fuer filter sein. soll etwas in den writer gegeben
     325             : // werden, soll ein << reichen. hierfuer sind neue typen erzeugt
     326             : // worden. ausserdem soll moeglich sein das objekt nach vielen
     327             : // zustaenden der momentanen formatierung zu fragen, sodasz diese der
     328             : // filter nicht selbst verwalten musz.
     329             : //
     330             : // den anfang macht eine vorlagen-oberklasse, die einfachen umgang mit
     331             : // formatvorlagen ermoeglicht:
     332             : //
     333             : 
     334             : class SwFltOutBase
     335             : {
     336             :     SwDoc& rDoc;
     337             : protected:
     338             :     RndStdIds eFlyAnchor;
     339             :     sal_Bool bFlyAbsPos;
     340             : 
     341           0 :     SwDoc& GetDoc()                 { return rDoc; }
     342             :     SfxItemSet* NewFlyDefaults();
     343             :     SwFltOutBase(SwDoc& rDocu);
     344             :     virtual ~SwFltOutBase();
     345             : public:
     346             :     virtual SwFltOutBase& operator << (const SfxPoolItem& rItem) = 0;
     347             : 
     348             :     virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich) = 0;
     349             :     virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich) = 0;
     350             : 
     351             :     virtual const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich);
     352             :     virtual sal_Bool BeginTable();
     353             :     virtual void NextTableCell();
     354             :     virtual void NextTableRow();
     355             :     virtual void SetTableWidth(SwTwips nW);
     356             :     virtual void SetTableOrient(sal_Int16 eOri);
     357             :     virtual void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell);
     358             :     virtual void SetCellHeight(SwTwips nH);
     359             :     virtual void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell);
     360             :     virtual void SetCellSpace(sal_uInt16 nSp);
     361             :     virtual void DeleteCell(sal_uInt16 nCell);
     362             :     virtual void EndTable();
     363             : 
     364             :     virtual sal_Bool IsInFly() = 0;
     365             :     virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr) = 0;
     366             :     virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich) = 0;
     367             :     virtual sal_Bool BeginFly( RndStdIds eAnchor, sal_Bool bAbsolutePos,
     368             :                                const SfxItemSet* pMoreAttrs = 0 );
     369             :     virtual void SetFlyAnchor( RndStdIds eAnchor );
     370             :     virtual void EndFly();
     371             : };
     372             : 
     373           0 : class SwFltOutDoc : public SwFltOutBase
     374             : {
     375             :     SwFltControlStack& rStack;
     376             :     SwFltEndStack& rEndStack;
     377             :     SwPaM* pPaM;
     378             :     SwFrmFmt* pFly;
     379             : // table items:
     380             :     const SwTable* pTable;
     381             :     SwPosition* pTabSavedPos; // set when in table
     382             :     SwPosition* pFlySavedPos; // set when in fly
     383             :     SwTwips nTableWidth;
     384             :     sal_uInt16 usTableX;
     385             :     sal_uInt16 usTableY;
     386             :     sal_Bool bReadNoTbl;                // Keine Tabellen
     387             : 
     388             :     SwTableBox* GetBox(sal_uInt16 ny, sal_uInt16 nx = USHRT_MAX);
     389             :     sal_Bool SeekCell( short nRow, short nCol, sal_Bool bPam );
     390             :     void SplitTable();
     391             : public:
     392           0 :     SwFltOutDoc(SwDoc& rDocu, SwPaM* pP, SwFltControlStack& rStk,
     393             :         SwFltEndStack& rEStk)
     394             :     : SwFltOutBase(rDocu), rStack(rStk), rEndStack(rEStk), pPaM(pP),
     395             :           pFly(0), pTable(0), pTabSavedPos(0), pFlySavedPos(0),
     396           0 :           nTableWidth(0), bReadNoTbl(sal_False)
     397           0 :     {}
     398             : 
     399           0 :     void SetReadNoTable()           { bReadNoTbl = sal_True; }
     400             :     sal_Bool IsTableWidthSet() const    { return 0 != nTableWidth; }
     401             : 
     402             :     virtual SwFltOutBase& operator << (const SfxPoolItem& rItem);
     403             : 
     404             :     virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich);
     405             :     virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich);
     406             : 
     407             :     sal_Bool IsInTable();
     408             :     virtual const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich);
     409             :     virtual sal_Bool BeginTable();
     410             :     virtual void NextTableCell();
     411             :     virtual void NextTableRow();
     412             :     virtual void SetTableWidth(SwTwips nW);
     413             :     virtual void SetTableOrient(sal_Int16 eOri);
     414             :     virtual void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell);
     415             :     virtual void SetCellHeight(SwTwips nH);
     416             :     virtual void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell);
     417             :     virtual void SetCellSpace(sal_uInt16 nSp);
     418             :     virtual void DeleteCell(sal_uInt16 nCell);
     419             :     virtual void EndTable();
     420             : 
     421             :     SwFrmFmt* MakeFly( RndStdIds eAnchor, SfxItemSet* pSet );
     422             :     virtual sal_Bool IsInFly();
     423             :     virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr);
     424             :     virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich);
     425             :     virtual sal_Bool BeginFly( RndStdIds eAnchor, sal_Bool bAbsolutePos,
     426             :                                const SfxItemSet* pMoreAttrs = 0 );
     427             :     virtual void EndFly();
     428             : };
     429             : 
     430             : class SwFltFormatCollection : public SwFltOutBase
     431             : {
     432             :     SwTxtFmtColl* pColl;
     433             :     SfxItemSet* pFlyAttrs;      // Simulation der Flys in Styles
     434             :     sal_Bool bHasFly;
     435             : public:
     436             :     SwFltFormatCollection(SwDoc&, RES_POOL_COLLFMT_TYPE nType);
     437             :     SwFltFormatCollection(SwDoc&, const String& rName );
     438           0 :     ~SwFltFormatCollection() { if( pFlyAttrs ) delete pFlyAttrs; }
     439             : 
     440           0 :     void Reset()
     441             :     {
     442             :         // #i73790# - method renamed
     443           0 :         pColl->ResetAllFmtAttr();
     444           0 :         pColl->SetAuto(sal_False); // nach Empfehlung JP
     445           0 :     }
     446           0 :     void Derived(SwTxtFmtColl* pBase)
     447           0 :         { pColl->SetDerivedFrom(pBase); }
     448             : 
     449             : //  SwTxtFmtColl* Search(String, CharSet eSrc);
     450           0 :     SwTxtFmtColl* GetColl()         { return pColl; }
     451             :     void SetHasFly()                { bHasFly = sal_True; }
     452           0 :     SfxItemSet* GetpFlyAttrs()      { return pFlyAttrs; }
     453             : 
     454             :     virtual SwFltOutBase& operator << (const SfxPoolItem& rItem);
     455             :     virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich);
     456             :     virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich);
     457             : 
     458             :     virtual sal_Bool IsInFly();
     459             :     virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr);
     460             :     virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich);
     461             :     virtual sal_Bool BeginFly( RndStdIds eAnchor, sal_Bool bAbsolutePos,
     462             :                                const SfxItemSet* pMoreAttrs = 0 );
     463             :     sal_Bool BeginStyleFly( SwFltOutDoc* pOutDoc );
     464             :     virtual void EndFly();
     465             : };
     466             : 
     467             : //
     468             : // dies nun ist die zauberhafteklasse: intention: alle eins nach dem
     469             : // andern hinein'pipe'n. wird eine besondere struktur eingelesen, wird
     470             : // eine klammer geoeffnet (BeginXxx) und nach beendigung geschlossen
     471             : // (EndXxx), wobei Xxx zB fuer Fusznoten, Kopf/Fuszzeilen oder
     472             : // Tabellen steht. Styles funktionieren auch so, haben aber den
     473             : // unterschied, keine buchstaben zu akzeptieren.
     474             : // beginnt ein neuer absatz oder aehnliches, wird NextXxx genutzt.
     475             : // hier ist moeglich, Tab, Zeilenumbruch, Absatzende, Seitenumbruch
     476             : // und Sektionsende einzufuegen.
     477             : //
     478             : class SwFltShell
     479             : {
     480             :     SwFltOutDoc* pOutDoc;
     481             :     SwFltFormatCollection* pColls[256];
     482             :     SwFltOutBase* pOut;
     483             : 
     484             : //  SwFltFormatCollection* pFormat; // set when in style-mode
     485             :     SwPageDesc* pCurrentPageDesc;
     486             :     SwPosition* pSavedPos; // set, when in footnote or header/footer -mode
     487             : #ifdef None
     488             : #undef None
     489             : #endif
     490             :     enum SubModes {
     491             :         None,
     492             :         Header,
     493             :         Footer,
     494             :         Footnote,
     495             :         Table,
     496             :         Fly,
     497             :         Style,
     498             :         Max
     499             :     } eSubMode;
     500             : 
     501             : // Fly items:
     502             :     sal_uInt16 nAktStyle;               // zur Indizierung pStyleFlyTable
     503             : //
     504             :     SwFltControlStack aStack;
     505             :     SwFltEndStack aEndStack;
     506             :     SwPaM* pPaM;
     507             : //
     508             :     String sBaseURL;
     509             :     sal_uInt16 nPageDescOffset; // fuers update der pagedescs
     510             :     CharSet eSrcCharSet; // charset der quelle
     511             :     friend class SwFltControlStack;
     512             :     sal_Bool bNewDoc;
     513             :     sal_Bool bStdPD;
     514             :     sal_Bool bProtect;
     515             : 
     516             : public:
     517             :     SwFltShell(SwDoc* , SwPaM& , const String& rBaseURL, sal_Bool bNew, sal_uLong = 0);
     518             :     ~SwFltShell();
     519             : 
     520           0 :     SwDoc& GetDoc()                 { return *aStack.pDoc; }
     521             : 
     522             :     CharSet SetCharSet(CharSet eNew)    { CharSet eOld = eSrcCharSet;
     523             :                                           eSrcCharSet = eNew;
     524             :                                           return eOld;
     525             :                                         }
     526           0 :     void SetUseStdPageDesc()        { bStdPD = sal_True; }
     527           0 :     void SetProtect()               { bProtect = sal_True; }
     528             :     SwPageDesc* MakePageDesc(SwPageDesc* pFirstPageDesc = NULL);
     529           0 :     SwPageDesc& GetPageDesc()       { return *pCurrentPageDesc; }
     530           0 :     void NextTab()                  { (*this) << sal_uInt8(0x09); }
     531           0 :     void NextLine()                 { (*this) << sal_uInt8(0x0a); }
     532             :     void NextParagraph();
     533             :     void NextPage();
     534           0 :     void NextSection()      { pCurrentPageDesc = MakePageDesc(); }
     535             : 
     536             :     SwFltShell& AddGraphic( const String& rPicName );
     537             :     SwFltShell& AddError( const sal_Char* pErr );
     538             :     SwFltShell& EndItem( sal_uInt16 nId );
     539             :     SwFltShell& SetStyle( sal_uInt16 nStyle );
     540             : 
     541             :     SwFltShell& operator << ( Graphic& );
     542             :     SwFltShell& operator << ( SwFltBookmark& aBook );
     543             :     void SetBookEnd(long nHandle);
     544             :     SwFltShell& operator << ( const String& );  // Vorsicht: CHARSET_ANSI
     545             :     SwFltShell& operator << ( const sal_Unicode );
     546             :     SwFltShell& operator << ( const SwField& );
     547           0 :     SwFltShell& operator << ( const SfxPoolItem& rItem )
     548           0 :         { *pOut << rItem; return *this; }
     549             : 
     550             : //  SwFltShell& operator >> (SfxPoolItem&);
     551             : // methode zum beenden einer sub-sektion, zB Fusznote etc
     552             :     void End()                      { eSubMode = None; }
     553             : // methoden zur verwaltung von Header/Footer
     554             :     void BeginHeader(SwPageDesc* =NULL);
     555             :     void BeginFooter(SwPageDesc* =NULL);
     556             :     void EndHeaderFooter();
     557             : // methoden zur verwaltung von FootNotes
     558             :     void BeginFootnote();
     559             :     void EndFootnote();
     560             : // methoden zur verwaltung von Tabellen
     561           0 :     sal_Bool IsInTable() {
     562           0 :         return ( pOut == pOutDoc ) ? pOutDoc->IsInTable() : 0; }
     563           0 :     const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich) {
     564           0 :         return pOut->GetCellAttr(nWhich); }
     565           0 :     sal_Bool BeginTable() {
     566           0 :         sal_Bool b = pOut->BeginTable();
     567           0 :         if(b) eSubMode = Table;
     568           0 :         return b; }
     569           0 :     void NextTableCell() {
     570           0 :         pOut->NextTableCell(); }
     571           0 :     void NextTableRow() {
     572           0 :         pOut->NextTableRow(); }
     573           0 :     void SetTableWidth(SwTwips nW) {
     574           0 :         pOut->SetTableWidth(nW); }
     575             :     sal_Bool IsTableWidthSet() {
     576             :         return pOutDoc->IsTableWidthSet(); }
     577           0 :     void SetTableOrient(sal_Int16 eOri) {
     578           0 :         pOut->SetTableOrient(eOri); }
     579           0 :     void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell = USHRT_MAX ) {
     580           0 :         pOut->SetCellWidth(nWidth, nCell); }
     581           0 :     void SetCellHeight(SwTwips nH) {
     582           0 :         pOut->SetCellHeight(nH); }
     583           0 :     void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell = USHRT_MAX ){
     584           0 :         pOut->SetCellBorder(rFmtBox, nCell); }
     585           0 :     void SetCellSpace(sal_uInt16 nSp) {
     586           0 :         pOut->SetCellSpace(nSp); }
     587           0 :     void DeleteCell(sal_uInt16 nCell = USHRT_MAX) {
     588           0 :         pOut->DeleteCell(nCell); }
     589           0 :     void EndTable() {
     590           0 :         pOut->EndTable(); }
     591             : // methoden zur verwaltung von Flys
     592           0 :     sal_Bool IsInFly() { return pOut->IsInFly(); }
     593             :     sal_Bool BeginFly( RndStdIds eAnchor = FLY_AT_PARA, sal_Bool bAbsolutePos = sal_False );
     594           0 :     void SetFlyAnchor( RndStdIds eAnchor )
     595           0 :         { pOut->SetFlyAnchor( eAnchor ); }
     596             :     void SetFlyXPos( short nXPos, sal_Int16 eHRel = com::sun::star::text::RelOrientation::FRAME,
     597             :                      sal_Int16 eHAlign = com::sun::star::text::HoriOrientation::NONE );
     598             :     void SetFlyYPos( short nYPos, sal_Int16 eVRel = com::sun::star::text::RelOrientation::FRAME,
     599             :                      sal_Int16 eVAlign = com::sun::star::text::VertOrientation::NONE );
     600           0 :     void SetFlyFrmAttr(const SfxPoolItem& rAttr){
     601           0 :         pOut->SetFlyFrmAttr( rAttr ); }
     602             :     void EndFly();
     603             : // methoden zur verwaltung von styles:
     604           0 :     void BeginStyle(sal_uInt16 nUserCode, RES_POOL_COLLFMT_TYPE aType)
     605             :     {
     606             :         OSL_ENSURE(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds");
     607             :         OSL_ENSURE(pColls[nUserCode] == NULL, "user codes dublicate");
     608           0 :         if (eSubMode == Style)
     609           0 :             EndStyle();
     610           0 :         pOut = pColls[nUserCode] = new SwFltFormatCollection(GetDoc(), aType);
     611           0 :         nAktStyle = nUserCode;
     612           0 :         eSubMode = Style;
     613           0 :     }
     614           0 :     void BeginStyle( sal_uInt16 nUserCode, const String& rName )
     615             :     {
     616             :         OSL_ENSURE(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds");
     617             :         OSL_ENSURE(pColls[nUserCode] == NULL, "user codes dublicate");
     618           0 :         if (eSubMode == Style)
     619           0 :             EndStyle();
     620           0 :         pOut = pColls[nUserCode] = new SwFltFormatCollection(GetDoc(), rName );
     621           0 :         nAktStyle = nUserCode;
     622           0 :         eSubMode = Style;
     623           0 :     }
     624           0 :     sal_Bool IsStyleImported(sal_uInt16 nUserCode)
     625           0 :         { return pColls[nUserCode] != 0; }
     626           0 :     void BaseStyle(sal_uInt16 nBased)
     627             :     {
     628             :         OSL_ENSURE(eSubMode == Style, "wrong state for style");
     629             :         OSL_ENSURE(pColls[nBased], "Style based on noexistent style" );
     630           0 :         if( eSubMode == Style && pColls[nBased]->GetColl() )
     631           0 :             ((SwFltFormatCollection*)pOut)->Derived(pColls[nBased]->GetColl());
     632           0 :     }
     633             :     void NextStyle(sal_uInt16 nWhich, sal_uInt16 nNext);
     634             : 
     635           0 :     void EndStyle()
     636             :     {
     637             : //   OSL_ENSURE(eSubMode == Style, "wrong state for style");
     638           0 :         nAktStyle = 0;
     639           0 :         pOut = pOutDoc;
     640           0 :         eSubMode = None;
     641           0 :     }
     642             : 
     643           0 :     bool IsFlagSet(SwFltControlStack::Flags no) const
     644           0 :         { return aStack.IsFlagSet(no); }
     645             :     void ConvertUStr( String& rInOut );
     646             :     OUString QuoteStr( const OUString& rIn );
     647             : 
     648             :     // folgende status kann die shell verwalten:
     649             :     const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich);
     650             :     const SfxPoolItem& GetAttr(sal_uInt16 nWhich);
     651             :     const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich);
     652             :     SwFieldType* GetSysFldType(sal_uInt16 eWhich);
     653             :     sal_Bool GetWeightBold();
     654             :     sal_Bool GetPostureItalic();
     655             :     sal_Bool GetCrossedOut();
     656             :     sal_Bool GetContour();
     657             :     sal_Bool GetCaseKapitaelchen();
     658             :     sal_Bool GetCaseVersalien();
     659             : 
     660           0 :     const String& GetBaseURL() const { return sBaseURL; }
     661             : };
     662             : 
     663             : SW_DLLPUBLIC void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset);
     664             : 
     665             : #endif
     666             : 
     667             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10