LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/inc - node.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 99 112 88.4 %
Date: 2013-07-09 Functions: 63 71 88.7 %
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             : 
      20             : #ifndef SW_NODE_HXX
      21             : #define SW_NODE_HXX
      22             : 
      23             : #include <vector>
      24             : 
      25             : #include <boost/utility.hpp>
      26             : #include <boost/shared_ptr.hpp>
      27             : 
      28             : #include <sal/types.h>
      29             : #include <tools/mempool.hxx>
      30             : 
      31             : #include "swdllapi.h"
      32             : #include <ndarr.hxx>
      33             : #include <ndtyp.hxx>
      34             : #include <index.hxx>
      35             : #include <fmtcol.hxx>
      36             : 
      37             : // ---------------------
      38             : // forward declarations
      39             : // ---------------------
      40             : 
      41             : class SwCntntFrm;
      42             : class SwCntntNode;
      43             : class SwDoc;
      44             : class SwEndNode;
      45             : class SwFrm;
      46             : class SwFrmFmt;
      47             : class SwGrfNode;
      48             : class SwNoTxtNode;
      49             : class SwNodeIndex;
      50             : class SwOLENode;
      51             : class SwRect;
      52             : class SwSection;
      53             : class SwSectionFmt;
      54             : class SwTOXBase;
      55             : class SwSectionNode;
      56             : class SwStartNode;
      57             : class SwTabFrm;
      58             : class SwRootFrm;
      59             : class SwTable;
      60             : class SwTableNode;
      61             : class SwTableBox;
      62             : class SwTxtNode;
      63             : class SwPageDesc;
      64             : class ViewShell;
      65             : struct SwPosition;
      66             : class IStyleAccess;
      67             : class IDocumentSettingAccess;
      68             : class IDocumentDeviceAccess;
      69             : class IDocumentMarkAccess;
      70             : class IDocumentRedlineAccess;
      71             : class IDocumentStylePoolAccess;
      72             : class IDocumentLineNumberAccess;
      73             : class IDocumentLinksAdministration;
      74             : class IDocumentFieldsAccess;
      75             : class IDocumentContentOperations;
      76             : class IDocumentListItems;
      77             : class SwOLENodes;
      78             : class Point;
      79             : 
      80             : /// Base class of the Writer document model elements.
      81             : class SW_DLLPUBLIC SwNode
      82             :     : private BigPtrEntry
      83             : {
      84             :     friend class SwNodes;
      85             : 
      86             :     sal_uInt8 nNodeType;
      87             : 
      88             :     /// For text nodes: level of auto format. Was put here because we had still free bits.
      89             :     sal_uInt8 nAFmtNumLvl : 3;
      90             :     bool bSetNumLSpace : 1;         ///< For numbering: TRUE: set indent.
      91             :     bool bIgnoreDontExpand : 1;     ///< for Text Attributes - ignore the flag
      92             : 
      93             : #ifdef DBG_UTIL
      94             :     static long s_nSerial;
      95             :     long m_nSerial;
      96             : #endif
      97             : 
      98             : protected:
      99             :     SwStartNode* pStartOfSection;
     100             : 
     101             :     SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeId );
     102             : 
     103             :     /// for the initial StartNode
     104             :     SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNodeId );
     105             : 
     106             : public:
     107             :     /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
     108             :        from subclasses */
     109             :     virtual ~SwNode() = 0;
     110             : 
     111             : #ifdef DBG_UTIL
     112             :     long GetSerial() const { return m_nSerial; }
     113             : #endif
     114             : 
     115             :     sal_uInt16 GetSectionLevel() const;
     116             : 
     117             :     inline sal_uLong StartOfSectionIndex() const;
     118       46004 :     inline const SwStartNode* StartOfSectionNode() const { return pStartOfSection; }
     119       65161 :     inline       SwStartNode* StartOfSectionNode() { return pStartOfSection; }
     120             : 
     121             :     inline sal_uLong EndOfSectionIndex() const;
     122             :     inline const SwEndNode* EndOfSectionNode() const;
     123             :     inline         SwEndNode* EndOfSectionNode();
     124             : 
     125           0 :     inline sal_uInt8 GetAutoFmtLvl() const     { return nAFmtNumLvl; }
     126           0 :     inline void SetAutoFmtLvl( sal_uInt8 nVal )      { nAFmtNumLvl = nVal; }
     127             : 
     128             :     inline bool IsSetNumLSpace() const  { return bSetNumLSpace; }
     129           0 :     inline void SetNumLSpace( bool bFlag )        { bSetNumLSpace = bFlag; }
     130             : 
     131       62316 :     inline bool IsIgnoreDontExpand() const  { return bIgnoreDontExpand; }
     132        1454 :     inline void SetIgnoreDontExpand( bool bNew )  { bIgnoreDontExpand = bNew; }
     133             : 
     134      128669 :     sal_uInt8   GetNodeType() const { return nNodeType; }
     135             : 
     136             :     inline       SwStartNode *GetStartNode();
     137             :     inline const SwStartNode *GetStartNode() const;
     138             :     inline       SwCntntNode *GetCntntNode();
     139             :     inline const SwCntntNode *GetCntntNode() const;
     140             :     inline       SwEndNode   *GetEndNode();
     141             :     inline const SwEndNode   *GetEndNode() const;
     142             :     inline       SwTxtNode   *GetTxtNode();
     143             :     inline const SwTxtNode   *GetTxtNode() const;
     144             :     inline       SwOLENode   *GetOLENode();
     145             :     inline const SwOLENode   *GetOLENode() const;
     146             :     inline       SwNoTxtNode *GetNoTxtNode();
     147             :     inline const SwNoTxtNode *GetNoTxtNode() const;
     148             :     inline       SwGrfNode   *GetGrfNode();
     149             :     inline const SwGrfNode   *GetGrfNode() const;
     150             :     inline       SwTableNode *GetTableNode();
     151             :     inline const SwTableNode *GetTableNode() const;
     152             :     inline       SwSectionNode *GetSectionNode();
     153             :     inline const SwSectionNode *GetSectionNode() const;
     154             : 
     155             :     inline sal_Bool IsStartNode() const;
     156             :     inline sal_Bool IsCntntNode() const;
     157             :     inline sal_Bool IsEndNode() const;
     158             :     inline sal_Bool IsTxtNode() const;
     159             :     inline sal_Bool IsTableNode() const;
     160             :     inline sal_Bool IsSectionNode() const;
     161             :     inline sal_Bool IsOLENode() const;
     162             :     inline sal_Bool IsNoTxtNode() const;
     163             :     inline sal_Bool IsGrfNode() const;
     164             : 
     165             :     /**
     166             :        Checks if this node is in redlines.
     167             : 
     168             :        @retval sal_True       this node is in redlines
     169             :        @retval sal_False      else
     170             :      */
     171             :     sal_Bool IsInRedlines() const;
     172             : 
     173             :     /** Search table node, in which it is. If it is in no table
     174             :        @return 0. */
     175             :                     SwTableNode *FindTableNode();
     176             :     inline const  SwTableNode *FindTableNode() const;
     177             : 
     178             :     /** Search section node, in which it is. If it is in no section
     179             :        @return 0. */
     180             :                     SwSectionNode *FindSectionNode();
     181             :     inline    const   SwSectionNode *FindSectionNode() const;
     182             : 
     183             :     SwStartNode* FindSttNodeByType( SwStartNodeType eTyp );
     184             :     inline const SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ) const;
     185             : 
     186       85346 :     const SwStartNode* FindTableBoxStartNode() const
     187       85346 :                         { return FindSttNodeByType( SwTableBoxStartNode ); }
     188         578 :     const SwStartNode* FindFlyStartNode() const
     189         578 :                         { return FindSttNodeByType( SwFlyStartNode ); }
     190         122 :     const SwStartNode* FindFootnoteStartNode() const
     191         122 :                         { return FindSttNodeByType( SwFootnoteStartNode ); }
     192         311 :     const SwStartNode* FindHeaderStartNode() const
     193         311 :                         { return FindSttNodeByType( SwHeaderStartNode ); }
     194         303 :     const SwStartNode* FindFooterStartNode() const
     195         303 :                         { return FindSttNodeByType( SwFooterStartNode ); }
     196             : 
     197             :     /// Node is in which nodes-array/doc?
     198             :     inline          SwNodes& GetNodes();
     199             :     inline const  SwNodes& GetNodes() const;
     200             :     inline            SwDoc* GetDoc();
     201             :     inline const  SwDoc* GetDoc() const;
     202             : 
     203             :     /** Provides access to the document setting interface
     204             :      */
     205             :     const IDocumentSettingAccess* getIDocumentSettingAccess() const;
     206             : 
     207             :     /** Provides access to the document device interface
     208             :      */
     209             :     const IDocumentDeviceAccess* getIDocumentDeviceAccess() const;
     210             : 
     211             :     /** Provides access to the document bookmark interface
     212             :      */
     213             :     const IDocumentMarkAccess* getIDocumentMarkAccess() const;
     214             : 
     215             :     /** Provides access to the document redline interface
     216             :      */
     217             :     const IDocumentRedlineAccess* getIDocumentRedlineAccess() const;
     218             : 
     219             :     /** Provides access to the document style pool interface
     220             :      */
     221             :     const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
     222             : 
     223             :     /** Provides access to the document line number information interface
     224             :      */
     225             :     const IDocumentLineNumberAccess* getIDocumentLineNumberAccess() const;
     226             : 
     227             :     /** Provides access to the document draw model interface
     228             :      */
     229             :     const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
     230             : 
     231             :     /** Provides access to the document layout interface
     232             :      */
     233             :     const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
     234             :           IDocumentLayoutAccess* getIDocumentLayoutAccess();
     235             : 
     236             :     /** Provides access to the document links administration interface
     237             :      */
     238             :     const IDocumentLinksAdministration* getIDocumentLinksAdministration() const;
     239             :           IDocumentLinksAdministration* getIDocumentLinksAdministration();
     240             : 
     241             :     /** Provides access to the document fields administration interface
     242             :      */
     243             :     const IDocumentFieldsAccess* getIDocumentFieldsAccess() const;
     244             :           IDocumentFieldsAccess* getIDocumentFieldsAccess();
     245             : 
     246             :     /** Provides access to the document content operations interface
     247             :      */
     248             :           IDocumentContentOperations* getIDocumentContentOperations();
     249             : 
     250             :     /** Provides access to the document automatic styles interface
     251             :      */
     252             :           IStyleAccess& getIDocumentStyleAccess();
     253             : 
     254             :     /** Provides access to the document's numbered items interface
     255             : 
     256             :         @author OD
     257             :     */
     258             :     IDocumentListItems& getIDocumentListItems();
     259             : 
     260             :     /// Is node in the visible area of the Shell?
     261             :     sal_Bool IsInVisibleArea( ViewShell* pSh = 0 ) const;
     262             :     /// Is node in an protected area?
     263             :     bool IsInProtectSect() const;
     264             :     /**  Is node in something that is protected (range, frame,
     265             :         table cells ... including anchor in case of frames or footnotes)? */
     266             :     sal_Bool IsProtect() const;
     267             : 
     268             :     /** Search PageDesc with which this node is formated. If layout is existent
     269             :        search over layout, else only the hard way is left: search over the nodes
     270             :        to the front!! */
     271             :     const SwPageDesc* FindPageDesc( sal_Bool bCalcLay, sal_uInt32* pPgDescNdIdx = 0 ) const;
     272             : 
     273             :     /// If node is in a fly return the respective format.
     274             :     SwFrmFmt* GetFlyFmt() const;
     275             : 
     276             :     /// If node is in a table return the respective table box.
     277             :     SwTableBox* GetTblBox() const;
     278             : 
     279    11874556 :     inline sal_uLong GetIndex() const { return GetPos(); }
     280             : 
     281             :     const SwTxtNode* FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const;
     282             : 
     283             :     sal_uInt8 HasPrevNextLayNode() const;
     284             : 
     285             :     /**
     286             :      * Dumps the node structure to the given destination (file nodes.xml in the current directory by default)
     287             :      * @since 3.5
     288             :      */
     289             :     virtual void dumpAsXml( xmlTextWriterPtr writer = NULL );
     290             : 
     291             : private:
     292             :     /// Private constructor because copying is never allowed!!
     293             :     SwNode( const SwNode & rNodes );
     294             :     SwNode & operator= ( const SwNode & rNodes );
     295             : };
     296             : 
     297             : /// Starts a section of nodes in the document model.
     298       23991 : class SwStartNode: public SwNode
     299             : {
     300             :     friend class SwNode;
     301             :     friend class SwNodes;
     302             :     friend class SwEndNode;     ///< to set the theEndOfSection !!
     303             : 
     304             :     SwEndNode* pEndOfSection;
     305             :     SwStartNodeType eSttNdTyp;
     306             : 
     307             :     /// for the initial StartNode
     308             :     SwStartNode( SwNodes& rNodes, sal_uLong nPos );
     309             : 
     310             : protected:
     311             :     SwStartNode( const SwNodeIndex &rWhere,
     312             :                  const sal_uInt8 nNodeType = ND_STARTNODE,
     313             :                  SwStartNodeType = SwNormalStartNode );
     314             : public:
     315       24285 :     DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode)
     316             : 
     317      298353 :     SwStartNodeType GetStartNodeType() const        { return eSttNdTyp; }
     318             : 
     319             :     /// Call ChkCondcoll to all ContentNodes of section.
     320             :     void CheckSectionCondColl() const;
     321             : 
     322             :     virtual void dumpAsXml( xmlTextWriterPtr writer = NULL );
     323             : 
     324             : private:
     325             :     /// Private constructor because copying is never allowed!!
     326             :     SwStartNode( const SwStartNode & rNode );
     327             :     SwStartNode & operator= ( const SwStartNode & rNode );
     328             : };
     329             : 
     330             : 
     331             : /// Ends a section of nodes in the document model.
     332       24242 : class SwEndNode : public SwNode
     333             : {
     334             :     friend class SwNodes;
     335             :     friend class SwTableNode;       ///< To enable creation of its EndNote.
     336             :     friend class SwSectionNode;     ///< To enable creation of its EndNote.
     337             : 
     338             :     /// for the initial StartNode
     339             :     SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd );
     340             : 
     341             : protected:
     342             :     SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd );
     343             : 
     344       24273 :     DECL_FIXEDMEMPOOL_NEWDEL(SwEndNode)
     345             : 
     346             : private:
     347             :     /// Private constructor because copying is never allowed!!
     348             :     SwEndNode( const SwEndNode & rNode );
     349             :     SwEndNode & operator= ( const SwEndNode & rNode );
     350             : };
     351             : 
     352             : 
     353             : // --------------------
     354             : // SwCntntNode
     355             : // --------------------
     356             : class SW_DLLPUBLIC SwCntntNode: public SwModify, public SwNode, public SwIndexReg
     357             : {
     358             : 
     359             : //FEATURE::CONDCOLL
     360             :     SwDepend* pCondColl;
     361             : //FEATURE::CONDCOLL
     362             :     mutable bool mbSetModifyAtAttr;
     363             : 
     364             : protected:
     365             :     SwCntntNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeType,
     366             :                 SwFmtColl *pFmtColl );
     367             :     /** the = 0 forces the class to be an abstract base class, but the dtor can be still called
     368             :        from subclasses */
     369             :     virtual ~SwCntntNode() = 0;
     370             : 
     371             :     /**  Attribute-set for all auto attributes of a CntntNode.
     372             :       (e.g. TxtNode or NoTxtNode). */
     373             :     boost::shared_ptr<const SfxItemSet> mpAttrSet;
     374             : 
     375             :     /// Make respective nodes create the specific AttrSets.
     376             :     virtual void NewAttrSet( SwAttrPool& ) = 0;
     377             : 
     378             :     /** There some functions that like to remove items from the internal
     379             :        SwAttrSet (handle): */
     380             :     sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds );
     381             : 
     382             :    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
     383             : 
     384             : public:
     385             :     TYPEINFO();     /// Already contained in base class Client.
     386             : 
     387             :     /** MakeFrm will be called for a certain layout
     388             :        pSib is another SwFrm of the same layout (e.g. the SwRootFrm itself, a sibling, the parent) */
     389             :     virtual SwCntntFrm *MakeFrm( SwFrm* pSib ) = 0;
     390             : 
     391             :     virtual SwCntntNode *SplitCntntNode(const SwPosition & ) = 0;
     392             : 
     393             :     virtual SwCntntNode *JoinNext();
     394             :     virtual SwCntntNode *JoinPrev();
     395             :     /** Is it possible to join two nodes?
     396             :        In pIdx the second position can be returned. */
     397             :     int CanJoinNext( SwNodeIndex* pIdx =0 ) const;
     398             :     int CanJoinPrev( SwNodeIndex* pIdx =0 ) const;
     399             : 
     400        8403 :     void MakeStartIndex( SwIndex * pIdx )   { pIdx->Assign( this, 0 ); }
     401        4069 :     void MakeEndIndex( SwIndex * pIdx )     { pIdx->Assign( this, Len() ); }
     402             : 
     403             :     sal_Bool GoNext(SwIndex *, sal_uInt16 nMode ) const;
     404             :     sal_Bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const;
     405             : 
     406             :     /// Replacement for good old GetFrm(..):
     407             :     SwCntntFrm *getLayoutFrm( const SwRootFrm*,
     408             :                         const Point* pDocPos = 0,
     409             :                         const SwPosition *pPos = 0,
     410             :                         const sal_Bool bCalcFrm = sal_True ) const;
     411             :     /** @return the real size of the frame or an empty rectangle if
     412             :        no layout exists. Needed for export filters. */
     413             :     SwRect FindLayoutRect( const sal_Bool bPrtArea = sal_False,
     414             :                             const Point* pPoint = 0,
     415             :                             const sal_Bool bCalcFrm = sal_False  ) const;
     416             :     SwRect FindPageFrmRect( const sal_Bool bPrtArea = sal_False,
     417             :                             const Point* pPoint = 0,
     418             :                             const sal_Bool bCalcFrm = sal_False  ) const;
     419             : 
     420             :     /** Method creates all views of document for given node. The content
     421             :        frames that are created are put in the respective layout. */
     422             :     void MakeFrms( SwCntntNode& rNode );
     423             : 
     424             :     /** Method deletes all views of document for the node. The content-
     425             :        frames are removed from the respective layout. */
     426             :     void DelFrms();
     427             : 
     428             :     /** @return count of elements of node content. Default is 1.
     429             :        There are differences between text node and formula node. */
     430             :     virtual xub_StrLen Len() const;
     431             : 
     432             :     virtual SwCntntNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const = 0;
     433             : 
     434             :     /// Get information from Client.
     435             :     virtual bool GetInfo( SfxPoolItem& ) const;
     436             : 
     437             :     /// SS for PoolItems: hard attributation.
     438             : 
     439             :     /// If bInParent is FALSE search for attribute only in this node.
     440             :     const SfxPoolItem& GetAttr( sal_uInt16 nWhich, sal_Bool bInParent=sal_True ) const;
     441             :     sal_Bool GetAttr( SfxItemSet& rSet, sal_Bool bInParent=sal_True ) const;
     442             :     /// made virtual
     443             :     virtual sal_Bool SetAttr( const SfxPoolItem& );
     444             :     virtual sal_Bool SetAttr( const SfxItemSet& rSet );
     445             :     virtual sal_Bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
     446             :     virtual sal_Bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr );
     447             :     virtual sal_uInt16 ResetAllAttr();
     448             : 
     449             :     /// Obtains attribute that is not delivered via conditional style!
     450             :     const SfxPoolItem* GetNoCondAttr( sal_uInt16 nWhich, sal_Bool bInParents ) const;
     451             : 
     452             :     /** Does node has already its own auto-attributes?
     453             :      Access to SwAttrSet. */
     454             :     inline const SwAttrSet &GetSwAttrSet() const;
     455      516480 :     inline const SwAttrSet *GetpSwAttrSet() const { return static_cast<const SwAttrSet*>(mpAttrSet.get()); }
     456       48214 :     inline sal_Bool  HasSwAttrSet() const { return mpAttrSet ? sal_True : sal_False; }
     457             : 
     458             :     virtual SwFmtColl* ChgFmtColl( SwFmtColl* );
     459        7946 :     SwFmtColl* GetFmtColl() const { return (SwFmtColl*)GetRegisteredIn(); }
     460             : 
     461             : //FEATURE::CONDCOLL
     462             :     inline SwFmtColl& GetAnyFmtColl() const;
     463             :     void SetCondFmtColl( SwFmtColl* );
     464             :     inline SwFmtColl* GetCondFmtColl() const;
     465             : 
     466             :     sal_Bool IsAnyCondition( SwCollCondition& rTmp ) const;
     467             :     void ChkCondColl();
     468             : //FEATURE::CONDCOLL
     469             : 
     470             :     /** Invalidates NumRule at the node. NumRule is updated
     471             :        on EndAction of a Shell at the latest. */
     472             :     sal_Bool InvalidateNumRule();
     473             : 
     474             :     /** determines the text direction for a certain
     475             :        position. @return -1, if text direction could *not* be determined. */
     476             :     short GetTextDirection( const SwPosition& rPos,
     477             :                             const Point* pPt ) const;
     478             : 
     479       18121 :     inline void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; }
     480       36124 :     inline bool GetModifyAtAttr() const { return mbSetModifyAtAttr; }
     481             : 
     482             :     static SwOLENodes* CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize );
     483             : 
     484             : private:
     485             :     /// Private constructor because copying is never allowed!!
     486             :     SwCntntNode( const SwCntntNode & rNode );
     487             :     SwCntntNode & operator= ( const SwCntntNode & rNode );
     488             : };
     489             : 
     490             : 
     491             : 
     492             : //---------
     493             : // SwTableNode
     494             : //---------
     495             : class SW_DLLPUBLIC SwTableNode : public SwStartNode, public SwModify
     496             : {
     497             :     friend class SwNodes;
     498             :     SwTable* pTable;
     499             : protected:
     500             :     virtual ~SwTableNode();
     501             : 
     502             : public:
     503             :     SwTableNode( const SwNodeIndex & );
     504             : 
     505        4741 :     const SwTable& GetTable() const { return *pTable; }
     506        2080 :     SwTable& GetTable() { return *pTable; }
     507             :     SwTabFrm *MakeFrm( SwFrm* );
     508             : 
     509             :     /// Creates the frms for the table node (i.e. the TabFrms).
     510             :     void MakeFrms( SwNodeIndex* pIdxBehind );
     511             : 
     512             :     /** Method deletes all views of document for the node.
     513             :        The content frames are removed from the respective layout. */
     514             :     void DelFrms();
     515             : 
     516             :     /** Method creates all views of the document for the previous node.
     517             :        The content frames that are created are put into the respective layout. */
     518             :     void MakeFrms( const SwNodeIndex & rIdx );
     519             : 
     520             :     SwTableNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
     521             :     void SetNewTable( SwTable* , sal_Bool bNewFrames=sal_True );
     522             : 
     523             : private:
     524             :     /// Private constructor because copying is never allowed!!
     525             :     SwTableNode( const SwTableNode & rNode );
     526             :     SwTableNode & operator= ( const SwTableNode & rNode );
     527             : };
     528             : 
     529             : 
     530             : //---------
     531             : // SwSectionNode
     532             : //---------
     533             : class SwSectionNode
     534             :     : public SwStartNode
     535             :     , private ::boost::noncopyable
     536             : {
     537             :     friend class SwNodes;
     538             : 
     539             : private:
     540             :     ::std::auto_ptr<SwSection> const m_pSection;
     541             : 
     542             : protected:
     543             :     virtual ~SwSectionNode();
     544             : 
     545             : public:
     546             :     SwSectionNode(SwNodeIndex const&,
     547             :         SwSectionFmt & rFmt, SwTOXBase const*const pTOXBase);
     548             : 
     549         755 :     const SwSection& GetSection() const { return *m_pSection; }
     550         525 :           SwSection& GetSection()       { return *m_pSection; }
     551             : 
     552             :     SwFrm *MakeFrm( SwFrm* );
     553             : 
     554             :     /** Creates the frms for the SectionNode (i.e. the SectionFrms).
     555             :        On default the frames are created until the end of the range.
     556             :        When another NodeIndex pEnd is passed a MakeFrms is called up to it.
     557             :        Used by TableToText. */
     558             :     void MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEnd = NULL );
     559             : 
     560             :     /** Method deletes all views of document for the node. The
     561             :      content frames are removed from the respective layout. */
     562             :     void DelFrms();
     563             : 
     564             :     /** Method creates all views of document for the previous node.
     565             :        The content frames created are put into the respective layout. */
     566             :     void MakeFrms( const SwNodeIndex & rIdx );
     567             : 
     568             :     SwSectionNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
     569             : 
     570             :     /// Set pointer in format of section on itself.
     571             :     void NodesArrChgd();
     572             : 
     573             :     /** Check for not hidden areas whether there is content that is not in
     574             :        a hidden sub-area. */
     575             :     sal_Bool IsCntntHidden() const;
     576             : 
     577             : 
     578             : };
     579             : 
     580             : 
     581             : //----------------
     582             : // SwDummySectionNode
     583             : //----------------
     584             : 
     585             : /** This class is internal. And quite frankly I don't know what ND_SECTIONDUMMY is for,
     586             :    the class has been merely created to replace "SwNode( ND_SECTIONDUMMY )", the only case
     587             :    of instantiating SwNode directly. Now SwNode can be an abstract base class. */
     588           0 : class SwDummySectionNode
     589             :     : private SwNode
     590             : {
     591             : private:
     592             :     friend class SwNodes;
     593             :     SwDummySectionNode( const SwNodeIndex &rWhere );
     594             : };
     595             : 
     596             : 
     597       58813 : inline       SwEndNode   *SwNode::GetEndNode()
     598             : {
     599       58813 :      return ND_ENDNODE == nNodeType ? (SwEndNode*)this : 0;
     600             : }
     601           0 : inline const SwEndNode   *SwNode::GetEndNode() const
     602             : {
     603           0 :      return ND_ENDNODE == nNodeType ? (const SwEndNode*)this : 0;
     604             : }
     605       40967 : inline       SwStartNode *SwNode::GetStartNode()
     606             : {
     607       40967 :      return ND_STARTNODE & nNodeType ? (SwStartNode*)this : 0;
     608             : }
     609           0 : inline const SwStartNode *SwNode::GetStartNode() const
     610             : {
     611           0 :      return ND_STARTNODE & nNodeType ? (const SwStartNode*)this : 0;
     612             : }
     613       86775 : inline       SwTableNode *SwNode::GetTableNode()
     614             : {
     615       86775 :      return ND_TABLENODE == nNodeType ? (SwTableNode*)this : 0;
     616             : }
     617          16 : inline const SwTableNode *SwNode::GetTableNode() const
     618             : {
     619          16 :      return ND_TABLENODE == nNodeType ? (const SwTableNode*)this : 0;
     620             : }
     621       42558 : inline       SwSectionNode *SwNode::GetSectionNode()
     622             : {
     623       42558 :      return ND_SECTIONNODE == nNodeType ? (SwSectionNode*)this : 0;
     624             : }
     625       12153 : inline const SwSectionNode *SwNode::GetSectionNode() const
     626             : {
     627       12153 :      return ND_SECTIONNODE == nNodeType ? (const SwSectionNode*)this : 0;
     628             : }
     629      682219 : inline       SwCntntNode *SwNode::GetCntntNode()
     630             : {
     631      682219 :      return ND_CONTENTNODE & nNodeType ? (SwCntntNode*)this : 0;
     632             : }
     633        3073 : inline const SwCntntNode *SwNode::GetCntntNode() const
     634             : {
     635        3073 :      return ND_CONTENTNODE & nNodeType ? (const SwCntntNode*)this : 0;
     636             : }
     637             : 
     638             : 
     639      126943 : inline sal_Bool SwNode::IsStartNode() const
     640             : {
     641      126943 :     return ND_STARTNODE & nNodeType  ? sal_True : sal_False;
     642             : }
     643      176421 : inline sal_Bool SwNode::IsCntntNode() const
     644             : {
     645      176421 :     return ND_CONTENTNODE & nNodeType  ? sal_True : sal_False;
     646             : }
     647       11038 : inline sal_Bool SwNode::IsEndNode() const
     648             : {
     649       11038 :     return ND_ENDNODE == nNodeType  ? sal_True : sal_False;
     650             : }
     651      292051 : inline sal_Bool SwNode::IsTxtNode() const
     652             : {
     653      292051 :     return ND_TEXTNODE == nNodeType  ? sal_True : sal_False;
     654             : }
     655      262396 : inline sal_Bool SwNode::IsTableNode() const
     656             : {
     657      262396 :     return ND_TABLENODE == nNodeType  ? sal_True : sal_False;
     658             : }
     659      166723 : inline sal_Bool SwNode::IsSectionNode() const
     660             : {
     661      166723 :     return ND_SECTIONNODE == nNodeType  ? sal_True : sal_False;
     662             : }
     663         816 : inline sal_Bool SwNode::IsNoTxtNode() const
     664             : {
     665         816 :     return ND_NOTXTNODE & nNodeType  ? sal_True : sal_False;
     666             : }
     667         141 : inline sal_Bool SwNode::IsOLENode() const
     668             : {
     669         141 :     return ND_OLENODE == nNodeType  ? sal_True : sal_False;
     670             : }
     671         288 : inline sal_Bool SwNode::IsGrfNode() const
     672             : {
     673         288 :     return ND_GRFNODE == nNodeType  ? sal_True : sal_False;
     674             : }
     675             : 
     676       87284 : inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const
     677             : {
     678       87284 :     return ((SwNode*)this)->FindSttNodeByType( eTyp );
     679             : }
     680       36194 : inline const SwTableNode* SwNode::FindTableNode() const
     681             : {
     682       36194 :     return ((SwNode*)this)->FindTableNode();
     683             : }
     684       19174 : inline const SwSectionNode* SwNode::FindSectionNode() const
     685             : {
     686       19174 :     return ((SwNode*)this)->FindSectionNode();
     687             : }
     688       40638 : inline sal_uLong SwNode::StartOfSectionIndex() const
     689             : {
     690       40638 :     return pStartOfSection->GetIndex();
     691             : }
     692        3116 : inline sal_uLong SwNode::EndOfSectionIndex() const
     693             : {
     694        3116 :     const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
     695        3116 :     return pStNd->pEndOfSection->GetIndex();
     696             : }
     697       16778 : inline const SwEndNode* SwNode::EndOfSectionNode() const
     698             : {
     699       16778 :     const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
     700       16778 :     return pStNd->pEndOfSection;
     701             : }
     702        3627 : inline SwEndNode* SwNode::EndOfSectionNode()
     703             : {
     704        3627 :     SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
     705        3627 :     return pStNd->pEndOfSection;
     706             : }
     707             : 
     708     4657645 : inline SwNodes& SwNode::GetNodes()
     709             : {
     710     4657645 :     return (SwNodes&)GetArray();
     711             : }
     712      863043 : inline const SwNodes& SwNode::GetNodes() const
     713             : {
     714      863043 :     return (SwNodes&)GetArray();
     715             : }
     716             : 
     717      693967 : inline SwDoc* SwNode::GetDoc()
     718             : {
     719      693967 :     return GetNodes().GetDoc();
     720             : }
     721      738291 : inline const SwDoc* SwNode::GetDoc() const
     722             : {
     723      738291 :     return GetNodes().GetDoc();
     724             : }
     725             : 
     726         134 : inline SwFmtColl* SwCntntNode::GetCondFmtColl() const
     727             : {
     728         134 :     return pCondColl ? (SwFmtColl*)pCondColl->GetRegisteredIn() : 0;
     729             : }
     730             : 
     731             : 
     732      867738 : inline SwFmtColl& SwCntntNode::GetAnyFmtColl() const
     733             : {
     734           0 :     return pCondColl && pCondColl->GetRegisteredIn()
     735           0 :                 ? *(SwFmtColl*)pCondColl->GetRegisteredIn()
     736      867738 :                 : *(SwFmtColl*)GetRegisteredIn();
     737             : }
     738             : 
     739     1088316 : inline const SwAttrSet& SwCntntNode::GetSwAttrSet() const
     740             : {
     741     1088316 :     return mpAttrSet ? *GetpSwAttrSet() : GetAnyFmtColl().GetAttrSet();
     742             : }
     743             : 
     744             : //FEATURE::CONDCOLL
     745             : 
     746      132874 : inline const SfxPoolItem& SwCntntNode::GetAttr( sal_uInt16 nWhich,
     747             :                                                 sal_Bool bInParents ) const
     748             : {
     749      132874 :     return GetSwAttrSet().Get( nWhich, bInParents );
     750             : }
     751             : 
     752           0 : inline SwDummySectionNode::SwDummySectionNode( const SwNodeIndex &rWhere )
     753           0 :     : SwNode( rWhere, ND_SECTIONDUMMY )
     754             : {
     755           0 : }
     756             : 
     757             : #endif
     758             : 
     759             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10