LCOV - code coverage report
Current view: top level - sw/source/core/doc - docftn.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 233 271 86.0 %
Date: 2014-04-11 Functions: 21 21 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <ftnidx.hxx>
      21             : #include <rootfrm.hxx>
      22             : #include <txtftn.hxx>
      23             : #include <fmtftn.hxx>
      24             : #include <pam.hxx>
      25             : #include <pagedesc.hxx>
      26             : #include <charfmt.hxx>
      27             : #include <UndoAttribute.hxx>
      28             : #include <hints.hxx>
      29             : #include <rolbck.hxx>
      30             : #include <doc.hxx>
      31             : #include <IDocumentUndoRedo.hxx>
      32             : #include <ndtxt.hxx>
      33             : #include <poolfmt.hxx>
      34             : #include <ftninfo.hxx>
      35             : 
      36             : /*********************** SwEndNoteInfo ***************************/
      37             : 
      38          52 : SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
      39             : {
      40          52 :     if( rInfo.GetFtnTxtColl() )
      41          14 :         rInfo.GetFtnTxtColl()->Add(this);
      42          38 :     else if ( GetRegisteredIn())
      43           0 :         GetRegisteredInNonConst()->Remove(this);
      44             : 
      45          52 :     if ( rInfo.aPageDescDep.GetRegisteredIn() )
      46          30 :         ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
      47          22 :     else if ( aPageDescDep.GetRegisteredIn() )
      48           0 :         ((SwModify*)aPageDescDep.GetRegisteredIn())->Remove( &aPageDescDep );
      49             : 
      50          52 :     if ( rInfo.aCharFmtDep.GetRegisteredIn() )
      51          51 :         ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
      52           1 :     else if ( aCharFmtDep.GetRegisteredIn() )
      53           0 :         ((SwModify*)aCharFmtDep.GetRegisteredIn())->Remove( &aCharFmtDep );
      54             : 
      55          52 :     if ( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
      56          27 :         ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
      57          54 :                                                     &aAnchorCharFmtDep );
      58          25 :     else if( aAnchorCharFmtDep.GetRegisteredIn() )
      59           0 :         ((SwModify*)aAnchorCharFmtDep.GetRegisteredIn())->Remove(
      60           0 :                                                     &aAnchorCharFmtDep );
      61             : 
      62          52 :     aFmt = rInfo.aFmt;
      63          52 :     nFtnOffset = rInfo.nFtnOffset;
      64          52 :     m_bEndNote = rInfo.m_bEndNote;
      65          52 :     sPrefix = rInfo.sPrefix;
      66          52 :     sSuffix = rInfo.sSuffix;
      67          52 :     return *this;
      68             : }
      69             : 
      70        2235 : bool SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const
      71             : {
      72        2235 :     return  aPageDescDep.GetRegisteredIn() ==
      73        4467 :                                 rInfo.aPageDescDep.GetRegisteredIn() &&
      74        2232 :             aCharFmtDep.GetRegisteredIn() ==
      75        4452 :                                 rInfo.aCharFmtDep.GetRegisteredIn() &&
      76        2220 :             aAnchorCharFmtDep.GetRegisteredIn() ==
      77        4434 :                                 rInfo.aAnchorCharFmtDep.GetRegisteredIn() &&
      78        4425 :             GetFtnTxtColl() == rInfo.GetFtnTxtColl() &&
      79        4413 :             aFmt.GetNumberingType() == rInfo.aFmt.GetNumberingType() &&
      80        4402 :             nFtnOffset == rInfo.nFtnOffset &&
      81        4400 :             m_bEndNote == rInfo.m_bEndNote &&
      82        6631 :             sPrefix == rInfo.sPrefix &&
      83        4431 :             sSuffix == rInfo.sSuffix;
      84             : }
      85             : 
      86        2261 : SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
      87        2261 :     SwClient( rInfo.GetFtnTxtColl() ),
      88             :     aPageDescDep( this, 0 ),
      89             :     aCharFmtDep( this, 0 ),
      90             :     aAnchorCharFmtDep( this, 0 ),
      91             :     sPrefix( rInfo.sPrefix ),
      92             :     sSuffix( rInfo.sSuffix ),
      93             :     m_bEndNote( true ),
      94             :     aFmt( rInfo.aFmt ),
      95        2261 :     nFtnOffset( rInfo.nFtnOffset )
      96             : {
      97        2261 :     if( rInfo.aPageDescDep.GetRegisteredIn() )
      98          73 :         ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
      99             : 
     100        2261 :     if( rInfo.aCharFmtDep.GetRegisteredIn() )
     101         138 :         ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
     102             : 
     103        2261 :     if( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
     104          83 :         ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
     105         166 :                 &aAnchorCharFmtDep );
     106        2261 : }
     107             : 
     108        3705 : SwEndNoteInfo::SwEndNoteInfo(SwTxtFmtColl *pFmt) :
     109             :     SwClient(pFmt),
     110             :     aPageDescDep( this, 0 ),
     111             :     aCharFmtDep( this, 0 ),
     112             :     aAnchorCharFmtDep( this, 0 ),
     113             :     m_bEndNote( true ),
     114        3705 :     nFtnOffset( 0 )
     115             : {
     116        3705 :     aFmt.SetNumberingType(SVX_NUM_ROMAN_LOWER);
     117        3705 : }
     118             : 
     119          52 : SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const
     120             : {
     121          52 :     if ( !aPageDescDep.GetRegisteredIn() )
     122             :     {
     123             :         SwPageDesc *pDesc = rDoc.GetPageDescFromPool( static_cast<sal_uInt16>(
     124          24 :             m_bEndNote ? RES_POOLPAGE_ENDNOTE   : RES_POOLPAGE_FOOTNOTE ) );
     125          24 :         pDesc->Add( &((SwClient&)aPageDescDep) );
     126             :     }
     127             : 
     128          52 :     return (SwPageDesc*)( aPageDescDep.GetRegisteredIn() );
     129             : }
     130             : 
     131          44 : bool SwEndNoteInfo::KnowsPageDesc() const
     132             : {
     133          44 :     return (aPageDescDep.GetRegisteredIn() != 0);
     134             : }
     135             : 
     136        6554 : bool SwEndNoteInfo::DependsOn( const SwPageDesc* pDesc ) const
     137             : {
     138        6554 :     return ( aPageDescDep.GetRegisteredIn() == pDesc );
     139             : }
     140             : 
     141           6 : void SwEndNoteInfo::ChgPageDesc( SwPageDesc *pDesc )
     142             : {
     143           6 :     pDesc->Add( &((SwClient&)aPageDescDep) );
     144           6 : }
     145             : 
     146           3 : void SwEndNoteInfo::SetFtnTxtColl(SwTxtFmtColl& rFmt)
     147             : {
     148           3 :     rFmt.Add(this);
     149           3 : }
     150             : 
     151         235 : SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const
     152             : {
     153         235 :     if ( !aCharFmtDep.GetRegisteredIn() )
     154             :     {
     155             :         SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
     156          86 :             m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) );
     157          86 :         pFmt->Add( &((SwClient&)aCharFmtDep) );
     158             :     }
     159         235 :     return (SwCharFmt*)aCharFmtDep.GetRegisteredIn();
     160             : }
     161             : 
     162          12 : void SwEndNoteInfo::SetCharFmt( SwCharFmt* pChFmt )
     163             : {
     164             :     OSL_ENSURE(pChFmt, "no CharFmt?");
     165          12 :     pChFmt->Add( &((SwClient&)aCharFmtDep) );
     166          12 : }
     167             : 
     168         351 : SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const
     169             : {
     170         351 :     if( !aAnchorCharFmtDep.GetRegisteredIn() )
     171             :     {
     172             :         SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
     173          46 :             m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) );
     174          46 :         pFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
     175             :     }
     176         351 :     return (SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn();
     177             : }
     178             : 
     179           6 : void SwEndNoteInfo::SetAnchorCharFmt( SwCharFmt* pChFmt )
     180             : {
     181             :     OSL_ENSURE(pChFmt, "no CharFmt?");
     182           6 :     pChFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
     183           6 : }
     184             : 
     185         321 : void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
     186             : {
     187         321 :     sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
     188             : 
     189         321 :     if( RES_ATTRSET_CHG == nWhich ||
     190             :         RES_FMT_CHG == nWhich )
     191             :     {
     192             :         SwDoc* pDoc;
     193         321 :         if( aCharFmtDep.GetRegisteredIn() )
     194         321 :             pDoc = ((SwCharFmt*)aCharFmtDep.GetRegisteredIn())->GetDoc();
     195             :         else
     196           0 :             pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc();
     197         321 :         SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs();
     198         532 :         for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
     199             :         {
     200         211 :             SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
     201         211 :             const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
     202         211 :             if ( rFtn.IsEndNote() == m_bEndNote )
     203             :             {
     204         179 :                 pTxtFtn->SetNumber(rFtn.GetNumber(), rFtn.GetNumStr());
     205             :             }
     206         321 :         }
     207             :     }
     208             :     else
     209           0 :         CheckRegistration( pOld, pNew );
     210         321 : }
     211             : 
     212             : /*********************** SwFtnInfo ***************************/
     213             : 
     214          34 : SwFtnInfo& SwFtnInfo::operator=(const SwFtnInfo& rInfo)
     215             : {
     216          34 :     SwEndNoteInfo::operator=(rInfo);
     217          34 :     aQuoVadis =  rInfo.aQuoVadis;
     218          34 :     aErgoSum = rInfo.aErgoSum;
     219          34 :     ePos = rInfo.ePos;
     220          34 :     eNum = rInfo.eNum;
     221          34 :     return *this;
     222             : }
     223             : 
     224        1426 : bool SwFtnInfo::operator==( const SwFtnInfo& rInfo ) const
     225             : {
     226        2851 :     return  ePos == rInfo.ePos &&
     227        2844 :             eNum == rInfo.eNum &&
     228        2814 :             SwEndNoteInfo::operator==(rInfo) &&
     229        4215 :             aQuoVadis == rInfo.aQuoVadis &&
     230        2820 :             aErgoSum == rInfo.aErgoSum;
     231             : }
     232             : 
     233        1438 : SwFtnInfo::SwFtnInfo(const SwFtnInfo& rInfo) :
     234             :     SwEndNoteInfo( rInfo ),
     235             :     aQuoVadis( rInfo.aQuoVadis ),
     236             :     aErgoSum( rInfo.aErgoSum ),
     237             :     ePos( rInfo.ePos ),
     238        1438 :     eNum( rInfo.eNum )
     239             : {
     240        1438 :     m_bEndNote = false;
     241        1438 : }
     242             : 
     243        1853 : SwFtnInfo::SwFtnInfo(SwTxtFmtColl *pFmt) :
     244             :     SwEndNoteInfo( pFmt ),
     245             :     ePos( FTNPOS_PAGE ),
     246        1853 :     eNum( FTNNUM_DOC )
     247             : {
     248        1853 :     aFmt.SetNumberingType(SVX_NUM_ARABIC);
     249        1853 :     m_bEndNote = false;
     250        1853 : }
     251             : 
     252             : /*********************** SwDoc ***************************/
     253             : 
     254        1426 : void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo)
     255             : {
     256        1426 :     SwRootFrm* pTmpRoot = GetCurrentLayout();
     257        1426 :     if( !(GetFtnInfo() == rInfo) )
     258             :     {
     259          33 :         const SwFtnInfo &rOld = GetFtnInfo();
     260             : 
     261          33 :         if (GetIDocumentUndoRedo().DoesUndo())
     262             :         {
     263          13 :             GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld) );
     264             :         }
     265             : 
     266          33 :         bool bFtnPos  = rInfo.ePos != rOld.ePos;
     267          33 :         bool bFtnDesc = rOld.ePos == FTNPOS_CHAPTER &&
     268          33 :                             rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this );
     269          65 :         bool bExtra   = rInfo.aQuoVadis != rOld.aQuoVadis ||
     270          63 :                             rInfo.aErgoSum != rOld.aErgoSum ||
     271          61 :                             rInfo.aFmt.GetNumberingType() != rOld.aFmt.GetNumberingType() ||
     272          90 :                             rInfo.GetPrefix() != rOld.GetPrefix() ||
     273          60 :                             rInfo.GetSuffix() != rOld.GetSuffix();
     274          33 :         SwCharFmt *pOldChrFmt = rOld.GetCharFmt( *this ),
     275          33 :                   *pNewChrFmt = rInfo.GetCharFmt( *this );
     276          33 :         bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
     277             : 
     278          33 :         *mpFtnInfo = rInfo;
     279             : 
     280          33 :         if (pTmpRoot)
     281             :         {
     282          13 :             std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
     283          13 :             if ( bFtnPos )
     284           1 :                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllRemoveFtns));
     285             :             else
     286             :             {
     287          12 :                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::UpdateFtnNums));
     288          12 :                 if ( bFtnDesc )
     289           0 :                     std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::CheckFtnPageDescs), sal_False));
     290          12 :                 if ( bExtra )
     291             :                 {
     292             :                     // For messages regarding ErgoSum etc. we save the extra code and use the
     293             :                     // available methods.
     294           7 :                     SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
     295          12 :                     for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
     296             :                     {
     297           5 :                         SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
     298           5 :                         const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
     299           5 :                         if ( !rFtn.IsEndNote() )
     300           5 :                             pTxtFtn->SetNumber(rFtn.GetNumber(), rFtn.GetNumStr());
     301             :                     }
     302             :                 }
     303          13 :             }
     304             :         }
     305          33 :         if( FTNNUM_PAGE != rInfo.eNum )
     306          29 :             GetFtnIdxs().UpdateAllFtn();
     307           4 :         else if( bFtnChrFmts )
     308             :         {
     309           0 :             SwFmtChg aOld( pOldChrFmt );
     310           0 :             SwFmtChg aNew( pNewChrFmt );
     311           0 :             mpFtnInfo->ModifyNotification( &aOld, &aNew );
     312             :         }
     313             : 
     314             :         // #i81002# no update during loading
     315          33 :         if ( !IsInReading() )
     316             :         {
     317          13 :             UpdateRefFlds(NULL);
     318             :         }
     319          33 :         SetModified();
     320             :     }
     321        1426 : }
     322             : 
     323         816 : void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
     324             : {
     325         816 :     SwRootFrm* pTmpRoot = GetCurrentLayout();
     326         816 :     if( !(GetEndNoteInfo() == rInfo) )
     327             :     {
     328          18 :         if(GetIDocumentUndoRedo().DoesUndo())
     329             :         {
     330           7 :             SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) );
     331           7 :             GetIDocumentUndoRedo().AppendUndo(pUndo);
     332             :         }
     333             : 
     334          18 :         bool bNumChg  = rInfo.nFtnOffset != GetEndNoteInfo().nFtnOffset;
     335             :         // this seems to be an optimization: UpdateAllFtn() is only called
     336             :         // if the offset changes; if the offset is the same,
     337             :         // but type/prefix/suffix changes, just set new numbers.
     338          45 :         bool const bExtra = !bNumChg &&
     339          17 :                 (   (rInfo.aFmt.GetNumberingType() !=
     340          17 :                         GetEndNoteInfo().aFmt.GetNumberingType())
     341           9 :                 ||  (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix())
     342           8 :                 ||  (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix())
     343          18 :                 );
     344          18 :         bool bFtnDesc = rInfo.GetPageDesc( *this ) !=
     345          18 :                             GetEndNoteInfo().GetPageDesc( *this );
     346          18 :         SwCharFmt *pOldChrFmt = GetEndNoteInfo().GetCharFmt( *this ),
     347          18 :                   *pNewChrFmt = rInfo.GetCharFmt( *this );
     348          18 :         bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
     349             : 
     350          18 :         *mpEndNoteInfo = rInfo;
     351             : 
     352          18 :         if ( pTmpRoot )
     353             :         {
     354           7 :             if ( bFtnDesc )
     355             :             {
     356           1 :                 std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
     357           1 :                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::CheckFtnPageDescs), sal_True));
     358             :             }
     359           7 :             if ( bExtra )
     360             :             {
     361             :                 // For messages regarding ErgoSum etc. we save the extra code and use the
     362             :                 // available methods.
     363           3 :                 SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
     364           6 :                 for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
     365             :                 {
     366           3 :                     SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
     367           3 :                     const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
     368           3 :                     if ( rFtn.IsEndNote() )
     369           3 :                         pTxtFtn->SetNumber(rFtn.GetNumber(), rFtn.GetNumStr());
     370             :                 }
     371             :             }
     372             :         }
     373          18 :         if( bNumChg )
     374           1 :             GetFtnIdxs().UpdateAllFtn();
     375          17 :         else if( bFtnChrFmts )
     376             :         {
     377           1 :             SwFmtChg aOld( pOldChrFmt );
     378           2 :             SwFmtChg aNew( pNewChrFmt );
     379           2 :             mpEndNoteInfo->ModifyNotification( &aOld, &aNew );
     380             :         }
     381             : 
     382             :         // #i81002# no update during loading
     383          18 :         if ( !IsInReading() )
     384             :         {
     385           7 :             UpdateRefFlds(NULL);
     386             :         }
     387          18 :         SetModified();
     388             :     }
     389         816 : }
     390             : 
     391           2 : bool SwDoc::SetCurFtn( const SwPaM& rPam, const OUString& rNumStr,
     392             :                        sal_uInt16 nNumber, bool bIsEndNote )
     393             : {
     394           2 :     SwFtnIdxs& rFtnArr = GetFtnIdxs();
     395           2 :     SwRootFrm* pTmpRoot = GetCurrentLayout();
     396             : 
     397           2 :     const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
     398           2 :     const sal_uLong nSttNd = pStt->nNode.GetIndex();
     399           2 :     const sal_Int32 nSttCnt = pStt->nContent.GetIndex();
     400           2 :     const sal_uLong nEndNd = pEnd->nNode.GetIndex();
     401           2 :     const sal_Int32 nEndCnt = pEnd->nContent.GetIndex();
     402             : 
     403             :     sal_uInt16 nPos;
     404           2 :     rFtnArr.SeekEntry( pStt->nNode, &nPos );
     405             : 
     406           2 :     SwUndoChangeFootNote* pUndo = 0;
     407           2 :     if (GetIDocumentUndoRedo().DoesUndo())
     408             :     {
     409           2 :         GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it
     410           2 :         pUndo = new SwUndoChangeFootNote( rPam, rNumStr, nNumber, bIsEndNote );
     411             :     }
     412             : 
     413             :     SwTxtFtn* pTxtFtn;
     414             :     sal_uLong nIdx;
     415           2 :     bool bChg = false;
     416           2 :     bool bTypeChgd = false;
     417           2 :     sal_uInt16 n = nPos;        // save
     418          12 :     while( nPos < rFtnArr.size() &&
     419           4 :             (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ nPos++ ] )))
     420           4 :                 < nEndNd || ( nIdx == nEndNd &&
     421           2 :                 nEndCnt >= *pTxtFtn->GetStart() )) )
     422           4 :         if( nIdx > nSttNd || ( nIdx == nSttNd &&
     423           2 :                 nSttCnt <= *pTxtFtn->GetStart() ) )
     424             :         {
     425           2 :             const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
     426           2 :             if( rFtn.GetNumStr() != rNumStr ||
     427           0 :                 rFtn.IsEndNote() != bIsEndNote )
     428             :             {
     429           2 :                 bChg = true;
     430           2 :                 if ( pUndo )
     431             :                 {
     432           2 :                     pUndo->GetHistory().Add( *pTxtFtn );
     433             :                 }
     434             : 
     435           2 :                 pTxtFtn->SetNumber( nNumber, rNumStr );
     436           2 :                 if( rFtn.IsEndNote() != bIsEndNote )
     437             :                 {
     438           0 :                     ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote );
     439           0 :                     bTypeChgd = true;
     440           0 :                     pTxtFtn->CheckCondColl();
     441             :                     //#i11339# dispose UNO wrapper when a footnote is changed to an endnote or vice versa
     442           0 :                     SwPtrMsgPoolItem aMsgHint( RES_FOOTNOTE_DELETED, (void*)&pTxtFtn->GetAttr() );
     443           0 :                     GetUnoCallBack()->ModifyNotification( &aMsgHint, &aMsgHint );
     444             :                 }
     445             :             }
     446             :         }
     447             : 
     448           2 :     nPos = n;       // There are more in the front!
     449           4 :     while( nPos &&
     450           0 :             (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ --nPos ] )))
     451           0 :                 > nSttNd || ( nIdx == nSttNd &&
     452           0 :                 nSttCnt <= *pTxtFtn->GetStart() )) )
     453           0 :         if( nIdx < nEndNd || ( nIdx == nEndNd &&
     454           0 :             nEndCnt >= *pTxtFtn->GetStart() ) )
     455             :         {
     456           0 :             const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
     457           0 :             if( rFtn.GetNumStr() != rNumStr ||
     458           0 :                 rFtn.IsEndNote() != bIsEndNote )
     459             :             {
     460           0 :                 bChg = true;
     461           0 :                 if ( pUndo )
     462             :                 {
     463           0 :                     pUndo->GetHistory().Add( *pTxtFtn );
     464             :                 }
     465             : 
     466           0 :                 pTxtFtn->SetNumber( nNumber, rNumStr );
     467           0 :                 if( rFtn.IsEndNote() != bIsEndNote )
     468             :                 {
     469           0 :                     ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote );
     470           0 :                     bTypeChgd = true;
     471           0 :                     pTxtFtn->CheckCondColl();
     472             :                 }
     473             :             }
     474             :         }
     475             : 
     476             :     // Who needs to be triggered?
     477           2 :     if( bChg )
     478             :     {
     479           2 :         if( pUndo )
     480             :         {
     481           2 :             GetIDocumentUndoRedo().AppendUndo(pUndo);
     482             :         }
     483             : 
     484           2 :         if ( bTypeChgd )
     485           0 :             rFtnArr.UpdateAllFtn();
     486           2 :         if( FTNNUM_PAGE != GetFtnInfo().eNum )
     487             :         {
     488           2 :             if ( !bTypeChgd )
     489           2 :                 rFtnArr.UpdateAllFtn();
     490             :         }
     491           0 :         else if( pTmpRoot )
     492             :         {
     493           0 :             std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
     494           0 :             std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::UpdateFtnNums));
     495             :         }
     496           2 :         SetModified();
     497             :     }
     498             :     else
     499           0 :         delete pUndo;
     500           2 :     return bChg;
     501             : }
     502             : 
     503             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10