LCOV - code coverage report
Current view: top level - sw/source/core/docnode - node.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 621 907 68.5 %
Date: 2012-08-25 Functions: 73 83 88.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 641 1504 42.6 %

           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                 :            : 
      30                 :            : #include <hintids.hxx>
      31                 :            : #include <editeng/frmdiritem.hxx>
      32                 :            : #include <editeng/protitem.hxx>
      33                 :            : #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
      34                 :            : #include <fmtcntnt.hxx>
      35                 :            : #include <fmtanchr.hxx>
      36                 :            : #include <frmfmt.hxx>
      37                 :            : #include <txtftn.hxx>
      38                 :            : #include <ftnfrm.hxx>
      39                 :            : #include <doc.hxx>
      40                 :            : #include <docary.hxx>
      41                 :            : #include <node.hxx>
      42                 :            : #include <ndindex.hxx>
      43                 :            : #include <numrule.hxx>
      44                 :            : #include <swtable.hxx>
      45                 :            : #include <ndtxt.hxx>
      46                 :            : #include <pam.hxx>
      47                 :            : #include <swcache.hxx>
      48                 :            : #include <section.hxx>
      49                 :            : #include <cntfrm.hxx>
      50                 :            : #include <flyfrm.hxx>
      51                 :            : #include <txtfrm.hxx>
      52                 :            : #include <tabfrm.hxx>  // SwTabFrm
      53                 :            : #include <viewsh.hxx>
      54                 :            : #include <paratr.hxx>
      55                 :            : #include <ftnidx.hxx>
      56                 :            : #include <fmtftn.hxx>
      57                 :            : #include <fmthdft.hxx>
      58                 :            : #include <frmatr.hxx>
      59                 :            : #include <fmtautofmt.hxx>
      60                 :            : #include <frmtool.hxx>
      61                 :            : #include <pagefrm.hxx>
      62                 :            : #include <node2lay.hxx>
      63                 :            : #include <pagedesc.hxx>
      64                 :            : #include <fmtpdsc.hxx>
      65                 :            : #include <breakit.hxx>
      66                 :            : #include <crsskip.hxx>
      67                 :            : #include <SwStyleNameMapper.hxx>
      68                 :            : #include <scriptinfo.hxx>
      69                 :            : #include <rootfrm.hxx>
      70                 :            : #include <istyleaccess.hxx>
      71                 :            : #include <IDocumentListItems.hxx>
      72                 :            : #include <switerator.hxx>
      73                 :            : #include "ndole.hxx"
      74                 :            : 
      75                 :            : using namespace ::com::sun::star::i18n;
      76                 :            : 
      77 [ +  + ][ +  + ]:     185619 : TYPEINIT2( SwCntntNode, SwModify, SwIndexReg )
                 [ -  + ]
      78                 :            : 
      79                 :            : /*
      80                 :            :  * Some local helper functions for the attribute set handle of a content node.
      81                 :            :  * Since the attribute set of a content node may not be modified directly,
      82                 :            :  * we always have to create a new SwAttrSet, do the modifications, and get
      83                 :            :  * a new handle from the style access
      84                 :            :  */
      85                 :            : 
      86                 :            : namespace AttrSetHandleHelper
      87                 :            : {
      88                 :            : 
      89                 :      30714 : void GetNewAutoStyle( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
      90                 :            :                       const SwCntntNode& rNode,
      91                 :            :                       SwAttrSet& rNewAttrSet )
      92                 :            : {
      93                 :      30714 :     const SwAttrSet* pAttrSet = static_cast<const SwAttrSet*>(mrpAttrSet.get());
      94         [ +  + ]:      30714 :     if( rNode.GetModifyAtAttr() )
      95                 :        119 :         const_cast<SwAttrSet*>(pAttrSet)->SetModifyAtAttr( 0 );
      96                 :      30714 :     IStyleAccess& rSA = pAttrSet->GetPool()->GetDoc()->GetIStyleAccess();
      97                 :      30714 :     mrpAttrSet = rSA.getAutomaticStyle( rNewAttrSet, rNode.IsTxtNode() ?
      98                 :            :                                                      IStyleAccess::AUTO_STYLE_PARA :
      99 [ +  - ][ +  + ]:      30714 :                                                      IStyleAccess::AUTO_STYLE_NOTXT );
     100                 :      30714 :     const bool bSetModifyAtAttr = ((SwAttrSet*)mrpAttrSet.get())->SetModifyAtAttr( &rNode );
     101                 :      30714 :     rNode.SetModifyAtAttr( bSetModifyAtAttr );
     102                 :      30714 : }
     103                 :            : 
     104                 :            : 
     105                 :        338 : void SetParent( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
     106                 :            :                 const SwCntntNode& rNode,
     107                 :            :                 const SwFmt* pParentFmt,
     108                 :            :                 const SwFmt* pConditionalFmt )
     109                 :            : {
     110                 :        338 :     const SwAttrSet* pAttrSet = static_cast<const SwAttrSet*>(mrpAttrSet.get());
     111                 :            :     OSL_ENSURE( pAttrSet, "no SwAttrSet" );
     112                 :            :     OSL_ENSURE( pParentFmt || !pConditionalFmt, "ConditionalFmt without ParentFmt?" );
     113                 :            : 
     114         [ +  - ]:        338 :     const SwAttrSet* pParentSet = pParentFmt ? &pParentFmt->GetAttrSet() : 0;
     115                 :            : 
     116         [ +  + ]:        338 :     if ( pParentSet != pAttrSet->GetParent() )
     117                 :            :     {
     118         [ +  - ]:        169 :         SwAttrSet aNewSet( *pAttrSet );
     119                 :        169 :         aNewSet.SetParent( pParentSet );
     120         [ +  - ]:        169 :         aNewSet.ClearItem( RES_FRMATR_STYLE_NAME );
     121         [ +  - ]:        169 :         aNewSet.ClearItem( RES_FRMATR_CONDITIONAL_STYLE_NAME );
     122         [ +  - ]:        169 :         String sVal;
     123                 :            : 
     124         [ +  - ]:        169 :         if ( pParentFmt )
     125                 :            :         {
     126         [ +  - ]:        169 :             SwStyleNameMapper::FillProgName( pParentFmt->GetName(), sVal, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
     127         [ +  - ]:        169 :             const SfxStringItem aAnyFmtColl( RES_FRMATR_STYLE_NAME, sVal );
     128         [ +  - ]:        169 :             aNewSet.Put( aAnyFmtColl );
     129                 :            : 
     130         [ -  + ]:        169 :             if ( pConditionalFmt != pParentFmt )
     131         [ #  # ]:          0 :                 SwStyleNameMapper::FillProgName( pConditionalFmt->GetName(), sVal, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
     132                 :            : 
     133         [ +  - ]:        169 :             const SfxStringItem aFmtColl( RES_FRMATR_CONDITIONAL_STYLE_NAME, sVal );
     134 [ +  - ][ +  - ]:        169 :             aNewSet.Put( aFmtColl );
                 [ +  - ]
     135                 :            :         }
     136                 :            : 
     137 [ +  - ][ +  - ]:        169 :         GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
                 [ +  - ]
     138                 :            :     }
     139                 :        338 : }
     140                 :            : 
     141                 :       7318 : const SfxPoolItem* Put( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
     142                 :            :                         const SwCntntNode& rNode,
     143                 :            :                         const SfxPoolItem& rAttr )
     144                 :            : {
     145         [ +  - ]:       7318 :     SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
     146         [ +  - ]:       7318 :     const SfxPoolItem* pRet = aNewSet.Put( rAttr );
     147         [ +  + ]:       7318 :     if ( pRet )
     148         [ +  - ]:       3067 :         GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
     149         [ +  - ]:       7318 :     return pRet;
     150                 :            : }
     151                 :            : 
     152                 :      12792 : int Put( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, const SwCntntNode& rNode,
     153                 :            :          const SfxItemSet& rSet )
     154                 :            : {
     155         [ +  - ]:      12792 :     SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
     156                 :            : 
     157                 :            :     // #i76273# Robust
     158                 :      12792 :     SfxItemSet* pStyleNames = 0;
     159 [ +  - ][ +  + ]:      12792 :     if ( SFX_ITEM_SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, sal_False ) )
     160                 :            :     {
     161 [ +  - ][ +  - ]:       2625 :         pStyleNames = new SfxItemSet( *aNewSet.GetPool(), RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME );
     162         [ +  - ]:       2625 :         pStyleNames->Put( aNewSet );
     163                 :            :     }
     164                 :            : 
     165         [ +  - ]:      12792 :     const int nRet = aNewSet.Put( rSet );
     166                 :            : 
     167                 :            :     // #i76273# Robust
     168         [ +  + ]:      12792 :     if ( pStyleNames )
     169                 :            :     {
     170         [ +  - ]:       2625 :         aNewSet.Put( *pStyleNames );
     171 [ +  - ][ +  - ]:       2625 :         delete pStyleNames;
     172                 :            :     }
     173                 :            : 
     174         [ +  + ]:      12792 :     if ( nRet )
     175         [ +  - ]:      12395 :         GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
     176                 :            : 
     177         [ +  - ]:      12792 :     return nRet;
     178                 :            : }
     179                 :            : 
     180                 :       1414 : int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
     181                 :            :             const SwCntntNode& rNode, const SfxPoolItem& rAttr,
     182                 :            :             SwAttrSet* pOld, SwAttrSet* pNew )
     183                 :            : {
     184         [ +  - ]:       1414 :     SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
     185                 :            : 
     186                 :            :     // for a correct broadcast, we need to do a SetModifyAtAttr with the items
     187                 :            :     // from aNewSet. The 'regular' SetModifyAtAttr is done in GetNewAutoStyle
     188         [ +  + ]:       1414 :     if( rNode.GetModifyAtAttr() )
     189         [ +  - ]:          3 :         aNewSet.SetModifyAtAttr( &rNode );
     190                 :            : 
     191         [ +  - ]:       1414 :     const int nRet = aNewSet.Put_BC( rAttr, pOld, pNew );
     192                 :            : 
     193         [ +  + ]:       1414 :     if ( nRet )
     194         [ +  - ]:       1364 :         GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
     195                 :            : 
     196         [ +  - ]:       1414 :     return nRet;
     197                 :            : }
     198                 :            : 
     199                 :       6708 : int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
     200                 :            :             const SwCntntNode& rNode, const SfxItemSet& rSet,
     201                 :            :             SwAttrSet* pOld, SwAttrSet* pNew )
     202                 :            : {
     203         [ +  - ]:       6708 :     SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
     204                 :            : 
     205                 :            :     // #i76273# Robust
     206                 :       6708 :     SfxItemSet* pStyleNames = 0;
     207 [ +  - ][ +  + ]:       6708 :     if ( SFX_ITEM_SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, sal_False ) )
     208                 :            :     {
     209 [ +  - ][ +  - ]:        653 :         pStyleNames = new SfxItemSet( *aNewSet.GetPool(), RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME );
     210         [ +  - ]:        653 :         pStyleNames->Put( aNewSet );
     211                 :            :     }
     212                 :            : 
     213                 :            :     // for a correct broadcast, we need to do a SetModifyAtAttr with the items
     214                 :            :     // from aNewSet. The 'regular' SetModifyAtAttr is done in GetNewAutoStyle
     215         [ -  + ]:       6708 :     if( rNode.GetModifyAtAttr() )
     216         [ #  # ]:          0 :         aNewSet.SetModifyAtAttr( &rNode );
     217                 :            : 
     218         [ +  - ]:       6708 :     const int nRet = aNewSet.Put_BC( rSet, pOld, pNew );
     219                 :            : 
     220                 :            :     // #i76273# Robust
     221         [ +  + ]:       6708 :     if ( pStyleNames )
     222                 :            :     {
     223         [ +  - ]:        653 :         aNewSet.Put( *pStyleNames );
     224 [ +  - ][ +  - ]:        653 :         delete pStyleNames;
     225                 :            :     }
     226                 :            : 
     227         [ +  + ]:       6708 :     if ( nRet )
     228         [ +  - ]:       5706 :         GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
     229                 :            : 
     230         [ +  - ]:       6708 :     return nRet;
     231                 :            : }
     232                 :            : 
     233                 :       6585 : sal_uInt16 ClearItem_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
     234                 :            :                      const SwCntntNode& rNode, sal_uInt16 nWhich,
     235                 :            :                      SwAttrSet* pOld, SwAttrSet* pNew )
     236                 :            : {
     237         [ +  - ]:       6585 :     SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
     238         [ +  + ]:       6585 :     if( rNode.GetModifyAtAttr() )
     239         [ +  - ]:       1521 :         aNewSet.SetModifyAtAttr( &rNode );
     240         [ +  - ]:       6585 :     const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich, pOld, pNew );
     241         [ +  + ]:       6585 :     if ( nRet )
     242         [ +  - ]:       3721 :         GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
     243         [ +  - ]:       6585 :     return nRet;
     244                 :            : }
     245                 :            : 
     246                 :      18514 : sal_uInt16 ClearItem_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet,
     247                 :            :                      const SwCntntNode& rNode,
     248                 :            :                      sal_uInt16 nWhich1, sal_uInt16 nWhich2,
     249                 :            :                      SwAttrSet* pOld, SwAttrSet* pNew )
     250                 :            : {
     251         [ +  - ]:      18514 :     SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet );
     252         [ -  + ]:      18514 :     if( rNode.GetModifyAtAttr() )
     253         [ #  # ]:          0 :         aNewSet.SetModifyAtAttr( &rNode );
     254         [ +  - ]:      18514 :     const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich1, nWhich2, pOld, pNew );
     255         [ +  + ]:      18514 :     if ( nRet )
     256         [ +  - ]:       2074 :         GetNewAutoStyle( mrpAttrSet, rNode, aNewSet );
     257         [ +  - ]:      18514 :     return nRet;
     258                 :            : }
     259                 :            : 
     260                 :            : }
     261                 :            : 
     262                 :            : /*******************************************************************
     263                 :            : |*
     264                 :            : |*  SwNode::GetSectionLevel
     265                 :            : |*
     266                 :            : |*  Beschreibung
     267                 :            : |*      Die Funktion liefert den Sectionlevel an der durch
     268                 :            : |*      aIndex bezeichneten Position.
     269                 :            : |*
     270                 :            : |*      Die Logik ist wie folgt:   ( S -> Start, E -> End, C -> CntntNode)
     271                 :            : |*          Level   0       E
     272                 :            : |*                  1   S  E
     273                 :            : |*                  2    SC
     274                 :            : |*
     275                 :            : |*      alle EndNodes der GrundSection haben den Level 0
     276                 :            : |*      alle StartNodes der GrundSection haben den Level 1
     277                 :            : |*
     278                 :            : *******************************************************************/
     279                 :            : 
     280                 :            : 
     281                 :          6 : sal_uInt16 SwNode::GetSectionLevel() const
     282                 :            : {
     283                 :            :     // EndNode einer Grund-Section ?? diese sind immer 0 !!
     284 [ -  + ][ #  # ]:          6 :     if( IsEndNode() && 0 == pStartOfSection->StartOfSectionIndex() )
                 [ -  + ]
     285                 :          0 :         return 0;
     286                 :            : 
     287                 :            :     sal_uInt16 nLevel;
     288         [ -  + ]:          6 :     const SwNode* pNode = IsStartNode() ? this : pStartOfSection;
     289         [ +  + ]:         18 :     for( nLevel = 1; 0 != pNode->StartOfSectionIndex(); ++nLevel )
     290                 :         12 :         pNode = pNode->pStartOfSection;
     291         [ -  + ]:          6 :     return IsEndNode() ? nLevel-1 : nLevel;
     292                 :            : }
     293                 :            : 
     294                 :            : /*******************************************************************
     295                 :            : |*
     296                 :            : |*  SwNode::SwNode
     297                 :            : |*
     298                 :            : |*  Beschreibung
     299                 :            : |*      Konstruktor; dieser fuegt einen Node in das Array rNodes
     300                 :            : |*      an der Position rWhere ein. Dieser bekommt als
     301                 :            : |*      theEndOfSection den EndOfSection-Index des Nodes
     302                 :            : |*      unmittelbar vor ihm. Falls er sich an der Position 0
     303                 :            : |*      innerhalb des variablen Arrays befindet, wird
     304                 :            : |*      theEndOfSection 0 (der neue selbst).
     305                 :            : |*
     306                 :            : |*  Parameter
     307                 :            : |*      IN
     308                 :            : |*      rNodes bezeichnet das variable Array, in das der Node
     309                 :            : |*      eingefuegt werden soll
     310                 :            : |*      IN
     311                 :            : |*      rWhere bezeichnet die Position innerhalb dieses Arrays,
     312                 :            : |*      an der der Node eingefuegt werden soll
     313                 :            : |*
     314                 :            : *******************************************************************/
     315                 :            : 
     316                 :            : #ifdef DBG_UTIL
     317                 :            : long SwNode::s_nSerial = 0;
     318                 :            : #endif
     319                 :            : 
     320                 :      22733 : SwNode::SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType )
     321                 :      22733 :     : nNodeType( nNdType ), pStartOfSection( 0 )
     322                 :            : {
     323                 :      22733 :     bSetNumLSpace = bIgnoreDontExpand = sal_False;
     324                 :      22733 :     nAFmtNumLvl = 0;
     325                 :            : 
     326                 :      22733 :     SwNodes& rNodes = (SwNodes&)rWhere.GetNodes();
     327                 :      22733 :     SwNode* pInsNd = this;      // der MAC kann this nicht einfuegen !!
     328         [ +  - ]:      22733 :     if( rWhere.GetIndex() )
     329                 :            :     {
     330         [ +  - ]:      22733 :         SwNode* pNd = rNodes[ rWhere.GetIndex() -1 ];
     331         [ +  - ]:      22733 :         rNodes.InsertNode( pInsNd, rWhere );
     332         [ +  + ]:      22733 :         if( 0 == ( pStartOfSection = pNd->GetStartNode()) )
     333                 :            :         {
     334                 :      14844 :             pStartOfSection = pNd->pStartOfSection;
     335         [ +  + ]:      14844 :             if( pNd->GetEndNode() )     // EndNode ? Section ueberspringen!
     336                 :            :             {
     337                 :       3049 :                 pNd = pStartOfSection;
     338                 :       3049 :                 pStartOfSection = pNd->pStartOfSection;
     339                 :            :             }
     340                 :            :         }
     341                 :            :     }
     342                 :            :     else
     343                 :            :     {
     344         [ #  # ]:          0 :         rNodes.InsertNode( pInsNd, rWhere );
     345                 :          0 :         pStartOfSection = (SwStartNode*)this;
     346                 :            :     }
     347                 :            : 
     348                 :            : #ifdef DBG_UTIL
     349                 :            :     m_nSerial = s_nSerial;
     350                 :            :     s_nSerial++;
     351                 :            : #endif
     352                 :      22733 : }
     353                 :            : 
     354                 :      30984 : SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNdType )
     355                 :      30984 :     : nNodeType( nNdType ), pStartOfSection( 0 )
     356                 :            : {
     357                 :      30984 :     bSetNumLSpace = bIgnoreDontExpand = sal_False;
     358                 :      30984 :     nAFmtNumLvl = 0;
     359                 :            : 
     360                 :      30984 :     SwNode* pInsNd = this;      // der MAC kann this nicht einfuegen !!
     361         [ +  + ]:      30984 :     if( nPos )
     362                 :            :     {
     363         [ +  - ]:      27886 :         SwNode* pNd = rNodes[ nPos - 1 ];
     364         [ +  - ]:      27886 :         rNodes.InsertNode( pInsNd, nPos );
     365         [ +  + ]:      27886 :         if( 0 == ( pStartOfSection = pNd->GetStartNode()) )
     366                 :            :         {
     367                 :      12392 :             pStartOfSection = pNd->pStartOfSection;
     368         [ +  - ]:      12392 :             if( pNd->GetEndNode() )     // EndNode ? Section ueberspringen!
     369                 :            :             {
     370                 :      12392 :                 pNd = pStartOfSection;
     371                 :      12392 :                 pStartOfSection = pNd->pStartOfSection;
     372                 :            :             }
     373                 :            :         }
     374                 :            :     }
     375                 :            :     else
     376                 :            :     {
     377         [ +  - ]:       3098 :         rNodes.InsertNode( pInsNd, nPos );
     378                 :       3098 :         pStartOfSection = (SwStartNode*)this;
     379                 :            :     }
     380                 :            : 
     381                 :            : #ifdef DBG_UTIL
     382                 :            :     m_nSerial = s_nSerial;
     383                 :            :     s_nSerial++;
     384                 :            : #endif
     385                 :      30984 : }
     386                 :            : 
     387                 :      51296 : SwNode::~SwNode()
     388                 :            : {
     389         [ -  + ]:      51296 : }
     390                 :            : 
     391                 :            : // suche den TabellenNode, in dem dieser steht. Wenn in keiner
     392                 :            : // Tabelle wird 0 returnt.
     393                 :            : 
     394                 :            : 
     395                 :     131873 : SwTableNode* SwNode::FindTableNode()
     396                 :            : {
     397         [ -  + ]:     131873 :     if( IsTableNode() )
     398                 :          0 :         return GetTableNode();
     399                 :     131873 :     SwStartNode* pTmp = pStartOfSection;
     400 [ +  + ][ +  + ]:     258980 :     while( !pTmp->IsTableNode() && pTmp->GetIndex() )
                 [ +  + ]
     401                 :     127107 :         pTmp = pTmp->pStartOfSection;
     402                 :     131873 :     return pTmp->GetTableNode();
     403                 :            : }
     404                 :            : 
     405                 :            : 
     406                 :            : // liegt der Node im Sichtbarenbereich der Shell ?
     407                 :          0 : sal_Bool SwNode::IsInVisibleArea( ViewShell* pSh ) const
     408                 :            : {
     409                 :          0 :     sal_Bool bRet = sal_False;
     410                 :            :     const SwCntntNode* pNd;
     411                 :            : 
     412         [ #  # ]:          0 :     if( ND_STARTNODE & nNodeType )
     413                 :            :     {
     414         [ #  # ]:          0 :         SwNodeIndex aIdx( *this );
     415 [ #  # ][ #  # ]:          0 :         pNd = GetNodes().GoNext( &aIdx );
     416                 :            :     }
     417         [ #  # ]:          0 :     else if( ND_ENDNODE & nNodeType )
     418                 :            :     {
     419         [ #  # ]:          0 :         SwNodeIndex aIdx( *EndOfSectionNode() );
     420 [ #  # ][ #  # ]:          0 :         pNd = GetNodes().GoPrevious( &aIdx );
     421                 :            :     }
     422                 :            :     else
     423                 :          0 :         pNd = GetCntntNode();
     424                 :            : 
     425         [ #  # ]:          0 :     if( !pSh )
     426                 :            :         // dann die Shell vom Doc besorgen:
     427                 :          0 :         GetDoc()->GetEditShell( &pSh );
     428                 :            : 
     429         [ #  # ]:          0 :     if( pSh )
     430                 :            :     {
     431                 :            :         const SwFrm* pFrm;
     432 [ #  # ][ #  # ]:          0 :         if( pNd && 0 != ( pFrm = pNd->getLayoutFrm( pSh->GetLayout(), 0, 0, sal_False ) ) )
                 [ #  # ]
     433                 :            :         {
     434                 :            : 
     435         [ #  # ]:          0 :             if ( pFrm->IsInTab() )
     436                 :          0 :                 pFrm = pFrm->FindTabFrm();
     437                 :            : 
     438         [ #  # ]:          0 :             if( !pFrm->IsValid() )
     439         [ #  # ]:          0 :                 do
           [ #  #  #  # ]
     440                 :          0 :                 {   pFrm = pFrm->FindPrev();
     441                 :          0 :                 } while ( pFrm && !pFrm->IsValid() );
     442                 :            : 
     443 [ #  # ][ #  # ]:          0 :             if( !pFrm || pSh->VisArea().IsOver( pFrm->Frm() ) )
                 [ #  # ]
     444                 :          0 :                 bRet = sal_True;
     445                 :            :         }
     446                 :            :     }
     447                 :            : 
     448                 :          0 :     return bRet;
     449                 :            : }
     450                 :            : 
     451                 :      24257 : sal_Bool SwNode::IsInProtectSect() const
     452                 :            : {
     453         [ -  + ]:      24257 :     const SwNode* pNd = ND_SECTIONNODE == nNodeType ? pStartOfSection : this;
     454                 :      24257 :     const SwSectionNode* pSectNd = pNd->FindSectionNode();
     455 [ -  + ][ +  + ]:      24257 :     return pSectNd && pSectNd->GetSection().IsProtectFlag();
     456                 :            : }
     457                 :            : 
     458                 :            :     // befindet sich der Node in irgendetwas geschuetzten ?
     459                 :            :     // (Bereich/Rahmen/Tabellenzellen/... incl. des Ankers bei
     460                 :            :     //  Rahmen/Fussnoten/..)
     461                 :        102 : sal_Bool SwNode::IsProtect() const
     462                 :            : {
     463         [ -  + ]:        102 :     const SwNode* pNd = ND_SECTIONNODE == nNodeType ? pStartOfSection : this;
     464                 :        102 :     const SwStartNode* pSttNd = pNd->FindSectionNode();
     465 [ #  # ][ -  + ]:        102 :     if( pSttNd && ((SwSectionNode*)pSttNd)->GetSection().IsProtectFlag() )
                 [ -  + ]
     466                 :          0 :         return sal_True;
     467                 :            : 
     468         [ +  - ]:        102 :     if( 0 != ( pSttNd = FindTableBoxStartNode() ) )
     469                 :            :     {
     470                 :            :         SwCntntFrm* pCFrm;
     471 [ +  - ][ +  + ]:        102 :         if( IsCntntNode() && 0 != (pCFrm = ((SwCntntNode*)this)->getLayoutFrm( GetDoc()->GetCurrentLayout() ) ))
                 [ +  + ]
     472                 :         84 :             return pCFrm->IsProtected();
     473                 :            : 
     474                 :         18 :         const SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().
     475                 :         36 :                                         GetTblBox( pSttNd->GetIndex() );
     476                 :            :         //Robust #149568
     477 [ -  + ][ -  + ]:         18 :         if( pBox && pBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
                 [ +  - ]
     478                 :          0 :             return sal_True;
     479                 :            :     }
     480                 :            : 
     481                 :         18 :     SwFrmFmt* pFlyFmt = GetFlyFmt();
     482         [ -  + ]:         18 :     if( pFlyFmt )
     483                 :            :     {
     484         [ #  # ]:          0 :         if( pFlyFmt->GetProtect().IsCntntProtected() )
     485                 :          0 :             return sal_True;
     486                 :          0 :         const SwFmtAnchor& rAnchor = pFlyFmt->GetAnchor();
     487                 :          0 :         return rAnchor.GetCntntAnchor()
     488                 :          0 :                 ? rAnchor.GetCntntAnchor()->nNode.GetNode().IsProtect()
     489         [ #  # ]:          0 :                 : sal_False;
     490                 :            :     }
     491                 :            : 
     492         [ -  + ]:         18 :     if( 0 != ( pSttNd = FindFootnoteStartNode() ) )
     493                 :            :     {
     494                 :          0 :         const SwTxtFtn* pTFtn = GetDoc()->GetFtnIdxs().SeekEntry(
     495         [ #  # ]:          0 :                                 SwNodeIndex( *pSttNd ) );
     496         [ #  # ]:          0 :         if( pTFtn )
     497                 :          0 :             return pTFtn->GetTxtNode().IsProtect();
     498                 :            :     }
     499                 :            : 
     500                 :        102 :     return sal_False;
     501                 :            : }
     502                 :            : 
     503                 :            :     // suche den PageDesc, mit dem dieser Node formatiert ist. Wenn das
     504                 :            :     // Layout vorhanden ist wird ueber das gesucht, ansonsten gibt es nur
     505                 :            :     // die harte Tour ueber die Nodes nach vorne suchen!!
     506                 :        205 : const SwPageDesc* SwNode::FindPageDesc( sal_Bool bCalcLay,
     507                 :            :                                         sal_uInt32* pPgDescNdIdx ) const
     508                 :            : {
     509         [ -  + ]:        205 :     if ( !GetNodes().IsDocNodes() )
     510                 :            :     {
     511                 :          0 :         return 0;
     512                 :            :     }
     513                 :            : 
     514                 :        205 :     const SwPageDesc* pPgDesc = 0;
     515                 :            : 
     516                 :            :     const SwCntntNode* pNode;
     517         [ +  + ]:        205 :     if( ND_STARTNODE & nNodeType )
     518                 :            :     {
     519         [ +  - ]:          2 :         SwNodeIndex aIdx( *this );
     520 [ +  - ][ +  - ]:          2 :         pNode = GetNodes().GoNext( &aIdx );
     521                 :            :     }
     522         [ -  + ]:        203 :     else if( ND_ENDNODE & nNodeType )
     523                 :            :     {
     524         [ #  # ]:          0 :         SwNodeIndex aIdx( *EndOfSectionNode() );
     525 [ #  # ][ #  # ]:          0 :         pNode = GetNodes().GoPrevious( &aIdx );
     526                 :            :     }
     527                 :            :     else
     528                 :            :     {
     529                 :        203 :         pNode = GetCntntNode();
     530         [ +  - ]:        203 :         if( pNode )
     531                 :        203 :             pPgDesc = ((SwFmtPageDesc&)pNode->GetAttr( RES_PAGEDESC )).GetPageDesc();
     532                 :            :     }
     533                 :            : 
     534                 :            :     // geht es uebers Layout?
     535         [ +  + ]:        205 :     if( !pPgDesc )
     536                 :            :     {
     537                 :            :         const SwFrm* pFrm;
     538                 :            :         const SwPageFrm* pPage;
     539 [ +  - ][ +  + ]:        196 :         if( pNode && 0 != ( pFrm = pNode->getLayoutFrm( pNode->GetDoc()->GetCurrentLayout(), 0, 0, bCalcLay ) ) &&
         [ +  - ][ +  + ]
     540                 :            :             0 != ( pPage = pFrm->FindPageFrm() ) )
     541                 :            :         {
     542                 :        194 :             pPgDesc = pPage->GetPageDesc();
     543         [ +  + ]:        194 :             if ( pPgDescNdIdx )
     544                 :            :             {
     545                 :          2 :                 *pPgDescNdIdx = pNode->GetIndex();
     546                 :            :             }
     547                 :            :         }
     548                 :            :     }
     549                 :            : 
     550         [ +  + ]:        205 :     if( !pPgDesc )
     551                 :            :     {
     552                 :            :         // dann also uebers Nodes-Array
     553                 :          2 :         const SwDoc* pDoc = GetDoc();
     554                 :          2 :         const SwNode* pNd = this;
     555                 :            :         const SwStartNode* pSttNd;
     556 [ #  # ][ -  + ]:          2 :         if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() &&
                 [ -  + ]
     557                 :            :             0 != ( pSttNd = pNd->FindFlyStartNode() ) )
     558                 :            :         {
     559                 :            :             // dann erstmal den richtigen Anker finden
     560                 :          0 :             const SwFrmFmt* pFmt = 0;
     561                 :          0 :             const SwFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
     562                 :            :             sal_uInt16 n;
     563                 :            : 
     564         [ #  # ]:          0 :             for( n = 0; n < rFmts.size(); ++n )
     565                 :            :             {
     566                 :          0 :                 SwFrmFmt* pFrmFmt = rFmts[ n ];
     567                 :          0 :                 const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt();
     568         [ #  # ]:          0 :                 if( rCntnt.GetCntntIdx() &&
           [ #  #  #  # ]
     569                 :          0 :                     &rCntnt.GetCntntIdx()->GetNode() == (SwNode*)pSttNd )
     570                 :            :                 {
     571                 :          0 :                     pFmt = pFrmFmt;
     572                 :          0 :                     break;
     573                 :            :                 }
     574                 :            :             }
     575                 :            : 
     576         [ #  # ]:          0 :             if( pFmt )
     577                 :            :             {
     578                 :          0 :                 const SwFmtAnchor* pAnchor = &pFmt->GetAnchor();
     579         [ #  # ]:          0 :                 if ((FLY_AT_PAGE != pAnchor->GetAnchorId()) &&
           [ #  #  #  # ]
     580                 :          0 :                     pAnchor->GetCntntAnchor() )
     581                 :            :                 {
     582                 :          0 :                     pNd = &pAnchor->GetCntntAnchor()->nNode.GetNode();
     583                 :          0 :                     const SwNode* pFlyNd = pNd->FindFlyStartNode();
     584         [ #  # ]:          0 :                     while( pFlyNd )
     585                 :            :                     {
     586                 :            :                         // dann ueber den Anker nach oben "hangeln"
     587         [ #  # ]:          0 :                         for( n = 0; n < rFmts.size(); ++n )
     588                 :            :                         {
     589                 :          0 :                             const SwFrmFmt* pFrmFmt = rFmts[ n ];
     590                 :          0 :                             const SwNodeIndex* pIdx = pFrmFmt->GetCntnt().
     591                 :          0 :                                                         GetCntntIdx();
     592 [ #  # ][ #  # ]:          0 :                             if( pIdx && pFlyNd == &pIdx->GetNode() )
                 [ #  # ]
     593                 :            :                             {
     594         [ #  # ]:          0 :                                 if( pFmt == pFrmFmt )
     595                 :            :                                 {
     596                 :          0 :                                     pNd = pFlyNd;
     597                 :          0 :                                     pFlyNd = 0;
     598                 :          0 :                                     break;
     599                 :            :                                 }
     600                 :          0 :                                 pAnchor = &pFrmFmt->GetAnchor();
     601         [ #  # ]:          0 :                                 if ((FLY_AT_PAGE == pAnchor->GetAnchorId()) ||
           [ #  #  #  # ]
     602                 :          0 :                                     !pAnchor->GetCntntAnchor() )
     603                 :            :                                 {
     604                 :          0 :                                     pFlyNd = 0;
     605                 :          0 :                                     break;
     606                 :            :                                 }
     607                 :            : 
     608                 :          0 :                                 pFlyNd = pAnchor->GetCntntAnchor()->nNode.
     609                 :          0 :                                         GetNode().FindFlyStartNode();
     610                 :          0 :                                 break;
     611                 :            :                             }
     612                 :            :                         }
     613         [ #  # ]:          0 :                         if( n >= rFmts.size() )
     614                 :            :                         {
     615                 :            :                             OSL_ENSURE( !this, "Fly-Section aber kein Format gefunden" );
     616                 :          0 :                             return sal_False;
     617                 :            :                         }
     618                 :            :                     }
     619                 :            :                 }
     620                 :            :             }
     621                 :            :             // in pNd sollte jetzt der richtige Anker Node stehen oder
     622                 :            :             // immer noch der this
     623                 :            :         }
     624                 :            : 
     625         [ -  + ]:          2 :         if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
     626                 :            :         {
     627         [ #  # ]:          0 :             if( pNd->GetIndex() > GetNodes().GetEndOfAutotext().GetIndex() )
     628                 :            :             {
     629                 :          0 :                 pPgDesc = &pDoc->GetPageDesc( 0 );
     630                 :          0 :                 pNd = 0;
     631                 :            :             }
     632                 :            :             else
     633                 :            :             {
     634                 :            :                 // suche den Body Textnode
     635 [ #  # ][ #  # ]:          0 :                 if( 0 != ( pSttNd = pNd->FindHeaderStartNode() ) ||
                 [ #  # ]
     636                 :            :                     0 != ( pSttNd = pNd->FindFooterStartNode() ))
     637                 :            :                 {
     638                 :            :                     // dann in den PageDescs diesen StartNode suchen
     639                 :            :                     sal_uInt16 nId;
     640                 :            :                     UseOnPage eAskUse;
     641         [ #  # ]:          0 :                     if( SwHeaderStartNode == pSttNd->GetStartNodeType())
     642                 :            :                     {
     643                 :          0 :                         nId = RES_HEADER;
     644                 :          0 :                         eAskUse = nsUseOnPage::PD_HEADERSHARE;
     645                 :            :                     }
     646                 :            :                     else
     647                 :            :                     {
     648                 :          0 :                         nId = RES_FOOTER;
     649                 :          0 :                         eAskUse = nsUseOnPage::PD_FOOTERSHARE;
     650                 :            :                     }
     651                 :            : 
     652 [ #  # ][ #  # ]:          0 :                     for( sal_uInt16 n = pDoc->GetPageDescCnt(); n && !pPgDesc; )
                 [ #  # ]
     653                 :            :                     {
     654                 :          0 :                         const SwPageDesc& rPgDsc = pDoc->GetPageDesc( --n );
     655                 :          0 :                         const SwFrmFmt* pFmt = &rPgDsc.GetMaster();
     656                 :          0 :                         int nStt = 0, nLast = 1;
     657         [ #  # ]:          0 :                         if( !( eAskUse & rPgDsc.ReadUseOn() )) ++nLast;
     658                 :            : 
     659         [ #  # ]:          0 :                         for( ; nStt < nLast; ++nStt, pFmt = &rPgDsc.GetLeft() )
     660                 :            :                         {
     661                 :            :                             const SwFmtHeader& rHdFt = (SwFmtHeader&)
     662                 :          0 :                                                     pFmt->GetFmtAttr( nId );
     663         [ #  # ]:          0 :                             if( rHdFt.GetHeaderFmt() )
     664                 :            :                             {
     665                 :            :                                 const SwFmtCntnt& rCntnt =
     666                 :          0 :                                     rHdFt.GetHeaderFmt()->GetCntnt();
     667         [ #  # ]:          0 :                                 if( rCntnt.GetCntntIdx() &&
           [ #  #  #  # ]
     668                 :          0 :                                     &rCntnt.GetCntntIdx()->GetNode() ==
     669                 :            :                                     (SwNode*)pSttNd )
     670                 :            :                                 {
     671                 :          0 :                                     pPgDesc = &rPgDsc;
     672                 :          0 :                                     break;
     673                 :            :                                 }
     674                 :            :                             }
     675                 :            :                         }
     676                 :            :                     }
     677                 :            : 
     678         [ #  # ]:          0 :                     if( !pPgDesc )
     679                 :          0 :                         pPgDesc = &pDoc->GetPageDesc( 0 );
     680                 :          0 :                     pNd = 0;
     681                 :            :                 }
     682         [ #  # ]:          0 :                 else if( 0 != ( pSttNd = pNd->FindFootnoteStartNode() ))
     683                 :            :                 {
     684                 :            :                     // der Anker kann nur im Bodytext sein
     685                 :            :                     const SwTxtFtn* pTxtFtn;
     686                 :          0 :                     const SwFtnIdxs& rFtnArr = pDoc->GetFtnIdxs();
     687         [ #  # ]:          0 :                     for( sal_uInt16 n = 0; n < rFtnArr.size(); ++n )
     688   [ #  #  #  # ]:          0 :                         if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() &&
                 [ #  # ]
     689                 :            :                             (SwNode*)pSttNd ==
     690                 :          0 :                             &pTxtFtn->GetStartNode()->GetNode() )
     691                 :            :                         {
     692         [ #  # ]:          0 :                             pNd = &pTxtFtn->GetTxtNode();
     693                 :          0 :                             break;
     694                 :            :                         }
     695                 :            :                 }
     696                 :            :                 else
     697                 :            :                 {
     698                 :            :                     // kann jetzt nur noch ein Seitengebundener Fly sein
     699                 :            :                     // oder irgendetwas neueres.
     700                 :            :                     // Hier koennen wir nur noch den Standard returnen
     701                 :            :                     OSL_ENSURE( pNd->FindFlyStartNode(),
     702                 :            :                             "wo befindet sich dieser Node?" );
     703                 :            : 
     704                 :          0 :                     pPgDesc = &pDoc->GetPageDesc( 0 );
     705                 :          0 :                     pNd = 0;
     706                 :            :                 }
     707                 :            :             }
     708                 :            :         }
     709                 :            : 
     710         [ +  - ]:          2 :         if( pNd )
     711                 :            :         {
     712         [ +  - ]:          2 :             SwFindNearestNode aInfo( *pNd );
     713                 :            :             // dann ueber alle Nodes aller PageDesc
     714                 :            :             const SfxPoolItem* pItem;
     715         [ +  - ]:          2 :             sal_uInt32 i, nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_PAGEDESC );
     716         [ -  + ]:          2 :             for( i = 0; i < nMaxItems; ++i )
     717         [ #  # ]:          0 :                 if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_PAGEDESC, i ) ) &&
           [ #  #  #  # ]
                 [ #  # ]
     718                 :          0 :                     ((SwFmtPageDesc*)pItem)->GetDefinedIn() )
     719                 :            :                 {
     720                 :          0 :                     const SwModify* pMod = ((SwFmtPageDesc*)pItem)->GetDefinedIn();
     721 [ #  # ][ #  # ]:          0 :                     if( pMod->ISA( SwCntntNode ) )
                 [ #  # ]
     722         [ #  # ]:          0 :                         aInfo.CheckNode( *(SwCntntNode*)pMod );
     723 [ #  # ][ #  # ]:          0 :                     else if( pMod->ISA( SwFmt ))
                 [ #  # ]
     724         [ #  # ]:          0 :                         ((SwFmt*)pMod)->GetInfo( aInfo );
     725                 :            :                 }
     726                 :            : 
     727         [ -  + ]:          2 :             if( 0 != ( pNd = aInfo.GetFoundNode() ))
     728                 :            :             {
     729         [ #  # ]:          0 :                 if( pNd->IsCntntNode() )
     730                 :            :                     pPgDesc = ((SwFmtPageDesc&)pNd->GetCntntNode()->
     731         [ #  # ]:          0 :                                 GetAttr( RES_PAGEDESC )).GetPageDesc();
     732         [ #  # ]:          0 :                 else if( pNd->IsTableNode() )
     733                 :          0 :                     pPgDesc = pNd->GetTableNode()->GetTable().
     734         [ #  # ]:          0 :                             GetFrmFmt()->GetPageDesc().GetPageDesc();
     735         [ #  # ]:          0 :                 else if( pNd->IsSectionNode() )
     736                 :          0 :                     pPgDesc = pNd->GetSectionNode()->GetSection().
     737         [ #  # ]:          0 :                             GetFmt()->GetPageDesc().GetPageDesc();
     738         [ #  # ]:          0 :                 if ( pPgDescNdIdx )
     739                 :            :                 {
     740                 :          0 :                     *pPgDescNdIdx = pNd->GetIndex();
     741                 :            :                 }
     742                 :            :             }
     743         [ +  - ]:          2 :             if( !pPgDesc )
     744 [ +  - ][ +  - ]:          2 :                 pPgDesc = &pDoc->GetPageDesc( 0 );
     745                 :            :         }
     746                 :            :     }
     747                 :        205 :     return pPgDesc;
     748                 :            : }
     749                 :            : 
     750                 :            : 
     751                 :            :     // falls der Node in einem Fly steht, dann wird das entsprechende Format
     752                 :            :     // returnt
     753                 :         86 : SwFrmFmt* SwNode::GetFlyFmt() const
     754                 :            : {
     755                 :         86 :     SwFrmFmt* pRet = 0;
     756                 :         86 :     const SwNode* pSttNd = FindFlyStartNode();
     757         [ +  + ]:         86 :     if( pSttNd )
     758                 :            :     {
     759         [ +  - ]:         62 :         if( IsCntntNode() )
     760                 :            :         {
     761                 :         62 :             SwCntntFrm* pFrm = SwIterator<SwCntntFrm,SwCntntNode>::FirstElement( *(SwCntntNode*)this );
     762         [ +  + ]:         62 :             if( pFrm )
     763                 :         50 :                 pRet = pFrm->FindFlyFrm()->GetFmt();
     764                 :            :         }
     765         [ +  + ]:         62 :         if( !pRet )
     766                 :            :         {
     767                 :            :             // dann gibts noch harten steinigen Weg uebers Dokument:
     768                 :         12 :             const SwFrmFmts& rFrmFmtTbl = *GetDoc()->GetSpzFrmFmts();
     769         [ +  - ]:         42 :             for( sal_uInt16 n = 0; n < rFrmFmtTbl.size(); ++n )
     770                 :            :             {
     771                 :         30 :                 SwFrmFmt* pFmt = rFrmFmtTbl[n];
     772                 :         30 :                 const SwFmtCntnt& rCntnt = pFmt->GetCntnt();
     773         [ +  + ]:         48 :                 if( rCntnt.GetCntntIdx() &&
           [ +  +  +  + ]
     774                 :         18 :                     &rCntnt.GetCntntIdx()->GetNode() == pSttNd )
     775                 :            :                 {
     776                 :         12 :                     pRet = pFmt;
     777                 :         12 :                     break;
     778                 :            :                 }
     779                 :            :             }
     780                 :            :         }
     781                 :            :     }
     782                 :         86 :     return pRet;
     783                 :            : }
     784                 :            : 
     785                 :        643 : SwTableBox* SwNode::GetTblBox() const
     786                 :            : {
     787                 :        643 :     SwTableBox* pBox = 0;
     788                 :        643 :     const SwNode* pSttNd = FindTableBoxStartNode();
     789         [ +  - ]:        643 :     if( pSttNd )
     790                 :        643 :         pBox = (SwTableBox*)pSttNd->FindTableNode()->GetTable().GetTblBox(
     791                 :       1286 :                                                     pSttNd->GetIndex() );
     792                 :        643 :     return pBox;
     793                 :            : }
     794                 :            : 
     795                 :     183659 : SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp )
     796                 :            : {
     797         [ +  + ]:     183659 :     SwStartNode* pTmp = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
     798                 :            : 
     799 [ +  + ][ +  + ]:     353593 :     while( eTyp != pTmp->GetStartNodeType() && pTmp->GetIndex() )
                 [ +  + ]
     800                 :     169934 :         pTmp = pTmp->pStartOfSection;
     801         [ +  + ]:     183659 :     return eTyp == pTmp->GetStartNodeType() ? pTmp : 0;
     802                 :            : }
     803                 :            : 
     804                 :          4 : const SwTxtNode* SwNode::FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const
     805                 :            : {
     806                 :          4 :     const SwTxtNode* pRet = 0;
     807                 :          4 :     const SwOutlineNodes& rONds = GetNodes().GetOutLineNds();
     808 [ -  + ][ -  + ]:          4 :     if( MAXLEVEL > nLvl && !rONds.empty() )
                 [ +  - ]
     809                 :            :     {
     810                 :            :         sal_uInt16 nPos;
     811                 :          0 :         SwNode* pNd = (SwNode*)this;
     812                 :          0 :         sal_Bool bCheckFirst = sal_False;
     813 [ #  # ][ #  # ]:          0 :         if( !rONds.Seek_Entry( pNd, &nPos ))
     814                 :            :         {
     815         [ #  # ]:          0 :             if( nPos )
     816                 :          0 :                 nPos = nPos-1;
     817                 :            :             else
     818                 :          0 :                 bCheckFirst = sal_True;
     819                 :            :         }
     820                 :            : 
     821         [ #  # ]:          0 :         if( bCheckFirst )
     822                 :            :         {
     823                 :            :             // der 1.GliederungsNode liegt hinter dem Fragenden. Dann
     824                 :            :             // teste mal, ob dieser auf der gleichen Seite steht. Wenn
     825                 :            :             // nicht, ist das ein ungueltiger. Bug 61865
     826         [ #  # ]:          0 :             pRet = rONds[0]->GetTxtNode();
     827                 :            : 
     828                 :          0 :             const SwCntntNode* pCNd = GetCntntNode();
     829                 :            : 
     830                 :          0 :             Point aPt( 0, 0 );
     831 [ #  # ][ #  # ]:          0 :             const SwFrm* pFrm = pRet->getLayoutFrm( pRet->GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False ),
     832 [ #  # ][ #  # ]:          0 :                        * pMyFrm = pCNd ? pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False ) : 0;
                 [ #  # ]
     833 [ #  # ][ #  # ]:          0 :             const SwPageFrm* pPgFrm = pFrm ? pFrm->FindPageFrm() : 0;
     834         [ #  # ]:          0 :             if( pPgFrm && pMyFrm &&
           [ #  #  #  # ]
                 [ #  # ]
     835                 :          0 :                 pPgFrm->Frm().Top() > pMyFrm->Frm().Top() )
     836                 :            :             {
     837                 :            :                 // der Fragende liegt vor der Seite, also ist er ungueltig
     838                 :          0 :                 pRet = 0;
     839                 :            :             }
     840                 :            :         }
     841                 :            :         else
     842                 :            :         {
     843                 :            :             // oder ans Feld und von dort holen !!
     844 [ #  # ][ #  # ]:          0 :             while( nPos &&
                 [ #  # ]
     845         [ #  # ]:          0 :                    nLvl < ( pRet = rONds[nPos]->GetTxtNode() )
     846         [ #  # ]:          0 :                     ->GetAttrOutlineLevel() - 1 )  //<-end,zhaojianwei
     847                 :          0 :                 --nPos;
     848                 :            : 
     849         [ #  # ]:          0 :             if( !nPos )     // bei 0 gesondert holen !!
     850         [ #  # ]:          0 :                 pRet = rONds[0]->GetTxtNode();
     851                 :            :         }
     852                 :            :     }
     853                 :          4 :     return pRet;
     854                 :            : }
     855                 :            : 
     856                 :        900 : inline sal_Bool IsValidNextPrevNd( const SwNode& rNd )
     857                 :            : {
     858                 :        900 :     return ND_TABLENODE == rNd.GetNodeType() ||
     859                 :        900 :            ( ND_CONTENTNODE & rNd.GetNodeType() ) ||
     860                 :        459 :             ( ND_ENDNODE == rNd.GetNodeType() && rNd.StartOfSectionNode() &&
     861 [ -  + ][ +  -  :       2259 :             ND_TABLENODE == rNd.StartOfSectionNode()->GetNodeType() );
          +  +  +  +  +  
                      - ]
     862                 :            : }
     863                 :            : 
     864                 :        300 : sal_uInt8 SwNode::HasPrevNextLayNode() const
     865                 :            : {
     866                 :            :     // assumption: <this> node is a node inside the document nodes array section.
     867                 :            : 
     868                 :        300 :     sal_uInt8 nRet = 0;
     869         [ +  - ]:        300 :     if( IsValidNextPrevNd( *this ))
     870                 :            :     {
     871         [ +  - ]:        300 :         SwNodeIndex aIdx( *this, -1 );
     872                 :            :         // #i77805# - skip section start and end nodes
     873   [ +  -  -  +  :        600 :         while ( aIdx.GetNode().IsSectionNode() ||
           #  # ][ -  + ]
     874                 :        300 :                 ( aIdx.GetNode().IsEndNode() &&
     875                 :          0 :                   aIdx.GetNode().StartOfSectionNode()->IsSectionNode() ) )
     876                 :            :         {
     877         [ #  # ]:          0 :             --aIdx;
     878                 :            :         }
     879         [ +  + ]:        300 :         if( IsValidNextPrevNd( aIdx.GetNode() ))
     880                 :        147 :             nRet |= ND_HAS_PREV_LAYNODE;
     881                 :            :         // #i77805# - skip section start and end nodes
     882 [ +  - ][ +  - ]:        300 :         aIdx = SwNodeIndex( *this, +1 );
                 [ +  - ]
     883   [ +  -  +  +  :        753 :         while ( aIdx.GetNode().IsSectionNode() ||
           -  + ][ -  + ]
     884                 :        300 :                 ( aIdx.GetNode().IsEndNode() &&
     885                 :        153 :                   aIdx.GetNode().StartOfSectionNode()->IsSectionNode() ) )
     886                 :            :         {
     887         [ #  # ]:          0 :             ++aIdx;
     888                 :            :         }
     889         [ +  + ]:        300 :         if( IsValidNextPrevNd( aIdx.GetNode() ))
     890         [ +  - ]:        300 :             nRet |= ND_HAS_NEXT_LAYNODE;
     891                 :            :     }
     892                 :        300 :     return nRet;
     893                 :            : }
     894                 :            : 
     895                 :            : /*******************************************************************
     896                 :            : |*
     897                 :            : |*  SwNode::StartOfSection
     898                 :            : |*
     899                 :            : |*  Beschreibung
     900                 :            : |*      Die Funktion liefert die StartOfSection des Nodes.
     901                 :            : |*
     902                 :            : |*  Parameter
     903                 :            : |*      IN
     904                 :            : |*      rNodes bezeichnet das variable Array, in dem sich der Node
     905                 :            : |*      befindet
     906                 :            : |*
     907                 :            : *******************************************************************/
     908                 :            : 
     909                 :            : 
     910                 :       3671 : SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType,
     911                 :            :                             SwStartNodeType eSttNd )
     912                 :       3671 :     : SwNode( rWhere, nNdType ), eSttNdTyp( eSttNd )
     913                 :            : {
     914                 :            :     // erstmal temporaer, bis der EndNode eingefuegt wird.
     915                 :       3671 :     pEndOfSection = (SwEndNode*)this;
     916                 :       3671 : }
     917                 :            : 
     918                 :      15494 : SwStartNode::SwStartNode( SwNodes& rNodes, sal_uLong nPos )
     919                 :      15494 :     : SwNode( rNodes, nPos, ND_STARTNODE ), eSttNdTyp( SwNormalStartNode )
     920                 :            : {
     921                 :            :     // erstmal temporaer, bis der EndNode eingefuegt wird.
     922                 :      15494 :     pEndOfSection = (SwEndNode*)this;
     923                 :      15494 : }
     924                 :            : 
     925                 :            : 
     926                 :        120 : void SwStartNode::CheckSectionCondColl() const
     927                 :            : {
     928                 :            : //FEATURE::CONDCOLL
     929         [ +  - ]:        120 :     SwNodeIndex aIdx( *this );
     930                 :        120 :     sal_uLong nEndIdx = EndOfSectionIndex();
     931                 :        120 :     const SwNodes& rNds = GetNodes();
     932                 :            :     SwCntntNode* pCNd;
     933 [ +  - ][ +  + ]:        246 :     while( 0 != ( pCNd = rNds.GoNext( &aIdx )) && pCNd->GetIndex() < nEndIdx )
         [ +  + ][ +  + ]
     934 [ +  - ][ +  - ]:        246 :         pCNd->ChkCondColl();
     935                 :            : //FEATURE::CONDCOLL
     936                 :        120 : }
     937                 :            : 
     938                 :            : /*******************************************************************
     939                 :            : |*
     940                 :            : |*  SwEndNode::SwEndNode
     941                 :            : |*
     942                 :            : |*  Beschreibung
     943                 :            : |*      Konstruktor; dieser fuegt einen Node in das Array rNodes
     944                 :            : |*      an der Position aWhere ein. Der
     945                 :            : |*      theStartOfSection-Pointer wird entsprechend gesetzt,
     946                 :            : |*      und der EndOfSection-Pointer des zugehoerigen
     947                 :            : |*      Startnodes -- durch rStartOfSection bezeichnet --
     948                 :            : |*      wird auf diesen Node gesetzt.
     949                 :            : |*
     950                 :            : |*  Parameter
     951                 :            : |*      IN
     952                 :            : |*      rNodes bezeichnet das variable Array, in das der Node
     953                 :            : |*      eingefuegt werden soll
     954                 :            : |*      IN
     955                 :            : |*      aWhere bezeichnet die Position innerhalb dieses Arrays,
     956                 :            : |*      an der der Node eingefuegt werden soll
     957                 :            : |*      !!!!!!!!!!!!
     958                 :            : |*      Es wird eine Kopie uebergeben!
     959                 :            : |*
     960                 :            : *******************************************************************/
     961                 :            : 
     962                 :            : 
     963                 :       3671 : SwEndNode::SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd )
     964                 :       3671 :     : SwNode( rWhere, ND_ENDNODE )
     965                 :            : {
     966                 :       3671 :     pStartOfSection = &rSttNd;
     967                 :       3671 :     pStartOfSection->pEndOfSection = this;
     968                 :       3671 : }
     969                 :            : 
     970                 :      15490 : SwEndNode::SwEndNode( SwNodes& rNds, sal_uLong nPos, SwStartNode& rSttNd )
     971                 :      15490 :     : SwNode( rNds, nPos, ND_ENDNODE )
     972                 :            : {
     973                 :      15490 :     pStartOfSection = &rSttNd;
     974                 :      15490 :     pStartOfSection->pEndOfSection = this;
     975                 :      15490 : }
     976                 :            : 
     977                 :            : 
     978                 :            : 
     979                 :            : // --------------------
     980                 :            : // SwCntntNode
     981                 :            : // --------------------
     982                 :            : 
     983                 :            : 
     984                 :      15391 : SwCntntNode::SwCntntNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType,
     985                 :            :                             SwFmtColl *pColl )
     986                 :            :     : SwModify( pColl ),     // CrsrsShell, FrameFmt,
     987                 :            :     SwNode( rWhere, nNdType ),
     988                 :            :     pCondColl( 0 ),
     989 [ +  - ][ +  - ]:      15391 :     mbSetModifyAtAttr( false )
                 [ +  - ]
     990                 :            : {
     991                 :      15391 : }
     992                 :            : 
     993                 :            : 
     994 [ +  - ][ +  - ]:      15000 : SwCntntNode::~SwCntntNode()
                 [ +  - ]
     995                 :            : {
     996                 :            :     // Die Basisklasse SwClient vom SwFrm nimmt sich aus
     997                 :            :     // der Abhaengikeitsliste raus!
     998                 :            :     // Daher muessen alle Frames in der Abhaengigkeitsliste geloescht werden.
     999         [ +  + ]:      15000 :     if( GetDepends() )
    1000         [ +  - ]:        942 :         DelFrms();
    1001                 :            : 
    1002 [ -  + ][ #  # ]:      15000 :     delete pCondColl;
    1003                 :            : 
    1004 [ +  + ][ +  + ]:      15000 :     if ( mpAttrSet.get() && mbSetModifyAtAttr )
                 [ +  + ]
    1005         [ +  - ]:        518 :         ((SwAttrSet*)mpAttrSet.get())->SetModifyAtAttr( 0 );
    1006         [ -  + ]:      15000 : }
    1007                 :            : 
    1008                 :     111033 : void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
    1009                 :            : {
    1010                 :            :     sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
    1011 [ +  + ][ +  - ]:     111033 :                     pNewValue ? pNewValue->Which() : 0 ;
    1012                 :            : 
    1013   [ -  +  -  +  :     111033 :     switch( nWhich )
                   +  + ]
    1014                 :            :     {
    1015                 :            :     case RES_OBJECTDYING :
    1016                 :            :         {
    1017                 :          0 :             SwFmt * pFmt = (SwFmt *) ((SwPtrMsgPoolItem *)pNewValue)->pObject;
    1018                 :            : 
    1019                 :            :             // nicht umhaengen wenn dieses das oberste Format ist !!
    1020         [ #  # ]:          0 :             if( GetRegisteredIn() == pFmt )
    1021                 :            :             {
    1022         [ #  # ]:          0 :                 if( pFmt->GetRegisteredIn() )
    1023                 :            :                 {
    1024                 :            :                     // wenn Parent, dann im neuen Parent wieder anmelden
    1025                 :          0 :                     ((SwModify*)pFmt->GetRegisteredIn())->Add( this );
    1026         [ #  # ]:          0 :                     if ( GetpSwAttrSet() )
    1027                 :          0 :                         AttrSetHandleHelper::SetParent( mpAttrSet, *this, GetFmtColl(), GetFmtColl() );
    1028                 :            :                 }
    1029                 :            :                 else
    1030                 :            :                 {
    1031                 :            :                     // sonst auf jeden Fall beim sterbenden abmelden
    1032                 :          0 :                     ((SwModify*)GetRegisteredIn())->Remove( this );
    1033         [ #  # ]:          0 :                     if ( GetpSwAttrSet() )
    1034                 :          0 :                         AttrSetHandleHelper::SetParent( mpAttrSet, *this, 0, 0 );
    1035                 :            :                 }
    1036                 :            :             }
    1037                 :            :         }
    1038                 :          0 :         break;
    1039                 :            : 
    1040                 :            : 
    1041                 :            :     case RES_FMT_CHG:
    1042                 :            :         // falls mein Format Parent umgesetzt wird, dann melde ich
    1043                 :            :         // meinen Attrset beim Neuen an.
    1044                 :            : 
    1045                 :            :         // sein eigenes Modify ueberspringen !!
    1046   [ +  +  +  - ]:       6726 :         if( GetpSwAttrSet() &&
                 [ +  + ]
    1047                 :        169 :             ((SwFmtChg*)pNewValue)->pChangedFmt == GetRegisteredIn() )
    1048                 :            :         {
    1049                 :            :             // den Set an den neuen Parent haengen
    1050                 :        169 :             AttrSetHandleHelper::SetParent( mpAttrSet, *this, GetFmtColl(), GetFmtColl() );
    1051                 :            :         }
    1052                 :       6557 :         break;
    1053                 :            : //FEATURE::CONDCOLL
    1054                 :            :     case RES_CONDCOLL_CONDCHG:
    1055   [ #  #  #  # ]:          0 :         if( ((SwCondCollCondChg*)pNewValue)->pChangedFmt == GetRegisteredIn() &&
                 [ #  # ]
    1056                 :          0 :             &GetNodes() == &GetDoc()->GetNodes() )
    1057                 :            :         {
    1058                 :          0 :             ChkCondColl();
    1059                 :            :         }
    1060                 :     111033 :         return ;    // nicht an die Basisklasse / Frames weitergeben
    1061                 :            : //FEATURE::CONDCOLL
    1062                 :            : 
    1063                 :            :     case RES_ATTRSET_CHG:
    1064 [ +  + ][ +  + ]:      86660 :         if( GetNodes().IsDocNodes() && IsTxtNode() )
                 [ +  + ]
    1065                 :            :         {
    1066         [ +  + ]:     130488 :             if( SFX_ITEM_SET == ((SwAttrSetChg*)pOldValue)->GetChgSet()->GetItemState(
    1067                 :      65244 :                 RES_CHRATR_HIDDEN, sal_False ) )
    1068                 :            :             {
    1069                 :         48 :                 ((SwTxtNode*)this)->SetCalcHiddenCharFlags();
    1070                 :            :             }
    1071                 :            :         }
    1072                 :      86660 :         break;
    1073                 :            : 
    1074                 :            :     case RES_UPDATE_ATTR:
    1075 [ +  - ][ +  + ]:      15060 :         if( GetNodes().IsDocNodes() && IsTxtNode() )
                 [ +  + ]
    1076                 :            :         {
    1077                 :      15052 :             const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->nWhichAttr;
    1078         [ +  + ]:      15052 :             if ( RES_ATTRSET_CHG == nTmp )
    1079                 :            :             {
    1080                 :            :                 // anybody wants to do some optimization here?
    1081                 :        481 :                 ((SwTxtNode*)this)->SetCalcHiddenCharFlags();
    1082                 :            :             }
    1083                 :            :         }
    1084                 :      15060 :         break;
    1085                 :            :     }
    1086                 :            : 
    1087                 :     111033 :     NotifyClients( pOldValue, pNewValue );
    1088                 :            : }
    1089                 :            : 
    1090                 :       2665 : sal_Bool SwCntntNode::InvalidateNumRule()
    1091                 :            : {
    1092                 :       2665 :     SwNumRule* pRule = 0;
    1093                 :            :     const SfxPoolItem* pItem;
    1094 [ +  + ][ +  +  :       2704 :     if( GetNodes().IsDocNodes() &&
             +  +  +  - ]
                 [ +  + ]
    1095                 :            :         0 != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, sal_True )) &&
    1096                 :         21 :         ((SwNumRuleItem*)pItem)->GetValue().Len() &&
    1097                 :            :         0 != (pRule = GetDoc()->FindNumRulePtr(
    1098                 :         18 :                                 ((SwNumRuleItem*)pItem)->GetValue() ) ) )
    1099                 :            :     {
    1100                 :         18 :         pRule->SetInvalidRule( sal_True );
    1101                 :            :     }
    1102                 :       2665 :     return 0 != pRule;
    1103                 :            : }
    1104                 :            : 
    1105                 :     486517 : SwCntntFrm *SwCntntNode::getLayoutFrm( const SwRootFrm* _pRoot,
    1106                 :            :     const Point* pPoint, const SwPosition *pPos, const sal_Bool bCalcFrm ) const
    1107                 :            : {
    1108                 :            :     return (SwCntntFrm*) ::GetFrmOfModify( _pRoot, *(SwModify*)this, FRM_CNTNT,
    1109                 :     486517 :                                             pPoint, pPos, bCalcFrm );
    1110                 :            : }
    1111                 :            : 
    1112                 :        440 : SwRect SwCntntNode::FindLayoutRect( const sal_Bool bPrtArea, const Point* pPoint,
    1113                 :            :                                     const sal_Bool bCalcFrm ) const
    1114                 :            : {
    1115                 :        440 :     SwRect aRet;
    1116                 :            :     SwCntntFrm* pFrm = (SwCntntFrm*)::GetFrmOfModify( 0, *(SwModify*)this,
    1117                 :        440 :                                             FRM_CNTNT, pPoint, 0, bCalcFrm );
    1118         [ +  + ]:        440 :     if( pFrm )
    1119         [ -  + ]:        438 :         aRet = bPrtArea ? pFrm->Prt() : pFrm->Frm();
    1120                 :        440 :     return aRet;
    1121                 :            : }
    1122                 :            : 
    1123                 :         76 : SwRect SwCntntNode::FindPageFrmRect( const sal_Bool bPrtArea, const Point* pPoint,
    1124                 :            :                                     const sal_Bool bCalcFrm ) const
    1125                 :            : {
    1126                 :         76 :     SwRect aRet;
    1127                 :            :     SwFrm* pFrm = ::GetFrmOfModify( 0, *(SwModify*)this,
    1128                 :         76 :                                             FRM_CNTNT, pPoint, 0, bCalcFrm );
    1129 [ +  - ][ +  - ]:         76 :     if( pFrm && 0 != ( pFrm = pFrm->FindPageFrm() ))
                 [ +  - ]
    1130         [ -  + ]:         76 :         aRet = bPrtArea ? pFrm->Prt() : pFrm->Frm();
    1131                 :         76 :     return aRet;
    1132                 :            : }
    1133                 :            : 
    1134                 :          4 : xub_StrLen SwCntntNode::Len() const { return 0; }
    1135                 :            : 
    1136                 :            : 
    1137                 :            : 
    1138                 :       2597 : SwFmtColl *SwCntntNode::ChgFmtColl( SwFmtColl *pNewColl )
    1139                 :            : {
    1140                 :            :     OSL_ENSURE( pNewColl, "Collectionpointer ist 0." );
    1141                 :       2597 :     SwFmtColl *pOldColl = GetFmtColl();
    1142                 :            : 
    1143         [ +  - ]:       2597 :     if( pNewColl != pOldColl )
    1144                 :            :     {
    1145                 :       2597 :         pNewColl->Add( this );
    1146                 :            : 
    1147                 :            :         // setze den Parent von unseren Auto-Attributen auf die neue
    1148                 :            :         // Collection:
    1149         [ +  + ]:       2597 :         if( GetpSwAttrSet() )
    1150                 :        169 :             AttrSetHandleHelper::SetParent( mpAttrSet, *this, pNewColl, pNewColl );
    1151                 :            : 
    1152                 :            : //FEATURE::CONDCOLL
    1153                 :            :         // HACK: hier muss die entsprechend der neuen Vorlage die Bedingungen
    1154                 :            :         //      neu ueberprueft werden!
    1155                 :            :         if( sal_True /*pNewColl */ )
    1156                 :            :         {
    1157                 :       2597 :             SetCondFmtColl( 0 );
    1158                 :            :         }
    1159                 :            : //FEATURE::CONDCOLL
    1160                 :            : 
    1161         [ +  - ]:       2597 :         if( !IsModifyLocked() )
    1162                 :            :         {
    1163         [ +  - ]:       2597 :             SwFmtChg aTmp1( pOldColl );
    1164         [ +  - ]:       2597 :             SwFmtChg aTmp2( pNewColl );
    1165 [ +  - ][ +  - ]:       2597 :             SwCntntNode::Modify( &aTmp1, &aTmp2 );
                 [ +  - ]
    1166                 :            :         }
    1167                 :            :     }
    1168         [ -  + ]:       2597 :     if ( IsInCache() )
    1169                 :            :     {
    1170                 :          0 :         SwFrm::GetCache().Delete( this );
    1171                 :          0 :         SetInCache( sal_False );
    1172                 :            :     }
    1173                 :       2597 :     return pOldColl;
    1174                 :            : }
    1175                 :            : 
    1176                 :            : 
    1177                 :      97001 : sal_Bool SwCntntNode::GoNext(SwIndex * pIdx, sal_uInt16 nMode ) const
    1178                 :            : {
    1179                 :      97001 :     sal_Bool bRet = sal_True;
    1180         [ +  + ]:      97001 :     if( pIdx->GetIndex() < Len() )
    1181                 :            :     {
    1182         [ -  + ]:      95395 :         if( !IsTxtNode() )
    1183                 :          0 :             (*pIdx)++;
    1184                 :            :         else
    1185                 :            :         {
    1186                 :      95395 :             const SwTxtNode& rTNd = *GetTxtNode();
    1187                 :      95395 :             xub_StrLen nPos = pIdx->GetIndex();
    1188         [ +  - ]:      95395 :             if( pBreakIt->GetBreakIter().is() )
    1189                 :            :             {
    1190                 :      95395 :                 sal_Int32 nDone = 0;
    1191                 :            :                 sal_uInt16 nItrMode = ( CRSR_SKIP_CELLS & nMode ) ?
    1192                 :            :                                         CharacterIteratorMode::SKIPCELL :
    1193         [ -  + ]:      95395 :                                         CharacterIteratorMode::SKIPCONTROLCHARACTER;
    1194 [ +  - ][ +  - ]:     286185 :                 nPos = (xub_StrLen)pBreakIt->GetBreakIter()->nextCharacters( rTNd.GetTxt(), nPos,
    1195 [ +  - ][ +  - ]:      95395 :                                    pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
    1196 [ +  - ][ +  - ]:      95395 :                                    nItrMode, 1, nDone );
    1197                 :            : 
    1198                 :            :                 // Check if nPos is inside hidden text range:
    1199         [ +  + ]:      95395 :                 if ( CRSR_SKIP_HIDDEN & nMode )
    1200                 :            :                 {
    1201                 :            :                     xub_StrLen nHiddenStart;
    1202                 :            :                     xub_StrLen nHiddenEnd;
    1203         [ +  - ]:         20 :                     SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
    1204 [ -  + ][ #  # ]:         20 :                     if ( nHiddenStart != STRING_LEN && nHiddenStart != nPos )
    1205                 :         20 :                          nPos = nHiddenEnd;
    1206                 :            :                 }
    1207                 :            : 
    1208         [ +  - ]:      95395 :                 if( 1 == nDone )
    1209         [ +  - ]:      95395 :                     *pIdx = nPos;
    1210                 :            :                 else
    1211                 :      95395 :                     bRet = sal_False;
    1212                 :            :             }
    1213         [ #  # ]:          0 :             else if( nPos < rTNd.GetTxt().Len() )
    1214                 :          0 :                 (*pIdx)++;
    1215                 :            :             else
    1216                 :          0 :                 bRet = sal_False;
    1217                 :            :         }
    1218                 :            :     }
    1219                 :            :     else
    1220                 :       1606 :         bRet = sal_False;
    1221                 :      97001 :     return bRet;
    1222                 :            : }
    1223                 :            : 
    1224                 :            : 
    1225                 :      71227 : sal_Bool SwCntntNode::GoPrevious(SwIndex * pIdx, sal_uInt16 nMode ) const
    1226                 :            : {
    1227                 :      71227 :     sal_Bool bRet = sal_True;
    1228         [ +  + ]:      71227 :     if( pIdx->GetIndex() > 0 )
    1229                 :            :     {
    1230         [ -  + ]:      69054 :         if( !IsTxtNode() )
    1231                 :          0 :             (*pIdx)--;
    1232                 :            :         else
    1233                 :            :         {
    1234                 :      69054 :             const SwTxtNode& rTNd = *GetTxtNode();
    1235                 :      69054 :             xub_StrLen nPos = pIdx->GetIndex();
    1236         [ +  - ]:      69054 :             if( pBreakIt->GetBreakIter().is() )
    1237                 :            :             {
    1238                 :      69054 :                 sal_Int32 nDone = 0;
    1239                 :            :                 sal_uInt16 nItrMode = ( CRSR_SKIP_CELLS & nMode ) ?
    1240                 :            :                                         CharacterIteratorMode::SKIPCELL :
    1241         [ -  + ]:      69054 :                                         CharacterIteratorMode::SKIPCONTROLCHARACTER;
    1242 [ +  - ][ +  - ]:     207162 :                 nPos = (xub_StrLen)pBreakIt->GetBreakIter()->previousCharacters( rTNd.GetTxt(), nPos,
    1243 [ +  - ][ +  - ]:      69054 :                                    pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
    1244 [ +  - ][ +  - ]:      69054 :                                    nItrMode, 1, nDone );
    1245                 :            : 
    1246                 :            :                 // Check if nPos is inside hidden text range:
    1247         [ +  + ]:      69054 :                 if ( CRSR_SKIP_HIDDEN & nMode )
    1248                 :            :                 {
    1249                 :            :                     xub_StrLen nHiddenStart;
    1250                 :            :                     xub_StrLen nHiddenEnd;
    1251         [ +  - ]:         10 :                     SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
    1252         [ -  + ]:         10 :                     if ( nHiddenStart != STRING_LEN  )
    1253                 :         10 :                          nPos = nHiddenStart;
    1254                 :            :                 }
    1255                 :            : 
    1256         [ +  - ]:      69054 :                 if( 1 == nDone )
    1257         [ +  - ]:      69054 :                     *pIdx = nPos;
    1258                 :            :                 else
    1259                 :      69054 :                     bRet = sal_False;
    1260                 :            :             }
    1261         [ #  # ]:          0 :             else if( nPos )
    1262                 :          0 :                 (*pIdx)--;
    1263                 :            :             else
    1264                 :          0 :                 bRet = sal_False;
    1265                 :            :         }
    1266                 :            :     }
    1267                 :            :     else
    1268                 :       2173 :         bRet = sal_False;
    1269                 :      71227 :     return bRet;
    1270                 :            : }
    1271                 :            : 
    1272                 :            : 
    1273                 :            : /*
    1274                 :            :  * Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
    1275                 :            :  * Dokument. Die erzeugten Contentframes werden in das entsprechende
    1276                 :            :  * Layout gehaengt.
    1277                 :            :  */
    1278                 :            : 
    1279                 :            : 
    1280                 :        731 : void SwCntntNode::MakeFrms( SwCntntNode& rNode )
    1281                 :            : {
    1282                 :            :     OSL_ENSURE( &rNode != this,
    1283                 :            :             "Kein Contentnode oder Copy-Node und neuer Node identisch." );
    1284                 :            : 
    1285 [ +  + ][ -  + ]:        731 :     if( !GetDepends() || &rNode == this )   // gibt es ueberhaupt Frames ??
                 [ +  + ]
    1286                 :        731 :         return;
    1287                 :            : 
    1288                 :            :     SwFrm *pFrm, *pNew;
    1289                 :            :     SwLayoutFrm *pUpper;
    1290                 :            :     // Frames anlegen fuer Nodes, die vor oder hinter der Tabelle stehen ??
    1291                 :            :     OSL_ENSURE( FindTableNode() == rNode.FindTableNode(), "Table confusion" );
    1292                 :            : 
    1293         [ +  - ]:        610 :     SwNode2Layout aNode2Layout( *this, rNode.GetIndex() );
    1294                 :            : 
    1295 [ +  - ][ +  + ]:       1174 :     while( 0 != (pUpper = aNode2Layout.UpperFrm( pFrm, rNode )) )
    1296                 :            :     {
    1297         [ +  - ]:        564 :         pNew = rNode.MakeFrm( pUpper );
    1298         [ +  - ]:        564 :         pNew->Paste( pUpper, pFrm );
    1299                 :            :         // #i27138#
    1300                 :            :         // notify accessibility paragraphs objects about changed
    1301                 :            :         // CONTENT_FLOWS_FROM/_TO relation.
    1302                 :            :         // Relation CONTENT_FLOWS_FROM for next paragraph will change
    1303                 :            :         // and relation CONTENT_FLOWS_TO for previous paragraph will change.
    1304         [ +  - ]:        564 :         if ( pNew->IsTxtFrm() )
    1305                 :            :         {
    1306                 :        564 :             ViewShell* pViewShell( pNew->getRootFrm()->GetCurrShell() );
    1307         [ +  - ]:       1128 :             if ( pViewShell && pViewShell->GetLayout() &&
           [ +  -  -  + ]
         [ -  + ][ +  - ]
    1308         [ +  - ]:        564 :                  pViewShell->GetLayout()->IsAnyShellAccessible() )
    1309                 :            :             {
    1310                 :            :                 pViewShell->InvalidateAccessibleParaFlowRelation(
    1311         [ #  # ]:          0 :                             dynamic_cast<SwTxtFrm*>(pNew->FindNextCnt( true )),
    1312 [ #  # ][ #  # ]:          0 :                             dynamic_cast<SwTxtFrm*>(pNew->FindPrevCnt( true )) );
         [ #  # ][ #  # ]
    1313                 :            :             }
    1314                 :            :         }
    1315         [ +  - ]:        731 :     }
    1316                 :            : }
    1317                 :            : 
    1318                 :            : /*
    1319                 :            :  * Methode loescht fuer den Node alle Ansichten vom
    1320                 :            :  * Dokument. Die Contentframes werden aus dem entsprechenden
    1321                 :            :  * Layout ausgehaengt.
    1322                 :            :  */
    1323                 :            : 
    1324                 :            : 
    1325                 :       1777 : void SwCntntNode::DelFrms()
    1326                 :            : {
    1327         [ +  + ]:       1777 :     if( !GetDepends() )
    1328                 :       1777 :         return;
    1329                 :            : 
    1330                 :       1505 :     SwCntntFrm::DelFrms(*this);
    1331         [ +  - ]:       1505 :     if( IsTxtNode() )
    1332                 :            :     {
    1333                 :       1505 :         ((SwTxtNode*)this)->SetWrong( NULL );
    1334                 :       1505 :         ((SwTxtNode*)this)->SetWrongDirty( true );
    1335                 :            : 
    1336                 :       1505 :         ((SwTxtNode*)this)->SetGrammarCheck( NULL );
    1337                 :       1505 :         ((SwTxtNode*)this)->SetGrammarCheckDirty( true );
    1338                 :            :         // SMARTTAGS
    1339                 :       1505 :         ((SwTxtNode*)this)->SetSmartTags( NULL );
    1340                 :       1505 :         ((SwTxtNode*)this)->SetSmartTagDirty( true );
    1341                 :            : 
    1342                 :       1505 :         ((SwTxtNode*)this)->SetWordCountDirty( true );
    1343                 :       1505 :         ((SwTxtNode*)this)->SetAutoCompleteWordDirty( true );
    1344                 :            :     }
    1345                 :            : }
    1346                 :            : 
    1347                 :            : 
    1348                 :          0 : SwCntntNode *SwCntntNode::JoinNext()
    1349                 :            : {
    1350                 :          0 :     return this;
    1351                 :            : }
    1352                 :            : 
    1353                 :            : 
    1354                 :          0 : SwCntntNode *SwCntntNode::JoinPrev()
    1355                 :            : {
    1356                 :          0 :     return this;
    1357                 :            : }
    1358                 :            : 
    1359                 :            : 
    1360                 :            : 
    1361                 :            :     // erfrage vom Modify Informationen
    1362                 :      21866 : sal_Bool SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const
    1363                 :            : {
    1364   [ +  -  -  - ]:      21866 :     switch( rInfo.Which() )
    1365                 :            :     {
    1366                 :            :     case RES_AUTOFMT_DOCNODE:
    1367         [ +  + ]:      21866 :         if( &GetNodes() == ((SwAutoFmtGetDocNode&)rInfo).pNodes )
    1368                 :            :         {
    1369                 :      21510 :             ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = this;
    1370                 :      21510 :             return sal_False;
    1371                 :            :         }
    1372                 :        356 :         break;
    1373                 :            : 
    1374                 :            :     case RES_FINDNEARESTNODE:
    1375         [ #  # ]:          0 :         if( ((SwFmtPageDesc&)GetAttr( RES_PAGEDESC )).GetPageDesc() )
    1376                 :          0 :             ((SwFindNearestNode&)rInfo).CheckNode( *this );
    1377                 :          0 :         return sal_True;
    1378                 :            : 
    1379                 :            :     case RES_CONTENT_VISIBLE:
    1380                 :            :         {
    1381                 :            :             ((SwPtrMsgPoolItem&)rInfo).pObject =
    1382                 :          0 :                 SwIterator<SwFrm,SwCntntNode>::FirstElement(*this);
    1383                 :            :         }
    1384                 :          0 :         return sal_False;
    1385                 :            :     }
    1386                 :            : 
    1387                 :      21866 :     return SwModify::GetInfo( rInfo );
    1388                 :            : }
    1389                 :            : 
    1390                 :            : 
    1391                 :            :     // setze ein Attribut
    1392                 :       8732 : sal_Bool SwCntntNode::SetAttr(const SfxPoolItem& rAttr )
    1393                 :            : {
    1394         [ +  + ]:       8732 :     if( !GetpSwAttrSet() )            // lasse von den entsprechenden Nodes die
    1395                 :       2268 :         NewAttrSet( GetDoc()->GetAttrPool() );      // AttrSets anlegen
    1396                 :            : 
    1397                 :            :     OSL_ENSURE( GetpSwAttrSet(), "warum wurde kein AttrSet angelegt?" );
    1398                 :            : 
    1399         [ +  + ]:       8732 :     if ( IsInCache() )
    1400                 :            :     {
    1401                 :         36 :         SwFrm::GetCache().Delete( this );
    1402                 :         36 :         SetInCache( sal_False );
    1403                 :            :     }
    1404                 :            : 
    1405                 :       8732 :     sal_Bool bRet = sal_False;
    1406                 :            :     // wenn Modify gelockt ist, werden keine Modifies verschickt
    1407   [ +  -  +  +  :      25412 :     if( IsModifyLocked() ||
           +  + ][ +  + ]
    1408                 :      16680 :         ( !GetDepends() &&  RES_PARATR_NUMRULE != rAttr.Which() ))
    1409                 :            :     {
    1410                 :       7318 :         bRet = 0 != AttrSetHandleHelper::Put( mpAttrSet, *this, rAttr );
    1411                 :            :     }
    1412                 :            :     else
    1413                 :            :     {
    1414 [ +  - ][ +  - ]:       1414 :         SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
                 [ +  - ]
    1415 [ +  - ][ +  - ]:       1414 :                   aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
                 [ +  - ]
    1416 [ +  - ][ +  + ]:       1414 :         if( 0 != ( bRet = 0 != AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew ) ))
    1417                 :            :         {
    1418 [ +  - ][ +  - ]:       1364 :             SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
    1419 [ +  - ][ +  - ]:       1364 :             SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
    1420 [ +  - ][ +  - ]:       1364 :             ModifyNotification( &aChgOld, &aChgNew );       // alle veraenderten werden verschickt
                 [ +  - ]
    1421 [ +  - ][ +  - ]:       1414 :         }
    1422                 :            :     }
    1423                 :       8732 :     return bRet;
    1424                 :            : }
    1425                 :            : #include <svl/itemiter.hxx>
    1426                 :            : 
    1427                 :      19642 : sal_Bool SwCntntNode::SetAttr( const SfxItemSet& rSet )
    1428                 :            : {
    1429         [ +  + ]:      19642 :     if ( IsInCache() )
    1430                 :            :     {
    1431         [ +  - ]:       2671 :         SwFrm::GetCache().Delete( this );
    1432                 :       2671 :         SetInCache( sal_False );
    1433                 :            :     }
    1434                 :            : 
    1435                 :      19642 :     const SfxPoolItem* pFnd = 0;
    1436 [ +  - ][ +  + ]:      19642 :     if( SFX_ITEM_SET == rSet.GetItemState( RES_AUTO_STYLE, sal_False, &pFnd ) )
    1437                 :            :     {
    1438                 :            :         OSL_ENSURE( rSet.Count() == 1, "SetAutoStyle mixed with other attributes?!" );
    1439                 :        145 :         const SwFmtAutoFmt* pTmp = static_cast<const SwFmtAutoFmt*>(pFnd);
    1440                 :            : 
    1441                 :            :         // If there already is an attribute set (usually containing a numbering
    1442                 :            :         // item), we have to merge the attribute of the new set into the old set:
    1443                 :        145 :         bool bSetParent = true;
    1444 [ +  - ][ +  + ]:        145 :         if ( GetpSwAttrSet() )
    1445                 :            :         {
    1446                 :          3 :             bSetParent = false;
    1447 [ +  - ][ +  - ]:          3 :             AttrSetHandleHelper::Put( mpAttrSet, *this, *pTmp->GetStyleHandle() );
                 [ +  - ]
    1448                 :            :         }
    1449                 :            :         else
    1450                 :            :         {
    1451 [ +  - ][ +  - ]:        142 :             mpAttrSet = pTmp->GetStyleHandle();
                 [ +  - ]
    1452                 :            :         }
    1453                 :            : 
    1454         [ +  + ]:        145 :         if ( bSetParent )
    1455                 :            :         {
    1456                 :            :             // If the content node has a conditional style, we have to set the
    1457                 :            :             // string item containing the correct conditional style name (the
    1458                 :            :             // style name property has already been set during the import!)
    1459                 :            :             // In case we do not have a conditional style, we make use of the
    1460                 :            :             // fact that nobody else uses the attribute set behind the handle.
    1461                 :            :             // FME 2007-07-10 #i78124# If autostyle does not have a parent,
    1462                 :            :             // the string is empty.
    1463                 :        142 :             const SfxPoolItem* pNameItem = 0;
    1464         [ +  - ]:        426 :             if ( 0 != GetCondFmtColl() ||
           [ +  -  -  + ]
                 [ -  + ]
    1465         [ +  - ]:        142 :                  SFX_ITEM_SET != mpAttrSet->GetItemState( RES_FRMATR_STYLE_NAME, sal_False, &pNameItem ) ||
    1466                 :        142 :                  0 == static_cast<const SfxStringItem*>(pNameItem)->GetValue().Len() )
    1467         [ #  # ]:          0 :                 AttrSetHandleHelper::SetParent( mpAttrSet, *this, &GetAnyFmtColl(), GetFmtColl() );
    1468                 :            :             else
    1469                 :        142 :                 const_cast<SfxItemSet*>(mpAttrSet.get())->SetParent( &GetFmtColl()->GetAttrSet() );
    1470                 :            :         }
    1471                 :            : 
    1472                 :        145 :         return sal_True;
    1473                 :            :     }
    1474                 :            : 
    1475 [ +  - ][ +  + ]:      19497 :     if( !GetpSwAttrSet() )            // lasse von den entsprechenden Nodes die
    1476         [ +  - ]:       8467 :         NewAttrSet( GetDoc()->GetAttrPool() );      // AttrSets anlegen
    1477                 :            : 
    1478                 :      19497 :     sal_Bool bRet = sal_False;
    1479                 :            :     // wenn Modify gelockt ist, werden keine Modifies verschickt
    1480   [ +  +  +  + ]:      48037 :     if ( IsModifyLocked() ||
         [ +  + ][ +  + ]
    1481                 :      17279 :          ( !GetDepends() &&
    1482         [ +  - ]:      11261 :            SFX_ITEM_SET != rSet.GetItemState( RES_PARATR_NUMRULE, sal_False ) ) )
    1483                 :            :     {
    1484                 :            :         // einige Sonderbehandlungen fuer Attribute
    1485         [ +  - ]:      12789 :         bRet = 0 != AttrSetHandleHelper::Put( mpAttrSet, *this, rSet );
    1486                 :            :     }
    1487                 :            :     else
    1488                 :            :     {
    1489 [ +  - ][ +  - ]:       6708 :         SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
                 [ +  - ]
    1490 [ +  - ][ +  - ]:       6708 :                   aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
                 [ +  - ]
    1491 [ +  - ][ +  + ]:       6708 :         if( 0 != (bRet = 0 != AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew )) )
    1492                 :            :         {
    1493                 :            :             // einige Sonderbehandlungen fuer Attribute
    1494 [ +  - ][ +  - ]:       5706 :             SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
    1495 [ +  - ][ +  - ]:       5706 :             SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
    1496 [ +  - ][ +  - ]:       5706 :             ModifyNotification( &aChgOld, &aChgNew );       // alle veraenderten werden verschickt
                 [ +  - ]
    1497 [ +  - ][ +  - ]:       6708 :         }
    1498                 :            :     }
    1499                 :      19642 :     return bRet;
    1500                 :            : }
    1501                 :            : 
    1502                 :            : // Nimmt den Hint mit nWhich aus dem Delta-Array
    1503                 :            : 
    1504                 :            : 
    1505                 :      57037 : sal_Bool SwCntntNode::ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
    1506                 :            : {
    1507 [ +  - ][ +  + ]:      57037 :     if( !GetpSwAttrSet() )
    1508                 :      38523 :         return sal_False;
    1509                 :            : 
    1510         [ +  + ]:      18514 :     if ( IsInCache() )
    1511                 :            :     {
    1512         [ +  - ]:         20 :         SwFrm::GetCache().Delete( this );
    1513                 :         20 :         SetInCache( sal_False );
    1514                 :            :     }
    1515                 :            : 
    1516                 :            :     // wenn Modify gelockt ist, werden keine Modifies verschickt
    1517         [ -  + ]:      18514 :     if( IsModifyLocked() )
    1518                 :            :     {
    1519                 :          0 :         sal_uInt16 nDel = 0;
    1520 [ #  # ][ #  # ]:          0 :         if ( !nWhich2 || nWhich2 < nWhich1 )
    1521                 :            :         {
    1522         [ #  # ]:          0 :             std::vector<sal_uInt16> aClearWhichIds;
    1523         [ #  # ]:          0 :             aClearWhichIds.push_back( nWhich1 );
    1524         [ #  # ]:          0 :             nDel = ClearItemsFromAttrSet( aClearWhichIds );
    1525                 :            :         }
    1526                 :            :         else
    1527         [ #  # ]:          0 :             nDel = AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, 0, 0 );
    1528                 :            : 
    1529 [ #  # ][ #  # ]:          0 :         if( !GetpSwAttrSet()->Count() )   // leer, dann loeschen
    1530         [ #  # ]:          0 :             mpAttrSet.reset();//DELETEZ( mpAttrSet );
    1531                 :          0 :         return 0 != nDel;
    1532                 :            :     }
    1533                 :            : 
    1534                 :            :     // sollte kein gueltiger Bereich definiert sein ?
    1535 [ -  + ][ #  # ]:      18514 :     if( !nWhich2 || nWhich2 < nWhich1 )
    1536                 :      18514 :         nWhich2 = nWhich1;      // dann setze auf 1. Id, nur dieses Item
    1537                 :            : 
    1538 [ +  - ][ +  - ]:      18514 :     SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
                 [ +  - ]
    1539 [ +  - ][ +  - ]:      18514 :               aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
                 [ +  - ]
    1540         [ +  - ]:      18514 :     sal_Bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, &aOld, &aNew );
    1541                 :            : 
    1542         [ +  + ]:      18514 :     if( bRet )
    1543                 :            :     {
    1544 [ +  - ][ +  - ]:       2074 :         SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
    1545 [ +  - ][ +  - ]:       2074 :         SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
    1546         [ +  - ]:       2074 :         ModifyNotification( &aChgOld, &aChgNew );       // alle veraenderten werden verschickt
    1547                 :            : 
    1548 [ +  - ][ +  + ]:       2074 :         if( !GetpSwAttrSet()->Count() )   // leer, dann loeschen
    1549 [ +  - ][ +  - ]:       2074 :             mpAttrSet.reset();//DELETEZ( mpAttrSet );
                 [ +  - ]
    1550                 :            :     }
    1551 [ +  - ][ +  - ]:      57037 :     return bRet;
    1552                 :            : }
    1553                 :       3770 : sal_Bool SwCntntNode::ResetAttr( const std::vector<sal_uInt16>& rWhichArr )
    1554                 :            : {
    1555         [ +  + ]:       3770 :     if( !GetpSwAttrSet() )
    1556                 :         73 :         return sal_False;
    1557                 :            : 
    1558         [ +  + ]:       3697 :     if ( IsInCache() )
    1559                 :            :     {
    1560                 :         12 :         SwFrm::GetCache().Delete( this );
    1561                 :         12 :         SetInCache( sal_False );
    1562                 :            :     }
    1563                 :            : 
    1564                 :            :     // wenn Modify gelockt ist, werden keine Modifies verschickt
    1565                 :       3697 :     sal_uInt16 nDel = 0;
    1566         [ +  + ]:       3697 :     if( IsModifyLocked() )
    1567                 :            :     {
    1568         [ +  - ]:       3621 :         std::vector<sal_uInt16> aClearWhichIds(rWhichArr);
    1569         [ +  - ]:       3621 :         nDel = ClearItemsFromAttrSet( aClearWhichIds );
    1570                 :            :     }
    1571                 :            :     else
    1572                 :            :     {
    1573 [ +  - ][ +  - ]:         76 :         SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
                 [ +  - ]
    1574 [ +  - ][ +  - ]:         76 :                   aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
                 [ +  - ]
    1575                 :            : 
    1576                 :         76 :         std::vector<sal_uInt16>::const_iterator it;
    1577 [ +  - ][ +  - ]:       3040 :         for ( it = rWhichArr.begin(); it != rWhichArr.end(); ++it )
                 [ +  + ]
    1578 [ +  - ][ +  - ]:       2964 :             if( AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, *it, &aOld, &aNew ))
                 [ +  + ]
    1579                 :        100 :                 ++nDel;
    1580                 :            : 
    1581         [ +  + ]:         76 :         if( nDel )
    1582                 :            :         {
    1583 [ +  - ][ +  - ]:         22 :             SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
    1584 [ +  - ][ +  - ]:         22 :             SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
    1585 [ +  - ][ +  - ]:         22 :             ModifyNotification( &aChgOld, &aChgNew );       // alle veraenderten werden verschickt
                 [ +  - ]
    1586 [ +  - ][ +  - ]:         76 :         }
    1587                 :            :     }
    1588         [ -  + ]:       3697 :     if( !GetpSwAttrSet()->Count() )   // leer, dann loeschen
    1589                 :          0 :         mpAttrSet.reset();//DELETEZ( mpAttrSet );
    1590                 :       3770 :     return 0 != nDel ;
    1591                 :            : }
    1592                 :            : 
    1593                 :            : 
    1594                 :       3774 : sal_uInt16 SwCntntNode::ResetAllAttr()
    1595                 :            : {
    1596 [ +  - ][ +  + ]:       3774 :     if( !GetpSwAttrSet() )
    1597                 :        153 :         return 0;
    1598                 :            : 
    1599         [ -  + ]:       3621 :     if ( IsInCache() )
    1600                 :            :     {
    1601         [ #  # ]:          0 :         SwFrm::GetCache().Delete( this );
    1602                 :          0 :         SetInCache( sal_False );
    1603                 :            :     }
    1604                 :            : 
    1605                 :            :     // wenn Modify gelockt ist, werden keine Modifies verschickt
    1606         [ -  + ]:       3621 :     if( IsModifyLocked() )
    1607                 :            :     {
    1608         [ #  # ]:          0 :         std::vector<sal_uInt16> aClearWhichIds;
    1609         [ #  # ]:          0 :         aClearWhichIds.push_back(0);
    1610         [ #  # ]:          0 :         sal_uInt16 nDel = ClearItemsFromAttrSet( aClearWhichIds );
    1611 [ #  # ][ #  # ]:          0 :         if( !GetpSwAttrSet()->Count() )   // leer, dann loeschen
    1612         [ #  # ]:          0 :             mpAttrSet.reset();            // DELETEZ( mpAttrSet );
    1613                 :          0 :         return nDel;
    1614                 :            :     }
    1615                 :            : 
    1616 [ +  - ][ +  - ]:       3621 :     SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
                 [ +  - ]
    1617 [ +  - ][ +  - ]:       3621 :               aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
                 [ +  - ]
    1618         [ +  - ]:       3621 :     sal_Bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, 0, &aOld, &aNew );
    1619                 :            : 
    1620         [ +  - ]:       3621 :     if( bRet )
    1621                 :            :     {
    1622 [ +  - ][ +  - ]:       3621 :         SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
    1623 [ +  - ][ +  - ]:       3621 :         SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
    1624         [ +  - ]:       3621 :         ModifyNotification( &aChgOld, &aChgNew );       // alle veraenderten werden verschickt
    1625                 :            : 
    1626 [ +  - ][ +  - ]:       3621 :         if( !GetpSwAttrSet()->Count() )   // leer, dann loeschen
    1627 [ +  - ][ +  - ]:       3621 :             mpAttrSet.reset();//DELETEZ( mpAttrSet );
                 [ +  - ]
    1628                 :            :     }
    1629 [ +  - ][ +  - ]:       3774 :     return aNew.Count();
    1630                 :            : }
    1631                 :            : 
    1632                 :            : 
    1633                 :      74405 : sal_Bool SwCntntNode::GetAttr( SfxItemSet& rSet, sal_Bool bInParent ) const
    1634                 :            : {
    1635         [ -  + ]:      74405 :     if( rSet.Count() )
    1636                 :          0 :         rSet.ClearItem();
    1637                 :            : 
    1638                 :      74405 :     const SwAttrSet& rAttrSet = GetSwAttrSet();
    1639         [ +  - ]:      74405 :     if( bInParent )
    1640         [ +  + ]:      74405 :         return rSet.Set( rAttrSet, sal_True ) ? sal_True : sal_False;
    1641                 :            : 
    1642                 :          0 :     rSet.Put( rAttrSet );
    1643         [ #  # ]:      74405 :     return rSet.Count() ? sal_True : sal_False;
    1644                 :            : }
    1645                 :            : 
    1646                 :       4527 : sal_uInt16 SwCntntNode::ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds )
    1647                 :            : {
    1648                 :       4527 :     sal_uInt16 nRet = 0;
    1649         [ +  + ]:       4527 :     if ( 0 == rWhichIds.size() )
    1650                 :       1403 :         return nRet;
    1651                 :            : 
    1652                 :            :     OSL_ENSURE( GetpSwAttrSet(), "no item set" );
    1653 [ +  - ][ +  - ]:       3124 :     SwAttrSet aNewAttrSet( *GetpSwAttrSet() );
    1654   [ +  -  +  - ]:      13750 :     for ( std::vector<sal_uInt16>::const_iterator aIter = rWhichIds.begin();
                 [ +  + ]
    1655                 :       6875 :           aIter != rWhichIds.end();
    1656                 :            :           ++aIter )
    1657                 :            :     {
    1658 [ +  - ][ +  - ]:       3751 :         nRet = nRet + aNewAttrSet.ClearItem( *aIter );
    1659                 :            :     }
    1660         [ +  + ]:       3124 :     if ( nRet )
    1661         [ +  - ]:       2218 :         AttrSetHandleHelper::GetNewAutoStyle( mpAttrSet, *this, aNewAttrSet );
    1662                 :            : 
    1663         [ +  - ]:       4527 :     return nRet;
    1664                 :            : }
    1665                 :            : 
    1666                 :     236496 : const SfxPoolItem* SwCntntNode::GetNoCondAttr( sal_uInt16 nWhich,
    1667                 :            :                                                 sal_Bool bInParents ) const
    1668                 :            : {
    1669                 :     236496 :     const SfxPoolItem* pFnd = 0;
    1670 [ -  + ][ #  # ]:     236496 :     if( pCondColl && pCondColl->GetRegisteredIn() )
                 [ -  + ]
    1671                 :            :     {
    1672 [ #  # ][ #  # ]:          0 :         if( !GetpSwAttrSet() || ( SFX_ITEM_SET != GetpSwAttrSet()->GetItemState(
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1673         [ #  # ]:          0 :                     nWhich, sal_False, &pFnd ) && bInParents ))
    1674         [ #  # ]:          0 :             ((SwFmt*)GetRegisteredIn())->GetItemState( nWhich, bInParents, &pFnd );
    1675                 :            :     }
    1676                 :            :     // undo change of issue #i51029#
    1677                 :            :     // Note: <GetSwAttrSet()> returns <mpAttrSet>, if set, otherwise it returns
    1678                 :            :     //       the attribute set of the paragraph style, which is valid for the
    1679                 :            :     //       content node - see file <node.hxx>
    1680                 :            :     else
    1681                 :            :     {
    1682 [ +  - ][ +  - ]:     236496 :         GetSwAttrSet().GetItemState( nWhich, bInParents, &pFnd );
    1683                 :            :     }
    1684                 :     236496 :     return pFnd;
    1685                 :            : }
    1686                 :            : 
    1687                 :            :     // koennen 2 Nodes zusammengefasst werden ?
    1688                 :            :     // in pIdx kann die 2. Position returnt werden.
    1689                 :       1368 : int SwCntntNode::CanJoinNext( SwNodeIndex* pIdx ) const
    1690                 :            : {
    1691                 :       1368 :     const SwNodes& rNds = GetNodes();
    1692                 :       1368 :     sal_uInt8 nNdType = GetNodeType();
    1693         [ +  - ]:       1368 :     SwNodeIndex aIdx( *this, 1 );
    1694                 :            : 
    1695                 :       1368 :     const SwNode* pNd = this;
    1696 [ +  - ][ +  -  :       4372 :     while( aIdx < rNds.Count()-1 &&
             +  +  +  - ]
                 [ +  + ]
    1697                 :       1435 :         (( pNd = &aIdx.GetNode())->IsSectionNode() ||
    1698                 :       1502 :             ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
    1699         [ +  - ]:         67 :         aIdx++;
    1700                 :            : 
    1701 [ +  - ][ -  + ]:       1368 :     if( pNd->GetNodeType() != nNdType || rNds.Count()-1 == aIdx.GetIndex() )
                 [ -  + ]
    1702                 :          0 :         return sal_False;
    1703         [ +  - ]:       1368 :     if( IsTxtNode() )
    1704                 :            :     {   // Do not merge strings if the result exceeds the allowed string length
    1705                 :       1368 :         const SwTxtNode* pTxtNd = static_cast<const SwTxtNode*>(this);
    1706                 :       1368 :         sal_uInt64 nSum = pTxtNd->GetTxt().Len();
    1707         [ +  - ]:       1368 :         pTxtNd = static_cast<const SwTxtNode*>(pNd);
    1708                 :       1368 :         nSum += pTxtNd->GetTxt().Len();
    1709         [ -  + ]:       1368 :         if( nSum > STRING_LEN )
    1710                 :          0 :             return sal_False;
    1711                 :            :     }
    1712         [ +  - ]:       1368 :     if( pIdx )
    1713         [ +  - ]:       1368 :         *pIdx = aIdx;
    1714         [ +  - ]:       1368 :     return sal_True;
    1715                 :            : }
    1716                 :            : 
    1717                 :            : 
    1718                 :            :     // koennen 2 Nodes zusammengefasst werden ?
    1719                 :            :     // in pIdx kann die 2. Position returnt werden.
    1720                 :          6 : int SwCntntNode::CanJoinPrev( SwNodeIndex* pIdx ) const
    1721                 :            : {
    1722                 :          6 :     sal_uInt8 nNdType = GetNodeType();
    1723         [ +  - ]:          6 :     SwNodeIndex aIdx( *this, -1 );
    1724                 :            : 
    1725                 :          6 :     const SwNode* pNd = this;
    1726 [ +  - ][ +  -  :         18 :     while( aIdx.GetIndex() &&
             -  +  #  # ]
                 [ -  + ]
    1727                 :          6 :         (( pNd = &aIdx.GetNode())->IsSectionNode() ||
    1728                 :          6 :             ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
    1729         [ #  # ]:          0 :         aIdx--;
    1730                 :            : 
    1731 [ +  - ][ -  + ]:          6 :     if( pNd->GetNodeType() != nNdType || 0 == aIdx.GetIndex() )
                 [ -  + ]
    1732                 :          0 :         return sal_False;
    1733         [ +  + ]:          6 :     if( pIdx )
    1734         [ +  - ]:          4 :         *pIdx = aIdx;
    1735         [ +  - ]:          6 :     return sal_True;
    1736                 :            : }
    1737                 :            : 
    1738                 :            : 
    1739                 :            : //FEATURE::CONDCOLL
    1740                 :            : 
    1741                 :            : 
    1742                 :       2597 : void SwCntntNode::SetCondFmtColl( SwFmtColl* pColl )
    1743                 :            : {
    1744 [ +  - ][ +  - ]:       2597 :     if( (!pColl && pCondColl) || ( pColl && !pCondColl ) ||
         [ -  + ][ #  # ]
           [ -  +  #  # ]
                 [ -  + ]
    1745                 :          0 :         ( pColl && pColl != pCondColl->GetRegisteredIn() ) )
    1746                 :            :     {
    1747                 :          0 :         SwFmtColl* pOldColl = GetCondFmtColl();
    1748         [ #  # ]:          0 :         delete pCondColl;
    1749         [ #  # ]:          0 :         if( pColl )
    1750         [ #  # ]:          0 :             pCondColl = new SwDepend( this, pColl );
    1751                 :            :         else
    1752                 :          0 :             pCondColl = 0;
    1753                 :            : 
    1754         [ #  # ]:          0 :         if( GetpSwAttrSet() )
    1755                 :            :         {
    1756                 :          0 :             AttrSetHandleHelper::SetParent( mpAttrSet, *this, &GetAnyFmtColl(), GetFmtColl() );
    1757                 :            :         }
    1758                 :            : 
    1759         [ #  # ]:          0 :         if( !IsModifyLocked() )
    1760                 :            :         {
    1761 [ #  # ][ #  # ]:          0 :             SwFmtChg aTmp1( pOldColl ? pOldColl : GetFmtColl() );
    1762 [ #  # ][ #  # ]:          0 :             SwFmtChg aTmp2( pColl ? pColl : GetFmtColl() );
    1763 [ #  # ][ #  # ]:          0 :             NotifyClients( &aTmp1, &aTmp2 );
                 [ #  # ]
    1764                 :            :         }
    1765         [ #  # ]:          0 :         if( IsInCache() )
    1766                 :            :         {
    1767                 :          0 :             SwFrm::GetCache().Delete( this );
    1768                 :          0 :             SetInCache( sal_False );
    1769                 :            :         }
    1770                 :            :     }
    1771                 :       2597 : }
    1772                 :            : 
    1773                 :            : 
    1774                 :         23 : sal_Bool SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const
    1775                 :            : {
    1776                 :         23 :     const SwNodes& rNds = GetNodes();
    1777                 :            :     {
    1778                 :         23 :         int nCond = 0;
    1779                 :         23 :         const SwStartNode* pSttNd = StartOfSectionNode();
    1780         [ +  + ]:         69 :         while( pSttNd )
    1781                 :            :         {
    1782      [ -  -  + ]:         46 :             switch( pSttNd->GetNodeType() )
    1783                 :            :             {
    1784                 :          0 :             case ND_TABLENODE:      nCond = PARA_IN_TABLEBODY; break;
    1785                 :          0 :             case ND_SECTIONNODE:    nCond = PARA_IN_SECTION; break;
    1786                 :            : 
    1787                 :            :             default:
    1788   [ -  -  -  -  :         46 :                 switch( pSttNd->GetStartNodeType() )
                -  +  - ]
    1789                 :            :                 {
    1790                 :            :                 case SwTableBoxStartNode:
    1791                 :            :                     {
    1792                 :          0 :                         nCond = PARA_IN_TABLEBODY;
    1793                 :          0 :                         const SwTableNode* pTblNd = pSttNd->FindTableNode();
    1794                 :            :                         const SwTableBox* pBox;
    1795   [ #  #  #  # ]:          0 :                         if( pTblNd && 0 != ( pBox = pTblNd->GetTable().
                 [ #  # ]
           [ #  #  #  # ]
    1796                 :          0 :                             GetTblBox( pSttNd->GetIndex() ) ) && pBox &&
    1797                 :          0 :                             pBox->IsInHeadline( &pTblNd->GetTable() ) )
    1798                 :          0 :                             nCond = PARA_IN_TABLEHEAD;
    1799                 :            :                     }
    1800                 :          0 :                     break;
    1801                 :          0 :                 case SwFlyStartNode:        nCond = PARA_IN_FRAME; break;
    1802                 :            :                 case SwFootnoteStartNode:
    1803                 :            :                     {
    1804                 :          0 :                         nCond = PARA_IN_FOOTENOTE;
    1805                 :          0 :                         const SwFtnIdxs& rFtnArr = rNds.GetDoc()->GetFtnIdxs();
    1806                 :            :                         const SwTxtFtn* pTxtFtn;
    1807                 :          0 :                         const SwNode* pSrchNd = pSttNd;
    1808                 :            : 
    1809         [ #  # ]:          0 :                         for( sal_uInt16 n = 0; n < rFtnArr.size(); ++n )
    1810   [ #  #  #  # ]:          0 :                             if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() &&
                 [ #  # ]
    1811                 :          0 :                                 pSrchNd == &pTxtFtn->GetStartNode()->GetNode() )
    1812                 :            :                             {
    1813         [ #  # ]:          0 :                                 if( pTxtFtn->GetFtn().IsEndNote() )
    1814                 :          0 :                                     nCond = PARA_IN_ENDNOTE;
    1815                 :          0 :                                 break;
    1816                 :            :                             }
    1817                 :            :                     }
    1818                 :          0 :                     break;
    1819                 :          0 :                 case SwHeaderStartNode:     nCond = PARA_IN_HEADER; break;
    1820                 :          0 :                 case SwFooterStartNode:     nCond = PARA_IN_FOOTER; break;
    1821                 :         46 :                 case SwNormalStartNode:     break;
    1822                 :            :                 }
    1823                 :            :             }
    1824                 :            : 
    1825         [ -  + ]:         46 :             if( nCond )
    1826                 :            :             {
    1827                 :          0 :                 rTmp.SetCondition( (Master_CollConditions)nCond, 0 );
    1828                 :          0 :                 return sal_True;
    1829                 :            :             }
    1830                 :         46 :             pSttNd = pSttNd->GetIndex()
    1831                 :         23 :                         ? pSttNd->StartOfSectionNode()
    1832         [ +  + ]:         46 :                         : 0;
    1833                 :            :         }
    1834                 :            :     }
    1835                 :            : 
    1836                 :            :     {
    1837                 :            :         sal_uInt16 nPos;
    1838         [ +  - ]:         23 :         const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
    1839         [ -  + ]:         23 :         if( !rOutlNds.empty() )
    1840                 :            :         {
    1841 [ #  # ][ #  # ]:          0 :             if( !rOutlNds.Seek_Entry( (SwCntntNode*)this, &nPos ) && nPos )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1842                 :          0 :                 --nPos;
    1843   [ #  #  #  # ]:          0 :             if( nPos < rOutlNds.size() &&
                 [ #  # ]
    1844         [ #  # ]:          0 :                 rOutlNds[ nPos ]->GetIndex() < GetIndex() )
    1845                 :            :             {
    1846         [ #  # ]:          0 :                 SwTxtNode* pOutlNd = rOutlNds[ nPos ]->GetTxtNode();
    1847                 :            : 
    1848 [ #  # ][ #  # ]:          0 :                 if( pOutlNd->IsOutline())
    1849                 :            :                 {
    1850 [ #  # ][ #  # ]:          0 :                     rTmp.SetCondition( PARA_IN_OUTLINE, pOutlNd->GetAttrOutlineLevel() - 1 );
    1851                 :          0 :                     return sal_True;
    1852                 :            :                 }
    1853                 :            :             }
    1854                 :            :         }
    1855                 :            :     }
    1856                 :            : 
    1857                 :         23 :     return sal_False;
    1858                 :            : }
    1859                 :            : 
    1860                 :            : 
    1861                 :        149 : void SwCntntNode::ChkCondColl()
    1862                 :            : {
    1863                 :            :     // zur Sicherheit abfragen
    1864         [ +  + ]:        149 :     if( RES_CONDTXTFMTCOLL == GetFmtColl()->Which() )
    1865                 :            :     {
    1866         [ +  - ]:         23 :         SwCollCondition aTmp( 0, 0, 0 );
    1867                 :            :         const SwCollCondition* pCColl;
    1868                 :            : 
    1869                 :         23 :         bool bDone = false;
    1870                 :            : 
    1871 [ +  - ][ -  + ]:         23 :         if( IsAnyCondition( aTmp ))
    1872                 :            :         {
    1873                 :          0 :             pCColl = static_cast<SwConditionTxtFmtColl*>(GetFmtColl())
    1874         [ #  # ]:          0 :                 ->HasCondition( aTmp );
    1875                 :            : 
    1876         [ #  # ]:          0 :             if (pCColl)
    1877                 :            :             {
    1878         [ #  # ]:          0 :                 SetCondFmtColl( pCColl->GetTxtFmtColl() );
    1879                 :          0 :                 bDone = true;
    1880                 :            :             }
    1881                 :            :         }
    1882                 :            : 
    1883         [ +  - ]:         23 :         if (!bDone)
    1884                 :            :         {
    1885 [ +  - ][ +  - ]:         23 :             if( IsTxtNode() && ((SwTxtNode*)this)->GetNumRule())
         [ -  + ][ -  + ]
    1886                 :            :             {
    1887                 :            :                 // steht in einer Numerierung
    1888                 :            :                 // welcher Level?
    1889                 :            :                 aTmp.SetCondition( PARA_IN_LIST,
    1890 [ #  # ][ #  # ]:          0 :                                 ((SwTxtNode*)this)->GetActualListLevel() );
    1891                 :          0 :                 pCColl = ((SwConditionTxtFmtColl*)GetFmtColl())->
    1892         [ #  # ]:          0 :                                 HasCondition( aTmp );
    1893                 :            :             }
    1894                 :            :             else
    1895                 :         23 :                 pCColl = 0;
    1896                 :            : 
    1897         [ -  + ]:         23 :             if( pCColl )
    1898         [ #  # ]:          0 :                 SetCondFmtColl( pCColl->GetTxtFmtColl() );
    1899         [ -  + ]:         23 :             else if( pCondColl )
    1900         [ #  # ]:          0 :                 SetCondFmtColl( 0 );
    1901         [ +  - ]:         23 :         }
    1902                 :            :     }
    1903                 :        149 : }
    1904                 :            : 
    1905                 :            : // #i42921#
    1906                 :      14298 : short SwCntntNode::GetTextDirection( const SwPosition& rPos,
    1907                 :            :                                      const Point* pPt ) const
    1908                 :            : {
    1909                 :      14298 :     short nRet = -1;
    1910                 :            : 
    1911                 :      14298 :     Point aPt;
    1912         [ +  + ]:      14298 :     if( pPt )
    1913                 :      13692 :         aPt = *pPt;
    1914                 :            : 
    1915                 :            :     // #i72024# - No format of the frame, because this can cause recursive layout actions
    1916 [ +  - ][ +  - ]:      14298 :     SwFrm* pFrm = getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, &rPos, sal_False );
    1917                 :            : 
    1918         [ +  - ]:      14298 :     if ( pFrm )
    1919                 :            :     {
    1920 [ +  - ][ -  + ]:      14298 :         if ( pFrm->IsVertical() )
    1921                 :            :         {
    1922 [ #  # ][ #  # ]:          0 :             if ( pFrm->IsRightToLeft() )
    1923                 :          0 :                 nRet = FRMDIR_VERT_TOP_LEFT;
    1924                 :            :             else
    1925                 :          0 :                 nRet = FRMDIR_VERT_TOP_RIGHT;
    1926                 :            :         }
    1927                 :            :         else
    1928                 :            :         {
    1929 [ +  - ][ -  + ]:      14298 :             if ( pFrm->IsRightToLeft() )
    1930                 :          0 :                 nRet = FRMDIR_HORI_RIGHT_TOP;
    1931                 :            :             else
    1932                 :      14298 :                 nRet = FRMDIR_HORI_LEFT_TOP;
    1933                 :            :         }
    1934                 :            :     }
    1935                 :            : 
    1936                 :            : 
    1937                 :      14298 :     return nRet;
    1938                 :            : }
    1939                 :            : 
    1940                 :          9 : SwOLENodes* SwCntntNode::CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize )
    1941                 :            : {
    1942                 :          9 :     SwOLENodes *pNodes = 0;
    1943         [ +  - ]:          9 :     SwIterator<SwCntntNode,SwFmtColl> aIter( rColl );
    1944 [ +  - ][ #  # ]:          9 :     for( SwCntntNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
                 [ -  + ]
    1945                 :            :     {
    1946                 :          0 :         SwOLENode *pONd = pNd->GetOLENode();
    1947 [ #  # ][ #  # ]:          0 :         if ( pONd && (!bOnlyWithInvalidSize || pONd->IsOLESizeInvalid()) )
         [ #  # ][ #  # ]
    1948                 :            :         {
    1949         [ #  # ]:          0 :             if ( !pNodes  )
    1950 [ #  # ][ #  # ]:          0 :                 pNodes = new SwOLENodes;
    1951         [ #  # ]:          0 :             pNodes->push_back( pONd );
    1952                 :            :         }
    1953                 :            :     }
    1954                 :            : 
    1955         [ +  - ]:          9 :     return pNodes;
    1956                 :            : }
    1957                 :            : 
    1958                 :            : /*
    1959                 :            :  * Document Interface Access
    1960                 :            :  */
    1961         [ +  - ]:     665248 : const IDocumentSettingAccess* SwNode::getIDocumentSettingAccess() const { return GetDoc(); }
    1962         [ +  - ]:      30826 : const IDocumentDeviceAccess* SwNode::getIDocumentDeviceAccess() const { return GetDoc(); }
    1963                 :     147511 : const IDocumentMarkAccess* SwNode::getIDocumentMarkAccess() const { return GetDoc()->getIDocumentMarkAccess(); }
    1964         [ +  - ]:     134397 : const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return GetDoc(); }
    1965         [ +  - ]:         32 : const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return GetDoc(); }
    1966         [ +  - ]:      26189 : const IDocumentLineNumberAccess* SwNode::getIDocumentLineNumberAccess() const { return GetDoc(); }
    1967         [ +  - ]:       2091 : const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return GetDoc(); }
    1968         [ #  # ]:          0 : const IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() const { return GetDoc(); }
    1969         [ +  - ]:      94706 : IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() { return GetDoc(); }
    1970         [ +  - ]:          3 : const IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() const { return GetDoc(); }
    1971         [ +  - ]:         11 : IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() { return GetDoc(); }
    1972         [ #  # ]:          0 : const IDocumentFieldsAccess* SwNode::getIDocumentFieldsAccess() const { return GetDoc(); }
    1973         [ +  - ]:      11393 : IDocumentFieldsAccess* SwNode::getIDocumentFieldsAccess() { return GetDoc(); }
    1974         [ #  # ]:          0 : IDocumentContentOperations* SwNode::getIDocumentContentOperations() { return GetDoc(); }
    1975                 :       5783 : IStyleAccess& SwNode::getIDocumentStyleAccess() { return GetDoc()->GetIStyleAccess(); }
    1976                 :            : // #i83479#
    1977                 :       8286 : IDocumentListItems& SwNode::getIDocumentListItems()
    1978                 :            : {
    1979                 :       8286 :     return *GetDoc();
    1980                 :            : }
    1981                 :            : 
    1982                 :      19239 : sal_Bool SwNode::IsInRedlines() const
    1983                 :            : {
    1984                 :      19239 :     const SwDoc * pDoc = GetDoc();
    1985                 :      19239 :     sal_Bool bResult = sal_False;
    1986                 :            : 
    1987         [ +  - ]:      19239 :     if (pDoc != NULL)
    1988                 :      19239 :         bResult = pDoc->IsInRedlines(*this);
    1989                 :            : 
    1990                 :      19239 :     return bResult;
    1991                 :            : }
    1992                 :            : 
    1993                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10