LCOV - code coverage report
Current view: top level - sw/inc - node.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 112 0.0 %
Date: 2014-04-14 Functions: 0 71 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10