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: undraw.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"
34 #include <rtl/string.h>
37 #include <rtl/memory.h>
39 #include <hintids.hxx>
42 #include <rtl/string.h>
44 #include <svx/svdogrp.hxx>
45 #include <svx/svdundo.hxx>
46 #include <svx/svdpage.hxx>
47 #include <svx/svdmark.hxx>
48 #include <fmtanchr.hxx>
49 #include <fmtflcnt.hxx>
50 #include <txtflcnt.hxx>
55 #include <swundo.hxx> // fuer die UndoIds
59 #include <dcontact.hxx>
61 #include <rootfrm.hxx>
64 struct SwUndoGroupObjImpl
70 // OD 2004-04-15 #i26791# - keeping the anchor and the relative position
71 // of drawing objects no longer needed
75 inline SwDoc
& SwUndoIter::GetDoc() const { return *pAktPam
->GetDoc(); }
79 IMPL_LINK( SwDoc
, AddDrawUndo
, SdrUndoAction
*, pUndo
)
81 #if OSL_DEBUG_LEVEL > 1
82 USHORT nId
= pUndo
->GetId();
84 String
sComment( pUndo
->GetComment() );
87 if( DoesUndo() && !IsNoDrawUndoObj() )
90 const SdrMarkList
* pMarkList
= 0;
91 ViewShell
* pSh
= GetRootFrm() ? GetRootFrm()->GetCurrShell() : 0;
92 if( pSh
&& pSh
->HasDrawView() )
93 pMarkList
= &pSh
->GetDrawView()->GetMarkedObjectList();
95 AppendUndo( new SwSdrUndo( pUndo
, pMarkList
) );
102 SwSdrUndo::SwSdrUndo( SdrUndoAction
* pUndo
, const SdrMarkList
* pMrkLst
)
103 : SwUndo( UNDO_DRAWUNDO
), pSdrUndo( pUndo
)
105 if( pMrkLst
&& pMrkLst
->GetMarkCount() )
106 pMarkList
= new SdrMarkList( *pMrkLst
);
111 SwSdrUndo::~SwSdrUndo()
117 void SwSdrUndo::Undo( SwUndoIter
& rUndoIter
)
120 rUndoIter
.pMarkList
= pMarkList
;
123 void SwSdrUndo::Redo( SwUndoIter
& rUndoIter
)
126 rUndoIter
.pMarkList
= pMarkList
;
129 String
SwSdrUndo::GetComment() const
131 return pSdrUndo
->GetComment();
134 //--------------------------------------------
136 void lcl_SendRemoveToUno( SwFmt
& rFmt
)
138 SwPtrMsgPoolItem
aMsgHint( RES_REMOVE_UNO_OBJECT
, &rFmt
);
139 rFmt
.Modify( &aMsgHint
, &aMsgHint
);
142 void lcl_SaveAnchor( SwFrmFmt
* pFmt
, ULONG
& rNodePos
)
144 const SwFmtAnchor
& rAnchor
= pFmt
->GetAnchor();
145 if( FLY_AT_CNTNT
== rAnchor
.GetAnchorId() ||
146 FLY_AUTO_CNTNT
== rAnchor
.GetAnchorId() ||
147 FLY_AT_FLY
== rAnchor
.GetAnchorId() ||
148 FLY_IN_CNTNT
== rAnchor
.GetAnchorId() )
150 rNodePos
= rAnchor
.GetCntntAnchor()->nNode
.GetIndex();
151 xub_StrLen nCntntPos
= 0;
153 if( FLY_IN_CNTNT
== rAnchor
.GetAnchorId() )
155 nCntntPos
= rAnchor
.GetCntntAnchor()->nContent
.GetIndex();
157 // TextAttribut zerstoeren
158 SwTxtNode
*pTxtNd
= pFmt
->GetDoc()->GetNodes()[ rNodePos
]->GetTxtNode();
159 ASSERT( pTxtNd
, "Kein Textnode gefunden" );
160 SwTxtFlyCnt
* pAttr
= static_cast<SwTxtFlyCnt
*>(
161 pTxtNd
->GetTxtAttrForCharAt( nCntntPos
, RES_TXTATR_FLYCNT
));
162 // Attribut steht noch im TextNode, loeschen
163 if( pAttr
&& pAttr
->GetFlyCnt().GetFrmFmt() == pFmt
)
165 // Pointer auf 0, nicht loeschen
166 ((SwFmtFlyCnt
&)pAttr
->GetFlyCnt()).SetFlyFmt();
167 SwIndex
aIdx( pTxtNd
, nCntntPos
);
168 pTxtNd
->EraseText( aIdx
, 1 );
171 else if( FLY_AUTO_CNTNT
== rAnchor
.GetAnchorId() )
172 nCntntPos
= rAnchor
.GetCntntAnchor()->nContent
.GetIndex();
174 pFmt
->SetFmtAttr( SwFmtAnchor( rAnchor
.GetAnchorId(), nCntntPos
) );
178 void lcl_RestoreAnchor( SwFrmFmt
* pFmt
, ULONG
& rNodePos
)
180 const SwFmtAnchor
& rAnchor
= pFmt
->GetAnchor();
181 if( FLY_AT_CNTNT
== rAnchor
.GetAnchorId() ||
182 FLY_AUTO_CNTNT
== rAnchor
.GetAnchorId() ||
183 FLY_AT_FLY
== rAnchor
.GetAnchorId() ||
184 FLY_IN_CNTNT
== rAnchor
.GetAnchorId() )
186 xub_StrLen nCntntPos
= rAnchor
.GetPageNum();
187 SwNodes
& rNds
= pFmt
->GetDoc()->GetNodes();
189 SwNodeIndex
aIdx( rNds
, rNodePos
);
190 SwPosition
aPos( aIdx
);
192 SwFmtAnchor
aTmp( rAnchor
.GetAnchorId() );
193 if( FLY_IN_CNTNT
== rAnchor
.GetAnchorId() ||
194 FLY_AUTO_CNTNT
== rAnchor
.GetAnchorId() )
195 aPos
.nContent
.Assign( aIdx
.GetNode().GetCntntNode(), nCntntPos
);
196 aTmp
.SetAnchor( &aPos
);
197 pFmt
->SetFmtAttr( aTmp
);
199 if( FLY_IN_CNTNT
== rAnchor
.GetAnchorId() )
201 SwTxtNode
*pTxtNd
= aIdx
.GetNode().GetTxtNode();
202 ASSERT( pTxtNd
, "no Text Node" );
203 SwFmtFlyCnt
aFmt( pFmt
);
204 pTxtNd
->InsertItem( aFmt
, nCntntPos
, nCntntPos
);
209 SwUndoDrawGroup::SwUndoDrawGroup( USHORT nCnt
)
210 : SwUndo( UNDO_DRAWGROUP
), nSize( nCnt
+ 1 ), bDelFmt( TRUE
)
212 pObjArr
= new SwUndoGroupObjImpl
[ nSize
];
215 SwUndoDrawGroup::~SwUndoDrawGroup()
219 SwUndoGroupObjImpl
* pTmp
= pObjArr
+ 1;
220 for( USHORT n
= 1; n
< nSize
; ++n
, ++pTmp
)
224 delete pObjArr
->pFmt
; // das GroupObject-Format
229 void SwUndoDrawGroup::Undo( SwUndoIter
& )
233 // das Group-Object sichern
234 SwDrawFrmFmt
* pFmt
= pObjArr
->pFmt
;
235 SwDrawContact
* pDrawContact
= (SwDrawContact
*)pFmt
->FindContactObj();
236 SdrObject
* pObj
= pDrawContact
->GetMaster();
237 pObjArr
->pObj
= pObj
;
239 //loescht sich selbst!
240 pDrawContact
->Changed( *pObj
, SDRUSERCALL_DELETE
, pObj
->GetLastBoundRect() );
241 pObj
->SetUserCall( 0 );
243 ::lcl_SaveAnchor( pFmt
, pObjArr
->nNodeIdx
);
245 // alle Uno-Objecte sollten sich jetzt abmelden
246 ::lcl_SendRemoveToUno( *pFmt
);
248 // aus dem Array austragen
249 SwDoc
* pDoc
= pFmt
->GetDoc();
250 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
251 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
253 for( USHORT n
= 1; n
< nSize
; ++n
)
255 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
257 ::lcl_RestoreAnchor( rSave
.pFmt
, rSave
.nNodeIdx
);
258 rFlyFmts
.Insert( rSave
.pFmt
, rFlyFmts
.Count() );
262 SwDrawContact
*pContact
= new SwDrawContact( rSave
.pFmt
, pObj
);
263 pContact
->ConnectToLayout();
264 // --> OD 2005-03-22 #i45718# - follow-up of #i35635#
265 // move object to visible layer
266 pContact
->MoveObjToVisibleLayer( pObj
);
268 // --> OD 2005-05-10 #i45952# - notify that position attributes
270 ASSERT( rSave
.pFmt
->ISA(SwDrawFrmFmt
),
271 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
272 if ( rSave
.pFmt
->ISA(SwDrawFrmFmt
) )
274 static_cast<SwDrawFrmFmt
*>(rSave
.pFmt
)->PosAttrSet();
280 void SwUndoDrawGroup::Redo( SwUndoIter
& )
284 // aus dem Array austragen
285 SwDoc
* pDoc
= pObjArr
->pFmt
->GetDoc();
286 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
289 for( USHORT n
= 1; n
< nSize
; ++n
)
291 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
295 SwDrawContact
*pContact
= (SwDrawContact
*)GetUserCall(pObj
);
296 //loescht sich selbst!
297 pContact
->Changed( *pObj
, SDRUSERCALL_DELETE
, pObj
->GetLastBoundRect() );
298 pObj
->SetUserCall( 0 );
300 ::lcl_SaveAnchor( rSave
.pFmt
, rSave
.nNodeIdx
);
302 // alle Uno-Objecte sollten sich jetzt abmelden
303 ::lcl_SendRemoveToUno( *rSave
.pFmt
);
305 rFlyFmts
.Remove( rFlyFmts
.GetPos( rSave
.pFmt
));
308 // das Group-Object wieder einfuegen
309 ::lcl_RestoreAnchor( pObjArr
->pFmt
, pObjArr
->nNodeIdx
);
310 rFlyFmts
.Insert( pObjArr
->pFmt
, rFlyFmts
.Count() );
312 SwDrawContact
*pContact
= new SwDrawContact( pObjArr
->pFmt
, pObjArr
->pObj
);
313 // OD 2004-04-15 #i26791# - correction: connect object to layout
314 pContact
->ConnectToLayout();
315 // --> OD 2005-03-22 #i45718# - follow-up of #i35635#
316 // move object to visible layer
317 pContact
->MoveObjToVisibleLayer( pObjArr
->pObj
);
319 // --> OD 2005-05-10 #i45952# - notify that position attributes
321 ASSERT( pObjArr
->pFmt
->ISA(SwDrawFrmFmt
),
322 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
323 if ( pObjArr
->pFmt
->ISA(SwDrawFrmFmt
) )
325 static_cast<SwDrawFrmFmt
*>(pObjArr
->pFmt
)->PosAttrSet();
330 void SwUndoDrawGroup::AddObj( USHORT nPos
, SwDrawFrmFmt
* pFmt
, SdrObject
* pObj
)
332 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ nPos
+ 1 );
335 ::lcl_SaveAnchor( pFmt
, rSave
.nNodeIdx
);
337 // alle Uno-Objecte sollten sich jetzt abmelden
338 ::lcl_SendRemoveToUno( *pFmt
);
340 // aus dem Array austragen
341 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pFmt
->GetDoc()->GetSpzFrmFmts();
342 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
345 void SwUndoDrawGroup::SetGroupFmt( SwDrawFrmFmt
* pFmt
)
348 pObjArr
->pFmt
= pFmt
;
352 // ------------------------------
354 SwUndoDrawUnGroup::SwUndoDrawUnGroup( SdrObjGroup
* pObj
)
355 : SwUndo( UNDO_DRAWUNGROUP
), bDelFmt( FALSE
)
357 nSize
= (USHORT
)pObj
->GetSubList()->GetObjCount() + 1;
358 pObjArr
= new SwUndoGroupObjImpl
[ nSize
];
360 SwDrawContact
*pContact
= (SwDrawContact
*)GetUserCall(pObj
);
361 SwDrawFrmFmt
* pFmt
= (SwDrawFrmFmt
*)pContact
->GetFmt();
363 pObjArr
->pObj
= pObj
;
364 pObjArr
->pFmt
= pFmt
;
366 //loescht sich selbst!
367 pContact
->Changed( *pObj
, SDRUSERCALL_DELETE
, pObj
->GetLastBoundRect() );
368 pObj
->SetUserCall( 0 );
370 ::lcl_SaveAnchor( pFmt
, pObjArr
->nNodeIdx
);
372 // alle Uno-Objecte sollten sich jetzt abmelden
373 ::lcl_SendRemoveToUno( *pFmt
);
375 // aus dem Array austragen
376 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pFmt
->GetDoc()->GetSpzFrmFmts();
377 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
380 SwUndoDrawUnGroup::~SwUndoDrawUnGroup()
384 SwUndoGroupObjImpl
* pTmp
= pObjArr
+ 1;
385 for( USHORT n
= 1; n
< nSize
; ++n
, ++pTmp
)
389 delete pObjArr
->pFmt
; // das GroupObject-Format
394 void SwUndoDrawUnGroup::Undo( SwUndoIter
& rIter
)
398 // aus dem Array austragen
399 SwDoc
* pDoc
= &rIter
.GetDoc();
400 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
402 for( USHORT n
= 1; n
< nSize
; ++n
)
404 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
406 // --> OD 2006-11-01 #130889# - taken over by <SwUndoDrawUnGroupConnectToLayout>
407 // SwDrawContact* pContact = (SwDrawContact*)rSave.pFmt->FindContactObj();
409 // rSave.pObj = pContact->GetMaster();
411 // //loescht sich selbst!
412 // pContact->Changed( *rSave.pObj, SDRUSERCALL_DELETE,
413 // rSave.pObj->GetLastBoundRect() );
414 // rSave.pObj->SetUserCall( 0 );
417 ::lcl_SaveAnchor( rSave
.pFmt
, rSave
.nNodeIdx
);
419 // alle Uno-Objecte sollten sich jetzt abmelden
420 ::lcl_SendRemoveToUno( *rSave
.pFmt
);
422 rFlyFmts
.Remove( rFlyFmts
.GetPos( rSave
.pFmt
));
425 // das Group-Object wieder einfuegen
426 ::lcl_RestoreAnchor( pObjArr
->pFmt
, pObjArr
->nNodeIdx
);
427 rFlyFmts
.Insert( pObjArr
->pFmt
, rFlyFmts
.Count() );
429 SwDrawContact
*pContact
= new SwDrawContact( pObjArr
->pFmt
, pObjArr
->pObj
);
430 pContact
->ConnectToLayout();
431 // --> OD 2005-03-22 #i45718# - follow-up of #i35635#
432 // move object to visible layer
433 pContact
->MoveObjToVisibleLayer( pObjArr
->pObj
);
435 // --> OD 2005-05-10 #i45952# - notify that position attributes
437 ASSERT( pObjArr
->pFmt
->ISA(SwDrawFrmFmt
),
438 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
439 if ( pObjArr
->pFmt
->ISA(SwDrawFrmFmt
) )
441 static_cast<SwDrawFrmFmt
*>(pObjArr
->pFmt
)->PosAttrSet();
446 void SwUndoDrawUnGroup::Redo( SwUndoIter
& )
450 // das Group-Object sichern
451 SwDrawFrmFmt
* pFmt
= pObjArr
->pFmt
;
452 SwDrawContact
* pContact
= (SwDrawContact
*)pFmt
->FindContactObj();
454 //loescht sich selbst!
455 pContact
->Changed( *pObjArr
->pObj
, SDRUSERCALL_DELETE
,
456 pObjArr
->pObj
->GetLastBoundRect() );
457 pObjArr
->pObj
->SetUserCall( 0 );
459 ::lcl_SaveAnchor( pFmt
, pObjArr
->nNodeIdx
);
461 // alle Uno-Objecte sollten sich jetzt abmelden
462 ::lcl_SendRemoveToUno( *pFmt
);
464 // aus dem Array austragen
465 SwDoc
* pDoc
= pFmt
->GetDoc();
466 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
467 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
469 for( USHORT n
= 1; n
< nSize
; ++n
)
471 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
473 ::lcl_RestoreAnchor( rSave
.pFmt
, rSave
.nNodeIdx
);
474 rFlyFmts
.Insert( rSave
.pFmt
, rFlyFmts
.Count() );
476 // --> OD 2006-11-01 #130889# - taken over by <SwUndoDrawUnGroupConnectToLayout>
477 // SdrObject* pObj = rSave.pObj;
479 // SwDrawContact *pContact = new SwDrawContact( rSave.pFmt, rSave.pObj );
480 // pContact->ConnectToLayout();
481 // // --> OD 2005-03-22 #i45718# - follow-up of #i35635#
482 // // move object to visible layer
483 // pContact->MoveObjToVisibleLayer( rSave.pObj );
486 // --> OD 2005-05-10 #i45952# - notify that position attributes
488 ASSERT( rSave
.pFmt
->ISA(SwDrawFrmFmt
),
489 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
490 if ( rSave
.pFmt
->ISA(SwDrawFrmFmt
) )
492 static_cast<SwDrawFrmFmt
*>(rSave
.pFmt
)->PosAttrSet();
498 void SwUndoDrawUnGroup::AddObj( USHORT nPos
, SwDrawFrmFmt
* pFmt
)
500 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ nPos
+ 1 );
505 //-------------------------------------
506 // --> OD 2006-11-01 #130889#
507 SwUndoDrawUnGroupConnectToLayout::SwUndoDrawUnGroupConnectToLayout()
508 : SwUndo( UNDO_DRAWUNGROUP
)
512 SwUndoDrawUnGroupConnectToLayout::~SwUndoDrawUnGroupConnectToLayout()
516 void SwUndoDrawUnGroupConnectToLayout::Undo( SwUndoIter
& )
518 for ( std::vector
< SdrObject
>::size_type i
= 0;
519 i
< aDrawFmtsAndObjs
.size(); ++i
)
521 SdrObject
* pObj( aDrawFmtsAndObjs
[i
].second
);
522 SwDrawContact
* pDrawContact( dynamic_cast<SwDrawContact
*>(pObj
->GetUserCall()) );
523 ASSERT( pDrawContact
,
524 "<SwUndoDrawUnGroupConnectToLayout::Undo(..)> -- missing SwDrawContact instance" );
527 // deletion of instance <pDrawContact> and thus disconnection from
528 // the Writer layout.
529 pDrawContact
->Changed( *pObj
, SDRUSERCALL_DELETE
, pObj
->GetLastBoundRect() );
530 pObj
->SetUserCall( 0 );
535 void SwUndoDrawUnGroupConnectToLayout::Redo( SwUndoIter
& )
537 for ( std::vector
< std::pair
< SwDrawFrmFmt
*, SdrObject
* > >::size_type i
= 0;
538 i
< aDrawFmtsAndObjs
.size(); ++i
)
540 SwDrawFrmFmt
* pFmt( aDrawFmtsAndObjs
[i
].first
);
541 SdrObject
* pObj( aDrawFmtsAndObjs
[i
].second
);
542 SwDrawContact
*pContact
= new SwDrawContact( pFmt
, pObj
);
543 pContact
->ConnectToLayout();
544 pContact
->MoveObjToVisibleLayer( pObj
);
548 void SwUndoDrawUnGroupConnectToLayout::AddFmtAndObj( SwDrawFrmFmt
* pDrawFrmFmt
,
549 SdrObject
* pDrawObject
)
551 aDrawFmtsAndObjs
.push_back(
552 std::pair
< SwDrawFrmFmt
*, SdrObject
* >( pDrawFrmFmt
, pDrawObject
) );
556 //-------------------------------------
558 SwUndoDrawDelete::SwUndoDrawDelete( USHORT nCnt
)
559 : SwUndo( UNDO_DRAWDELETE
), nSize( nCnt
), bDelFmt( TRUE
)
561 pObjArr
= new SwUndoGroupObjImpl
[ nSize
];
562 pMarkLst
= new SdrMarkList();
565 SwUndoDrawDelete::~SwUndoDrawDelete()
569 SwUndoGroupObjImpl
* pTmp
= pObjArr
;
570 for( USHORT n
= 0; n
< pMarkLst
->GetMarkCount(); ++n
, ++pTmp
)
577 void SwUndoDrawDelete::Undo( SwUndoIter
&rIter
)
580 SwSpzFrmFmts
& rFlyFmts
= *rIter
.GetDoc().GetSpzFrmFmts();
581 for( USHORT n
= 0; n
< pMarkLst
->GetMarkCount(); ++n
)
583 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
584 ::lcl_RestoreAnchor( rSave
.pFmt
, rSave
.nNodeIdx
);
585 rFlyFmts
.Insert( rSave
.pFmt
, rFlyFmts
.Count() );
586 SdrObject
*pObj
= rSave
.pObj
;
587 SwDrawContact
*pContact
= new SwDrawContact( rSave
.pFmt
, pObj
);
588 pContact
->_Changed( *pObj
, SDRUSERCALL_INSERTED
, NULL
);
589 // --> OD 2005-03-22 #i45718# - follow-up of #i35635#
590 // move object to visible layer
591 pContact
->MoveObjToVisibleLayer( pObj
);
593 // --> OD 2005-05-10 #i45952# - notify that position attributes
595 ASSERT( rSave
.pFmt
->ISA(SwDrawFrmFmt
),
596 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
597 if ( rSave
.pFmt
->ISA(SwDrawFrmFmt
) )
599 static_cast<SwDrawFrmFmt
*>(rSave
.pFmt
)->PosAttrSet();
603 rIter
.pMarkList
= pMarkLst
;
606 void SwUndoDrawDelete::Redo( SwUndoIter
&rIter
)
609 SwSpzFrmFmts
& rFlyFmts
= *rIter
.GetDoc().GetSpzFrmFmts();
610 for( USHORT n
= 0; n
< pMarkLst
->GetMarkCount(); ++n
)
612 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
613 SdrObject
*pObj
= rSave
.pObj
;
614 SwDrawContact
*pContact
= (SwDrawContact
*)GetUserCall(pObj
);
615 SwDrawFrmFmt
*pFmt
= (SwDrawFrmFmt
*)pContact
->GetFmt();
616 //loescht sich selbst!
617 pContact
->Changed( *pObj
, SDRUSERCALL_DELETE
, pObj
->GetLastBoundRect() );
618 pObj
->SetUserCall( 0 );
620 // alle Uno-Objecte sollten sich jetzt abmelden
621 ::lcl_SendRemoveToUno( *pFmt
);
623 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
624 ::lcl_SaveAnchor( pFmt
, rSave
.nNodeIdx
);
628 void SwUndoDrawDelete::AddObj( USHORT
, SwDrawFrmFmt
* pFmt
,
629 const SdrMark
& rMark
)
631 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ pMarkLst
->GetMarkCount() );
632 rSave
.pObj
= rMark
.GetMarkedSdrObj();
634 ::lcl_SaveAnchor( pFmt
, rSave
.nNodeIdx
);
636 // alle Uno-Objecte sollten sich jetzt abmelden
637 ::lcl_SendRemoveToUno( *pFmt
);
639 // aus dem Array austragen
640 SwDoc
* pDoc
= pFmt
->GetDoc();
641 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
642 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
644 pMarkLst
->InsertEntry( rMark
);