1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: undobj1.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <hintids.hxx>
36 #include <svtools/itemiter.hxx>
37 #include <fmtflcnt.hxx>
38 #include <fmtanchr.hxx>
39 #include <fmtcntnt.hxx>
40 #include <txtflcnt.hxx>
44 #include <rolbck.hxx> // fuer die Attribut History
47 #include <rootfrm.hxx>
48 #include <swundo.hxx> // fuer die UndoIds
51 // OD 26.06.2003 #108784#
52 #include <dcontact.hxx>
55 // Inline Methode vom UndoIter
56 inline SwDoc
& SwUndoIter::GetDoc() const { return *pAktPam
->GetDoc(); }
58 //---------------------------------------------------------------------
60 SwUndoFlyBase::SwUndoFlyBase( SwFrmFmt
* pFormat
, SwUndoId nUndoId
)
61 : SwUndo( nUndoId
), pFrmFmt( pFormat
)
65 SwUndoFlyBase::~SwUndoFlyBase()
67 if( bDelFmt
) // loeschen waehrend eines Undo's ??
71 void SwUndoFlyBase::InsFly( SwUndoIter
& rUndoIter
, BOOL bShowSelFrm
)
73 SwDoc
* pDoc
= &rUndoIter
.GetDoc();
75 // ins Array wieder eintragen
76 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
77 rFlyFmts
.Insert( pFrmFmt
, rFlyFmts
.Count() );
79 // OD 26.06.2003 #108784# - insert 'master' drawing object into drawing page
80 if ( RES_DRAWFRMFMT
== pFrmFmt
->Which() )
82 SwDrawContact
* pDrawContact
=
83 static_cast<SwDrawContact
*>(pFrmFmt
->FindContactObj());
86 pDrawContact
->InsertMasterIntoDrawPage();
87 // --> OD 2005-01-31 #i40845# - follow-up of #i35635#
88 // move object to visible layer
89 pDrawContact
->MoveObjToVisibleLayer( pDrawContact
->GetMaster() );
94 SwFmtAnchor
aAnchor( (RndStdIds
)nRndId
);
96 if( FLY_PAGE
== nRndId
)
97 aAnchor
.SetPageNum( (USHORT
)nNdPgPos
);
100 SwPosition
aNewPos( *rUndoIter
.pAktPam
->GetPoint() );
101 aNewPos
.nNode
= nNdPgPos
;
102 if( FLY_IN_CNTNT
== nRndId
|| FLY_AUTO_CNTNT
== nRndId
)
103 aNewPos
.nContent
.Assign( aNewPos
.nNode
.GetNode().GetCntntNode(),
105 aAnchor
.SetAnchor( &aNewPos
);
108 pFrmFmt
->SetFmtAttr( aAnchor
); // Anker neu setzen
110 if( RES_DRAWFRMFMT
!= pFrmFmt
->Which() )
112 // Content holen und -Attribut neu setzen
113 SwNodeIndex
aIdx( pDoc
->GetNodes() );
114 RestoreSection( pDoc
, &aIdx
, SwFlyStartNode
);
115 pFrmFmt
->SetFmtAttr( SwFmtCntnt( aIdx
.GetNode().GetStartNode() ));
118 //JP 18.12.98: Bug 60505 - InCntntAttribut erst setzen, wenn der Inhalt
119 // vorhanden ist! Sonst wuerde das Layout den Fly vorher
120 // formatieren, aber keine Inhalt finden; so geschene bei
121 // Grafiken aus dem Internet
122 if( FLY_IN_CNTNT
== nRndId
)
124 // es muss mindestens das Attribut im TextNode stehen
125 SwCntntNode
* pCNd
= aAnchor
.GetCntntAnchor()->nNode
.GetNode().GetCntntNode();
126 ASSERT( pCNd
->IsTxtNode(), "Kein Textnode an dieser Position" );
127 ((SwTxtNode
*)pCNd
)->InsertItem( SwFmtFlyCnt(
128 (SwFlyFrmFmt
*)pFrmFmt
), nCntPos
, nCntPos
);
134 rUndoIter
.pSelFmt
= pFrmFmt
;
137 GetHistory()->Rollback( pDoc
);
144 const SwFmtAnchor
& rAnchor
= pFrmFmt
->GetAnchor();
145 nNdPgPos
= rAnchor
.GetCntntAnchor()->nNode
.GetIndex();
146 nCntPos
= rAnchor
.GetCntntAnchor()->nContent
.GetIndex();
152 const SwFmtAnchor
& rAnchor
= pFrmFmt
->GetAnchor();
153 nNdPgPos
= rAnchor
.GetCntntAnchor()->nNode
.GetIndex();
162 void SwUndoFlyBase::DelFly( SwDoc
* pDoc
)
164 bDelFmt
= TRUE
; // im DTOR das Format loeschen
165 pFrmFmt
->DelFrms(); // Frms vernichten.
167 // alle Uno-Objecte sollten sich jetzt abmelden
169 SwPtrMsgPoolItem
aMsgHint( RES_REMOVE_UNO_OBJECT
, pFrmFmt
);
170 pFrmFmt
->Modify( &aMsgHint
, &aMsgHint
);
173 if ( RES_DRAWFRMFMT
!= pFrmFmt
->Which() )
175 // gibt es ueberhaupt Inhalt, dann sicher diesen
176 const SwFmtCntnt
& rCntnt
= pFrmFmt
->GetCntnt();
177 ASSERT( rCntnt
.GetCntntIdx(), "Fly ohne Inhalt" );
179 SaveSection( pDoc
, *rCntnt
.GetCntntIdx() );
180 ((SwFmtCntnt
&)rCntnt
).SetNewCntntIdx( (const SwNodeIndex
*)0 );
182 // OD 02.07.2003 #108784# - remove 'master' drawing object from drawing page
183 else if ( RES_DRAWFRMFMT
== pFrmFmt
->Which() )
185 SwDrawContact
* pDrawContact
=
186 static_cast<SwDrawContact
*>(pFrmFmt
->FindContactObj());
189 pDrawContact
->RemoveMasterFromDrawPage();
193 const SwFmtAnchor
& rAnchor
= pFrmFmt
->GetAnchor();
194 const SwPosition
* pPos
= rAnchor
.GetCntntAnchor();
195 // die Positionen im Nodes-Array haben sich verschoben
196 if( FLY_IN_CNTNT
== ( nRndId
= static_cast<USHORT
>(rAnchor
.GetAnchorId()) ) )
198 nNdPgPos
= pPos
->nNode
.GetIndex();
199 nCntPos
= pPos
->nContent
.GetIndex();
200 SwTxtNode
*pTxtNd
= pDoc
->GetNodes()[ pPos
->nNode
]->GetTxtNode();
201 ASSERT( pTxtNd
, "Kein Textnode gefunden" );
202 SwTxtFlyCnt
* pAttr
= (SwTxtFlyCnt
*)pTxtNd
->GetTxtAttr( nCntPos
);
203 // Attribut steht noch im TextNode, loeschen
204 if( pAttr
&& pAttr
->GetFlyCnt().GetFrmFmt() == pFrmFmt
)
206 // Pointer auf 0, nicht loeschen
207 ((SwFmtFlyCnt
&)pAttr
->GetFlyCnt()).SetFlyFmt();
208 SwIndex
aIdx( pPos
->nContent
);
209 pTxtNd
->Erase( aIdx
, 1 );
212 else if( FLY_AUTO_CNTNT
== nRndId
)
214 nNdPgPos
= pPos
->nNode
.GetIndex();
215 nCntPos
= pPos
->nContent
.GetIndex();
217 else if( FLY_AT_CNTNT
== nRndId
|| FLY_AT_FLY
== nRndId
)
218 nNdPgPos
= pPos
->nNode
.GetIndex();
220 nNdPgPos
= rAnchor
.GetPageNum();
222 pFrmFmt
->ResetFmtAttr( RES_ANCHOR
); // Anchor loeschen
225 // aus dem Array austragen
226 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
227 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFrmFmt
));
230 // ----- Undo-InsertFly ------
232 SwUndoInsLayFmt::SwUndoInsLayFmt( SwFrmFmt
* pFormat
, ULONG nNodeIdx
, xub_StrLen nCntIdx
)
233 : SwUndoFlyBase( pFormat
, RES_DRAWFRMFMT
== pFormat
->Which() ?
234 UNDO_INSDRAWFMT
: UNDO_INSLAYFMT
),
235 mnCrsrSaveIndexPara( nNodeIdx
), mnCrsrSaveIndexPos( nCntIdx
)
237 const SwFmtAnchor
& rAnchor
= pFrmFmt
->GetAnchor();
238 nRndId
= static_cast<USHORT
>(rAnchor
.GetAnchorId());
243 nNdPgPos
= rAnchor
.GetPageNum();
247 nNdPgPos
= rAnchor
.GetCntntAnchor()->nNode
.GetIndex();
252 const SwPosition
* pPos
= rAnchor
.GetCntntAnchor();
253 nCntPos
= pPos
->nContent
.GetIndex();
254 nNdPgPos
= pPos
->nNode
.GetIndex();
258 ASSERT( FALSE
, "Was denn fuer ein FlyFrame?" );
262 SwUndoInsLayFmt::~SwUndoInsLayFmt()
266 void SwUndoInsLayFmt::Undo( SwUndoIter
& rUndoIter
)
268 const SwFmtCntnt
& rCntnt
= pFrmFmt
->GetCntnt();
269 if( rCntnt
.GetCntntIdx() ) // kein Inhalt
271 bool bRemoveIdx
= true;
272 if( mnCrsrSaveIndexPara
> 0 )
274 SwTxtNode
*pNode
= rUndoIter
.GetDoc().GetNodes()[mnCrsrSaveIndexPara
]->GetTxtNode();
277 SwNodeIndex
aIdx( rUndoIter
.GetDoc().GetNodes(), rCntnt
.GetCntntIdx()->GetIndex() );
278 SwNodeIndex
aEndIdx( rUndoIter
.GetDoc().GetNodes(), aIdx
.GetNode().EndOfSectionIndex() );
279 SwIndex
aIndex( pNode
, mnCrsrSaveIndexPos
);
280 SwPosition
aPos( *pNode
, aIndex
);
281 rUndoIter
.GetDoc().CorrAbs( aIdx
, aEndIdx
, aPos
, TRUE
);
286 RemoveIdxFromSection( rUndoIter
.GetDoc(),
287 rCntnt
.GetCntntIdx()->GetIndex() );
289 DelFly( &rUndoIter
.GetDoc() );
292 void SwUndoInsLayFmt::Redo( SwUndoIter
& rUndoIter
)
294 rUndoIter
.pLastUndoObj
= 0;
298 void SwUndoInsLayFmt::Repeat( SwUndoIter
& rUndoIter
)
300 if( UNDO_INSLAYFMT
== rUndoIter
.GetLastUndoId() &&
301 pFrmFmt
== ((SwUndoInsLayFmt
*)rUndoIter
.pLastUndoObj
)->pFrmFmt
)
304 SwDoc
* pDoc
= &rUndoIter
.GetDoc();
305 // erfrage und setze den Anker neu
306 SwFmtAnchor
aAnchor( pFrmFmt
->GetAnchor() );
307 if( FLY_AT_CNTNT
== aAnchor
.GetAnchorId() ||
308 FLY_AUTO_CNTNT
== aAnchor
.GetAnchorId() ||
309 FLY_IN_CNTNT
== aAnchor
.GetAnchorId() )
311 SwPosition
aPos( *rUndoIter
.pAktPam
->GetPoint() );
312 if( FLY_AT_CNTNT
== aAnchor
.GetAnchorId() )
313 aPos
.nContent
.Assign( 0, 0 );
314 aAnchor
.SetAnchor( &aPos
);
316 else if( FLY_AT_FLY
== aAnchor
.GetAnchorId() )
318 const SwStartNode
* pSttNd
= rUndoIter
.pAktPam
->GetNode()->FindFlyStartNode();
321 SwPosition
aPos( *pSttNd
);
322 aAnchor
.SetAnchor( &aPos
);
326 rUndoIter
.pLastUndoObj
= this;
330 else if( FLY_PAGE
== aAnchor
.GetAnchorId() )
332 aAnchor
.SetPageNum( pDoc
->GetRootFrm()->GetCurrPage(
333 rUndoIter
.pAktPam
));
336 ASSERT( FALSE
, "was fuer ein Anker ist es denn nun?" );
339 SwFrmFmt
* pFlyFmt
= pDoc
->CopyLayoutFmt( *pFrmFmt
, aAnchor
, true, true );
340 rUndoIter
.pSelFmt
= pFlyFmt
;
342 rUndoIter
.pLastUndoObj
= this;
346 String
SwUndoInsLayFmt::GetComment() const
353 If frame format is present and has an SdrObject use the undo
354 comment of the SdrObject. Otherwise use the default comment.
360 const SdrObject
* pSdrObj
= pFrmFmt
->FindSdrObject();
363 aResult
= SdrUndoNewObj::GetComment( *pSdrObj
);
369 aResult
= SwUndo::GetComment();
377 // ----- Undo-DeleteFly ------
379 SwUndoDelLayFmt::SwUndoDelLayFmt( SwFrmFmt
* pFormat
)
380 : SwUndoFlyBase( pFormat
, UNDO_DELLAYFMT
), bShowSelFrm( TRUE
)
382 SwDoc
* pDoc
= pFormat
->GetDoc();
385 SwNodeIndex
* pIdx
= GetMvSttIdx();
387 if( 1 == GetMvNodeCnt() && pIdx
&&
388 ( pNd
= (*pDoc
->GetUndoNds())[ *pIdx
] )->IsNoTxtNode() )
390 // dann setze eine andere Undo-ID; Grafik oder OLE
391 if( pNd
->IsGrfNode() )
392 SetId( UNDO_DELGRF
);
393 else if( pNd
->IsOLENode() )
395 SetId( UNDO_DELETE
);
401 SwRewriter
SwUndoDelLayFmt::GetRewriter() const
403 SwRewriter aRewriter
;
405 SwDoc
* pDoc
= pFrmFmt
->GetDoc();
409 SwNodeIndex
* pIdx
= GetMvSttIdx();
410 if( 1 == GetMvNodeCnt() && pIdx
)
412 SwNode
* pNd
= (*pDoc
->GetUndoNds())[ *pIdx
];
414 if ( pNd
->IsNoTxtNode() && pNd
->IsOLENode())
416 SwOLENode
* pOLENd
= pNd
->GetOLENode();
418 aRewriter
.AddRule(UNDO_ARG1
, pOLENd
->GetDescription());
426 void SwUndoDelLayFmt::Undo( SwUndoIter
& rUndoIter
)
428 InsFly( rUndoIter
, bShowSelFrm
);
431 void SwUndoDelLayFmt::Redo( SwUndoIter
& rUndoIter
)
433 const SwFmtCntnt
& rCntnt
= pFrmFmt
->GetCntnt();
434 if( rCntnt
.GetCntntIdx() ) // kein Inhalt
435 RemoveIdxFromSection( rUndoIter
.GetDoc(),
436 rCntnt
.GetCntntIdx()->GetIndex() );
438 DelFly( &rUndoIter
.GetDoc() );
441 void SwUndoDelLayFmt::Redo()
443 const SwFmtCntnt
& rCntnt
= pFrmFmt
->GetCntnt();
444 if( rCntnt
.GetCntntIdx() ) // kein Inhalt
445 RemoveIdxFromSection( *pFrmFmt
->GetDoc(),
446 rCntnt
.GetCntntIdx()->GetIndex() );
448 DelFly( pFrmFmt
->GetDoc() );
453 SwUndoSetFlyFmt::SwUndoSetFlyFmt( SwFrmFmt
& rFlyFmt
, SwFrmFmt
& rNewFrmFmt
)
454 : SwUndo( UNDO_SETFLYFRMFMT
), SwClient( &rFlyFmt
), pFrmFmt( &rFlyFmt
),
455 pOldFmt( (SwFrmFmt
*)rFlyFmt
.DerivedFrom() ), pNewFmt( &rNewFrmFmt
),
456 pItemSet( new SfxItemSet( *rFlyFmt
.GetAttrSet().GetPool(),
457 rFlyFmt
.GetAttrSet().GetRanges() )),
458 nOldNode( 0 ), nNewNode( 0 ),
459 nOldCntnt( 0 ), nNewCntnt( 0 ),
460 nOldAnchorTyp( 0 ), nNewAnchorTyp( 0 ), bAnchorChgd( FALSE
)
464 SwRewriter
SwUndoSetFlyFmt::GetRewriter() const
466 SwRewriter aRewriter
;
469 aRewriter
.AddRule(UNDO_ARG1
, pNewFmt
->GetName());
475 SwUndoSetFlyFmt::~SwUndoSetFlyFmt()
480 void SwUndoSetFlyFmt::GetAnchor( SwFmtAnchor
& rAnchor
,
481 ULONG nNode
, xub_StrLen nCntnt
)
483 RndStdIds nAnchorTyp
= rAnchor
.GetAnchorId();
484 if( FLY_PAGE
!= nAnchorTyp
)
486 SwNode
* pNd
= pFrmFmt
->GetDoc()->GetNodes()[ nNode
];
488 if( FLY_AT_FLY
== nAnchorTyp
489 ? ( !pNd
->IsStartNode() || SwFlyStartNode
!=
490 ((SwStartNode
*)pNd
)->GetStartNodeType() )
491 : !pNd
->IsTxtNode() )
492 pNd
= 0; // ungueltige Position
495 SwPosition
aPos( *pNd
);
496 if( FLY_IN_CNTNT
== nAnchorTyp
||
497 FLY_AUTO_CNTNT
== nAnchorTyp
)
499 if( nCntnt
> ((SwTxtNode
*)pNd
)->GetTxt().Len() )
500 pNd
= 0; // ungueltige Position
502 aPos
.nContent
.Assign( (SwTxtNode
*)pNd
, nCntnt
);
505 rAnchor
.SetAnchor( &aPos
);
510 // ungueltige Position - setze auf 1. Seite
511 rAnchor
.SetType( FLY_PAGE
);
512 rAnchor
.SetPageNum( 1 );
516 rAnchor
.SetPageNum( nCntnt
);
519 void SwUndoSetFlyFmt::Undo( SwUndoIter
& rIter
)
521 SwDoc
& rDoc
= rIter
.GetDoc();
523 // ist das neue Format noch vorhanden ??
524 if( USHRT_MAX
!= rDoc
.GetFrmFmts()->GetPos( (const SwFrmFmtPtr
)pOldFmt
) )
529 if( pFrmFmt
->DerivedFrom() != pOldFmt
)
530 pFrmFmt
->SetDerivedFrom( pOldFmt
);
532 SfxItemIter
aIter( *pItemSet
);
533 const SfxPoolItem
* pItem
= aIter
.GetCurItem();
536 if( IsInvalidItem( pItem
))
537 pFrmFmt
->ResetFmtAttr( pItemSet
->GetWhichByPos(
538 aIter
.GetCurPos() ));
540 pFrmFmt
->SetFmtAttr( *pItem
);
542 if( aIter
.IsAtEnd() )
544 pItem
= aIter
.NextItem();
549 const SwFmtAnchor
& rOldAnch
= pFrmFmt
->GetAnchor();
550 if( FLY_IN_CNTNT
== rOldAnch
.GetAnchorId() )
552 // Bei InCntnt's wird es spannend: Das TxtAttribut muss
553 // vernichtet werden. Leider reisst dies neben den Frms
554 // auch noch das Format mit in sein Grab. Um dass zu
555 // unterbinden loesen wir vorher die Verbindung zwischen
556 // Attribut und Format.
557 const SwPosition
*pPos
= rOldAnch
.GetCntntAnchor();
558 SwTxtNode
*pTxtNode
= pPos
->nNode
.GetNode().GetTxtNode();
559 ASSERT( pTxtNode
->HasHints(), "Missing FlyInCnt-Hint." );
560 const xub_StrLen nIdx
= pPos
->nContent
.GetIndex();
561 SwTxtAttr
* pHnt
= pTxtNode
->GetTxtAttr( nIdx
, RES_TXTATR_FLYCNT
);
563 ASSERT( pHnt
&& pHnt
->Which() == RES_TXTATR_FLYCNT
,
564 "Missing FlyInCnt-Hint." );
565 ASSERT( pHnt
&& pHnt
->GetFlyCnt().GetFrmFmt() == pFrmFmt
,
566 "Wrong TxtFlyCnt-Hint." );
568 ((SwFmtFlyCnt
&)pHnt
->GetFlyCnt()).SetFlyFmt();
570 // Die Verbindung ist geloest, jetzt muss noch das Attribut
571 // vernichtet werden.
572 pTxtNode
->Delete( RES_TXTATR_FLYCNT
, nIdx
, nIdx
);
576 SwFmtAnchor
aNewAnchor( (RndStdIds
) nOldAnchorTyp
);
577 GetAnchor( aNewAnchor
, nOldNode
, nOldCntnt
);
578 pFrmFmt
->SetFmtAttr( aNewAnchor
);
580 if( FLY_IN_CNTNT
== aNewAnchor
.GetAnchorId() )
582 SwPosition
* pPos
= (SwPosition
*)aNewAnchor
.GetCntntAnchor();
583 pPos
->nNode
.GetNode().GetTxtNode()->InsertItem(
584 SwFmtFlyCnt( (SwFlyFrmFmt
*)pFrmFmt
), nOldCntnt
, 0 );
589 rIter
.pSelFmt
= pFrmFmt
;
593 void SwUndoSetFlyFmt::Redo( SwUndoIter
& rIter
)
595 SwDoc
& rDoc
= rIter
.GetDoc();
597 // ist das neue Format noch vorhanden ??
598 if( USHRT_MAX
!= rDoc
.GetFrmFmts()->GetPos( (const SwFrmFmtPtr
)pNewFmt
) )
603 SwFmtAnchor
aNewAnchor( (RndStdIds
) nNewAnchorTyp
);
604 GetAnchor( aNewAnchor
, nNewNode
, nNewCntnt
);
605 SfxItemSet
aSet( rDoc
.GetAttrPool(), aFrmFmtSetRange
);
606 aSet
.Put( aNewAnchor
);
607 rDoc
.SetFrmFmtToFly( *pFrmFmt
, *pNewFmt
, &aSet
);
610 rDoc
.SetFrmFmtToFly( *pFrmFmt
, *pNewFmt
, 0 );
612 rIter
.pSelFmt
= pFrmFmt
;
616 void SwUndoSetFlyFmt::PutAttr( USHORT nWhich
, const SfxPoolItem
* pItem
)
618 if( pItem
&& pItem
!= GetDfltAttr( nWhich
) )
620 // Sonderbehandlung fuer den Anchor
621 if( RES_ANCHOR
== nWhich
)
623 // nur den 1. Ankerwechsel vermerken
624 ASSERT( !bAnchorChgd
, "mehrfacher Ankerwechsel nicht erlaubt!" );
628 const SwFmtAnchor
* pAnchor
= (SwFmtAnchor
*)pItem
;
629 switch( nOldAnchorTyp
= static_cast<USHORT
>(pAnchor
->GetAnchorId()) )
633 nOldCntnt
= pAnchor
->GetCntntAnchor()->nContent
.GetIndex();
636 nOldNode
= pAnchor
->GetCntntAnchor()->nNode
.GetIndex();
640 nOldCntnt
= pAnchor
->GetPageNum();
643 pAnchor
= (SwFmtAnchor
*)&pFrmFmt
->GetAnchor();
644 switch( nNewAnchorTyp
= static_cast<USHORT
>(pAnchor
->GetAnchorId()) )
648 nNewCntnt
= pAnchor
->GetCntntAnchor()->nContent
.GetIndex();
651 nNewNode
= pAnchor
->GetCntntAnchor()->nNode
.GetIndex();
655 nNewCntnt
= pAnchor
->GetPageNum();
659 pItemSet
->Put( *pItem
);
662 pItemSet
->InvalidateItem( nWhich
);
665 void SwUndoSetFlyFmt::Modify( SfxPoolItem
* pOld
, SfxPoolItem
* )
669 USHORT nWhich
= pOld
->Which();
671 if( nWhich
< POOLATTR_END
)
672 PutAttr( nWhich
, pOld
);
673 else if( RES_ATTRSET_CHG
== nWhich
)
675 SfxItemIter
aIter( *((SwAttrSetChg
*)pOld
)->GetChgSet() );
676 const SfxPoolItem
* pItem
= aIter
.GetCurItem();
679 PutAttr( pItem
->Which(), pItem
);
680 if( aIter
.IsAtEnd() )
682 pItem
= aIter
.NextItem();