LCOV - code coverage report
Current view: top level - sw/inc - node.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 99 113 87.6 %
Date: 2012-08-25 Functions: 63 72 87.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 51 68 75.0 %

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

Generated by: LCOV version 1.10