LCOV - code coverage report
Current view: top level - sw/source/core/doc - docftn.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 271 0.0 %
Date: 2014-04-14 Functions: 0 21 0.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           0 : SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
      39             : {
      40           0 :     if( rInfo.GetFtnTxtColl() )
      41           0 :         rInfo.GetFtnTxtColl()->Add(this);
      42           0 :     else if ( GetRegisteredIn())
      43           0 :         GetRegisteredInNonConst()->Remove(this);
      44             : 
      45           0 :     if ( rInfo.aPageDescDep.GetRegisteredIn() )
      46           0 :         ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
      47           0 :     else if ( aPageDescDep.GetRegisteredIn() )
      48           0 :         ((SwModify*)aPageDescDep.GetRegisteredIn())->Remove( &aPageDescDep );
      49             : 
      50           0 :     if ( rInfo.aCharFmtDep.GetRegisteredIn() )
      51           0 :         ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
      52           0 :     else if ( aCharFmtDep.GetRegisteredIn() )
      53           0 :         ((SwModify*)aCharFmtDep.GetRegisteredIn())->Remove( &aCharFmtDep );
      54             : 
      55           0 :     if ( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
      56           0 :         ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
      57           0 :                                                     &aAnchorCharFmtDep );
      58           0 :     else if( aAnchorCharFmtDep.GetRegisteredIn() )
      59           0 :         ((SwModify*)aAnchorCharFmtDep.GetRegisteredIn())->Remove(
      60           0 :                                                     &aAnchorCharFmtDep );
      61             : 
      62           0 :     aFmt = rInfo.aFmt;
      63           0 :     nFtnOffset = rInfo.nFtnOffset;
      64           0 :     m_bEndNote = rInfo.m_bEndNote;
      65           0 :     sPrefix = rInfo.sPrefix;
      66           0 :     sSuffix = rInfo.sSuffix;
      67           0 :     return *this;
      68             : }
      69             : 
      70           0 : bool SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const
      71             : {
      72           0 :     return  aPageDescDep.GetRegisteredIn() ==
      73           0 :                                 rInfo.aPageDescDep.GetRegisteredIn() &&
      74           0 :             aCharFmtDep.GetRegisteredIn() ==
      75           0 :                                 rInfo.aCharFmtDep.GetRegisteredIn() &&
      76           0 :             aAnchorCharFmtDep.GetRegisteredIn() ==
      77           0 :                                 rInfo.aAnchorCharFmtDep.GetRegisteredIn() &&
      78           0 :             GetFtnTxtColl() == rInfo.GetFtnTxtColl() &&
      79           0 :             aFmt.GetNumberingType() == rInfo.aFmt.GetNumberingType() &&
      80           0 :             nFtnOffset == rInfo.nFtnOffset &&
      81           0 :             m_bEndNote == rInfo.m_bEndNote &&
      82           0 :             sPrefix == rInfo.sPrefix &&
      83           0 :             sSuffix == rInfo.sSuffix;
      84             : }
      85             : 
      86           0 : SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
      87           0 :     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           0 :     nFtnOffset( rInfo.nFtnOffset )
      96             : {
      97           0 :     if( rInfo.aPageDescDep.GetRegisteredIn() )
      98           0 :         ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
      99             : 
     100           0 :     if( rInfo.aCharFmtDep.GetRegisteredIn() )
     101           0 :         ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
     102             : 
     103           0 :     if( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
     104           0 :         ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
     105           0 :                 &aAnchorCharFmtDep );
     106           0 : }
     107             : 
     108           0 : SwEndNoteInfo::SwEndNoteInfo(SwTxtFmtColl *pFmt) :
     109             :     SwClient(pFmt),
     110             :     aPageDescDep( this, 0 ),
     111             :     aCharFmtDep( this, 0 ),
     112             :     aAnchorCharFmtDep( this, 0 ),
     113             :     m_bEndNote( true ),
     114           0 :     nFtnOffset( 0 )
     115             : {
     116           0 :     aFmt.SetNumberingType(SVX_NUM_ROMAN_LOWER);
     117           0 : }
     118             : 
     119           0 : SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const
     120             : {
     121           0 :     if ( !aPageDescDep.GetRegisteredIn() )
     122             :     {
     123             :         SwPageDesc *pDesc = rDoc.GetPageDescFromPool( static_cast<sal_uInt16>(
     124           0 :             m_bEndNote ? RES_POOLPAGE_ENDNOTE   : RES_POOLPAGE_FOOTNOTE ) );
     125           0 :         pDesc->Add( &((SwClient&)aPageDescDep) );
     126             :     }
     127             : 
     128           0 :     return (SwPageDesc*)( aPageDescDep.GetRegisteredIn() );
     129             : }
     130             : 
     131           0 : bool SwEndNoteInfo::KnowsPageDesc() const
     132             : {
     133           0 :     return (aPageDescDep.GetRegisteredIn() != 0);
     134             : }
     135             : 
     136           0 : bool SwEndNoteInfo::DependsOn( const SwPageDesc* pDesc ) const
     137             : {
     138           0 :     return ( aPageDescDep.GetRegisteredIn() == pDesc );
     139             : }
     140             : 
     141           0 : void SwEndNoteInfo::ChgPageDesc( SwPageDesc *pDesc )
     142             : {
     143           0 :     pDesc->Add( &((SwClient&)aPageDescDep) );
     144           0 : }
     145             : 
     146           0 : void SwEndNoteInfo::SetFtnTxtColl(SwTxtFmtColl& rFmt)
     147             : {
     148           0 :     rFmt.Add(this);
     149           0 : }
     150             : 
     151           0 : SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const
     152             : {
     153           0 :     if ( !aCharFmtDep.GetRegisteredIn() )
     154             :     {
     155             :         SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
     156           0 :             m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) );
     157           0 :         pFmt->Add( &((SwClient&)aCharFmtDep) );
     158             :     }
     159           0 :     return (SwCharFmt*)aCharFmtDep.GetRegisteredIn();
     160             : }
     161             : 
     162           0 : void SwEndNoteInfo::SetCharFmt( SwCharFmt* pChFmt )
     163             : {
     164             :     OSL_ENSURE(pChFmt, "no CharFmt?");
     165           0 :     pChFmt->Add( &((SwClient&)aCharFmtDep) );
     166           0 : }
     167             : 
     168           0 : SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const
     169             : {
     170           0 :     if( !aAnchorCharFmtDep.GetRegisteredIn() )
     171             :     {
     172             :         SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
     173           0 :             m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) );
     174           0 :         pFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
     175             :     }
     176           0 :     return (SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn();
     177             : }
     178             : 
     179           0 : void SwEndNoteInfo::SetAnchorCharFmt( SwCharFmt* pChFmt )
     180             : {
     181             :     OSL_ENSURE(pChFmt, "no CharFmt?");
     182           0 :     pChFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
     183           0 : }
     184             : 
     185           0 : void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
     186             : {
     187           0 :     sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
     188             : 
     189           0 :     if( RES_ATTRSET_CHG == nWhich ||
     190             :         RES_FMT_CHG == nWhich )
     191             :     {
     192             :         SwDoc* pDoc;
     193           0 :         if( aCharFmtDep.GetRegisteredIn() )
     194           0 :             pDoc = ((SwCharFmt*)aCharFmtDep.GetRegisteredIn())->GetDoc();
     195             :         else
     196           0 :             pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc();
     197           0 :         SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs();
     198           0 :         for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
     199             :         {
     200           0 :             SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
     201           0 :             const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
     202           0 :             if ( rFtn.IsEndNote() == m_bEndNote )
     203             :             {
     204           0 :                 pTxtFtn->SetNumber(rFtn.GetNumber(), rFtn.GetNumStr());
     205             :             }
     206           0 :         }
     207             :     }
     208             :     else
     209           0 :         CheckRegistration( pOld, pNew );
     210           0 : }
     211             : 
     212             : /*********************** SwFtnInfo ***************************/
     213             : 
     214           0 : SwFtnInfo& SwFtnInfo::operator=(const SwFtnInfo& rInfo)
     215             : {
     216           0 :     SwEndNoteInfo::operator=(rInfo);
     217           0 :     aQuoVadis =  rInfo.aQuoVadis;
     218           0 :     aErgoSum = rInfo.aErgoSum;
     219           0 :     ePos = rInfo.ePos;
     220           0 :     eNum = rInfo.eNum;
     221           0 :     return *this;
     222             : }
     223             : 
     224           0 : bool SwFtnInfo::operator==( const SwFtnInfo& rInfo ) const
     225             : {
     226           0 :     return  ePos == rInfo.ePos &&
     227           0 :             eNum == rInfo.eNum &&
     228           0 :             SwEndNoteInfo::operator==(rInfo) &&
     229           0 :             aQuoVadis == rInfo.aQuoVadis &&
     230           0 :             aErgoSum == rInfo.aErgoSum;
     231             : }
     232             : 
     233           0 : SwFtnInfo::SwFtnInfo(const SwFtnInfo& rInfo) :
     234             :     SwEndNoteInfo( rInfo ),
     235             :     aQuoVadis( rInfo.aQuoVadis ),
     236             :     aErgoSum( rInfo.aErgoSum ),
     237             :     ePos( rInfo.ePos ),
     238           0 :     eNum( rInfo.eNum )
     239             : {
     240           0 :     m_bEndNote = false;
     241           0 : }
     242             : 
     243           0 : SwFtnInfo::SwFtnInfo(SwTxtFmtColl *pFmt) :
     244             :     SwEndNoteInfo( pFmt ),
     245             :     ePos( FTNPOS_PAGE ),
     246           0 :     eNum( FTNNUM_DOC )
     247             : {
     248           0 :     aFmt.SetNumberingType(SVX_NUM_ARABIC);
     249           0 :     m_bEndNote = false;
     250           0 : }
     251             : 
     252             : /*********************** SwDoc ***************************/
     253             : 
     254           0 : void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo)
     255             : {
     256           0 :     SwRootFrm* pTmpRoot = GetCurrentLayout();
     257           0 :     if( !(GetFtnInfo() == rInfo) )
     258             :     {
     259           0 :         const SwFtnInfo &rOld = GetFtnInfo();
     260             : 
     261           0 :         if (GetIDocumentUndoRedo().DoesUndo())
     262             :         {
     263           0 :             GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld) );
     264             :         }
     265             : 
     266           0 :         bool bFtnPos  = rInfo.ePos != rOld.ePos;
     267           0 :         bool bFtnDesc = rOld.ePos == FTNPOS_CHAPTER &&
     268           0 :                             rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this );
     269           0 :         bool bExtra   = rInfo.aQuoVadis != rOld.aQuoVadis ||
     270           0 :                             rInfo.aErgoSum != rOld.aErgoSum ||
     271           0 :                             rInfo.aFmt.GetNumberingType() != rOld.aFmt.GetNumberingType() ||
     272           0 :                             rInfo.GetPrefix() != rOld.GetPrefix() ||
     273           0 :                             rInfo.GetSuffix() != rOld.GetSuffix();
     274           0 :         SwCharFmt *pOldChrFmt = rOld.GetCharFmt( *this ),
     275           0 :                   *pNewChrFmt = rInfo.GetCharFmt( *this );
     276           0 :         bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
     277             : 
     278           0 :         *mpFtnInfo = rInfo;
     279             : 
     280           0 :         if (pTmpRoot)
     281             :         {
     282           0 :             std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
     283           0 :             if ( bFtnPos )
     284           0 :                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllRemoveFtns));
     285             :             else
     286             :             {
     287           0 :                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::UpdateFtnNums));
     288           0 :                 if ( bFtnDesc )
     289           0 :                     std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::CheckFtnPageDescs), sal_False));
     290           0 :                 if ( bExtra )
     291             :                 {
     292             :                     // For messages regarding ErgoSum etc. we save the extra code and use the
     293             :                     // available methods.
     294           0 :                     SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
     295           0 :                     for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
     296             :                     {
     297           0 :                         SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
     298           0 :                         const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
     299           0 :                         if ( !rFtn.IsEndNote() )
     300           0 :                             pTxtFtn->SetNumber(rFtn.GetNumber(), rFtn.GetNumStr());
     301             :                     }
     302             :                 }
     303           0 :             }
     304             :         }
     305           0 :         if( FTNNUM_PAGE != rInfo.eNum )
     306           0 :             GetFtnIdxs().UpdateAllFtn();
     307           0 :         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           0 :         if ( !IsInReading() )
     316             :         {
     317           0 :             UpdateRefFlds(NULL);
     318             :         }
     319           0 :         SetModified();
     320             :     }
     321           0 : }
     322             : 
     323           0 : void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
     324             : {
     325           0 :     SwRootFrm* pTmpRoot = GetCurrentLayout();
     326           0 :     if( !(GetEndNoteInfo() == rInfo) )
     327             :     {
     328           0 :         if(GetIDocumentUndoRedo().DoesUndo())
     329             :         {
     330           0 :             SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) );
     331           0 :             GetIDocumentUndoRedo().AppendUndo(pUndo);
     332             :         }
     333             : 
     334           0 :         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           0 :         bool const bExtra = !bNumChg &&
     339           0 :                 (   (rInfo.aFmt.GetNumberingType() !=
     340           0 :                         GetEndNoteInfo().aFmt.GetNumberingType())
     341           0 :                 ||  (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix())
     342           0 :                 ||  (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix())
     343           0 :                 );
     344           0 :         bool bFtnDesc = rInfo.GetPageDesc( *this ) !=
     345           0 :                             GetEndNoteInfo().GetPageDesc( *this );
     346           0 :         SwCharFmt *pOldChrFmt = GetEndNoteInfo().GetCharFmt( *this ),
     347           0 :                   *pNewChrFmt = rInfo.GetCharFmt( *this );
     348           0 :         bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
     349             : 
     350           0 :         *mpEndNoteInfo = rInfo;
     351             : 
     352           0 :         if ( pTmpRoot )
     353             :         {
     354           0 :             if ( bFtnDesc )
     355             :             {
     356           0 :                 std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
     357           0 :                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::CheckFtnPageDescs), sal_True));
     358             :             }
     359           0 :             if ( bExtra )
     360             :             {
     361             :                 // For messages regarding ErgoSum etc. we save the extra code and use the
     362             :                 // available methods.
     363           0 :                 SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
     364           0 :                 for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
     365             :                 {
     366           0 :                     SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
     367           0 :                     const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
     368           0 :                     if ( rFtn.IsEndNote() )
     369           0 :                         pTxtFtn->SetNumber(rFtn.GetNumber(), rFtn.GetNumStr());
     370             :                 }
     371             :             }
     372             :         }
     373           0 :         if( bNumChg )
     374           0 :             GetFtnIdxs().UpdateAllFtn();
     375           0 :         else if( bFtnChrFmts )
     376             :         {
     377           0 :             SwFmtChg aOld( pOldChrFmt );
     378           0 :             SwFmtChg aNew( pNewChrFmt );
     379           0 :             mpEndNoteInfo->ModifyNotification( &aOld, &aNew );
     380             :         }
     381             : 
     382             :         // #i81002# no update during loading
     383           0 :         if ( !IsInReading() )
     384             :         {
     385           0 :             UpdateRefFlds(NULL);
     386             :         }
     387           0 :         SetModified();
     388             :     }
     389           0 : }
     390             : 
     391           0 : bool SwDoc::SetCurFtn( const SwPaM& rPam, const OUString& rNumStr,
     392             :                        sal_uInt16 nNumber, bool bIsEndNote )
     393             : {
     394           0 :     SwFtnIdxs& rFtnArr = GetFtnIdxs();
     395           0 :     SwRootFrm* pTmpRoot = GetCurrentLayout();
     396             : 
     397           0 :     const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
     398           0 :     const sal_uLong nSttNd = pStt->nNode.GetIndex();
     399           0 :     const sal_Int32 nSttCnt = pStt->nContent.GetIndex();
     400           0 :     const sal_uLong nEndNd = pEnd->nNode.GetIndex();
     401           0 :     const sal_Int32 nEndCnt = pEnd->nContent.GetIndex();
     402             : 
     403             :     sal_uInt16 nPos;
     404           0 :     rFtnArr.SeekEntry( pStt->nNode, &nPos );
     405             : 
     406           0 :     SwUndoChangeFootNote* pUndo = 0;
     407           0 :     if (GetIDocumentUndoRedo().DoesUndo())
     408             :     {
     409           0 :         GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it
     410           0 :         pUndo = new SwUndoChangeFootNote( rPam, rNumStr, nNumber, bIsEndNote );
     411             :     }
     412             : 
     413             :     SwTxtFtn* pTxtFtn;
     414             :     sal_uLong nIdx;
     415           0 :     bool bChg = false;
     416           0 :     bool bTypeChgd = false;
     417           0 :     sal_uInt16 n = nPos;        // save
     418           0 :     while( nPos < rFtnArr.size() &&
     419           0 :             (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ nPos++ ] )))
     420           0 :                 < nEndNd || ( nIdx == nEndNd &&
     421           0 :                 nEndCnt >= *pTxtFtn->GetStart() )) )
     422           0 :         if( nIdx > nSttNd || ( nIdx == nSttNd &&
     423           0 :                 nSttCnt <= *pTxtFtn->GetStart() ) )
     424             :         {
     425           0 :             const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
     426           0 :             if( rFtn.GetNumStr() != rNumStr ||
     427           0 :                 rFtn.IsEndNote() != bIsEndNote )
     428             :             {
     429           0 :                 bChg = true;
     430           0 :                 if ( pUndo )
     431             :                 {
     432           0 :                     pUndo->GetHistory().Add( *pTxtFtn );
     433             :                 }
     434             : 
     435           0 :                 pTxtFtn->SetNumber( nNumber, rNumStr );
     436           0 :                 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           0 :     nPos = n;       // There are more in the front!
     449           0 :     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           0 :     if( bChg )
     478             :     {
     479           0 :         if( pUndo )
     480             :         {
     481           0 :             GetIDocumentUndoRedo().AppendUndo(pUndo);
     482             :         }
     483             : 
     484           0 :         if ( bTypeChgd )
     485           0 :             rFtnArr.UpdateAllFtn();
     486           0 :         if( FTNNUM_PAGE != GetFtnInfo().eNum )
     487             :         {
     488           0 :             if ( !bTypeChgd )
     489           0 :                 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           0 :         SetModified();
     497             :     }
     498             :     else
     499           0 :         delete pUndo;
     500           0 :     return bChg;
     501             : }
     502             : 
     503             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10