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 22 : SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
39 : {
40 22 : if( rInfo.GetFtnTxtColl() )
41 4 : rInfo.GetFtnTxtColl()->Add(this);
42 18 : else if ( GetRegisteredIn())
43 0 : GetRegisteredInNonConst()->Remove(this);
44 :
45 22 : if ( rInfo.aPageDescDep.GetRegisteredIn() )
46 12 : ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
47 10 : else if ( aPageDescDep.GetRegisteredIn() )
48 0 : ((SwModify*)aPageDescDep.GetRegisteredIn())->Remove( &aPageDescDep );
49 :
50 22 : if ( rInfo.aCharFmtDep.GetRegisteredIn() )
51 20 : ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
52 2 : else if ( aCharFmtDep.GetRegisteredIn() )
53 0 : ((SwModify*)aCharFmtDep.GetRegisteredIn())->Remove( &aCharFmtDep );
54 :
55 22 : if ( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
56 12 : ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
57 24 : &aAnchorCharFmtDep );
58 10 : else if( aAnchorCharFmtDep.GetRegisteredIn() )
59 0 : ((SwModify*)aAnchorCharFmtDep.GetRegisteredIn())->Remove(
60 0 : &aAnchorCharFmtDep );
61 :
62 22 : aFmt = rInfo.aFmt;
63 22 : nFtnOffset = rInfo.nFtnOffset;
64 22 : m_bEndNote = rInfo.m_bEndNote;
65 22 : sPrefix = rInfo.sPrefix;
66 22 : sSuffix = rInfo.sSuffix;
67 22 : return *this;
68 : }
69 :
70 :
71 1094 : bool SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const
72 : {
73 1094 : return aPageDescDep.GetRegisteredIn() ==
74 1094 : rInfo.aPageDescDep.GetRegisteredIn() &&
75 1092 : aCharFmtDep.GetRegisteredIn() ==
76 1092 : rInfo.aCharFmtDep.GetRegisteredIn() &&
77 1086 : aAnchorCharFmtDep.GetRegisteredIn() ==
78 1086 : rInfo.aAnchorCharFmtDep.GetRegisteredIn() &&
79 1080 : GetFtnTxtColl() == rInfo.GetFtnTxtColl() &&
80 1078 : aFmt.GetNumberingType() == rInfo.aFmt.GetNumberingType() &&
81 : nFtnOffset == rInfo.nFtnOffset &&
82 : m_bEndNote == rInfo.m_bEndNote &&
83 1076 : sPrefix == rInfo.sPrefix &&
84 6506 : sSuffix == rInfo.sSuffix;
85 : }
86 :
87 :
88 1092 : SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
89 1092 : 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 1092 : nFtnOffset( rInfo.nFtnOffset )
98 : {
99 1092 : if( rInfo.aPageDescDep.GetRegisteredIn() )
100 32 : ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
101 :
102 1092 : if( rInfo.aCharFmtDep.GetRegisteredIn() )
103 54 : ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
104 :
105 1092 : if( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
106 46 : ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
107 92 : &aAnchorCharFmtDep );
108 1092 : }
109 :
110 1118 : SwEndNoteInfo::SwEndNoteInfo(SwTxtFmtColl *pFmt) :
111 : SwClient(pFmt),
112 : aPageDescDep( this, 0 ),
113 : aCharFmtDep( this, 0 ),
114 : aAnchorCharFmtDep( this, 0 ),
115 : m_bEndNote( true ),
116 1118 : nFtnOffset( 0 )
117 : {
118 1118 : aFmt.SetNumberingType(SVX_NUM_ROMAN_LOWER);
119 1118 : }
120 :
121 12 : SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const
122 : {
123 12 : if ( !aPageDescDep.GetRegisteredIn() )
124 : {
125 : SwPageDesc *pDesc = rDoc.GetPageDescFromPool( static_cast<sal_uInt16>(
126 8 : m_bEndNote ? RES_POOLPAGE_ENDNOTE : RES_POOLPAGE_FOOTNOTE ) );
127 8 : pDesc->Add( &((SwClient&)aPageDescDep) );
128 : }
129 :
130 12 : return (SwPageDesc*)( aPageDescDep.GetRegisteredIn() );
131 : }
132 :
133 8 : bool SwEndNoteInfo::KnowsPageDesc() const
134 : {
135 8 : return (aPageDescDep.GetRegisteredIn() != 0);
136 : }
137 :
138 1660 : bool SwEndNoteInfo::DependsOn( const SwPageDesc* pDesc ) const
139 : {
140 1660 : return ( aPageDescDep.GetRegisteredIn() == pDesc );
141 : }
142 :
143 4 : void SwEndNoteInfo::ChgPageDesc( SwPageDesc *pDesc )
144 : {
145 4 : pDesc->Add( &((SwClient&)aPageDescDep) );
146 4 : }
147 :
148 2 : void SwEndNoteInfo::SetFtnTxtColl(SwTxtFmtColl& rFmt)
149 : {
150 2 : rFmt.Add(this);
151 2 : }
152 :
153 62 : SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const
154 : {
155 62 : if ( !aCharFmtDep.GetRegisteredIn() )
156 : {
157 : SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
158 18 : m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) );
159 18 : pFmt->Add( &((SwClient&)aCharFmtDep) );
160 : }
161 62 : return (SwCharFmt*)aCharFmtDep.GetRegisteredIn();
162 : }
163 :
164 6 : void SwEndNoteInfo::SetCharFmt( SwCharFmt* pChFmt )
165 : {
166 : OSL_ENSURE(pChFmt, "no CharFmt?");
167 6 : pChFmt->Add( &((SwClient&)aCharFmtDep) );
168 6 : }
169 :
170 48 : SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const
171 : {
172 48 : if( !aAnchorCharFmtDep.GetRegisteredIn() )
173 : {
174 : SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>(
175 8 : m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) );
176 8 : pFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
177 : }
178 48 : return (SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn();
179 : }
180 :
181 6 : void SwEndNoteInfo::SetAnchorCharFmt( SwCharFmt* pChFmt )
182 : {
183 : OSL_ENSURE(pChFmt, "no CharFmt?");
184 6 : pChFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
185 6 : }
186 :
187 4 : void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
188 : {
189 4 : sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
190 :
191 4 : if( RES_ATTRSET_CHG == nWhich ||
192 : RES_FMT_CHG == nWhich )
193 : {
194 : SwDoc* pDoc;
195 4 : if( aCharFmtDep.GetRegisteredIn() )
196 4 : pDoc = ((SwCharFmt*)aCharFmtDep.GetRegisteredIn())->GetDoc();
197 : else
198 0 : pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc();
199 4 : SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs();
200 4 : for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
201 : {
202 0 : SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
203 0 : const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
204 0 : if ( rFtn.IsEndNote() == m_bEndNote )
205 : {
206 0 : pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
207 : }
208 4 : }
209 : }
210 : else
211 0 : CheckRegistration( pOld, pNew );
212 4 : }
213 :
214 16 : SwFtnInfo& SwFtnInfo::operator=(const SwFtnInfo& rInfo)
215 : {
216 16 : SwEndNoteInfo::operator=(rInfo);
217 16 : aQuoVadis = rInfo.aQuoVadis;
218 16 : aErgoSum = rInfo.aErgoSum;
219 16 : ePos = rInfo.ePos;
220 16 : eNum = rInfo.eNum;
221 16 : return *this;
222 : }
223 :
224 :
225 684 : bool SwFtnInfo::operator==( const SwFtnInfo& rInfo ) const
226 : {
227 : return ePos == rInfo.ePos &&
228 : eNum == rInfo.eNum &&
229 684 : SwEndNoteInfo::operator==(rInfo) &&
230 670 : aQuoVadis == rInfo.aQuoVadis &&
231 2038 : aErgoSum == rInfo.aErgoSum;
232 : }
233 :
234 :
235 682 : SwFtnInfo::SwFtnInfo(const SwFtnInfo& rInfo) :
236 : SwEndNoteInfo( rInfo ),
237 : aQuoVadis( rInfo.aQuoVadis ),
238 : aErgoSum( rInfo.aErgoSum ),
239 : ePos( rInfo.ePos ),
240 682 : eNum( rInfo.eNum )
241 : {
242 682 : m_bEndNote = false;
243 682 : }
244 :
245 560 : SwFtnInfo::SwFtnInfo(SwTxtFmtColl *pFmt) :
246 : SwEndNoteInfo( pFmt ),
247 : ePos( FTNPOS_PAGE ),
248 560 : eNum( FTNNUM_DOC )
249 : {
250 560 : aFmt.SetNumberingType(SVX_NUM_ARABIC);
251 560 : m_bEndNote = false;
252 560 : }
253 :
254 : /*********************** SwDoc ***************************/
255 :
256 :
257 684 : void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo)
258 : {
259 684 : SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
260 684 : if( !(GetFtnInfo() == rInfo) )
261 : {
262 14 : const SwFtnInfo &rOld = GetFtnInfo();
263 :
264 14 : if (GetIDocumentUndoRedo().DoesUndo())
265 : {
266 0 : GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld) );
267 : }
268 :
269 14 : bool bFtnPos = rInfo.ePos != rOld.ePos;
270 : bool bFtnDesc = rOld.ePos == FTNPOS_CHAPTER &&
271 14 : rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this );
272 14 : bool bExtra = rInfo.aQuoVadis != rOld.aQuoVadis ||
273 14 : rInfo.aErgoSum != rOld.aErgoSum ||
274 14 : rInfo.aFmt.GetNumberingType() != rOld.aFmt.GetNumberingType() ||
275 14 : rInfo.GetPrefix() != rOld.GetPrefix() ||
276 56 : rInfo.GetSuffix() != rOld.GetSuffix();
277 14 : SwCharFmt *pOldChrFmt = rOld.GetCharFmt( *this ),
278 14 : *pNewChrFmt = rInfo.GetCharFmt( *this );
279 14 : bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
280 :
281 14 : *pFtnInfo = rInfo;
282 :
283 14 : 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 14 : if( FTNNUM_PAGE != rInfo.eNum )
312 14 : 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 14 : if ( !IsInReading() )
322 : {
323 0 : UpdateRefFlds(NULL);
324 : }
325 14 : SetModified();
326 : }
327 684 : }
328 :
329 410 : void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
330 : {
331 410 : SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219
332 410 : if( !(GetEndNoteInfo() == rInfo) )
333 : {
334 6 : if(GetIDocumentUndoRedo().DoesUndo())
335 : {
336 0 : SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) );
337 0 : GetIDocumentUndoRedo().AppendUndo(pUndo);
338 : }
339 :
340 6 : 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 6 : bool const bExtra = !bNumChg &&
345 6 : ( (rInfo.aFmt.GetNumberingType() !=
346 6 : GetEndNoteInfo().aFmt.GetNumberingType())
347 4 : || (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix())
348 4 : || (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix())
349 20 : );
350 6 : bool bFtnDesc = rInfo.GetPageDesc( *this ) !=
351 6 : GetEndNoteInfo().GetPageDesc( *this );
352 6 : SwCharFmt *pOldChrFmt = GetEndNoteInfo().GetCharFmt( *this ),
353 6 : *pNewChrFmt = rInfo.GetCharFmt( *this );
354 6 : bool bFtnChrFmts = pOldChrFmt != pNewChrFmt;
355 :
356 6 : *pEndNoteInfo = rInfo;
357 :
358 6 : 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 6 : if( bNumChg )
381 0 : GetFtnIdxs().UpdateAllFtn();
382 6 : 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 6 : if ( !IsInReading() )
391 : {
392 0 : UpdateRefFlds(NULL);
393 : }
394 6 : SetModified();
395 : }
396 410 : }
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: */
|