LCOV - code coverage report
Current view: top level - sw/source/filter/inc - fltshell.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 145 18.6 %
Date: 2012-08-25 Functions: 19 82 23.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 9 58 15.5 %

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

Generated by: LCOV version 1.10