LCOV - code coverage report
Current view: top level - sw/source/filter/inc - fltshell.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 49 65 75.4 %
Date: 2015-06-13 12:38:46 Functions: 32 43 74.4 %
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 INCLUDED_SW_SOURCE_FILTER_INC_FLTSHELL_HXX
      20             : #define INCLUDED_SW_SOURCE_FILTER_INC_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/formatbreakitem.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 SwField;
      40             : class SwFieldType;
      41             : class Graphic;
      42             : class SwTableBox;
      43             : class SwDoc;
      44             : class SwPaM;
      45             : 
      46             : inline void SwFltClearFlag(sal_uLong& rFieldFlags, int no)
      47             :     { rFieldFlags &= ~(1L << no); }
      48             : 
      49             : inline void SwFltSetFlag(sal_uLong& rFieldFlags, int no)
      50             :     { rFieldFlags |= sal_uLong(1) << no; }
      51             : 
      52         120 : inline bool SwFltGetFlag(sal_uLong nFieldFlags, int no)
      53         120 :     { return (nFieldFlags & (sal_uLong(1) << no)) != 0; }
      54             : 
      55             : //Subvert the Node/Content system to get positions which don't update as
      56             : //content is appended to them
      57      126930 : struct SW_DLLPUBLIC SwFltPosition
      58             : {
      59             : public:
      60             :     SwNodeIndex m_nNode;
      61             :     sal_Int32 m_nContent;
      62             : public:
      63           8 :     SwFltPosition(const SwFltPosition &rOther)
      64             :         : m_nNode(rOther.m_nNode)
      65           8 :         , m_nContent(rOther.m_nContent)
      66             :     {
      67           8 :     }
      68           0 :     SwFltPosition &operator=(const SwFltPosition &rOther)
      69             :     {
      70           0 :         m_nNode = rOther.m_nNode;
      71           0 :         m_nContent = rOther.m_nContent;
      72           0 :         return *this;
      73             :     }
      74       25182 :     bool operator==(const SwFltPosition &rOther) const
      75             :     {
      76       34237 :         return (m_nContent == rOther.m_nContent &&
      77       34237 :                 m_nNode == rOther.m_nNode);
      78             :     }
      79           0 :     void SetPos(SwNodeIndex &rNode, sal_uInt16 nIdx)
      80             :     {
      81           0 :         m_nNode = rNode;
      82           0 :         m_nContent = nIdx;
      83           0 :     }
      84             :     //operators with SwPosition, where the node is hacked to the previous one,
      85             :     //and the offset to content is de-dynamic-ified
      86      126922 :     SwFltPosition(const SwPosition &rPos)
      87             :         : m_nNode(rPos.nNode, -1)
      88      126922 :         , m_nContent(rPos.nContent.GetIndex())
      89             :     {
      90      126922 :     }
      91       26486 :     void SetPos(const SwPosition &rPos)
      92             :     {
      93       26486 :         m_nNode = rPos.nNode.GetIndex()-1;
      94       26486 :         m_nContent = rPos.nContent.GetIndex();
      95       26486 :     }
      96             : };
      97             : 
      98             : // Stack-Eintrag fuer die Attribute Es werden immer Pointer auf neue Attribute uebergeben.
      99             : class SwFltStackEntry : private ::boost::noncopyable
     100             : {
     101             : public:
     102             :     SwFltPosition m_aMkPos;
     103             :     SwFltPosition m_aPtPos;
     104             : 
     105             :     SfxPoolItem * pAttr;// Format Attribute
     106             : 
     107             :     bool bOld;          // to mark Attributes *before* skipping field results
     108             :     bool bOpen;     //Entry open, awaiting being closed
     109             :     bool bConsumedByField;
     110             : 
     111             :     sal_Int32 mnStartCP;
     112             :     sal_Int32 mnEndCP;
     113             :     bool bIsParaEnd;
     114             : 
     115             :     SW_DLLPUBLIC SwFltStackEntry(const SwPosition & rStartPos, SfxPoolItem* pHt );
     116             :     SW_DLLPUBLIC ~SwFltStackEntry();
     117             : 
     118             :     void SetStartPos(const SwPosition & rStartPos);
     119             :     SW_DLLPUBLIC void SetEndPos(  const SwPosition & rEndPos);
     120             :     SW_DLLPUBLIC bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck) const;
     121             :     SW_DLLPUBLIC static bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion,
     122             :         bool bCheck, const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, bool bIsParaEnd=false,
     123             :         sal_uInt16 nWhich=0);
     124             : 
     125       26203 :     void SetStartCP(sal_Int32 nCP) {mnStartCP = nCP;}
     126       25699 :     void SetEndCP(sal_Int32 nCP) {mnEndCP = nCP;}
     127       22895 :     sal_Int32 GetStartCP() const {return mnStartCP;}
     128       22895 :     sal_Int32 GetEndCP() const {return mnEndCP;}
     129             :     bool IsAbleMakeRegion();
     130       20059 :     bool IsParaEnd(){ return bIsParaEnd;}
     131       22892 :     void SetIsParaEnd(bool bArg){ bIsParaEnd = bArg;}
     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             : 
     140             :     sal_uLong nFieldFlags;
     141             :     vcl::KeyCode aEmptyKeyCode; // fuer Bookmarks
     142             : 
     143             : private:
     144             :     bool bHasSdOD;
     145             :     bool bSdODChecked;
     146             : 
     147             : protected:
     148             :     SwDoc* pDoc;
     149             :     bool bIsEndStack;
     150             : 
     151             :     virtual void SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry& rEntry);
     152         281 :     virtual sal_Int32 GetCurrAttrCP() const {return -1;}
     153             :     virtual bool IsParaEndInCPs(sal_Int32 nStart,sal_Int32 nEnd,bool bSdOD=true) const;
     154             : 
     155             :     //Clear the para end position recorded in reader intermittently for the least impact on loading performance
     156          77 :     virtual void ClearParaEndPosition(){};
     157             :     virtual bool CheckSdOD(sal_Int32 nStart,sal_Int32 nEnd);
     158             :     bool HasSdOD();
     159             : 
     160             : public:
     161             :     void MoveAttrs( const SwPosition&  rPos );
     162             :     enum Flags
     163             :     {
     164             :         HYPO,
     165             :         TAGS_DO_ID,
     166             :         TAGS_VISIBLE,
     167             :         BOOK_TO_VAR_REF,
     168             :         BOOK_AND_REF,
     169             :         TAGS_IN_TEXT,
     170             :         ALLOW_FLD_CR,
     171             :         NO_FLD_CR,
     172             :         DONT_HARD_PROTECT
     173             :     };
     174             : 
     175             :     SwFltControlStack(SwDoc* pDo, sal_uLong nFieldFl);
     176             :     virtual ~SwFltControlStack();
     177             : 
     178          80 :     bool IsFlagSet(Flags no) const  { return ::SwFltGetFlag(nFieldFlags, no);}
     179             : 
     180             :     void NewAttr(const SwPosition& rPos, const SfxPoolItem & rAttr );
     181             : 
     182             :     virtual SwFltStackEntry* SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, bool bTstEnde=true, long nHand = LONG_MAX, bool consumedByField=false);
     183             : 
     184             :     void StealAttr(const SwNodeIndex& rNode, sal_uInt16 nAttrId = 0);
     185             :     void MarkAllAttrsOld();
     186             :     void KillUnlockedAttrs(const SwPosition& pPos);
     187             :     SfxPoolItem* GetFormatStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos = 0);
     188             :     const SfxPoolItem* GetOpenStackAttr(const SwPosition& rPos, sal_uInt16 nWhich);
     189             :     void Delete(const SwPaM &rPam);
     190             : 
     191        1753 :     bool empty() const { return maEntries.empty(); }
     192       27946 :     Entries::size_type size() const { return maEntries.size(); }
     193      360357 :     SwFltStackEntry& operator[](Entries::size_type nIndex)
     194      360357 :          { return maEntries[nIndex]; }
     195             :     void DeleteAndDestroy(Entries::size_type nCnt);
     196             : };
     197             : 
     198             : class SwFltAnchorClient;
     199             : 
     200             : class SW_DLLPUBLIC SwFltAnchor : public SfxPoolItem
     201             : {
     202             :     SwFrameFormat* pFrameFormat;
     203             :     SwFltAnchorClient * pClient;
     204             : 
     205             : public:
     206             :     SwFltAnchor(SwFrameFormat* pFlyFormat);
     207             :     SwFltAnchor(const SwFltAnchor&);
     208             :     virtual ~SwFltAnchor();
     209             : 
     210             :     // "pure virtual Methoden" vom SfxPoolItem
     211             :     virtual bool operator==(const SfxPoolItem&) const SAL_OVERRIDE;
     212             :     virtual SfxPoolItem* Clone(SfxItemPool* = 0) const SAL_OVERRIDE;
     213             :     void SetFrameFormat(SwFrameFormat * _pFrameFormat);
     214             :     const SwFrameFormat* GetFrameFormat() const { return pFrameFormat;}
     215         114 :           SwFrameFormat* GetFrameFormat() { return pFrameFormat;}
     216             : };
     217             : 
     218         456 : class SwFltAnchorClient : public SwClient
     219             : {
     220             :     SwFltAnchor * m_pFltAnchor;
     221             : 
     222             : public:
     223             :     SwFltAnchorClient(SwFltAnchor * pFltAnchor);
     224             : 
     225             :     virtual void Modify (const SfxPoolItem *pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
     226             : };
     227             : 
     228          15 : class SW_DLLPUBLIC SwFltRedline : public SfxPoolItem
     229             : {
     230             : public:
     231             :     DateTime        aStamp;
     232             :     DateTime        aStampPrev;
     233             :     RedlineType_t   eType;
     234             :     RedlineType_t   eTypePrev;
     235             :     sal_uInt16          nAutorNo;
     236             :     sal_uInt16          nAutorNoPrev;
     237             : 
     238           5 :     SwFltRedline(RedlineType_t   eType_,
     239             :                  sal_uInt16          nAutorNo_,
     240             :                  const DateTime& rStamp_,
     241             :                  RedlineType_t   eTypePrev_    = nsRedlineType_t::REDLINE_INSERT,
     242             :                  sal_uInt16          nAutorNoPrev_ = USHRT_MAX,
     243             :                  const DateTime* pStampPrev_   = 0)
     244             :         : SfxPoolItem(RES_FLTR_REDLINE), aStamp(rStamp_),
     245             :         aStampPrev( DateTime::EMPTY ),
     246             :         eType(eType_),
     247           5 :         eTypePrev(eTypePrev_), nAutorNo(nAutorNo_), nAutorNoPrev(nAutorNoPrev_)
     248             :     {
     249           5 :             if( pStampPrev_ )
     250           0 :                 aStampPrev = *pStampPrev_;
     251           5 :     }
     252             : 
     253           5 :     SwFltRedline(const SwFltRedline& rCpy):
     254             :         SfxPoolItem(RES_FLTR_REDLINE),
     255             :         aStamp(         rCpy.aStamp       ),
     256             :         aStampPrev(     rCpy.aStampPrev   ),
     257             :         eType(          rCpy.eType        ),
     258             :         eTypePrev(      rCpy.eTypePrev    ),
     259             :         nAutorNo(       rCpy.nAutorNo     ),
     260           5 :         nAutorNoPrev(   rCpy.nAutorNoPrev )
     261           5 :         {}
     262             :     // "pure virtual Methoden" vom SfxPoolItem
     263             :     virtual bool operator==(const SfxPoolItem& rItem) const SAL_OVERRIDE;
     264             :     virtual SfxPoolItem* Clone(SfxItemPool* = 0) const SAL_OVERRIDE;
     265             : };
     266             : 
     267         120 : class SW_DLLPUBLIC SwFltBookmark : public SfxPoolItem
     268             : {
     269             : private:
     270             : 
     271             :     long mnHandle;
     272             :     OUString maName;
     273             :     OUString maVal;
     274             :     bool mbIsTOCBookmark;
     275             : 
     276             : public:
     277             :     SwFltBookmark( const OUString& rNa,
     278             :                    const OUString& rVa,
     279             :                    long nHand,
     280             :                    const bool bIsTOCBookmark = false );
     281             :     SwFltBookmark( const SwFltBookmark& );
     282             : 
     283             :     // "pure virtual Methoden" vom SfxPoolItem
     284             :     virtual bool operator==(const SfxPoolItem&) const SAL_OVERRIDE;
     285             :     virtual SfxPoolItem* Clone(SfxItemPool* = 0) const SAL_OVERRIDE;
     286             : 
     287          42 :     long GetHandle() const              { return mnHandle; }
     288          45 :     const OUString& GetName() const       { return maName; }
     289           0 :     const OUString& GetValSys() const     { return maVal; }
     290         115 :     bool IsTOCBookmark() const
     291             :     {
     292         115 :         return mbIsTOCBookmark;
     293             :     }
     294             : };
     295             : 
     296           0 : class SW_DLLPUBLIC SwFltTOX : public SfxPoolItem
     297             : {
     298             :     SwTOXBase* pTOXBase;
     299             :     sal_uInt16 nCols;
     300             :     bool bHadBreakItem; // there was a break item BEFORE insertion of the TOX
     301             :     bool bHadPageDescItem;
     302             : public:
     303             :     SwFltTOX(SwTOXBase* pBase, sal_uInt16 _nCols = 0);
     304             :     SwFltTOX(const SwFltTOX&);
     305             :     // "pure virtual Methoden" vom SfxPoolItem
     306             :     virtual bool operator==(const SfxPoolItem&) const SAL_OVERRIDE;
     307             :     virtual SfxPoolItem* Clone(SfxItemPool* = 0) const SAL_OVERRIDE;
     308           0 :     SwTOXBase* GetBase()            { return pTOXBase; }
     309             :     sal_uInt16 GetCols() const          { return nCols; }
     310           0 :     void SetHadBreakItem(    bool bVal ) { bHadBreakItem    = bVal; }
     311           0 :     void SetHadPageDescItem( bool bVal ) { bHadPageDescItem = bVal; }
     312           0 :     bool HadBreakItem()    const { return bHadBreakItem; }
     313           0 :     bool HadPageDescItem() const { return bHadPageDescItem; }
     314             : };
     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         250 : class SwFltEndStack : public SwFltControlStack
     320             : {
     321             : public:
     322         250 :     SwFltEndStack(SwDoc* pDo, sal_uLong nFieldFl)
     323         250 :         :SwFltControlStack(pDo, nFieldFl)
     324             :     {
     325         250 :         bIsEndStack = true;
     326         250 :     }
     327             : };
     328             : 
     329             : SW_DLLPUBLIC void UpdatePageDescs(SwDoc &rDoc, size_t nInPageDescOffset);
     330             : 
     331             : #endif
     332             : 
     333             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11