xref: /trunk/main/sw/source/core/doc/docftn.cxx (revision 3ce6c2dd3860afd353ceca3849779821e9b9f6f5)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 
28 #include <ftnidx.hxx>
29 #include <rootfrm.hxx>
30 #include <txtftn.hxx>
31 #include <fmtftn.hxx>
32 #include <pam.hxx>
33 #include <pagedesc.hxx>
34 #include <charfmt.hxx>
35 #include <UndoAttribute.hxx>
36 #include <hints.hxx>
37 #include <rolbck.hxx>
38 #include <doc.hxx>
39 #include <IDocumentUndoRedo.hxx>
40 #include <ndtxt.hxx>
41 #include <poolfmt.hxx>
42 #include <ftninfo.hxx>
43 #include <functional>
44 
45 /*********************** SwFtnInfo ***************************/
46 
operator =(const SwEndNoteInfo & rInfo)47 SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
48 {
49     if( rInfo.GetFtnTxtColl() )
50         rInfo.GetFtnTxtColl()->Add(this);
51     else if ( GetRegisteredIn())
52         GetRegisteredInNonConst()->Remove(this);
53 
54     if ( rInfo.aPageDescDep.GetRegisteredIn() )
55         ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
56     else if ( aPageDescDep.GetRegisteredIn() )
57         ((SwModify*)aPageDescDep.GetRegisteredIn())->Remove( &aPageDescDep );
58 
59     if ( rInfo.aCharFmtDep.GetRegisteredIn() )
60         ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
61     else if ( aCharFmtDep.GetRegisteredIn() )
62         ((SwModify*)aCharFmtDep.GetRegisteredIn())->Remove( &aCharFmtDep );
63 
64     if ( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
65         ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
66                                                     &aAnchorCharFmtDep );
67     else if( aAnchorCharFmtDep.GetRegisteredIn() )
68         ((SwModify*)aAnchorCharFmtDep.GetRegisteredIn())->Remove(
69                                                     &aAnchorCharFmtDep );
70 
71     aFmt = rInfo.aFmt;
72     nFtnOffset = rInfo.nFtnOffset;
73     m_bEndNote = rInfo.m_bEndNote;
74     sPrefix = rInfo.sPrefix;
75     sSuffix = rInfo.sSuffix;
76     return *this;
77 }
78 
79 
operator ==(const SwEndNoteInfo & rInfo) const80 sal_Bool SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const
81 {
82     return  aPageDescDep.GetRegisteredIn() ==
83                                 rInfo.aPageDescDep.GetRegisteredIn() &&
84             aCharFmtDep.GetRegisteredIn() ==
85                                 rInfo.aCharFmtDep.GetRegisteredIn() &&
86             aAnchorCharFmtDep.GetRegisteredIn() ==
87                                 rInfo.aAnchorCharFmtDep.GetRegisteredIn() &&
88             GetFtnTxtColl() == rInfo.GetFtnTxtColl() &&
89             aFmt.GetNumberingType() == rInfo.aFmt.GetNumberingType() &&
90             nFtnOffset == rInfo.nFtnOffset &&
91             m_bEndNote == rInfo.m_bEndNote &&
92             sPrefix == rInfo.sPrefix &&
93             sSuffix == rInfo.sSuffix;
94 }
95 
96 
SwEndNoteInfo(const SwEndNoteInfo & rInfo)97 SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
98     SwClient( rInfo.GetFtnTxtColl() ),
99     aPageDescDep( this, 0 ),
100     aCharFmtDep( this, 0 ),
101     aAnchorCharFmtDep( this, 0 ),
102     sPrefix( rInfo.sPrefix ),
103     sSuffix( rInfo.sSuffix ),
104     m_bEndNote( true ),
105     aFmt( rInfo.aFmt ),
106     nFtnOffset( rInfo.nFtnOffset )
107 {
108     if( rInfo.aPageDescDep.GetRegisteredIn() )
109         ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
110 
111     if( rInfo.aCharFmtDep.GetRegisteredIn() )
112         ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
113 
114     if( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
115         ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
116                 &aAnchorCharFmtDep );
117 }
118 
SwEndNoteInfo(SwTxtFmtColl * pFmt)119 SwEndNoteInfo::SwEndNoteInfo(SwTxtFmtColl *pFmt) :
120     SwClient(pFmt),
121     aPageDescDep( this, 0 ),
122     aCharFmtDep( this, 0 ),
123     aAnchorCharFmtDep( this, 0 ),
124     m_bEndNote( true ),
125     nFtnOffset( 0 )
126 {
127     aFmt.SetNumberingType(SVX_NUM_ROMAN_LOWER);
128 }
129 
GetPageDesc(SwDoc & rDoc) const130 SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const
131 {
132     if ( !aPageDescDep.GetRegisteredIn() )
133     {
134         SwPageDesc *pDesc = rDoc.GetPageDescFromPool( static_cast<sal_uInt16>(
135             m_bEndNote ? RES_POOLPAGE_ENDNOTE   : RES_POOLPAGE_FOOTNOTE ) );
136         pDesc->Add( &((SwClient&)aPageDescDep) );
137     }
138 
139     return (SwPageDesc*)( aPageDescDep.GetRegisteredIn() );
140 }
141 
KnowsPageDesc() const142 bool SwEndNoteInfo::KnowsPageDesc() const
143 {
144     return (aPageDescDep.GetRegisteredIn() != 0);
145 }
146 
DependsOn(const SwPageDesc * pDesc) const147 bool SwEndNoteInfo::DependsOn( const SwPageDesc* pDesc ) const
148 {
149     return ( aPageDescDep.GetRegisteredIn() == pDesc );
150 }
151 
ChgPageDesc(SwPageDesc * pDesc)152 void SwEndNoteInfo::ChgPageDesc( SwPageDesc *pDesc )
153 {
154     pDesc->Add( &((SwClient&)aPageDescDep) );
155 }
156 
SetFtnTxtColl(SwTxtFmtColl & rFmt)157 void SwEndNoteInfo::SetFtnTxtColl(SwTxtFmtColl& rFmt)
158 {
159     rFmt.Add(this);
160 }
161 
GetCharFmt(SwDoc & rDoc) const162 SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const
163 {
164     if ( !aCharFmtDep.GetRegisteredIn() )
165     {
166         SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
167             m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) );
168         pFmt->Add( &((SwClient&)aCharFmtDep) );
169     }
170     return (SwCharFmt*)aCharFmtDep.GetRegisteredIn();
171 }
172 
SetCharFmt(SwCharFmt * pChFmt)173 void SwEndNoteInfo::SetCharFmt( SwCharFmt* pChFmt )
174 {
175     DBG_ASSERT(pChFmt, "kein CharFmt?");
176     pChFmt->Add( &((SwClient&)aCharFmtDep) );
177 }
178 
GetAnchorCharFmt(SwDoc & rDoc) const179 SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const
180 {
181     if( !aAnchorCharFmtDep.GetRegisteredIn() )
182     {
183         SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
184             m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) );
185         pFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
186     }
187     return (SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn();
188 }
189 
SetAnchorCharFmt(SwCharFmt * pChFmt)190 void SwEndNoteInfo::SetAnchorCharFmt( SwCharFmt* pChFmt )
191 {
192     DBG_ASSERT(pChFmt, "kein CharFmt?");
193     pChFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
194 }
195 
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)196 void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
197 {
198     sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
199 
200     if( RES_ATTRSET_CHG == nWhich ||
201         RES_FMT_CHG == nWhich )
202     {
203         SwDoc* pDoc;
204         if( aCharFmtDep.GetRegisteredIn() )
205             pDoc = ((SwCharFmt*)aCharFmtDep.GetRegisteredIn())->GetDoc();
206         else
207             pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc();
208         SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs();
209         for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
210         {
211             SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
212             const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
213             if ( rFtn.IsEndNote() == m_bEndNote )
214             {
215                 pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
216             }
217         }
218     }
219     else
220         CheckRegistration( pOld, pNew );
221 }
222 
operator =(const SwFtnInfo & rInfo)223 SwFtnInfo& SwFtnInfo::operator=(const SwFtnInfo& rInfo)
224 {
225     SwEndNoteInfo::operator=(rInfo);
226     aQuoVadis =  rInfo.aQuoVadis;
227     aErgoSum = rInfo.aErgoSum;
228     ePos = rInfo.ePos;
229     eNum = rInfo.eNum;
230     return *this;
231 }
232 
233 
operator ==(const SwFtnInfo & rInfo) const234 sal_Bool SwFtnInfo::operator==( const SwFtnInfo& rInfo ) const
235 {
236     return  ePos == rInfo.ePos &&
237             eNum == rInfo.eNum &&
238             SwEndNoteInfo::operator==(rInfo) &&
239             aQuoVadis == rInfo.aQuoVadis &&
240             aErgoSum == rInfo.aErgoSum;
241 }
242 
243 
SwFtnInfo(const SwFtnInfo & rInfo)244 SwFtnInfo::SwFtnInfo(const SwFtnInfo& rInfo) :
245     SwEndNoteInfo( rInfo ),
246     aQuoVadis( rInfo.aQuoVadis ),
247     aErgoSum( rInfo.aErgoSum ),
248     ePos( rInfo.ePos ),
249     eNum( rInfo.eNum )
250 {
251     m_bEndNote = false;
252 }
253 
SwFtnInfo(SwTxtFmtColl * pFmt)254 SwFtnInfo::SwFtnInfo(SwTxtFmtColl *pFmt) :
255     SwEndNoteInfo( pFmt ),
256     ePos( FTNPOS_PAGE ),
257     eNum( FTNNUM_DOC )
258 {
259     aFmt.SetNumberingType(SVX_NUM_ARABIC);
260     m_bEndNote = false;
261 }
262 
263 /*********************** SwDoc ***************************/
264 
265 
SetFtnInfo(const SwFtnInfo & rInfo)266 void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo)
267 {
268     SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
269     if( !(GetFtnInfo() == rInfo) )
270     {
271         const SwFtnInfo &rOld = GetFtnInfo();
272 
273         if (GetIDocumentUndoRedo().DoesUndo())
274         {
275             GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld) );
276         }
277 
278         sal_Bool bFtnPos  = rInfo.ePos != rOld.ePos;
279         sal_Bool bFtnDesc = rOld.ePos == FTNPOS_CHAPTER &&
280                             rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this );
281         sal_Bool bExtra   = rInfo.aQuoVadis != rOld.aQuoVadis ||
282                             rInfo.aErgoSum != rOld.aErgoSum ||
283                             rInfo.aFmt.GetNumberingType() != rOld.aFmt.GetNumberingType() ||
284                             rInfo.GetPrefix() != rOld.GetPrefix() ||
285                             rInfo.GetSuffix() != rOld.GetSuffix();
286         SwCharFmt *pOldChrFmt = rOld.GetCharFmt( *this ),
287                   *pNewChrFmt = rInfo.GetCharFmt( *this );
288         sal_Bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
289 
290         *pFtnInfo = rInfo;
291 
292         if (pTmpRoot)
293         {
294             std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();//swmod 080304
295             if ( bFtnPos )
296                 //pTmpRoot->RemoveFtns();
297                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fn(&SwRootFrm::AllRemoveFtns));//swmod 080305
298             else
299             {
300                 //pTmpRoot->UpdateFtnNums();
301                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fn(&SwRootFrm::UpdateFtnNums));//swmod 080304
302                 if ( bFtnDesc )
303                     //pTmpRoot->CheckFtnPageDescs( FALSE );
304                     std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind(std::mem_fn(&SwRootFrm::CheckFtnPageDescs), std::placeholders::_1, sal_False));//swmod 080304
305                 if ( bExtra )
306                 {
307                     //Fuer die Benachrichtung bezueglich ErgoSum usw. sparen wir uns
308                     //extra-Code und nutzen die vorhandenen Wege.
309                     SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
310                     for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
311                     {
312                         SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
313                         const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
314                         if ( !rFtn.IsEndNote() )
315                             pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
316                     }
317                 }
318             }
319         }   //swmod 080219
320         if( FTNNUM_PAGE != rInfo.eNum )
321             GetFtnIdxs().UpdateAllFtn();
322         else if( bFtnChrFmts )
323         {
324             SwFmtChg aOld( pOldChrFmt );
325             SwFmtChg aNew( pNewChrFmt );
326             pFtnInfo->ModifyNotification( &aOld, &aNew );
327         }
328 
329         // --> OD 2008-01-09 #i81002#
330         // no update during loading
331         if ( !IsInReading() )
332         {
333             UpdateRefFlds(NULL);
334         }
335         SetModified();
336     }
337 }
338 
SetEndNoteInfo(const SwEndNoteInfo & rInfo)339 void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
340 {
341     SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
342     if( !(GetEndNoteInfo() == rInfo) )
343     {
344         if(GetIDocumentUndoRedo().DoesUndo())
345         {
346             SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) );
347             GetIDocumentUndoRedo().AppendUndo(pUndo);
348         }
349 
350         sal_Bool bNumChg  = rInfo.nFtnOffset != GetEndNoteInfo().nFtnOffset;
351         // this seems to be an optimization: UpdateAllFtn() is only called
352         // if the offset changes; if the offset is the same,
353         // but type/prefix/suffix changes, just set new numbers.
354         bool const bExtra = !bNumChg &&
355                 (   (rInfo.aFmt.GetNumberingType() !=
356                         GetEndNoteInfo().aFmt.GetNumberingType())
357                 ||  (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix())
358                 ||  (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix())
359                 );
360         sal_Bool bFtnDesc = rInfo.GetPageDesc( *this ) !=
361                             GetEndNoteInfo().GetPageDesc( *this );
362         SwCharFmt *pOldChrFmt = GetEndNoteInfo().GetCharFmt( *this ),
363                   *pNewChrFmt = rInfo.GetCharFmt( *this );
364         sal_Bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
365 
366         *pEndNoteInfo = rInfo;
367 
368         if ( pTmpRoot )
369         {
370             if ( bFtnDesc )
371                 //pTmpRoot->CheckFtnPageDescs( TRUE );
372             {
373                 std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
374                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind(std::mem_fn(&SwRootFrm::CheckFtnPageDescs), std::placeholders::_1, sal_True));//swmod 080304
375             }
376             if ( bExtra )
377             {
378                 //Fuer die Benachrichtung bezueglich ErgoSum usw. sparen wir uns
379                 //extra-Code und nutzen die vorhandenen Wege.
380                 SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
381                 for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
382                 {
383                     SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
384                     const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
385                     if ( rFtn.IsEndNote() )
386                         pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
387                 }
388             }
389         }   //swmod 080219
390         if( bNumChg )
391             GetFtnIdxs().UpdateAllFtn();
392         else if( bFtnChrFmts )
393         {
394             SwFmtChg aOld( pOldChrFmt );
395             SwFmtChg aNew( pNewChrFmt );
396             pEndNoteInfo->ModifyNotification( &aOld, &aNew );
397         }
398 
399         // --> OD 2008-01-09 #i81002#
400         // no update during loading
401         if ( !IsInReading() )
402         {
403             UpdateRefFlds(NULL);
404         }
405         SetModified();
406     }
407 }
408 
409 
SetCurFtn(const SwPaM & rPam,const String & rNumStr,sal_uInt16 nNumber,bool bIsEndNote)410 bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
411                        sal_uInt16 nNumber, bool bIsEndNote )
412 {
413     SwFtnIdxs& rFtnArr = GetFtnIdxs();
414     SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
415 
416     const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
417     const sal_uLong nSttNd = pStt->nNode.GetIndex();
418     const xub_StrLen nSttCnt = pStt->nContent.GetIndex();
419     const sal_uLong nEndNd = pEnd->nNode.GetIndex();
420     const xub_StrLen nEndCnt = pEnd->nContent.GetIndex();
421 
422     sal_uInt16 nPos;
423     rFtnArr.SeekEntry( pStt->nNode, &nPos );
424 
425     SwUndoChangeFootNote* pUndo = 0;
426     if (GetIDocumentUndoRedo().DoesUndo())
427     {
428         GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it
429         pUndo = new SwUndoChangeFootNote( rPam, rNumStr, nNumber, bIsEndNote );
430     }
431 
432     SwTxtFtn* pTxtFtn;
433     sal_uLong nIdx;
434     sal_Bool bChg = sal_False;
435     sal_Bool bTypeChgd = sal_False;
436     sal_uInt16 n = nPos;        // sichern
437     while( nPos < rFtnArr.Count() &&
438             (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ nPos++ ] )))
439                 < nEndNd || ( nIdx == nEndNd &&
440                 nEndCnt >= *pTxtFtn->GetStart() )) )
441         if( nIdx > nSttNd || ( nIdx == nSttNd &&
442                 nSttCnt <= *pTxtFtn->GetStart() ) )
443         {
444             const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
445             if( /*rFtn.GetNumber() != nNumber ||*/
446                 rFtn.GetNumStr() != rNumStr ||
447                 rFtn.IsEndNote() != bIsEndNote )
448             {
449                 bChg = sal_True;
450                 if ( pUndo )
451                 {
452                     pUndo->GetHistory().Add( *pTxtFtn );
453                 }
454 
455                 pTxtFtn->SetNumber( nNumber, &rNumStr );
456                 if( rFtn.IsEndNote() != bIsEndNote )
457                 {
458                     ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote );
459                     bTypeChgd = sal_True;
460                     pTxtFtn->CheckCondColl();
461                     //#i11339# dispose UNO wrapper when a footnote is changed to an endnote or vice versa
462                     SwPtrMsgPoolItem aMsgHint( RES_FOOTNOTE_DELETED, (void*)&pTxtFtn->GetAttr() );
463                     GetUnoCallBack()->ModifyNotification( &aMsgHint, &aMsgHint );
464                 }
465             }
466         }
467 
468     nPos = n;       // nach vorne gibt es auch noch welche !
469     while( nPos &&
470             (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ --nPos ] )))
471                 > nSttNd || ( nIdx == nSttNd &&
472                 nSttCnt <= *pTxtFtn->GetStart() )) )
473         if( nIdx < nEndNd || ( nIdx == nEndNd &&
474             nEndCnt >= *pTxtFtn->GetStart() ) )
475         {
476             const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
477             if( /*rFtn.GetNumber() != nNumber ||*/
478                 rFtn.GetNumStr() != rNumStr ||
479                 rFtn.IsEndNote() != bIsEndNote )
480             {
481                 bChg = sal_True;
482                 if ( pUndo )
483                 {
484                     pUndo->GetHistory().Add( *pTxtFtn );
485                 }
486 
487                 pTxtFtn->SetNumber( nNumber, &rNumStr );
488                 if( rFtn.IsEndNote() != bIsEndNote )
489                 {
490                     ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote );
491                     bTypeChgd = sal_True;
492                     pTxtFtn->CheckCondColl();
493                 }
494             }
495         }
496 
497     // wer muss angestossen werden ??
498     if( bChg )
499     {
500         if( pUndo )
501         {
502             GetIDocumentUndoRedo().AppendUndo(pUndo);
503         }
504 
505         if ( bTypeChgd )
506             rFtnArr.UpdateAllFtn();
507         if( FTNNUM_PAGE != GetFtnInfo().eNum )
508         {
509             if ( !bTypeChgd )
510                 rFtnArr.UpdateAllFtn();
511         }
512         else if( pTmpRoot )
513             //
514         {
515             std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
516             std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fn(&SwRootFrm::UpdateFtnNums));
517         }   //swmod 080304pTmpRoot->UpdateFtnNums();    //swmod 080219
518         SetModified();
519     }
520     else
521         delete pUndo;
522     return bChg;
523 }
524