LCOV - code coverage report
Current view: top level - sw/source/core/docnode - ndsect.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 403 666 60.5 %
Date: 2012-08-25 Functions: 23 24 95.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 525 1504 34.9 %

           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 <svl/smplhint.hxx>
      31                 :            : #include <hintids.hxx>
      32                 :            : #include <sfx2/linkmgr.hxx>
      33                 :            : #include <svl/itemiter.hxx>
      34                 :            : #include <tools/resid.hxx>
      35                 :            : #include <fmtcntnt.hxx>
      36                 :            : #include <fmtanchr.hxx>
      37                 :            : #include <txtftn.hxx>
      38                 :            : #include <fmtclds.hxx>
      39                 :            : #include <doc.hxx>
      40                 :            : #include <IDocumentUndoRedo.hxx>
      41                 :            : #include <rootfrm.hxx>
      42                 :            : #include <pam.hxx>
      43                 :            : #include <ndtxt.hxx>
      44                 :            : #include <section.hxx>
      45                 :            : #include <UndoSection.hxx>
      46                 :            : #include <UndoDelete.hxx>
      47                 :            : #include <swundo.hxx>
      48                 :            : #include <calc.hxx>
      49                 :            : #include <swtable.hxx>
      50                 :            : #include <swserv.hxx>
      51                 :            : #include <frmfmt.hxx>
      52                 :            : #include <frmtool.hxx>
      53                 :            : #include <ftnidx.hxx>
      54                 :            : #include <docary.hxx>
      55                 :            : #include <redline.hxx>
      56                 :            : #include <sectfrm.hxx>
      57                 :            : #include <pagefrm.hxx>
      58                 :            : #include <cntfrm.hxx>
      59                 :            : #include <node2lay.hxx>
      60                 :            : #include <doctxm.hxx>
      61                 :            : #include <fmtftntx.hxx>
      62                 :            : #include <comcore.hrc>
      63                 :            : // #i27138#
      64                 :            : #include <viewsh.hxx>
      65                 :            : #include <txtfrm.hxx>
      66                 :            : 
      67                 :            : 
      68                 :            : // #i21457# - new implementation of local method <lcl_IsInSameTblBox(..)>.
      69                 :            : // Method now determines the previous/next on its own. Thus, it can be controlled,
      70                 :            : // for which previous/next is checked, if it's visible.
      71                 :         25 : bool lcl_IsInSameTblBox( SwNodes& _rNds,
      72                 :            :                          const SwNode& _rNd,
      73                 :            :                          const bool _bPrev )
      74                 :            : {
      75         [ +  - ]:         25 :     const SwTableNode* pTblNd = _rNd.FindTableNode();
      76         [ +  - ]:         25 :     if ( !pTblNd )
      77                 :            :     {
      78                 :         25 :         return true;
      79                 :            :     }
      80                 :            : 
      81                 :            :     // determine index to be checked. Its assumed that a previous/next exist.
      82         [ #  # ]:          0 :     SwNodeIndex aChkIdx( _rNd );
      83                 :            :     {
      84                 :            :         // determine index of previous/next - skip hidden ones, which are
      85                 :            :         // inside the table.
      86                 :            :         // If found one is before/after table, this one isn't in the same
      87                 :            :         // table box as <_rNd>.
      88                 :          0 :         bool bFound = false;
      89         [ #  # ]:          0 :         do
      90                 :            :         {
      91 [ #  # ][ #  # ]:          0 :             if ( _bPrev
      92         [ #  # ]:          0 :                  ? !_rNds.GoPrevSection( &aChkIdx, sal_False, sal_False )
      93         [ #  # ]:          0 :                  : !_rNds.GoNextSection( &aChkIdx, sal_False, sal_False ) )
      94                 :            :             {
      95                 :            :                 OSL_FAIL( "<lcl_IsInSameTblBox(..)> - no previous/next!" );
      96                 :          0 :                 return false;
      97                 :            :             }
      98                 :            :             else
      99                 :            :             {
     100   [ #  #  #  # ]:          0 :                 if ( aChkIdx < pTblNd->GetIndex() ||
                 [ #  # ]
     101                 :          0 :                      aChkIdx > pTblNd->EndOfSectionNode()->GetIndex() )
     102                 :            :                 {
     103                 :          0 :                     return false;
     104                 :            :                 }
     105                 :            :                 else
     106                 :            :                 {
     107                 :            :                     // check, if found one isn't inside a hidden section, which
     108                 :            :                     // is also inside the table.
     109         [ #  # ]:          0 :                     SwSectionNode* pSectNd = aChkIdx.GetNode().FindSectionNode();
     110   [ #  #  #  #  :          0 :                     if ( !pSectNd ||
           #  # ][ #  # ]
     111                 :          0 :                          pSectNd->GetIndex() < pTblNd->GetIndex() ||
     112                 :          0 :                          !pSectNd->GetSection().IsHiddenFlag() )
     113                 :            :                     {
     114                 :          0 :                         bFound = true;
     115                 :            :                     }
     116                 :            :                 }
     117                 :            :             }
     118                 :          0 :         } while ( !bFound );
     119                 :            :     }
     120                 :            : 
     121                 :            :     // dann suche den StartNode der Box
     122                 :          0 :     const SwTableSortBoxes& rSortBoxes = pTblNd->GetTable().GetTabSortBoxes();
     123                 :          0 :     sal_uLong nIdx = _rNd.GetIndex();
     124         [ #  # ]:          0 :     for( sal_uInt16 n = 0; n < rSortBoxes.size(); ++n )
     125                 :            :     {
     126         [ #  # ]:          0 :         const SwStartNode* pNd = rSortBoxes[ n ]->GetSttNd();
     127 [ #  # ][ #  # ]:          0 :         if ( pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex() )
                 [ #  # ]
     128                 :            :         {
     129                 :            :             // dann muss der andere Index in derselben Section liegen
     130                 :          0 :             nIdx = aChkIdx.GetIndex();
     131 [ #  # ][ #  # ]:          0 :             return pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex();
     132                 :            :         }
     133                 :            :     }
     134                 :            : 
     135         [ #  # ]:         25 :     return true;
     136                 :            : }
     137                 :            : 
     138                 :         21 : void lcl_CheckEmptyLayFrm( SwNodes& rNds, SwSectionData& rSectionData,
     139                 :            :                         const SwNode& rStt, const SwNode& rEnd )
     140                 :            : {
     141         [ +  - ]:         21 :     SwNodeIndex aIdx( rStt );
     142 [ +  - ][ +  + ]:         45 :     if( !rNds.GoPrevSection( &aIdx, sal_True, sal_False ) ||
         [ -  + ][ #  # ]
                 [ +  - ]
     143 [ +  - ][ +  - ]:         24 :         !CheckNodesRange( rStt, aIdx, sal_True ) ||
         [ +  + ][ +  - ]
                 [ #  # ]
     144                 :            :         // #i21457#
     145         [ #  # ]:          0 :         !lcl_IsInSameTblBox( rNds, rStt, true ))
     146                 :            :     {
     147         [ +  - ]:         21 :         aIdx = rEnd;
     148 [ +  - ][ +  - ]:         84 :         if( !rNds.GoNextSection( &aIdx, sal_True, sal_False ) ||
         [ +  - ][ -  + ]
                 [ -  + ]
     149 [ +  - ][ +  - ]:         42 :             !CheckNodesRange( rEnd, aIdx, sal_True ) ||
         [ +  - ][ +  - ]
                 [ #  # ]
     150                 :            :             // #i21457#
     151         [ +  - ]:         21 :             !lcl_IsInSameTblBox( rNds, rEnd, false ))
     152                 :            :         {
     153                 :          0 :             rSectionData.SetHidden( false );
     154                 :            :         }
     155         [ +  - ]:         21 :     }
     156                 :         21 : }
     157                 :            : 
     158                 :            : SwSection *
     159                 :        114 : SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
     160                 :            :                        SwTOXBase const*const pTOXBase,
     161                 :            :                        SfxItemSet const*const pAttr, bool const bUpdate)
     162                 :            : {
     163                 :        114 :     const SwNode* pPrvNd = 0;
     164                 :        114 :     sal_uInt16 nRegionRet = 0;
     165 [ +  + ][ +  - ]:        114 :     if( rRange.HasMark() &&
         [ -  + ][ -  + ]
     166                 :            :         0 == ( nRegionRet = IsInsRegionAvailable( rRange, &pPrvNd ) ))
     167                 :            :     {
     168                 :            :         OSL_ENSURE( !this, "Selection ueber verschiedene Sections" );
     169                 :          0 :         return 0;
     170                 :            :     }
     171                 :            : 
     172                 :            :     // Teste ob das gesamte Dokument versteckt werden soll,
     173                 :            :     // koennen wir zur Zeit nicht !!!!
     174 [ +  + ][ +  - ]:        114 :     if (rNewData.IsHidden() && rRange.HasMark())
                 [ +  + ]
     175                 :            :     {
     176 [ +  - ][ +  - ]:          3 :         const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
     177   [ +  -  +  - ]:          6 :         if( !pStt->nContent.GetIndex() &&
                 [ +  - ]
     178         [ +  - ]:          3 :             pEnd->nNode.GetNode().GetCntntNode()->Len() ==
     179                 :          3 :             pEnd->nContent.GetIndex() )
     180                 :            :         {
     181         [ +  - ]:          3 :             ::lcl_CheckEmptyLayFrm( GetNodes(),
     182                 :            :                                     rNewData,
     183                 :          3 :                                     pStt->nNode.GetNode(),
     184         [ +  - ]:          6 :                                     pEnd->nNode.GetNode() );
     185                 :            :         }
     186                 :            :     }
     187                 :            : 
     188                 :        114 :     SwUndoInsSection* pUndoInsSect = 0;
     189 [ +  - ][ +  - ]:        114 :     bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
     190         [ +  + ]:        114 :     if (bUndo)
     191                 :            :     {
     192 [ +  - ][ +  - ]:         44 :         pUndoInsSect = new SwUndoInsSection(rRange, rNewData, pAttr, pTOXBase);
     193 [ +  - ][ +  - ]:         44 :         GetIDocumentUndoRedo().AppendUndo( pUndoInsSect );
     194 [ +  - ][ +  - ]:         44 :         GetIDocumentUndoRedo().DoUndo(false);
     195                 :            :     }
     196                 :            : 
     197         [ +  - ]:        114 :     SwSectionFmt* const pFmt = MakeSectionFmt( 0 );
     198         [ +  + ]:        114 :     if ( pAttr )
     199                 :            :     {
     200         [ +  - ]:         39 :         pFmt->SetFmtAttr( *pAttr );
     201                 :            :     }
     202                 :            : 
     203                 :        114 :     SwSectionNode* pNewSectNode = 0;
     204                 :            : 
     205         [ +  - ]:        114 :     RedlineMode_t eOld = GetRedlineMode();
     206         [ +  - ]:        114 :     SetRedlineMode_intern( (RedlineMode_t)((eOld & ~nsRedlineMode_t::REDLINE_SHOW_MASK) | nsRedlineMode_t::REDLINE_IGNORE));
     207                 :            : 
     208         [ +  + ]:        114 :     if( rRange.HasMark() )
     209                 :            :     {
     210         [ +  - ]:         42 :         SwPosition *pSttPos = (SwPosition*)rRange.Start(),
     211         [ +  - ]:         42 :                     *pEndPos = (SwPosition*)rRange.End();
     212 [ -  + ][ #  # ]:         42 :         if( pPrvNd && 3 == nRegionRet )
     213                 :            :         {
     214                 :            :             OSL_ENSURE( pPrvNd, "der SectionNode fehlt" );
     215 [ #  # ][ #  # ]:          0 :             SwNodeIndex aStt( pSttPos->nNode ), aEnd( pEndPos->nNode, +1 );
     216         [ #  # ]:          0 :             while( pPrvNd != aStt.GetNode().StartOfSectionNode() )
     217         [ #  # ]:          0 :                 aStt--;
     218         [ #  # ]:          0 :             while( pPrvNd != aEnd.GetNode().StartOfSectionNode() )
     219         [ #  # ]:          0 :                 aEnd++;
     220                 :            : 
     221         [ #  # ]:          0 :             --aEnd;     // im InsertSection ist Ende inclusive
     222         [ #  # ]:          0 :             pNewSectNode = GetNodes().InsertTextSection(
     223 [ #  # ][ #  # ]:          0 :                         aStt, *pFmt, rNewData, pTOXBase, & aEnd);
                 [ #  # ]
     224                 :            :         }
     225                 :            :         else
     226                 :            :         {
     227         [ -  + ]:         42 :             if( pUndoInsSect )
     228                 :            :             {
     229         [ #  # ]:          0 :                 if( !( pPrvNd && 1 == nRegionRet ) &&
           [ #  #  #  # ]
                 [ #  # ]
     230                 :          0 :                     pSttPos->nContent.GetIndex() )
     231                 :            :                 {
     232                 :            :                     SwTxtNode* const pTNd =
     233                 :          0 :                         pSttPos->nNode.GetNode().GetTxtNode();
     234         [ #  # ]:          0 :                     if (pTNd)
     235                 :            :                     {
     236         [ #  # ]:          0 :                         pUndoInsSect->SaveSplitNode( pTNd, sal_True );
     237                 :            :                     }
     238                 :            :                 }
     239                 :            : 
     240 [ #  # ][ #  # ]:          0 :                 if ( !( pPrvNd && 2 == nRegionRet ) )
     241                 :            :                 {
     242                 :            :                     SwTxtNode *const pTNd =
     243                 :          0 :                         pEndPos->nNode.GetNode().GetTxtNode();
     244         [ #  # ]:          0 :                     if (pTNd &&
           [ #  #  #  # ]
     245                 :          0 :                         (pTNd->GetTxt().Len() != pEndPos->nContent.GetIndex()))
     246                 :            :                     {
     247         [ #  # ]:          0 :                         pUndoInsSect->SaveSplitNode( pTNd, sal_False );
     248                 :            :                     }
     249                 :            :                 }
     250                 :            :             }
     251                 :            : 
     252                 :            :             const SwCntntNode* pCNd;
     253 [ -  + ][ #  # ]:         42 :             if( pPrvNd && 1 == nRegionRet )
     254                 :            :             {
     255         [ #  # ]:          0 :                 pSttPos->nNode.Assign( *pPrvNd );
     256 [ #  # ][ #  # ]:          0 :                 pSttPos->nContent.Assign( pSttPos->nNode.GetNode().GetCntntNode(), 0 );
     257                 :            :             }
     258         [ -  + ]:         42 :             else if( pSttPos->nContent.GetIndex() )
     259                 :            :             {
     260         [ #  # ]:          0 :                 SplitNode( *pSttPos, false );
     261                 :            :             }
     262                 :            : 
     263 [ -  + ][ #  # ]:         42 :             if( pPrvNd && 2 == nRegionRet )
     264                 :            :             {
     265         [ #  # ]:          0 :                 pEndPos->nNode.Assign( *pPrvNd );
     266 [ #  # ][ #  # ]:          0 :                 pEndPos->nContent.Assign( pEndPos->nNode.GetNode().GetCntntNode(), 0 );
     267                 :            :             }
     268                 :            :             else
     269                 :            :             {
     270                 :         42 :                 pCNd = pEndPos->nNode.GetNode().GetCntntNode();
     271 [ +  - ][ -  + ]:         42 :                 if( pCNd && pCNd->Len() != pEndPos->nContent.GetIndex() )
         [ -  + ][ +  - ]
     272                 :            :                 {
     273                 :          0 :                     xub_StrLen nCntnt = pSttPos->nContent.GetIndex();
     274         [ #  # ]:          0 :                     SplitNode( *pEndPos, false );
     275                 :            : 
     276                 :            :                     SwTxtNode* pTNd;
     277         [ #  # ]:          0 :                     if( pEndPos->nNode.GetIndex() == pSttPos->nNode.GetIndex() )
     278                 :            :                     {
     279         [ #  # ]:          0 :                         pSttPos->nNode--;
     280         [ #  # ]:          0 :                         pEndPos->nNode--;
     281                 :          0 :                         pTNd = pSttPos->nNode.GetNode().GetTxtNode();
     282 [ #  # ][ #  # ]:          0 :                         pSttPos->nContent.Assign( pTNd, nCntnt );
     283                 :            :                     }
     284                 :            :                     else
     285                 :            :                     {
     286                 :            :                         // wieder ans Ende vom vorherigen setzen
     287         [ #  # ]:          0 :                         pEndPos->nNode--;
     288                 :          0 :                         pTNd = pEndPos->nNode.GetNode().GetTxtNode();
     289                 :            :                     }
     290         [ #  # ]:          0 :                     if( pTNd ) nCntnt = pTNd->GetTxt().Len(); else nCntnt = 0;
     291 [ #  # ][ #  # ]:          0 :                     pEndPos->nContent.Assign( pTNd, nCntnt );
     292                 :            :                 }
     293                 :            :             }
     294         [ +  - ]:         42 :             pNewSectNode = GetNodes().InsertTextSection(
     295         [ +  - ]:         42 :                 pSttPos->nNode, *pFmt, rNewData, pTOXBase, &pEndPos->nNode);
     296                 :            :         }
     297                 :            :     }
     298                 :            :     else
     299                 :            :     {
     300                 :         72 :         const SwPosition* pPos = rRange.GetPoint();
     301                 :         72 :         const SwCntntNode* pCNd = pPos->nNode.GetNode().GetCntntNode();
     302         [ +  + ]:         72 :         if( !pPos->nContent.GetIndex() )
     303                 :            :         {
     304         [ +  - ]:         56 :             pNewSectNode = GetNodes().InsertTextSection(
     305         [ +  - ]:         56 :                 pPos->nNode, *pFmt, rNewData, pTOXBase, 0, true);
     306                 :            :         }
     307 [ +  - ][ +  + ]:         16 :         else if( pPos->nContent.GetIndex() == pCNd->Len() )
     308                 :            :         {
     309         [ +  - ]:          6 :             pNewSectNode = GetNodes().InsertTextSection(
     310         [ +  - ]:          6 :                 pPos->nNode, *pFmt, rNewData, pTOXBase, 0, false);
     311                 :            :         }
     312                 :            :         else
     313                 :            :         {
     314 [ +  - ][ +  - ]:         10 :             if( pUndoInsSect && pCNd->IsTxtNode() )
                 [ +  - ]
     315                 :            :             {
     316         [ +  - ]:         10 :                 pUndoInsSect->SaveSplitNode( (SwTxtNode*)pCNd, sal_True );
     317                 :            :             }
     318         [ +  - ]:         10 :             SplitNode( *pPos, false );
     319         [ +  - ]:         10 :             pNewSectNode = GetNodes().InsertTextSection(
     320         [ +  - ]:         10 :                 pPos->nNode, *pFmt, rNewData, pTOXBase, 0, true);
     321                 :            :         }
     322                 :            :     }
     323                 :            : 
     324                 :            : //FEATURE::CONDCOLL
     325         [ +  - ]:        114 :     pNewSectNode->CheckSectionCondColl();
     326                 :            : //FEATURE::CONDCOLL
     327                 :            : 
     328         [ +  - ]:        114 :     SetRedlineMode_intern( eOld );
     329                 :            : 
     330 [ +  - ][ +  - ]:        114 :     if( IsRedlineOn() || (!IsIgnoreRedline() && !pRedlineTbl->empty() ))
         [ +  - ][ +  - ]
         [ -  + ][ -  + ]
     331                 :            :     {
     332         [ #  # ]:          0 :         SwPaM aPam( *pNewSectNode->EndOfSectionNode(), *pNewSectNode, 1 );
     333 [ #  # ][ #  # ]:          0 :         if( IsRedlineOn() )
     334                 :            :         {
     335 [ #  # ][ #  # ]:          0 :             AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
                 [ #  # ]
     336                 :            :         }
     337                 :            :         else
     338                 :            :         {
     339         [ #  # ]:          0 :             SplitRedline( aPam );
     340         [ #  # ]:          0 :         }
     341                 :            :     }
     342                 :            : 
     343                 :            :     // ist eine Condition gesetzt
     344 [ +  + ][ +  - ]:        114 :     if (rNewData.IsHidden() && rNewData.GetCondition().Len())
                 [ +  + ]
     345                 :            :     {
     346                 :            :         // dann berechne bis zu dieser Position
     347         [ +  - ]:          3 :         SwCalc aCalc( *this );
     348         [ -  + ]:          3 :         if( ! IsInReading() )
     349                 :            :         {
     350         [ #  # ]:          0 :             FldsToCalc( aCalc, pNewSectNode->GetIndex(), USHRT_MAX );
     351                 :            :         }
     352                 :          3 :         SwSection& rNewSect = pNewSectNode->GetSection();
     353 [ +  - ][ +  - ]:          3 :         rNewSect.SetCondHidden( aCalc.Calculate( rNewSect.GetCondition() ).GetBool() );
         [ +  - ][ +  - ]
                 [ +  - ]
     354                 :            :     }
     355                 :            : 
     356                 :        114 :     sal_Bool bUpdateFtn = sal_False;
     357 [ +  + ][ -  + ]:        114 :     if( GetFtnIdxs().size() && pAttr )
                 [ -  + ]
     358                 :            :     {
     359                 :            :         sal_uInt16 nVal = ((SwFmtFtnAtTxtEnd&)pAttr->Get(
     360         [ #  # ]:          0 :                                             RES_FTN_AT_TXTEND )).GetValue();
     361 [ #  # ][ #  # ]:          0 :            if( ( FTNEND_ATTXTEND_OWNNUMSEQ == nVal ||
         [ #  # ][ #  # ]
                 [ #  # ]
     362                 :            :               FTNEND_ATTXTEND_OWNNUMANDFMT == nVal ) ||
     363                 :            :             ( FTNEND_ATTXTEND_OWNNUMSEQ == ( nVal = ((SwFmtEndAtTxtEnd&)
     364         [ #  # ]:          0 :                             pAttr->Get( RES_END_AT_TXTEND )).GetValue() ) ||
     365                 :            :               FTNEND_ATTXTEND_OWNNUMANDFMT == nVal ))
     366                 :            :         {
     367                 :          0 :             bUpdateFtn = sal_True;
     368                 :            :         }
     369                 :            :     }
     370                 :            : 
     371         [ +  + ]:        114 :     if( pUndoInsSect )
     372                 :            :     {
     373                 :         44 :         pUndoInsSect->SetSectNdPos( pNewSectNode->GetIndex() );
     374                 :         44 :         pUndoInsSect->SetUpdtFtnFlag( bUpdateFtn );
     375 [ +  - ][ +  - ]:         44 :         GetIDocumentUndoRedo().DoUndo(bUndo);
     376                 :            :     }
     377                 :            : 
     378         [ -  + ]:        114 :     if (rNewData.IsLinkType())
     379                 :            :     {
     380 [ #  # ][ #  # ]:          0 :         pNewSectNode->GetSection().CreateLink( bUpdate ? CREATE_UPDATE : CREATE_CONNECT );
     381                 :            :     }
     382                 :            : 
     383         [ -  + ]:        114 :     if( bUpdateFtn )
     384                 :            :     {
     385 [ #  # ][ #  # ]:          0 :         GetFtnIdxs().UpdateFtn( SwNodeIndex( *pNewSectNode ));
                 [ #  # ]
     386                 :            :     }
     387                 :            : 
     388         [ +  - ]:        114 :     SetModified();
     389                 :        114 :     return &pNewSectNode->GetSection();
     390                 :            : }
     391                 :            : 
     392                 :         42 : sal_uInt16 SwDoc::IsInsRegionAvailable( const SwPaM& rRange,
     393                 :            :                                 const SwNode** ppSttNd ) const
     394                 :            : {
     395                 :         42 :     sal_uInt16 nRet = 1;
     396         [ +  - ]:         42 :     if( rRange.HasMark() )
     397                 :            :     {
     398                 :            :         // teste ob es sich um eine gueltige Selektion handelt
     399                 :         42 :         const SwPosition* pStt = rRange.Start(),
     400                 :         42 :                         * pEnd = rRange.End();
     401                 :            : 
     402                 :         42 :         const SwCntntNode* pCNd = pEnd->nNode.GetNode().GetCntntNode();
     403                 :         42 :         const SwNode* pNd = &pStt->nNode.GetNode();
     404                 :         42 :         const SwSectionNode* pSectNd = pNd->FindSectionNode();
     405         [ +  - ]:         42 :         const SwSectionNode* pEndSectNd = pCNd ? pCNd->FindSectionNode() : 0;
     406 [ +  + ][ +  - ]:         42 :         if( pSectNd && pEndSectNd && pSectNd != pEndSectNd )
                 [ -  + ]
     407                 :            :         {
     408                 :            :             // versuche eine umschliessende Section zu erzeugen
     409                 :            :             // Aber, nur wenn der Start am Sectionanfang und das Ende am
     410                 :            :             // Section Ende liegt!
     411                 :          0 :             nRet = 0;
     412         [ #  # ]:          0 :             if( !pStt->nContent.GetIndex() && pSectNd->GetIndex()
           [ #  #  #  # ]
                 [ #  # ]
     413                 :          0 :                 == pStt->nNode.GetIndex() - 1 && pEnd->nContent.GetIndex() ==
     414                 :          0 :                 pCNd->Len() )
     415                 :            :             {
     416         [ #  # ]:          0 :                 SwNodeIndex aIdx( pStt->nNode, -1 );
     417                 :          0 :                 sal_uLong nCmp = pEnd->nNode.GetIndex();
     418                 :            :                 const SwStartNode* pPrvNd;
     419                 :            :                 const SwEndNode* pNxtNd;
     420   [ #  #  #  # ]:          0 :                 while( 0 != ( pPrvNd = (pNd = &aIdx.GetNode())->GetSectionNode() ) &&
                 [ #  # ]
     421                 :          0 :                     !( aIdx.GetIndex() < nCmp &&
     422         [ #  # ]:          0 :                         nCmp < pPrvNd->EndOfSectionIndex() ) )
     423                 :            :                 {
     424         [ #  # ]:          0 :                     aIdx--;
     425                 :            :                 }
     426         [ #  # ]:          0 :                 if( !pPrvNd )
     427                 :          0 :                     pPrvNd = pNd->IsStartNode() ? (SwStartNode*)pNd
     428         [ #  # ]:          0 :                                                 : pNd->StartOfSectionNode();
     429                 :            : 
     430         [ #  # ]:          0 :                 aIdx = pEnd->nNode.GetIndex() + 1;
     431                 :          0 :                 nCmp = pStt->nNode.GetIndex();
     432   [ #  #  #  #  :          0 :                 while( 0 != ( pNxtNd = (pNd = &aIdx.GetNode())->GetEndNode() ) &&
           #  # ][ #  # ]
     433                 :          0 :                     pNxtNd->StartOfSectionNode()->IsSectionNode() &&
     434                 :          0 :                     !( pNxtNd->StartOfSectionIndex() < nCmp &&
     435         [ #  # ]:          0 :                         nCmp < aIdx.GetIndex() ) )
     436                 :            :                 {
     437         [ #  # ]:          0 :                     aIdx++;
     438                 :            :                 }
     439         [ #  # ]:          0 :                 if( !pNxtNd )
     440                 :          0 :                     pNxtNd = pNd->EndOfSectionNode();
     441                 :            : 
     442 [ #  # ][ #  # ]:          0 :                 if( pPrvNd && pNxtNd && pPrvNd == pNxtNd->StartOfSectionNode() )
         [ #  # ][ #  # ]
     443                 :            :                 {
     444                 :          0 :                     nRet = 3;
     445                 :            : 
     446         [ #  # ]:          0 :                     if( ppSttNd )
     447                 :          0 :                         *ppSttNd = pPrvNd;
     448         [ #  # ]:          0 :                 }
     449                 :          0 :             }
     450                 :            :         }
     451 [ +  + ][ -  + ]:         42 :         else if( !pSectNd && pEndSectNd )
     452                 :            :         {
     453                 :            :             // versuche eine umschliessende Section zu erzeugen
     454                 :            :             // Aber, nur wenn das Ende am Section Ende liegt!
     455                 :          0 :             nRet = 0;
     456         [ #  # ]:          0 :             if( pEnd->nContent.GetIndex() == pCNd->Len() )
     457                 :            :             {
     458         [ #  # ]:          0 :                 SwNodeIndex aIdx( pEnd->nNode, 1 );
     459 [ #  # ][ #  # ]:          0 :                 if( aIdx.GetNode().IsEndNode() &&
                 [ #  # ]
     460         [ #  # ]:          0 :                         0 != aIdx.GetNode().FindSectionNode() )
     461                 :            :                 {
     462 [ #  # ][ #  # ]:          0 :                     do {
                 [ #  # ]
     463         [ #  # ]:          0 :                         aIdx++;
     464                 :          0 :                     } while( aIdx.GetNode().IsEndNode() &&
     465         [ #  # ]:          0 :                                 0 != aIdx.GetNode().FindSectionNode() );
     466                 :            :                     {
     467                 :          0 :                         nRet = 2;
     468         [ #  # ]:          0 :                         if( ppSttNd )
     469                 :            :                         {
     470         [ #  # ]:          0 :                             aIdx--;
     471                 :          0 :                             *ppSttNd = &aIdx.GetNode();
     472                 :            :                         }
     473                 :            :                     }
     474         [ #  # ]:          0 :                 }
     475                 :          0 :             }
     476                 :            :         }
     477 [ +  + ][ -  + ]:         42 :         else if( pSectNd && !pEndSectNd )
     478                 :            :         {
     479                 :            :             // versuche eine umschliessende Section zu erzeugen
     480                 :            :             // Aber, nur wenn der Start am Section Anfang liegt!
     481                 :          0 :             nRet = 0;
     482         [ #  # ]:          0 :             if( !pStt->nContent.GetIndex() )
     483                 :            :             {
     484         [ #  # ]:          0 :                 SwNodeIndex aIdx( pStt->nNode, -1 );
     485         [ #  # ]:          0 :                 if( aIdx.GetNode().IsSectionNode() )
     486                 :            :                 {
     487         [ #  # ]:          0 :                     do {
     488         [ #  # ]:          0 :                         aIdx--;
     489                 :          0 :                     } while( aIdx.GetNode().IsSectionNode() );
     490         [ #  # ]:          0 :                     if( !aIdx.GetNode().IsSectionNode() )
     491                 :            :                     {
     492                 :          0 :                         nRet = 1;
     493         [ #  # ]:          0 :                         if( ppSttNd )
     494                 :            :                         {
     495         [ #  # ]:          0 :                             aIdx++;
     496                 :          0 :                             *ppSttNd = &aIdx.GetNode();
     497                 :            :                         }
     498                 :            :                     }
     499         [ #  # ]:         42 :                 }
     500                 :            :             }
     501                 :            :         }
     502                 :            :     }
     503                 :         42 :     return nRet;
     504                 :            : }
     505                 :            : 
     506                 :       1534 : SwSection* SwDoc::GetCurrSection( const SwPosition& rPos ) const
     507                 :            : {
     508                 :       1534 :     const SwSectionNode* pSectNd = rPos.nNode.GetNode().FindSectionNode();
     509         [ +  + ]:       1534 :     if( pSectNd )
     510                 :         18 :         return (SwSection*)&pSectNd->GetSection();
     511                 :       1534 :     return 0;
     512                 :            : }
     513                 :            : 
     514                 :        116 : SwSectionFmt* SwDoc::MakeSectionFmt( SwSectionFmt *pDerivedFrom )
     515                 :            : {
     516         [ +  - ]:        116 :     if( !pDerivedFrom )
     517                 :        116 :         pDerivedFrom = (SwSectionFmt*)pDfltFrmFmt;
     518 [ +  - ][ +  - ]:        116 :     SwSectionFmt* pNew = new SwSectionFmt( pDerivedFrom, this );
     519         [ +  - ]:        116 :     pSectionFmtTbl->push_back( pNew );
     520                 :        116 :     return pNew;
     521                 :            : }
     522                 :            : 
     523                 :         14 : void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes )
     524                 :            : {
     525         [ +  - ]:         14 :     SwSectionFmts::iterator itFmtPos = std::find( pSectionFmtTbl->begin(), pSectionFmtTbl->end(), pFmt );
     526                 :            : 
     527 [ +  - ][ +  - ]:         14 :     GetIDocumentUndoRedo().StartUndo(UNDO_DELSECTION, NULL);
     528                 :            : 
     529 [ +  - ][ +  + ]:         14 :     if( pSectionFmtTbl->end() != itFmtPos )
     530                 :            :     {
     531         [ +  - ]:         10 :         const SwNodeIndex* pIdx = pFmt->GetCntnt( sal_False ).GetCntntIdx();
     532                 :            :         const SfxPoolItem* pFtnEndAtTxtEnd;
     533 [ +  + ][ -  + ]:         12 :         if( SFX_ITEM_SET != pFmt->GetItemState(
                 [ +  + ]
     534         [ +  - ]:         10 :                             RES_FTN_AT_TXTEND, sal_True, &pFtnEndAtTxtEnd ) ||
     535                 :            :             SFX_ITEM_SET != pFmt->GetItemState(
     536         [ +  - ]:          2 :                             RES_END_AT_TXTEND, sal_True, &pFtnEndAtTxtEnd ))
     537                 :          8 :             pFtnEndAtTxtEnd = 0;
     538                 :            : 
     539                 :            :         const SwSectionNode* pSectNd;
     540                 :            : 
     541 [ +  - ][ +  - ]:         10 :         if( GetIDocumentUndoRedo().DoesUndo() )
                 [ +  + ]
     542                 :            :         {
     543 [ +  + ][ +  - ]:         10 :             if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
                 [ +  - ]
           [ +  -  +  - ]
                 [ +  + ]
     544                 :          2 :                 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
     545                 :            :             {
     546         [ +  - ]:          2 :                 SwNodeIndex aUpdIdx( *pIdx );
     547         [ +  - ]:          2 :                 SwPaM aPaM( *pSectNd->EndOfSectionNode(), *pSectNd );
     548 [ +  - ][ +  - ]:          2 :                 GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( aPaM ));
         [ +  - ][ +  - ]
     549         [ -  + ]:          2 :                 if( pFtnEndAtTxtEnd )
     550         [ #  # ]:          0 :                     GetFtnIdxs().UpdateFtn( aUpdIdx );
     551         [ +  - ]:          2 :                 SetModified();
     552                 :            :                 //#126178# start/end undo have to be pairs!
     553 [ +  - ][ +  - ]:          2 :                 GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL);
     554 [ +  - ][ +  - ]:          2 :                 return ;
     555                 :            :             }
     556 [ +  - ][ +  - ]:          6 :             GetIDocumentUndoRedo().AppendUndo( MakeUndoDelSection( *pFmt ) );
                 [ +  - ]
     557                 :            :         }
     558 [ -  + ][ #  # ]:          2 :         else if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
                 [ #  # ]
           [ #  #  #  # ]
                 [ -  + ]
     559                 :          0 :                 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
     560                 :            :         {
     561         [ #  # ]:          0 :             SwNodeIndex aUpdIdx( *pIdx );
     562         [ #  # ]:          0 :             DeleteSection( (SwNode*)pSectNd );
     563         [ #  # ]:          0 :             if( pFtnEndAtTxtEnd )
     564         [ #  # ]:          0 :                 GetFtnIdxs().UpdateFtn( aUpdIdx );
     565         [ #  # ]:          0 :             SetModified();
     566                 :            :             //#126178# start/end undo have to be pairs!
     567 [ #  # ][ #  # ]:          0 :             GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL);
     568         [ #  # ]:          0 :             return ;
     569                 :            :         }
     570                 :            : 
     571                 :            :         {
     572         [ +  - ]:          8 :             SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFmt );
     573 [ +  - ][ +  - ]:          8 :             pFmt->ModifyNotification( &aMsgHint, &aMsgHint );
     574                 :            :         }
     575                 :            : 
     576                 :            :         // A ClearRedo could result in a rekursive call of this function and delete some section
     577                 :            :         // formats => the position iside the SectionFmtTbl could have changed
     578         [ +  - ]:          8 :         itFmtPos = std::find( pSectionFmtTbl->begin(), pSectionFmtTbl->end(), pFmt );
     579                 :            : 
     580                 :            :         // ACHTUNG: erst aus dem Array entfernen und dann loeschen.
     581                 :            :         //          Der Section-DTOR versucht selbst noch sein Format
     582                 :            :         //          zu loeschen!
     583         [ +  - ]:          8 :         pSectionFmtTbl->erase( itFmtPos );
     584                 :            : //FEATURE::CONDCOLL
     585                 :          8 :         sal_uLong nCnt = 0, nSttNd = 0;
     586 [ +  + ][ +  - ]:         14 :         if( pIdx && &GetNodes() == &pIdx->GetNodes() &&
           [ +  -  +  - ]
                 [ +  + ]
     587                 :          6 :             0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
     588                 :            :         {
     589                 :          6 :             nSttNd = pSectNd->GetIndex();
     590                 :          6 :             nCnt = pSectNd->EndOfSectionIndex() - nSttNd - 1;
     591                 :            :         }
     592                 :            : //FEATURE::CONDCOLL
     593                 :            : 
     594 [ +  - ][ +  - ]:          8 :         delete pFmt;
     595                 :            : 
     596 [ +  + ][ -  + ]:          8 :         if( nSttNd && pFtnEndAtTxtEnd )
     597                 :            :         {
     598 [ #  # ][ #  # ]:          0 :             SwNodeIndex aUpdIdx( GetNodes(), nSttNd );
     599 [ #  # ][ #  # ]:          0 :             GetFtnIdxs().UpdateFtn( aUpdIdx );
     600                 :            :         }
     601                 :            : 
     602                 :            : //FEATURE::CONDCOLL
     603                 :            :         SwCntntNode* pCNd;
     604         [ +  + ]:         24 :         for( ; nCnt--; ++nSttNd )
     605 [ +  - ][ +  - ]:         24 :             if( 0 != (pCNd = GetNodes()[ nSttNd ]->GetCntntNode() ) &&
           [ +  +  -  + ]
                 [ -  + ]
     606                 :         10 :                 RES_CONDTXTFMTCOLL == pCNd->GetFmtColl()->Which() )
     607         [ #  # ]:          0 :                 pCNd->ChkCondColl();
     608                 :            : //FEATURE::CONDCOLL
     609                 :            :     }
     610                 :            : 
     611 [ +  - ][ +  - ]:         12 :     GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL);
     612                 :            : 
     613         [ +  - ]:         14 :     SetModified();
     614                 :            : }
     615                 :            : 
     616                 :        224 : void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData,
     617                 :            :         SfxItemSet const*const pAttr, bool const bPreventLinkUpdate)
     618                 :            : {
     619         [ +  - ]:        224 :     SwSectionFmt* pFmt = (*pSectionFmtTbl)[ nPos ];
     620         [ +  - ]:        224 :     SwSection* pSection = pFmt->GetSection();
     621                 :            : 
     622                 :            :     /// remember hidden condition flag of SwSection before changes
     623                 :        224 :     bool bOldCondHidden = pSection->IsCondHidden() ? true : false;
     624                 :            : 
     625 [ +  + ][ +  - ]:        224 :     if (pSection->DataEquals(rNewData))
     626                 :            :     {
     627                 :            :         // die Attribute ueberpruefen
     628                 :        174 :         sal_Bool bOnlyAttrChg = sal_False;
     629 [ +  + ][ +  + ]:        174 :         if( pAttr && pAttr->Count() )
                 [ +  + ]
     630                 :            :         {
     631         [ +  - ]:        162 :             SfxItemIter aIter( *pAttr );
     632                 :        162 :             sal_uInt16 nWhich = aIter.GetCurItem()->Which();
     633                 :          0 :             while( sal_True )
     634                 :            :             {
     635 [ +  - ][ +  - ]:        162 :                 if( pFmt->GetFmtAttr( nWhich ) != *aIter.GetCurItem() )
                 [ +  + ]
     636                 :            :                 {
     637                 :        160 :                     bOnlyAttrChg = sal_True;
     638                 :        160 :                     break;
     639                 :            :                 }
     640                 :            : 
     641         [ +  - ]:          2 :                 if( aIter.IsAtEnd() )
     642                 :          2 :                     break;
     643         [ #  # ]:          0 :                 nWhich = aIter.NextItem()->Which();
     644         [ +  - ]:        162 :             }
     645                 :            :         }
     646                 :            : 
     647         [ +  + ]:        174 :         if( bOnlyAttrChg )
     648                 :            :         {
     649 [ +  - ][ +  - ]:        160 :             if (GetIDocumentUndoRedo().DoesUndo())
                 [ +  + ]
     650                 :            :             {
     651         [ +  - ]:         84 :                 GetIDocumentUndoRedo().AppendUndo(
     652 [ +  - ][ +  - ]:         84 :                     MakeUndoUpdateSection( *pFmt, true ) );
     653                 :            :             }
     654                 :            :             // #i32968# Inserting columns in the section causes MakeFrmFmt
     655                 :            :             // to put two  objects of type SwUndoFrmFmt on the undo stack.
     656                 :            :             // We don't want them.
     657 [ +  - ][ +  - ]:        160 :             ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
     658         [ +  - ]:        160 :             pFmt->SetFmtAttr( *pAttr );
     659 [ +  - ][ +  - ]:        160 :             SetModified();
     660                 :            :         }
     661                 :        224 :         return;
     662                 :            :     }
     663                 :            : 
     664                 :            :     // Teste ob eine gesamte Content-Section (Dokument/TabellenBox/Fly)
     665                 :            :     // versteckt werden soll, koennen wir zur Zeit nicht !!!!
     666                 :         50 :     const SwNodeIndex* pIdx = 0;
     667                 :            :     {
     668         [ +  + ]:         50 :         if (rNewData.IsHidden())
     669                 :            :         {
     670         [ +  - ]:         18 :             pIdx = pFmt->GetCntnt().GetCntntIdx();
     671         [ +  - ]:         18 :             if (pIdx)
     672                 :            :             {
     673                 :            :                 const SwSectionNode* pSectNd =
     674                 :         18 :                     pIdx->GetNode().GetSectionNode();
     675         [ +  - ]:         18 :                 if (pSectNd)
     676                 :            :                 {
     677         [ +  - ]:         18 :                     ::lcl_CheckEmptyLayFrm( GetNodes(), rNewData,
     678         [ +  - ]:         36 :                                 *pSectNd, *pSectNd->EndOfSectionNode() );
     679                 :            :                 }
     680                 :            :             }
     681                 :            :         }
     682                 :            :     }
     683                 :            : 
     684 [ +  - ][ +  - ]:         50 :     if (GetIDocumentUndoRedo().DoesUndo())
                 [ +  - ]
     685                 :            :     {
     686 [ +  - ][ +  - ]:         50 :         GetIDocumentUndoRedo().AppendUndo(MakeUndoUpdateSection(*pFmt, false));
                 [ +  - ]
     687                 :            :     }
     688                 :            :     // #i32968# Inserting columns in the section causes MakeFrmFmt to put two
     689                 :            :     // objects of type SwUndoFrmFmt on the undo stack. We don't want them.
     690 [ +  - ][ +  - ]:         50 :     ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
     691                 :            : 
     692                 :            :     // Der LinkFileName koennte auch nur aus Separatoren bestehen
     693         [ +  - ]:         50 :     String sCompareString = rtl::OUString(sfx2::cTokenSeperator);
     694         [ +  - ]:         50 :     sCompareString += sfx2::cTokenSeperator;
     695                 :            :     const bool bUpdate =
     696                 :         66 :            (!pSection->IsLinkType() && rNewData.IsLinkType())
     697                 :         48 :         || (    rNewData.GetLinkFileName().Len()
     698         [ +  - ]:         48 :             &&  (rNewData.GetLinkFileName() != sCompareString)
     699 [ +  + ][ +  - ]:        162 :             &&  (rNewData.GetLinkFileName() != pSection->GetLinkFileName()));
         [ +  - ][ +  + ]
           [ +  +  +  +  
                   +  - ]
     700                 :            : 
     701         [ +  - ]:         50 :     String sSectName( rNewData.GetSectionName() );
     702 [ +  - ][ +  + ]:         50 :     if (sSectName != pSection->GetSectionName())
     703 [ +  - ][ +  - ]:         14 :         GetUniqueSectionName( &sSectName );
     704                 :            :     else
     705         [ +  - ]:         36 :         sSectName.Erase();
     706                 :            : 
     707                 :            :     /// In SwSection::operator=(..) class member bCondHiddenFlag is always set to sal_True.
     708                 :            :     /// IMHO this have to be changed, but I can't estimate the consequences:
     709                 :            :     /// Either it is set to sal_True using corresponding method <SwSection.SetCondHidden(..)>,
     710                 :            :     /// or it is set to the value of SwSection which is assigned to it.
     711                 :            :     /// Discussion with AMA results that the adjustment to the assignment operator
     712                 :            :     /// could be very risky.
     713         [ +  - ]:         50 :     pSection->SetSectionData(rNewData);
     714                 :            : 
     715         [ -  + ]:         50 :     if( pAttr )
     716         [ #  # ]:          0 :         pSection->GetFmt()->SetFmtAttr( *pAttr );
     717                 :            : 
     718         [ +  + ]:         50 :     if( sSectName.Len() )
     719                 :            :     {
     720         [ +  - ]:         14 :         pSection->SetSectionName( sSectName );
     721                 :            :     }
     722                 :            : 
     723                 :            :     // ist eine Condition gesetzt
     724 [ +  + ][ +  + ]:         50 :     if( pSection->IsHidden() && pSection->GetCondition().Len() )
                 [ +  + ]
     725                 :            :     {
     726                 :            :         // dann berechne bis zu dieser Position
     727         [ +  - ]:         12 :         SwCalc aCalc( *this );
     728         [ -  + ]:         12 :         if( !pIdx )
     729         [ #  # ]:          0 :             pIdx = pFmt->GetCntnt().GetCntntIdx();
     730         [ +  - ]:         12 :         FldsToCalc( aCalc, pIdx->GetIndex(), USHRT_MAX );
     731                 :            : 
     732                 :            :         /// Because on using SwSection::operator=() to set up <pSection>
     733                 :            :         /// with <rNewData> and the above given note, the hidden condition flag
     734                 :            :         /// has to be set to sal_False, if hidden condition flag of <pFmt->GetSection()>
     735                 :            :         /// (SwSection before the changes) is sal_False (already saved in <bOldCondHidden>)
     736                 :            :         /// and new calculated condition is sal_True.
     737                 :            :         /// This is necessary, because otherwise the <SetCondHidden> would have
     738                 :            :         /// no effect.
     739                 :            :         bool bCalculatedCondHidden =
     740 [ +  - ][ +  - ]:         12 :                 aCalc.Calculate( pSection->GetCondition() ).GetBool() ? true : false;
                 [ +  - ]
     741 [ -  + ][ #  # ]:         12 :         if ( bCalculatedCondHidden && !bOldCondHidden )
     742                 :            :         {
     743         [ #  # ]:          0 :             pSection->SetCondHidden( false );
     744                 :            :         }
     745 [ +  - ][ +  - ]:         12 :         pSection->SetCondHidden( bCalculatedCondHidden );
     746                 :            :     }
     747                 :            : 
     748         [ +  + ]:         50 :     if( bUpdate )
     749 [ -  + ][ +  - ]:         20 :         pSection->CreateLink( bPreventLinkUpdate ? CREATE_CONNECT : CREATE_UPDATE );
     750 [ +  + ][ -  + ]:         30 :     else if( !pSection->IsLinkType() && pSection->IsConnected() )
                 [ -  + ]
     751                 :            :     {
     752         [ #  # ]:          0 :         pSection->Disconnect();
     753 [ #  # ][ #  # ]:          0 :         GetLinkManager().Remove( &pSection->GetBaseLink() );
     754                 :            :     }
     755                 :            : 
     756 [ +  - ][ +  - ]:        224 :     SetModified();
         [ +  - ][ +  - ]
     757                 :            : }
     758                 :            : 
     759                 :            : /* --------------------------------------------------
     760                 :            :  * LockFrms wurde im InsertSection genutzt, um zu verhindern, dass
     761                 :            :  * SectionFrms durch das DelFrms zerstoert werden. Dies ist durch
     762                 :            :  * den Destroy-Listen-Mechanismus ueberfluessig geworden.
     763                 :            :  * Falls diese Methode doch noch einmal reanimiert wird, bietet es
     764                 :            :  * sich vielleicht an, beim Entlocken die SectionFrms auf Inhalt zu
     765                 :            :  * pruefen und dann ggf. zur Zerstoerung anzumelden.
     766                 :            :  * --------------------------------------------------*/
     767                 :            : 
     768                 :            : // und dann waren da noch die Fussnoten:
     769                 :        127 : void lcl_DeleteFtn( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd )
     770                 :            : {
     771                 :        127 :     SwFtnIdxs& rFtnArr = pNd->GetDoc()->GetFtnIdxs();
     772         [ +  + ]:        127 :     if( rFtnArr.size() )
     773                 :            :     {
     774                 :            :         sal_uInt16 nPos;
     775 [ +  - ][ +  - ]:          8 :         rFtnArr.SeekEntry( SwNodeIndex( *pNd ), &nPos );
                 [ +  - ]
     776                 :            :         SwTxtFtn* pSrch;
     777                 :            : 
     778                 :            :         // loesche erstmal alle, die dahinter stehen
     779   [ +  -  -  + ]:         16 :         while( nPos < rFtnArr.size() &&
                 [ -  + ]
     780         [ +  - ]:          8 :             _SwTxtFtn_GetIndex( (pSrch = rFtnArr[ nPos ]) ) <= nEnd )
     781                 :            :         {
     782                 :            :             // Werden die Nodes nicht geloescht mussen sie bei den Seiten
     783                 :            :             // abmeldet (Frms loeschen) werden, denn sonst bleiben sie
     784                 :            :             // stehen (Undo loescht sie nicht!)
     785         [ #  # ]:          0 :             pSrch->DelFrms(0);
     786                 :          0 :             ++nPos;
     787                 :            :         }
     788                 :            : 
     789   [ -  +  #  # ]:          8 :         while( nPos-- &&
                 [ -  + ]
     790         [ #  # ]:          0 :             _SwTxtFtn_GetIndex( (pSrch = rFtnArr[ nPos ]) ) >= nStt )
     791                 :            :         {
     792                 :            :             // Werden die Nodes nicht geloescht mussen sie bei den Seiten
     793                 :            :             // abmeldet (Frms loeschen) werden, denn sonst bleiben sie
     794                 :            :             // stehen (Undo loescht sie nicht!)
     795         [ #  # ]:          0 :             pSrch->DelFrms(0);
     796                 :            :         }
     797                 :            :     }
     798                 :        127 : }
     799                 :            : 
     800                 :         72 : static inline bool lcl_IsTOXSection(SwSectionData const& rSectionData)
     801                 :            : {
     802                 :         72 :     return (TOX_CONTENT_SECTION == rSectionData.GetType())
     803 [ -  + ][ +  + ]:         72 :         || (TOX_HEADER_SECTION  == rSectionData.GetType());
     804                 :            : }
     805                 :            : 
     806                 :        116 : SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx,
     807                 :            :                                 SwSectionFmt& rSectionFmt,
     808                 :            :                                 SwSectionData const& rSectionData,
     809                 :            :                                 SwTOXBase const*const pTOXBase,
     810                 :            :                                 SwNodeIndex const*const pEnde,
     811                 :            :                                 bool const bInsAtStart, bool const bCreateFrms)
     812                 :            : {
     813         [ +  - ]:        116 :     SwNodeIndex aInsPos( rNdIdx );
     814         [ +  + ]:        116 :     if( !pEnde )        // kein Bereich also neue Section davor/hinter anlegen
     815                 :            :     {
     816                 :            :         // #i26762#
     817                 :            :         OSL_ENSURE(!pEnde || rNdIdx <= *pEnde,
     818                 :            :                "Section start and end in wrong order!");
     819                 :            : 
     820         [ +  + ]:         72 :         if( bInsAtStart )
     821                 :            :         {
     822         [ +  + ]:         66 :             if (!lcl_IsTOXSection(rSectionData))
     823                 :            :             {
     824         [ +  + ]:         32 :                 do {
     825         [ +  - ]:         32 :                     aInsPos--;
     826                 :         32 :                 } while( aInsPos.GetNode().IsSectionNode() );
     827         [ +  - ]:         30 :                 aInsPos++;
     828                 :            :             }
     829                 :            :         }
     830                 :            :         else
     831                 :            :         {
     832                 :            :             SwNode* pNd;
     833         [ +  - ]:          6 :             aInsPos++;
     834         [ +  + ]:          6 :             if (!lcl_IsTOXSection(rSectionData))
     835                 :            :             {
     836         [ -  + ]:          4 :                 while( aInsPos.GetIndex() < Count() - 1 &&
           [ #  #  #  # ]
                 [ -  + ]
     837                 :          0 :                         ( pNd = &aInsPos.GetNode())->IsEndNode() &&
     838                 :          0 :                         pNd->StartOfSectionNode()->IsSectionNode())
     839                 :            :                 {
     840         [ #  # ]:          0 :                     aInsPos++;
     841                 :            :                 }
     842                 :            :             }
     843                 :            :         }
     844                 :            :     }
     845                 :            : 
     846                 :            :     SwSectionNode *const pSectNd =
     847 [ +  - ][ +  - ]:        116 :             new SwSectionNode(aInsPos, rSectionFmt, pTOXBase);
     848         [ +  + ]:        116 :     if( pEnde )
     849                 :            :     {
     850                 :            :         // Sonderfall fuer die Reader/Writer
     851         [ +  - ]:         44 :         if( &pEnde->GetNode() != &GetEndOfContent() )
     852         [ +  - ]:         44 :             aInsPos = pEnde->GetIndex()+1;
     853                 :            :         // #i58710: We created a RTF document with a section break inside a table cell
     854                 :            :         // We are not able to handle a section start inside a table and the section end outside.
     855                 :         44 :         const SwNode* pLastNode = pSectNd->StartOfSectionNode()->EndOfSectionNode();
     856         [ -  + ]:         44 :         if( aInsPos > pLastNode->GetIndex() )
     857         [ #  # ]:          0 :             aInsPos = pLastNode->GetIndex();
     858                 :            :         // Another way round: if the section starts outside a table but the end is inside...
     859                 :            :         // aInsPos is at the moment the Position where my EndNode will be inserted
     860                 :         44 :         const SwStartNode* pStartNode = aInsPos.GetNode().StartOfSectionNode();
     861                 :            :         // This StartNode should be in front of me, but if not, I wanna survive
     862                 :         44 :         sal_uLong nMyIndex = pSectNd->GetIndex();
     863         [ -  + ]:         44 :         if( pStartNode->GetIndex() > nMyIndex ) // Suspicious!
     864                 :            :         {
     865                 :            :             const SwNode* pTemp;
     866         [ #  # ]:          0 :             do
     867                 :            :             {
     868                 :          0 :                 pTemp = pStartNode; // pTemp is a suspicious one
     869                 :          0 :                 pStartNode = pStartNode->StartOfSectionNode();
     870                 :            :             }
     871                 :          0 :             while( pStartNode->GetIndex() > nMyIndex );
     872                 :          0 :             pTemp = pTemp->EndOfSectionNode();
     873                 :            :             // If it starts behind me but ends behind my end...
     874         [ #  # ]:          0 :             if( pTemp->GetIndex() >= aInsPos.GetIndex() )
     875         [ #  # ]:          0 :                 aInsPos = pTemp->GetIndex()+1; // ...I have to correct my end position
     876                 :            :         }
     877                 :            : 
     878                 :            :     }
     879                 :            :     else
     880                 :            :     {
     881                 :         72 :         SwTxtNode* pCpyTNd = rNdIdx.GetNode().GetTxtNode();
     882         [ +  - ]:         72 :         if( pCpyTNd )
     883                 :            :         {
     884 [ +  - ][ +  - ]:         72 :             SwTxtNode* pTNd = new SwTxtNode( aInsPos, pCpyTNd->GetTxtColl() );
     885 [ +  - ][ +  + ]:         72 :             if( pCpyTNd->HasSwAttrSet() )
     886                 :            :             {
     887                 :            :                 // Task 70955 - move PageDesc/Break to the first Node of the
     888                 :            :                 //              section
     889         [ +  - ]:         24 :                 const SfxItemSet& rSet = *pCpyTNd->GetpSwAttrSet();
     890 [ +  - ][ +  - ]:         48 :                 if( SFX_ITEM_SET == rSet.GetItemState( RES_BREAK ) ||
         [ -  + ][ -  + ]
     891         [ +  - ]:         24 :                     SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC ))
     892                 :            :                 {
     893         [ #  # ]:          0 :                     SfxItemSet aSet( rSet );
     894         [ #  # ]:          0 :                     if( bInsAtStart )
     895         [ #  # ]:          0 :                         pCpyTNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
     896                 :            :                     else
     897                 :            :                     {
     898         [ #  # ]:          0 :                         aSet.ClearItem( RES_PAGEDESC );
     899         [ #  # ]:          0 :                         aSet.ClearItem( RES_BREAK );
     900                 :            :                     }
     901 [ #  # ][ #  # ]:          0 :                     pTNd->SetAttr( aSet );
     902                 :            :                 }
     903                 :            :                 else
     904         [ +  - ]:         24 :                     pTNd->SetAttr( rSet );
     905                 :            :             }
     906                 :            :             // den Frame anlegen nicht vergessen !!
     907         [ +  - ]:         72 :             pCpyTNd->MakeFrms( *pTNd );
     908                 :            :         }
     909                 :            :         else
     910 [ #  # ][ #  # ]:          0 :             new SwTxtNode( aInsPos, (SwTxtFmtColl*)GetDoc()->GetDfltTxtFmtColl() );
     911                 :            :     }
     912 [ +  - ][ +  - ]:        116 :     new SwEndNode( aInsPos, *pSectNd );
     913                 :            : 
     914         [ +  - ]:        116 :     pSectNd->GetSection().SetSectionData(rSectionData);
     915                 :        116 :     SwSectionFmt* pSectFmt = pSectNd->GetSection().GetFmt();
     916                 :            : 
     917                 :            :     // Hier bietet sich als Optimierung an, vorhandene Frames nicht zu
     918                 :            :     // zerstoeren und wieder neu anzulegen, sondern nur umzuhaengen.
     919                 :        114 :     sal_Bool bInsFrm = bCreateFrms && !pSectNd->GetSection().IsHidden() &&
     920 [ +  - ][ +  + ]:        230 :                    GetDoc()->GetCurrentViewShell(); //swmod 071108//swmod 071225
           [ +  +  +  + ]
     921                 :        116 :     SwNode2Layout *pNode2Layout = NULL;
     922         [ +  + ]:        116 :     if( bInsFrm )
     923                 :            :     {
     924         [ +  - ]:         44 :         SwNodeIndex aTmp( *pSectNd );
     925 [ +  - ][ -  + ]:         44 :         if( !pSectNd->GetNodes().FindPrvNxtFrmNode( aTmp, pSectNd->EndOfSectionNode() ) )
     926                 :            :             // dann sammel mal alle Uppers ein
     927 [ #  # ][ #  # ]:         44 :             pNode2Layout = new SwNode2Layout( *pSectNd );
                 [ +  - ]
     928                 :            :     }
     929                 :            : 
     930                 :            :     // jetzt noch bei allen im Bereich den richtigen StartNode setzen
     931                 :        116 :     sal_uLong nEnde = pSectNd->EndOfSectionIndex();
     932                 :        116 :     sal_uLong nStart = pSectNd->GetIndex()+1;
     933                 :        116 :     sal_uLong nSkipIdx = ULONG_MAX;
     934         [ +  + ]:        238 :     for( sal_uLong n = nStart; n < nEnde; ++n )
     935                 :            :     {
     936         [ +  - ]:        122 :         SwNode* pNd = (*this)[n];
     937                 :            : 
     938                 :            :         //JP 30.04.99: Bug 65644 - alle in der NodeSection liegenden
     939                 :            :         //              Sections unter die neue haengen
     940         [ +  - ]:        122 :         if( ULONG_MAX == nSkipIdx )
     941                 :        122 :             pNd->pStartOfSection = pSectNd;
     942         [ #  # ]:          0 :         else if( n >= nSkipIdx )
     943                 :          0 :             nSkipIdx = ULONG_MAX;
     944                 :            : 
     945         [ -  + ]:        122 :         if( pNd->IsStartNode() )
     946                 :            :         {
     947                 :            :             // die Verschachtelung der Formate herstellen!
     948         [ #  # ]:          0 :             if( pNd->IsSectionNode() )
     949                 :            :             {
     950                 :          0 :                 ((SwSectionNode*)pNd)->GetSection().GetFmt()->
     951         [ #  # ]:          0 :                                     SetDerivedFrom( pSectFmt );
     952         [ #  # ]:          0 :                 ((SwSectionNode*)pNd)->DelFrms();
     953                 :          0 :                 n = pNd->EndOfSectionIndex();
     954                 :            :             }
     955                 :            :             else
     956                 :            :             {
     957         [ #  # ]:          0 :                 if( pNd->IsTableNode() )
     958         [ #  # ]:          0 :                     ((SwTableNode*)pNd)->DelFrms();
     959                 :            : 
     960         [ #  # ]:          0 :                 if( ULONG_MAX == nSkipIdx )
     961                 :          0 :                     nSkipIdx = pNd->EndOfSectionIndex();
     962                 :            :             }
     963                 :            :         }
     964         [ +  - ]:        122 :         else if( pNd->IsCntntNode() )
     965 [ +  - ][ +  - ]:        122 :             ((SwCntntNode*)pNd)->DelFrms();
     966                 :            :     }
     967                 :            : 
     968         [ +  - ]:        116 :     lcl_DeleteFtn( pSectNd, nStart, nEnde );
     969                 :            : 
     970         [ +  + ]:        116 :     if( bInsFrm )
     971                 :            :     {
     972         [ -  + ]:         44 :         if( pNode2Layout )
     973                 :            :         {
     974                 :          0 :             sal_uLong nIdx = pSectNd->GetIndex();
     975         [ #  # ]:          0 :             pNode2Layout->RestoreUpperFrms( pSectNd->GetNodes(), nIdx, nIdx + 1 );
     976 [ #  # ][ #  # ]:          0 :             delete pNode2Layout;
     977                 :            :         }
     978                 :            :         else
     979         [ +  - ]:         44 :             pSectNd->MakeFrms( &aInsPos );
     980                 :            :     }
     981                 :            : 
     982         [ +  - ]:        116 :     return pSectNd;
     983                 :            : }
     984                 :            : 
     985                 :      75847 : SwSectionNode* SwNode::FindSectionNode()
     986                 :            : {
     987         [ +  + ]:      75847 :     if( IsSectionNode() )
     988                 :         56 :         return GetSectionNode();
     989                 :      75791 :     SwStartNode* pTmp = pStartOfSection;
     990 [ +  + ][ +  + ]:     154074 :     while( !pTmp->IsSectionNode() && pTmp->GetIndex() )
                 [ +  + ]
     991                 :      78283 :         pTmp = pTmp->pStartOfSection;
     992                 :      75847 :     return pTmp->GetSectionNode();
     993                 :            : }
     994                 :            : 
     995                 :            : 
     996                 :            : //---------
     997                 :            : // SwSectionNode
     998                 :            : //---------
     999                 :            : 
    1000                 :            : // ugly hack to make m_pSection const
    1001                 :            : static SwSectionFmt &
    1002                 :        116 : lcl_initParent(SwSectionNode & rThis, SwSectionFmt & rFmt)
    1003                 :            : {
    1004                 :            :     SwSectionNode *const pParent =
    1005                 :        116 :         rThis.StartOfSectionNode()->FindSectionNode();
    1006         [ +  + ]:        116 :     if( pParent )
    1007                 :            :     {
    1008                 :            :         // das Format beim richtigen Parent anmelden.
    1009                 :         36 :         rFmt.SetDerivedFrom( pParent->GetSection().GetFmt() );
    1010                 :            :     }
    1011                 :        116 :     return rFmt;
    1012                 :            : }
    1013                 :            : 
    1014                 :        116 : SwSectionNode::SwSectionNode(SwNodeIndex const& rIdx,
    1015                 :            :         SwSectionFmt & rFmt, SwTOXBase const*const pTOXBase)
    1016                 :            :     : SwStartNode( rIdx, ND_SECTIONNODE )
    1017                 :            :     , m_pSection( (pTOXBase)
    1018         [ +  - ]:         38 :         ? new SwTOXBaseSection(*pTOXBase, lcl_initParent(*this, rFmt))
    1019                 :         78 :         : new SwSection( CONTENT_SECTION, rFmt.GetName(),
    1020 [ +  + ][ +  - ]:        154 :                 lcl_initParent(*this, rFmt) ) )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    1021                 :            : {
    1022                 :            :     // jetzt noch die Verbindung von Format zum Node setzen
    1023                 :            :     // Modify unterdruecken, interresiert keinen
    1024                 :        116 :     rFmt.LockModify();
    1025 [ +  - ][ +  - ]:        116 :     rFmt.SetFmtAttr( SwFmtCntnt( this ) );
                 [ +  - ]
    1026                 :        116 :     rFmt.UnlockModify();
    1027                 :        116 : }
    1028                 :            : 
    1029                 :            : #ifdef DBG_UTIL
    1030                 :            : //remove superfluous SectionFrms
    1031                 :            : SwFrm* SwClearDummies( SwFrm* pFrm )
    1032                 :            : {
    1033                 :            :     SwFrm* pTmp = pFrm;
    1034                 :            :     while( pTmp )
    1035                 :            :     {
    1036                 :            :         OSL_ENSURE( !pTmp->GetUpper(), "SwClearDummies: No Upper allowed!" );
    1037                 :            :         if( pTmp->IsSctFrm() )
    1038                 :            :         {
    1039                 :            :             SwSectionFrm* pSectFrm = (SwSectionFrm*)pFrm;
    1040                 :            :             pTmp = pTmp->GetNext();
    1041                 :            :             if( !pSectFrm->GetLower() )
    1042                 :            :             {
    1043                 :            :                 if( pSectFrm->GetPrev() )
    1044                 :            :                     pSectFrm->GetPrev()->pNext = pTmp;
    1045                 :            :                 else
    1046                 :            :                     pFrm = pTmp;
    1047                 :            :                 if( pTmp )
    1048                 :            :                     pTmp->pPrev = pSectFrm->GetPrev();
    1049                 :            :                 delete pSectFrm;
    1050                 :            :             }
    1051                 :            :         }
    1052                 :            :         else
    1053                 :            :             pTmp = pTmp->GetNext();
    1054                 :            :     }
    1055                 :            :     return pFrm;
    1056                 :            : }
    1057                 :            : #endif
    1058                 :            : 
    1059         [ +  - ]:        116 : SwSectionNode::~SwSectionNode()
    1060                 :            : {
    1061                 :            :     // mba: test if iteration works as clients will be removed in callback
    1062                 :            :     // use hint which allows to specify, if the content shall be saved or not
    1063 [ +  - ][ +  - ]:        116 :     m_pSection->GetFmt()->CallSwClientNotify( SwSectionFrmMoveAndDeleteHint( sal_True ) );
                 [ +  - ]
    1064                 :        116 :     SwSectionFmt* pFmt = m_pSection->GetFmt();
    1065         [ +  - ]:        116 :     if( pFmt )
    1066                 :            :     {
    1067                 :            :         // das Attribut entfernen, weil die Section ihr Format loescht
    1068                 :            :         // und falls das Cntnt-Attribut vorhanden ist, die Section aufhebt.
    1069                 :        116 :         pFmt->LockModify();
    1070         [ +  - ]:        116 :         pFmt->ResetFmtAttr( RES_CNTNT );
    1071                 :        116 :         pFmt->UnlockModify();
    1072                 :            :     }
    1073         [ -  + ]:        232 : }
    1074                 :            : 
    1075                 :            : 
    1076                 :        156 : SwFrm *SwSectionNode::MakeFrm( SwFrm *pSib )
    1077                 :            : {
    1078                 :        156 :     m_pSection->m_Data.SetHiddenFlag(false);
    1079         [ +  - ]:        156 :     return new SwSectionFrm( *m_pSection, pSib );
    1080                 :            : }
    1081                 :            : 
    1082                 :            : //Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
    1083                 :            : //Dokument. Die erzeugten Contentframes werden in das entsprechende
    1084                 :            : //Layout gehaengt.
    1085                 :          4 : void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx )
    1086                 :            : {
    1087                 :            :     // also nehme meinen nachfolgenden oder vorhergehenden ContentFrame:
    1088                 :          4 :     SwNodes& rNds = GetNodes();
    1089 [ +  - ][ +  - ]:          4 :     if( rNds.IsDocNodes() && rNds.GetDoc()->GetCurrentViewShell() ) //swmod 071108//swmod 071225
                 [ +  - ]
    1090                 :            :     {
    1091 [ +  - ][ -  + ]:          4 :         if( GetSection().IsHidden() || IsCntntHidden() )
                 [ -  + ]
    1092                 :            :         {
    1093         [ #  # ]:          0 :             SwNodeIndex aIdx( *EndOfSectionNode() );
    1094         [ #  # ]:          0 :             SwCntntNode* pCNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
    1095         [ #  # ]:          0 :             if( !pCNd )
    1096                 :            :             {
    1097         [ #  # ]:          0 :                 aIdx = *this;
    1098 [ #  # ][ #  # ]:          0 :                 if( 0 == ( pCNd = rNds.GoPrevSection( &aIdx, sal_True, sal_False )) )
    1099                 :          4 :                     return ;
    1100                 :            :             }
    1101                 :          0 :             pCNd = aIdx.GetNode().GetCntntNode();
    1102 [ #  # ][ #  # ]:          0 :             pCNd->MakeFrms( (SwCntntNode&)rIdx.GetNode() );
         [ #  # ][ #  # ]
    1103                 :            :         }
    1104                 :            :         else
    1105                 :            :         {
    1106         [ +  - ]:          4 :             SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() );
    1107                 :            :             SwFrm *pFrm, *pNew;
    1108 [ +  - ][ +  + ]:          8 :             while( 0 != (pFrm = aNode2Layout.NextFrm()) )
    1109                 :            :             {
    1110                 :            :                 OSL_ENSURE( pFrm->IsSctFrm(), "Depend von Section keine Section." );
    1111         [ +  - ]:          4 :                 pNew = rIdx.GetNode().GetCntntNode()->MakeFrm( pFrm );
    1112                 :            : 
    1113         [ +  - ]:          4 :                 SwSectionNode* pS = rIdx.GetNode().FindSectionNode();
    1114                 :            : 
    1115                 :            :                 // Assure that node is not inside a table, which is inside the
    1116                 :            :                 // found section.
    1117         [ -  + ]:          4 :                 if ( pS )
    1118                 :            :                 {
    1119         [ #  # ]:          0 :                     SwTableNode* pTableNode = rIdx.GetNode().FindTableNode();
    1120   [ #  #  #  # ]:          0 :                     if ( pTableNode &&
                 [ #  # ]
    1121                 :          0 :                          pTableNode->GetIndex() > pS->GetIndex() )
    1122                 :            :                     {
    1123                 :          0 :                         pS = 0;
    1124                 :            :                     }
    1125                 :            :                 }
    1126                 :            : 
    1127                 :            :                 // if the node is in a section, the sectionframe now
    1128                 :            :                 // has to be created..
    1129                 :            :                 // boolean to control <Init()> of a new section frame.
    1130                 :          4 :                 bool bInitNewSect = false;
    1131         [ -  + ]:          4 :                 if( pS )
    1132                 :            :                 {
    1133 [ #  # ][ #  # ]:          0 :                     SwSectionFrm *pSct = new SwSectionFrm( pS->GetSection(), pFrm );
    1134                 :            :                     // prepare <Init()> of new section frame.
    1135                 :          0 :                     bInitNewSect = true;
    1136                 :          0 :                     SwLayoutFrm* pUp = pSct;
    1137         [ #  # ]:          0 :                     while( pUp->Lower() )  // for columned sections
    1138                 :            :                     {
    1139                 :            :                         OSL_ENSURE( pUp->Lower()->IsLayoutFrm(),"Who's in there?" );
    1140                 :          0 :                         pUp = (SwLayoutFrm*)pUp->Lower();
    1141                 :            :                     }
    1142         [ #  # ]:          0 :                     pNew->Paste( pUp, NULL );
    1143                 :            :                     // #i27138#
    1144                 :            :                     // notify accessibility paragraphs objects about changed
    1145                 :            :                     // CONTENT_FLOWS_FROM/_TO relation.
    1146                 :            :                     // Relation CONTENT_FLOWS_FROM for next paragraph will change
    1147                 :            :                     // and relation CONTENT_FLOWS_TO for previous paragraph will change.
    1148         [ #  # ]:          0 :                     if ( pNew->IsTxtFrm() )
    1149                 :            :                     {
    1150                 :          0 :                         ViewShell* pViewShell( pNew->getRootFrm()->GetCurrShell() );
    1151         [ #  # ]:          0 :                         if ( pViewShell && pViewShell->GetLayout() &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    1152         [ #  # ]:          0 :                              pViewShell->GetLayout()->IsAnyShellAccessible() )
    1153                 :            :                         {
    1154                 :            :                             pViewShell->InvalidateAccessibleParaFlowRelation(
    1155         [ #  # ]:          0 :                                 dynamic_cast<SwTxtFrm*>(pNew->FindNextCnt( true )),
    1156 [ #  # ][ #  # ]:          0 :                                 dynamic_cast<SwTxtFrm*>(pNew->FindPrevCnt( true )) );
         [ #  # ][ #  # ]
    1157                 :            :                         }
    1158                 :            :                     }
    1159                 :          0 :                     pNew = pSct;
    1160                 :            :                 }
    1161                 :            : 
    1162                 :            :                 // wird ein Node vorher oder nachher mit Frames versehen
    1163         [ +  - ]:          4 :                 if ( rIdx < GetIndex() )
    1164                 :            :                     // der neue liegt vor mir
    1165         [ +  - ]:          4 :                     pNew->Paste( pFrm->GetUpper(), pFrm );
    1166                 :            :                 else
    1167                 :            :                     // der neue liegt hinter mir
    1168         [ #  # ]:          0 :                     pNew->Paste( pFrm->GetUpper(), pFrm->GetNext() );
    1169                 :            :                 // #i27138#
    1170                 :            :                 // notify accessibility paragraphs objects about changed
    1171                 :            :                 // CONTENT_FLOWS_FROM/_TO relation.
    1172                 :            :                 // Relation CONTENT_FLOWS_FROM for next paragraph will change
    1173                 :            :                 // and relation CONTENT_FLOWS_TO for previous paragraph will change.
    1174         [ +  - ]:          4 :                 if ( pNew->IsTxtFrm() )
    1175                 :            :                 {
    1176                 :          4 :                     ViewShell* pViewShell( pNew->getRootFrm()->GetCurrShell() );
    1177         [ +  - ]:          8 :                     if ( pViewShell && pViewShell->GetLayout() &&
           [ +  -  -  + ]
         [ -  + ][ +  - ]
    1178         [ +  - ]:          4 :                          pViewShell->GetLayout()->IsAnyShellAccessible() )
    1179                 :            :                     {
    1180                 :            :                         pViewShell->InvalidateAccessibleParaFlowRelation(
    1181         [ #  # ]:          0 :                             dynamic_cast<SwTxtFrm*>(pNew->FindNextCnt( true )),
    1182 [ #  # ][ #  # ]:          0 :                             dynamic_cast<SwTxtFrm*>(pNew->FindPrevCnt( true )) );
         [ #  # ][ #  # ]
    1183                 :            :                     }
    1184                 :            :                 }
    1185         [ -  + ]:          4 :                 if ( bInitNewSect )
    1186         [ #  # ]:          0 :                     static_cast<SwSectionFrm*>(pNew)->Init();
    1187         [ +  - ]:          4 :             }
    1188                 :            :         }
    1189                 :            :     }
    1190                 :            : }
    1191                 :            : 
    1192                 :            : //Fuer jedes vorkommen im Layout einen SectionFrm anlegen und vor den
    1193                 :            : //entsprechenden CntntFrm pasten.
    1194                 :            : 
    1195                 :         51 : void SwSectionNode::MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEndIdx )
    1196                 :            : {
    1197                 :            :     OSL_ENSURE( pIdxBehind, "kein Index" );
    1198                 :         51 :     SwNodes& rNds = GetNodes();
    1199                 :         51 :     SwDoc* pDoc = rNds.GetDoc();
    1200                 :            : 
    1201                 :         51 :     *pIdxBehind = *this;
    1202                 :            : 
    1203                 :         51 :     m_pSection->m_Data.SetHiddenFlag(true);
    1204                 :            : 
    1205         [ +  + ]:         51 :     if( rNds.IsDocNodes() )
    1206                 :            :     {
    1207                 :            :         SwNodeIndex *pEnd = pEndIdx ? pEndIdx :
    1208 [ +  - ][ +  - ]:         49 :                             new SwNodeIndex( *EndOfSectionNode(), 1 );
    1209                 :         49 :         ::MakeFrms( pDoc, *pIdxBehind, *pEnd );
    1210         [ +  - ]:         49 :         if( !pEndIdx )
    1211         [ +  - ]:         49 :             delete pEnd;
    1212                 :            :     }
    1213                 :            : 
    1214                 :         51 : }
    1215                 :            : 
    1216                 :          4 : void SwSectionNode::DelFrms()
    1217                 :            : {
    1218                 :          4 :     sal_uLong nStt = GetIndex()+1, nEnd = EndOfSectionIndex();
    1219         [ -  + ]:          4 :     if( nStt >= nEnd )
    1220                 :            :     {
    1221                 :          4 :         return ;
    1222                 :            :     }
    1223                 :            : 
    1224                 :          4 :     SwNodes& rNds = GetNodes();
    1225                 :          4 :     m_pSection->GetFmt()->DelFrms();
    1226                 :            : 
    1227                 :            :     // unser Flag muessen wir noch aktualisieren
    1228                 :          4 :     m_pSection->m_Data.SetHiddenFlag(true);
    1229                 :            : 
    1230                 :            :     // Bug 30582: falls der Bereich in Fly oder TabellenBox ist, dann
    1231                 :            :     //              kann er nur "gehiddet" werden, wenn weiterer Content
    1232                 :            :     //              vorhanden ist, der "Frames" haelt. Sonst hat der
    1233                 :            :     //              Fly/TblBox-Frame keinen Lower !!!
    1234                 :            :     {
    1235         [ +  - ]:          4 :         SwNodeIndex aIdx( *this );
    1236 [ +  - ][ -  + ]:          8 :         if( !rNds.GoPrevSection( &aIdx, sal_True, sal_False ) ||
         [ #  # ][ #  # ]
                 [ +  - ]
    1237 [ #  # ][ #  # ]:          4 :             !CheckNodesRange( *this, aIdx, sal_True ) ||
         [ -  + ][ #  # ]
                 [ #  # ]
    1238                 :            :             // #i21457#
    1239         [ #  # ]:          0 :             !lcl_IsInSameTblBox( rNds, *this, true ))
    1240                 :            :         {
    1241         [ +  - ]:          4 :             aIdx = *EndOfSectionNode();
    1242 [ +  - ][ +  - ]:         16 :             if( !rNds.GoNextSection( &aIdx, sal_True, sal_False ) ||
         [ +  - ][ -  + ]
                 [ -  + ]
    1243 [ +  - ][ +  - ]:          8 :                 !CheckNodesRange( *EndOfSectionNode(), aIdx, sal_True ) ||
         [ +  - ][ +  - ]
                 [ #  # ]
    1244                 :            :                 // #i21457#
    1245         [ +  - ]:          4 :                 !lcl_IsInSameTblBox( rNds, *EndOfSectionNode(), false ))
    1246                 :            :             {
    1247                 :          0 :                 m_pSection->m_Data.SetHiddenFlag(false);
    1248                 :            :             }
    1249         [ +  - ]:          4 :         }
    1250                 :            :     }
    1251                 :            : }
    1252                 :            : 
    1253                 :          0 : SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
    1254                 :            : {
    1255                 :            :     // in welchen Array steht ich denn: Nodes, UndoNodes ??
    1256                 :          0 :     const SwNodes& rNds = GetNodes();
    1257                 :            : 
    1258                 :            :     // das SectionFrmFmt kopieren
    1259         [ #  # ]:          0 :     SwSectionFmt* pSectFmt = pDoc->MakeSectionFmt( 0 );
    1260         [ #  # ]:          0 :     pSectFmt->CopyAttrs( *GetSection().GetFmt() );
    1261                 :            : 
    1262                 :            :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
    1263                 :          0 :     ::std::auto_ptr<SwTOXBase> pTOXBase;
    1264                 :            :     SAL_WNODEPRECATED_DECLARATIONS_POP
    1265         [ #  # ]:          0 :     if (TOX_CONTENT_SECTION == GetSection().GetType())
    1266                 :            :     {
    1267                 :            :         OSL_ENSURE( GetSection().ISA( SwTOXBaseSection ), "no TOXBaseSection!" );
    1268                 :            :         SwTOXBaseSection const& rTBS(
    1269         [ #  # ]:          0 :             dynamic_cast<SwTOXBaseSection const&>(GetSection()));
    1270 [ #  # ][ #  # ]:          0 :         pTOXBase.reset( new SwTOXBase(rTBS, pDoc) );
    1271                 :            :     }
    1272                 :            : 
    1273                 :            :     SwSectionNode *const pSectNd =
    1274 [ #  # ][ #  # ]:          0 :         new SwSectionNode(rIdx, *pSectFmt, pTOXBase.get());
    1275 [ #  # ][ #  # ]:          0 :     SwEndNode* pEndNd = new SwEndNode( rIdx, *pSectNd );
    1276         [ #  # ]:          0 :     SwNodeIndex aInsPos( *pEndNd );
    1277                 :            : 
    1278                 :            :     // Werte uebertragen
    1279                 :          0 :     SwSection *const pNewSect = pSectNd->m_pSection.get();
    1280                 :            : 
    1281         [ #  # ]:          0 :     if (TOX_CONTENT_SECTION != GetSection().GetType())
    1282                 :            :     {
    1283                 :            :         // beim Move den Namen beibehalten
    1284 [ #  # ][ #  # ]:          0 :         if( rNds.GetDoc() == pDoc && pDoc->IsCopyIsMove() )
                 [ #  # ]
    1285                 :            :         {
    1286         [ #  # ]:          0 :             pNewSect->SetSectionName( GetSection().GetSectionName() );
    1287                 :            :         }
    1288                 :            :         else
    1289                 :            :         {
    1290                 :            :             pNewSect->SetSectionName(
    1291 [ #  # ][ #  # ]:          0 :                 pDoc->GetUniqueSectionName( &GetSection().GetSectionName() ));
                 [ #  # ]
    1292                 :            :         }
    1293                 :            :     }
    1294                 :            : 
    1295                 :            : 
    1296                 :          0 :     pNewSect->SetType( GetSection().GetType() );
    1297         [ #  # ]:          0 :     pNewSect->SetCondition( GetSection().GetCondition() );
    1298 [ #  # ][ #  # ]:          0 :     pNewSect->SetLinkFileName( GetSection().GetLinkFileName() );
    1299 [ #  # ][ #  # ]:          0 :     if( !pNewSect->IsHiddenFlag() && GetSection().IsHidden() )
                 [ #  # ]
    1300         [ #  # ]:          0 :         pNewSect->SetHidden( sal_True );
    1301 [ #  # ][ #  # ]:          0 :     if( !pNewSect->IsProtectFlag() && GetSection().IsProtect() )
         [ #  # ][ #  # ]
    1302         [ #  # ]:          0 :         pNewSect->SetProtect( sal_True );
    1303                 :            :     // edit in readonly sections
    1304 [ #  # ][ #  # ]:          0 :     if( !pNewSect->IsEditInReadonlyFlag() && GetSection().IsEditInReadonly() )
         [ #  # ][ #  # ]
    1305         [ #  # ]:          0 :         pNewSect->SetEditInReadonly( sal_True );
    1306                 :            : 
    1307         [ #  # ]:          0 :     SwNodeRange aRg( *this, +1, *EndOfSectionNode() );  // (wo stehe in denn nun ??)
    1308         [ #  # ]:          0 :     rNds._Copy( aRg, aInsPos, sal_False );
    1309                 :            : 
    1310                 :            :     // loesche alle Frames vom kopierten Bereich, diese werden beim
    1311                 :            :     // erzeugen des SectionFrames angelegt !
    1312         [ #  # ]:          0 :     pSectNd->DelFrms();
    1313                 :            : 
    1314                 :            :     // dann kopiere auch noch die Links/Server
    1315         [ #  # ]:          0 :     if( pNewSect->IsLinkType() )        // den Link eintragen
    1316         [ #  # ]:          0 :         pNewSect->CreateLink( pDoc->GetCurrentViewShell() ? CREATE_CONNECT  //swmod 071108//swmod 071225
    1317 [ #  # ][ #  # ]:          0 :                                                  : CREATE_NONE );
    1318                 :            : 
    1319                 :            :     // falls als Server aus dem Undo kopiert wird, wieder eintragen
    1320 [ #  # ][ #  # ]:          0 :     if (m_pSection->IsServer()
                 [ #  # ]
    1321 [ #  # ][ #  # ]:          0 :         && pDoc->GetIDocumentUndoRedo().IsUndoNodes(rNds))
    1322                 :            :     {
    1323         [ #  # ]:          0 :         pNewSect->SetRefObject( m_pSection->GetObject() );
    1324 [ #  # ][ #  # ]:          0 :         pDoc->GetLinkManager().InsertServer( pNewSect->GetObject() );
    1325                 :            :     }
    1326                 :            : 
    1327                 :            :     // METADATA: copy xml:id; must be done after insertion of node
    1328         [ #  # ]:          0 :     pSectFmt->RegisterAsCopyOf(*GetSection().GetFmt());
    1329                 :            : 
    1330 [ #  # ][ #  # ]:          0 :     return pSectNd;
                 [ #  # ]
    1331                 :            : }
    1332                 :            : 
    1333                 :          8 : sal_Bool SwSectionNode::IsCntntHidden() const
    1334                 :            : {
    1335                 :            :     OSL_ENSURE( !m_pSection->IsHidden(),
    1336                 :            :             "That's simple: Hidden Section => Hidden Content" );
    1337         [ +  - ]:          8 :     SwNodeIndex aTmp( *this, 1 );
    1338                 :          8 :     sal_uLong nEnd = EndOfSectionIndex();
    1339         [ +  - ]:          8 :     while( aTmp < nEnd )
    1340                 :            :     {
    1341         [ -  + ]:          8 :         if( aTmp.GetNode().IsSectionNode() )
    1342                 :            :         {
    1343                 :          0 :             const SwSection& rSect = ((SwSectionNode&)aTmp.GetNode()).GetSection();
    1344         [ #  # ]:          0 :             if( rSect.IsHiddenFlag() )
    1345                 :            :                 // dann diese Section ueberspringen
    1346         [ #  # ]:          0 :                 aTmp = *aTmp.GetNode().EndOfSectionNode();
    1347                 :            :         }
    1348                 :            :         else
    1349                 :            :         {
    1350 [ -  + ][ #  # ]:          8 :             if( aTmp.GetNode().IsCntntNode() || aTmp.GetNode().IsTableNode() )
                 [ +  - ]
    1351                 :          8 :                 return sal_False; // Nicht versteckter Inhalt wurde gefunden
    1352                 :            :             OSL_ENSURE( aTmp.GetNode().IsEndNode(), "EndNode expected" );
    1353                 :            :         }
    1354         [ #  # ]:          0 :         aTmp++;
    1355                 :            :     }
    1356         [ +  - ]:          8 :     return sal_True; // Alles versteckt
    1357                 :            : }
    1358                 :            : 
    1359                 :            : 
    1360                 :          4 : void SwSectionNode::NodesArrChgd()
    1361                 :            : {
    1362                 :          4 :     SwSectionFmt *const pFmt = m_pSection->GetFmt();
    1363         [ +  - ]:          4 :     if( pFmt )
    1364                 :            :     {
    1365                 :          4 :         SwNodes& rNds = GetNodes();
    1366                 :          4 :         SwDoc* pDoc = pFmt->GetDoc();
    1367                 :            : 
    1368         [ +  - ]:          4 :         if( !rNds.IsDocNodes() )
    1369                 :            :         {
    1370         [ +  - ]:          4 :             SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFmt );
    1371 [ +  - ][ +  - ]:          4 :             pFmt->ModifyNotification( &aMsgHint, &aMsgHint );
    1372                 :            :         }
    1373                 :            : 
    1374                 :          4 :         pFmt->LockModify();
    1375         [ +  - ]:          4 :         pFmt->SetFmtAttr( SwFmtCntnt( this ));
    1376                 :          4 :         pFmt->UnlockModify();
    1377                 :            : 
    1378                 :          4 :         SwSectionNode* pSectNd = StartOfSectionNode()->FindSectionNode();
    1379                 :            :         // set the correct parent from the new section
    1380                 :          2 :         pFmt->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFmt()
    1381         [ +  + ]:          6 :                                       : pDoc->GetDfltFrmFmt() );
    1382                 :            : 
    1383                 :            :         // jetzt noch bei allen im Bereich den richtigen StartNode setzen
    1384                 :          4 :         sal_uLong nStart = GetIndex()+1, nEnde = EndOfSectionIndex();
    1385         [ -  + ]:          4 :         for( sal_uLong n = nStart; n < nEnde; ++n )
    1386                 :            :             // die Verschachtelung der Formate herstellen!
    1387         [ #  # ]:          0 :             if( 0 != ( pSectNd = rNds[ n ]->GetSectionNode() ) )
    1388                 :            :             {
    1389                 :          0 :                 pSectNd->GetSection().GetFmt()->SetDerivedFrom( pFmt );
    1390                 :          0 :                 n = pSectNd->EndOfSectionIndex();
    1391                 :            :             }
    1392                 :            : 
    1393                 :            :         // verschieben vom Nodes- ins UndoNodes-Array?
    1394         [ -  + ]:          4 :         if( rNds.IsDocNodes() )
    1395                 :            :         {
    1396                 :            :             OSL_ENSURE( pDoc == GetDoc(),
    1397                 :            :                     "verschieben in unterschiedliche Documente?" );
    1398         [ #  # ]:          0 :             if( m_pSection->IsLinkType() )      // den Link austragen
    1399                 :          0 :                 m_pSection->CreateLink( pDoc->GetCurrentViewShell() ? CREATE_CONNECT    //swmod 071108
    1400         [ #  # ]:          0 :                                                          : CREATE_NONE );//swmod 071225
    1401         [ #  # ]:          0 :             if (m_pSection->IsServer())
    1402                 :            :             {
    1403                 :          0 :                 pDoc->GetLinkManager().InsertServer( m_pSection->GetObject() );
    1404                 :            :             }
    1405                 :            :         }
    1406                 :            :         else
    1407                 :            :         {
    1408         [ +  - ]:          4 :             if (CONTENT_SECTION != m_pSection->GetType())
    1409                 :            :             {
    1410                 :          4 :                 pDoc->GetLinkManager().Remove( &m_pSection->GetBaseLink() );
    1411                 :            :             }
    1412                 :            : 
    1413         [ -  + ]:          4 :             if (m_pSection->IsServer())
    1414                 :            :             {
    1415                 :          0 :                 pDoc->GetLinkManager().RemoveServer( m_pSection->GetObject() );
    1416                 :            :             }
    1417                 :            :         }
    1418                 :            :     }
    1419                 :          4 : }
    1420                 :            : 
    1421                 :            : 
    1422                 :         90 : String SwDoc::GetUniqueSectionName( const String* pChkStr ) const
    1423                 :            : {
    1424                 :         90 :     ResId aId( STR_REGION_DEFNAME, *pSwResMgr );
    1425         [ +  - ]:         90 :     String aName( aId );
    1426                 :         90 :     xub_StrLen nNmLen = aName.Len();
    1427                 :            : 
    1428                 :         90 :     sal_uInt16 nNum = 0;
    1429                 :         90 :     sal_uInt16 nTmp, nFlagSize = ( pSectionFmtTbl->size() / 8 ) +2;
    1430         [ +  - ]:         90 :     sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
    1431                 :         90 :     memset( pSetFlags, 0, nFlagSize );
    1432                 :            : 
    1433                 :            :     const SwSectionNode* pSectNd;
    1434                 :            :     sal_uInt16 n;
    1435                 :            : 
    1436         [ +  + ]:        390 :     for( n = 0; n < pSectionFmtTbl->size(); ++n )
    1437 [ +  - ][ +  - ]:        300 :         if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( sal_False ) ))
                 [ +  - ]
    1438                 :            :         {
    1439                 :        300 :             const String& rNm = pSectNd->GetSection().GetSectionName();
    1440 [ +  + ][ +  - ]:        300 :             if( rNm.Match( aName ) == nNmLen )
    1441                 :            :             {
    1442                 :            :                 // Nummer bestimmen und das Flag setzen
    1443 [ +  - ][ +  - ]:         76 :                 nNum = static_cast<sal_uInt16>(rNm.Copy( nNmLen ).ToInt32());
                 [ +  - ]
    1444 [ +  - ][ +  - ]:         76 :                 if( nNum-- && nNum < pSectionFmtTbl->size() )
                 [ +  - ]
    1445                 :         76 :                     pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
    1446                 :            :             }
    1447 [ +  - ][ +  - ]:        300 :             if( pChkStr && pChkStr->Equals( rNm ) )
         [ +  + ][ +  + ]
    1448                 :         12 :                 pChkStr = 0;
    1449                 :            :         }
    1450                 :            : 
    1451         [ +  + ]:         90 :     if( !pChkStr )
    1452                 :            :     {
    1453                 :            :         // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
    1454                 :         12 :         nNum = pSectionFmtTbl->size();
    1455         [ +  - ]:         24 :         for( n = 0; n < nFlagSize; ++n )
    1456         [ +  - ]:         12 :             if( 0xff != ( nTmp = pSetFlags[ n ] ))
    1457                 :            :             {
    1458                 :            :                 // also die Nummer bestimmen
    1459                 :         12 :                 nNum = n * 8;
    1460         [ -  + ]:         12 :                 while( nTmp & 1 )
    1461                 :          0 :                     ++nNum, nTmp >>= 1;
    1462                 :         12 :                 break;
    1463                 :            :             }
    1464                 :            : 
    1465                 :            :     }
    1466         [ +  - ]:         90 :     delete [] pSetFlags;
    1467         [ +  + ]:         90 :     if( pChkStr )
    1468         [ +  - ]:         78 :         return *pChkStr;
    1469 [ +  - ][ +  - ]:         90 :     return aName += String::CreateFromInt32( ++nNum );
         [ +  - ][ +  - ]
                 [ +  - ]
    1470                 :            : }
    1471                 :            : 
    1472                 :            : 
    1473                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10