LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/doc - docftn.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 145 264 54.9 %
Date: 2012-12-27 Functions: 18 21 85.7 %
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             : /*********************** SwFtnInfo ***************************/
      37             : 
      38           5 : SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
      39             : {
      40           5 :     if( rInfo.GetFtnTxtColl() )
      41           0 :         rInfo.GetFtnTxtColl()->Add(this);
      42           5 :     else if ( GetRegisteredIn())
      43           0 :         GetRegisteredInNonConst()->Remove(this);
      44             : 
      45           5 :     if ( rInfo.aPageDescDep.GetRegisteredIn() )
      46           1 :         ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
      47           4 :     else if ( aPageDescDep.GetRegisteredIn() )
      48           0 :         ((SwModify*)aPageDescDep.GetRegisteredIn())->Remove( &aPageDescDep );
      49             : 
      50           5 :     if ( rInfo.aCharFmtDep.GetRegisteredIn() )
      51           5 :         ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
      52           0 :     else if ( aCharFmtDep.GetRegisteredIn() )
      53           0 :         ((SwModify*)aCharFmtDep.GetRegisteredIn())->Remove( &aCharFmtDep );
      54             : 
      55           5 :     if ( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
      56           2 :         ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
      57           4 :                                                     &aAnchorCharFmtDep );
      58           3 :     else if( aAnchorCharFmtDep.GetRegisteredIn() )
      59           0 :         ((SwModify*)aAnchorCharFmtDep.GetRegisteredIn())->Remove(
      60           0 :                                                     &aAnchorCharFmtDep );
      61             : 
      62           5 :     aFmt = rInfo.aFmt;
      63           5 :     nFtnOffset = rInfo.nFtnOffset;
      64           5 :     m_bEndNote = rInfo.m_bEndNote;
      65           5 :     sPrefix = rInfo.sPrefix;
      66           5 :     sSuffix = rInfo.sSuffix;
      67           5 :     return *this;
      68             : }
      69             : 
      70             : 
      71         540 : bool SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const
      72             : {
      73         540 :     return  aPageDescDep.GetRegisteredIn() ==
      74         540 :                                 rInfo.aPageDescDep.GetRegisteredIn() &&
      75         540 :             aCharFmtDep.GetRegisteredIn() ==
      76         540 :                                 rInfo.aCharFmtDep.GetRegisteredIn() &&
      77         538 :             aAnchorCharFmtDep.GetRegisteredIn() ==
      78         538 :                                 rInfo.aAnchorCharFmtDep.GetRegisteredIn() &&
      79         536 :             GetFtnTxtColl() == rInfo.GetFtnTxtColl() &&
      80         536 :             aFmt.GetNumberingType() == rInfo.aFmt.GetNumberingType() &&
      81             :             nFtnOffset == rInfo.nFtnOffset &&
      82             :             m_bEndNote == rInfo.m_bEndNote &&
      83         535 :             sPrefix == rInfo.sPrefix &&
      84        3225 :             sSuffix == rInfo.sSuffix;
      85             : }
      86             : 
      87             : 
      88         540 : SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
      89         540 :     SwClient( rInfo.GetFtnTxtColl() ),
      90             :     aPageDescDep( this, 0 ),
      91             :     aCharFmtDep( this, 0 ),
      92             :     aAnchorCharFmtDep( this, 0 ),
      93             :     sPrefix( rInfo.sPrefix ),
      94             :     sSuffix( rInfo.sSuffix ),
      95             :     m_bEndNote( true ),
      96             :     aFmt( rInfo.aFmt ),
      97         540 :     nFtnOffset( rInfo.nFtnOffset )
      98             : {
      99         540 :     if( rInfo.aPageDescDep.GetRegisteredIn() )
     100           1 :         ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
     101             : 
     102         540 :     if( rInfo.aCharFmtDep.GetRegisteredIn() )
     103          19 :         ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
     104             : 
     105         540 :     if( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
     106          16 :         ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
     107          32 :                 &aAnchorCharFmtDep );
     108         540 : }
     109             : 
     110         552 : SwEndNoteInfo::SwEndNoteInfo(SwTxtFmtColl *pFmt) :
     111             :     SwClient(pFmt),
     112             :     aPageDescDep( this, 0 ),
     113             :     aCharFmtDep( this, 0 ),
     114             :     aAnchorCharFmtDep( this, 0 ),
     115             :     m_bEndNote( true ),
     116         552 :     nFtnOffset( 0 )
     117             : {
     118         552 :     aFmt.SetNumberingType(SVX_NUM_ROMAN_LOWER);
     119         552 : }
     120             : 
     121           2 : SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const
     122             : {
     123           2 :     if ( !aPageDescDep.GetRegisteredIn() )
     124             :     {
     125             :         SwPageDesc *pDesc = rDoc.GetPageDescFromPool( static_cast<sal_uInt16>(
     126           2 :             m_bEndNote ? RES_POOLPAGE_ENDNOTE   : RES_POOLPAGE_FOOTNOTE ) );
     127           2 :         pDesc->Add( &((SwClient&)aPageDescDep) );
     128             :     }
     129             : 
     130           2 :     return (SwPageDesc*)( aPageDescDep.GetRegisteredIn() );
     131             : }
     132             : 
     133           4 : bool SwEndNoteInfo::KnowsPageDesc() const
     134             : {
     135           4 :     return (aPageDescDep.GetRegisteredIn() != 0);
     136             : }
     137             : 
     138         838 : bool SwEndNoteInfo::DependsOn( const SwPageDesc* pDesc ) const
     139             : {
     140         838 :     return ( aPageDescDep.GetRegisteredIn() == pDesc );
     141             : }
     142             : 
     143           0 : void SwEndNoteInfo::ChgPageDesc( SwPageDesc *pDesc )
     144             : {
     145           0 :     pDesc->Add( &((SwClient&)aPageDescDep) );
     146           0 : }
     147             : 
     148           0 : void SwEndNoteInfo::SetFtnTxtColl(SwTxtFmtColl& rFmt)
     149             : {
     150           0 :     rFmt.Add(this);
     151           0 : }
     152             : 
     153          19 : SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const
     154             : {
     155          19 :     if ( !aCharFmtDep.GetRegisteredIn() )
     156             :     {
     157             :         SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
     158           9 :             m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) );
     159           9 :         pFmt->Add( &((SwClient&)aCharFmtDep) );
     160             :     }
     161          19 :     return (SwCharFmt*)aCharFmtDep.GetRegisteredIn();
     162             : }
     163             : 
     164           2 : void SwEndNoteInfo::SetCharFmt( SwCharFmt* pChFmt )
     165             : {
     166             :     OSL_ENSURE(pChFmt, "no CharFmt?");
     167           2 :     pChFmt->Add( &((SwClient&)aCharFmtDep) );
     168           2 : }
     169             : 
     170          18 : SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const
     171             : {
     172          18 :     if( !aAnchorCharFmtDep.GetRegisteredIn() )
     173             :     {
     174             :         SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
     175           5 :             m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) );
     176           5 :         pFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
     177             :     }
     178          18 :     return (SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn();
     179             : }
     180             : 
     181           2 : void SwEndNoteInfo::SetAnchorCharFmt( SwCharFmt* pChFmt )
     182             : {
     183             :     OSL_ENSURE(pChFmt, "no CharFmt?");
     184           2 :     pChFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
     185           2 : }
     186             : 
     187          20 : void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
     188             : {
     189          20 :     sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
     190             : 
     191          20 :     if( RES_ATTRSET_CHG == nWhich ||
     192             :         RES_FMT_CHG == nWhich )
     193             :     {
     194             :         SwDoc* pDoc;
     195          20 :         if( aCharFmtDep.GetRegisteredIn() )
     196          20 :             pDoc = ((SwCharFmt*)aCharFmtDep.GetRegisteredIn())->GetDoc();
     197             :         else
     198           0 :             pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc();
     199          20 :         SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs();
     200          30 :         for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
     201             :         {
     202          10 :             SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
     203          10 :             const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
     204          10 :             if ( rFtn.IsEndNote() == m_bEndNote )
     205             :             {
     206           6 :                 pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
     207             :             }
     208          20 :         }
     209             :     }
     210             :     else
     211           0 :         CheckRegistration( pOld, pNew );
     212          20 : }
     213             : 
     214           4 : SwFtnInfo& SwFtnInfo::operator=(const SwFtnInfo& rInfo)
     215             : {
     216           4 :     SwEndNoteInfo::operator=(rInfo);
     217           4 :     aQuoVadis =  rInfo.aQuoVadis;
     218           4 :     aErgoSum = rInfo.aErgoSum;
     219           4 :     ePos = rInfo.ePos;
     220           4 :     eNum = rInfo.eNum;
     221           4 :     return *this;
     222             : }
     223             : 
     224             : 
     225         338 : bool SwFtnInfo::operator==( const SwFtnInfo& rInfo ) const
     226             : {
     227             :     return  ePos == rInfo.ePos &&
     228             :             eNum == rInfo.eNum &&
     229         338 :             SwEndNoteInfo::operator==(rInfo) &&
     230         334 :             aQuoVadis == rInfo.aQuoVadis &&
     231        1010 :             aErgoSum == rInfo.aErgoSum;
     232             : }
     233             : 
     234             : 
     235         338 : SwFtnInfo::SwFtnInfo(const SwFtnInfo& rInfo) :
     236             :     SwEndNoteInfo( rInfo ),
     237             :     aQuoVadis( rInfo.aQuoVadis ),
     238             :     aErgoSum( rInfo.aErgoSum ),
     239             :     ePos( rInfo.ePos ),
     240         338 :     eNum( rInfo.eNum )
     241             : {
     242         338 :     m_bEndNote = false;
     243         338 : }
     244             : 
     245         276 : SwFtnInfo::SwFtnInfo(SwTxtFmtColl *pFmt) :
     246             :     SwEndNoteInfo( pFmt ),
     247             :     ePos( FTNPOS_PAGE ),
     248         276 :     eNum( FTNNUM_DOC )
     249             : {
     250         276 :     aFmt.SetNumberingType(SVX_NUM_ARABIC);
     251         276 :     m_bEndNote = false;
     252         276 : }
     253             : 
     254             : /*********************** SwDoc ***************************/
     255             : 
     256             : 
     257         338 : void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo)
     258             : {
     259         338 :     SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
     260         338 :     if( !(GetFtnInfo() == rInfo) )
     261             :     {
     262           4 :         const SwFtnInfo &rOld = GetFtnInfo();
     263             : 
     264           4 :         if (GetIDocumentUndoRedo().DoesUndo())
     265             :         {
     266           0 :             GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld) );
     267             :         }
     268             : 
     269           4 :         bool bFtnPos  = rInfo.ePos != rOld.ePos;
     270             :         bool bFtnDesc = rOld.ePos == FTNPOS_CHAPTER &&
     271           4 :                             rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this );
     272           4 :         bool bExtra   = rInfo.aQuoVadis != rOld.aQuoVadis ||
     273           4 :                             rInfo.aErgoSum != rOld.aErgoSum ||
     274           4 :                             rInfo.aFmt.GetNumberingType() != rOld.aFmt.GetNumberingType() ||
     275           4 :                             rInfo.GetPrefix() != rOld.GetPrefix() ||
     276          16 :                             rInfo.GetSuffix() != rOld.GetSuffix();
     277           4 :         SwCharFmt *pOldChrFmt = rOld.GetCharFmt( *this ),
     278           4 :                   *pNewChrFmt = rInfo.GetCharFmt( *this );
     279           4 :         bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
     280             : 
     281           4 :         *pFtnInfo = rInfo;
     282             : 
     283           4 :         if (pTmpRoot)
     284             :         {
     285           0 :             std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();//swmod 080304
     286           0 :             if ( bFtnPos )
     287             :                 //pTmpRoot->RemoveFtns();
     288           0 :                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllRemoveFtns));//swmod 080305
     289             :             else
     290             :             {
     291             :                 //pTmpRoot->UpdateFtnNums();
     292           0 :                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::UpdateFtnNums));//swmod 080304
     293           0 :                 if ( bFtnDesc )
     294             :                     //pTmpRoot->CheckFtnPageDescs( FALSE );
     295           0 :                     std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::CheckFtnPageDescs), sal_False));//swmod 080304
     296           0 :                 if ( bExtra )
     297             :                 {
     298             :                     // For messages regarding ErgoSum etc. we save the extra code and use the
     299             :                     // available methods.
     300           0 :                     SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
     301           0 :                     for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
     302             :                     {
     303           0 :                         SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
     304           0 :                         const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
     305           0 :                         if ( !rFtn.IsEndNote() )
     306           0 :                             pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
     307             :                     }
     308             :                 }
     309           0 :             }
     310             :         }   //swmod 080219
     311           4 :         if( FTNNUM_PAGE != rInfo.eNum )
     312           4 :             GetFtnIdxs().UpdateAllFtn();
     313           0 :         else if( bFtnChrFmts )
     314             :         {
     315           0 :             SwFmtChg aOld( pOldChrFmt );
     316           0 :             SwFmtChg aNew( pNewChrFmt );
     317           0 :             pFtnInfo->ModifyNotification( &aOld, &aNew );
     318             :         }
     319             : 
     320             :         // #i81002# no update during loading
     321           4 :         if ( !IsInReading() )
     322             :         {
     323           0 :             UpdateRefFlds(NULL);
     324             :         }
     325           4 :         SetModified();
     326             :     }
     327         338 : }
     328             : 
     329         202 : void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
     330             : {
     331         202 :     SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
     332         202 :     if( !(GetEndNoteInfo() == rInfo) )
     333             :     {
     334           1 :         if(GetIDocumentUndoRedo().DoesUndo())
     335             :         {
     336           0 :             SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) );
     337           0 :             GetIDocumentUndoRedo().AppendUndo(pUndo);
     338             :         }
     339             : 
     340           1 :         bool bNumChg  = rInfo.nFtnOffset != GetEndNoteInfo().nFtnOffset;
     341             :         // this seems to be an optimization: UpdateAllFtn() is only called
     342             :         // if the offset changes; if the offset is the same,
     343             :         // but type/prefix/suffix changes, just set new numbers.
     344           1 :         bool const bExtra = !bNumChg &&
     345           1 :                 (   (rInfo.aFmt.GetNumberingType() !=
     346           1 :                         GetEndNoteInfo().aFmt.GetNumberingType())
     347           0 :                 ||  (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix())
     348           0 :                 ||  (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix())
     349           2 :                 );
     350           1 :         bool bFtnDesc = rInfo.GetPageDesc( *this ) !=
     351           1 :                             GetEndNoteInfo().GetPageDesc( *this );
     352           1 :         SwCharFmt *pOldChrFmt = GetEndNoteInfo().GetCharFmt( *this ),
     353           1 :                   *pNewChrFmt = rInfo.GetCharFmt( *this );
     354           1 :         bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
     355             : 
     356           1 :         *pEndNoteInfo = rInfo;
     357             : 
     358           1 :         if ( pTmpRoot )
     359             :         {
     360           0 :             if ( bFtnDesc )
     361             :                 //pTmpRoot->CheckFtnPageDescs( TRUE );
     362             :             {
     363           0 :                 std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
     364           0 :                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::CheckFtnPageDescs), sal_True));//swmod 080304
     365             :             }
     366           0 :             if ( bExtra )
     367             :             {
     368             :                 // For messages regarding ErgoSum etc. we save the extra code and use the
     369             :                 // available methods.
     370           0 :                 SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
     371           0 :                 for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
     372             :                 {
     373           0 :                     SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
     374           0 :                     const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
     375           0 :                     if ( rFtn.IsEndNote() )
     376           0 :                         pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
     377             :                 }
     378             :             }
     379             :         }   //swmod 080219
     380           1 :         if( bNumChg )
     381           0 :             GetFtnIdxs().UpdateAllFtn();
     382           1 :         else if( bFtnChrFmts )
     383             :         {
     384           0 :             SwFmtChg aOld( pOldChrFmt );
     385           0 :             SwFmtChg aNew( pNewChrFmt );
     386           0 :             pEndNoteInfo->ModifyNotification( &aOld, &aNew );
     387             :         }
     388             : 
     389             :         // #i81002# no update during loading
     390           1 :         if ( !IsInReading() )
     391             :         {
     392           0 :             UpdateRefFlds(NULL);
     393             :         }
     394           1 :         SetModified();
     395             :     }
     396         202 : }
     397             : 
     398             : 
     399           0 : bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
     400             :                        sal_uInt16 nNumber, bool bIsEndNote )
     401             : {
     402           0 :     SwFtnIdxs& rFtnArr = GetFtnIdxs();
     403           0 :     SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
     404             : 
     405           0 :     const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
     406           0 :     const sal_uLong nSttNd = pStt->nNode.GetIndex();
     407           0 :     const xub_StrLen nSttCnt = pStt->nContent.GetIndex();
     408           0 :     const sal_uLong nEndNd = pEnd->nNode.GetIndex();
     409           0 :     const xub_StrLen nEndCnt = pEnd->nContent.GetIndex();
     410             : 
     411             :     sal_uInt16 nPos;
     412           0 :     rFtnArr.SeekEntry( pStt->nNode, &nPos );
     413             : 
     414           0 :     SwUndoChangeFootNote* pUndo = 0;
     415           0 :     if (GetIDocumentUndoRedo().DoesUndo())
     416             :     {
     417           0 :         GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it
     418           0 :         pUndo = new SwUndoChangeFootNote( rPam, rNumStr, nNumber, bIsEndNote );
     419             :     }
     420             : 
     421             :     SwTxtFtn* pTxtFtn;
     422             :     sal_uLong nIdx;
     423           0 :     bool bChg = false;
     424           0 :     bool bTypeChgd = false;
     425           0 :     sal_uInt16 n = nPos;        // save
     426           0 :     while( nPos < rFtnArr.size() &&
     427           0 :             (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ nPos++ ] )))
     428             :                 < nEndNd || ( nIdx == nEndNd &&
     429           0 :                 nEndCnt >= *pTxtFtn->GetStart() )) )
     430           0 :         if( nIdx > nSttNd || ( nIdx == nSttNd &&
     431           0 :                 nSttCnt <= *pTxtFtn->GetStart() ) )
     432             :         {
     433           0 :             const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
     434           0 :             if( rFtn.GetNumStr() != rNumStr ||
     435           0 :                 rFtn.IsEndNote() != bIsEndNote )
     436             :             {
     437           0 :                 bChg = true;
     438           0 :                 if ( pUndo )
     439             :                 {
     440           0 :                     pUndo->GetHistory().Add( *pTxtFtn );
     441             :                 }
     442             : 
     443           0 :                 pTxtFtn->SetNumber( nNumber, &rNumStr );
     444           0 :                 if( rFtn.IsEndNote() != bIsEndNote )
     445             :                 {
     446           0 :                     ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote );
     447           0 :                     bTypeChgd = true;
     448           0 :                     pTxtFtn->CheckCondColl();
     449             :                     //#i11339# dispose UNO wrapper when a footnote is changed to an endnote or vice versa
     450           0 :                     SwPtrMsgPoolItem aMsgHint( RES_FOOTNOTE_DELETED, (void*)&pTxtFtn->GetAttr() );
     451           0 :                     GetUnoCallBack()->ModifyNotification( &aMsgHint, &aMsgHint );
     452             :                 }
     453             :             }
     454             :         }
     455             : 
     456           0 :     nPos = n;       // There are more in the front!
     457           0 :     while( nPos &&
     458           0 :             (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ --nPos ] )))
     459             :                 > nSttNd || ( nIdx == nSttNd &&
     460           0 :                 nSttCnt <= *pTxtFtn->GetStart() )) )
     461           0 :         if( nIdx < nEndNd || ( nIdx == nEndNd &&
     462           0 :             nEndCnt >= *pTxtFtn->GetStart() ) )
     463             :         {
     464           0 :             const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
     465           0 :             if( rFtn.GetNumStr() != rNumStr ||
     466           0 :                 rFtn.IsEndNote() != bIsEndNote )
     467             :             {
     468           0 :                 bChg = true;
     469           0 :                 if ( pUndo )
     470             :                 {
     471           0 :                     pUndo->GetHistory().Add( *pTxtFtn );
     472             :                 }
     473             : 
     474           0 :                 pTxtFtn->SetNumber( nNumber, &rNumStr );
     475           0 :                 if( rFtn.IsEndNote() != bIsEndNote )
     476             :                 {
     477           0 :                     ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote );
     478           0 :                     bTypeChgd = true;
     479           0 :                     pTxtFtn->CheckCondColl();
     480             :                 }
     481             :             }
     482             :         }
     483             : 
     484             :     // Who needs to be triggered?
     485           0 :     if( bChg )
     486             :     {
     487           0 :         if( pUndo )
     488             :         {
     489           0 :             GetIDocumentUndoRedo().AppendUndo(pUndo);
     490             :         }
     491             : 
     492           0 :         if ( bTypeChgd )
     493           0 :             rFtnArr.UpdateAllFtn();
     494           0 :         if( FTNNUM_PAGE != GetFtnInfo().eNum )
     495             :         {
     496           0 :             if ( !bTypeChgd )
     497           0 :                 rFtnArr.UpdateAllFtn();
     498             :         }
     499           0 :         else if( pTmpRoot )
     500             :             //
     501             :         {
     502           0 :             std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
     503           0 :             std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::UpdateFtnNums));
     504             :         }   //swmod 080304pTmpRoot->UpdateFtnNums();    //swmod 080219
     505           0 :         SetModified();
     506             :     }
     507             :     else
     508           0 :         delete pUndo;
     509           0 :     return bChg;
     510             : }
     511             : 
     512             : 
     513             : 
     514             : 
     515             : 
     516             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10