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
= (SwTxtFlyCnt
*)pTxtNd
->GetTxtAttr( nCntntPos
);
161 // Attribut steht noch im TextNode, loeschen
162 if( pAttr
&& pAttr
->GetFlyCnt().GetFrmFmt() == pFmt
)
164 // Pointer auf 0, nicht loeschen
165 ((SwFmtFlyCnt
&)pAttr
->GetFlyCnt()).SetFlyFmt();
166 SwIndex
aIdx( pTxtNd
, nCntntPos
);
167 pTxtNd
->Erase( aIdx
, 1 );
170 else if( FLY_AUTO_CNTNT
== rAnchor
.GetAnchorId() )
171 nCntntPos
= rAnchor
.GetCntntAnchor()->nContent
.GetIndex();
173 pFmt
->SetFmtAttr( SwFmtAnchor( rAnchor
.GetAnchorId(), nCntntPos
) );
177 void lcl_RestoreAnchor( SwFrmFmt
* pFmt
, ULONG
& rNodePos
)
179 const SwFmtAnchor
& rAnchor
= pFmt
->GetAnchor();
180 if( FLY_AT_CNTNT
== rAnchor
.GetAnchorId() ||
181 FLY_AUTO_CNTNT
== rAnchor
.GetAnchorId() ||
182 FLY_AT_FLY
== rAnchor
.GetAnchorId() ||
183 FLY_IN_CNTNT
== rAnchor
.GetAnchorId() )
185 xub_StrLen nCntntPos
= rAnchor
.GetPageNum();
186 SwNodes
& rNds
= pFmt
->GetDoc()->GetNodes();
188 SwNodeIndex
aIdx( rNds
, rNodePos
);
189 SwPosition
aPos( aIdx
);
191 SwFmtAnchor
aTmp( rAnchor
.GetAnchorId() );
192 if( FLY_IN_CNTNT
== rAnchor
.GetAnchorId() ||
193 FLY_AUTO_CNTNT
== rAnchor
.GetAnchorId() )
194 aPos
.nContent
.Assign( aIdx
.GetNode().GetCntntNode(), nCntntPos
);
195 aTmp
.SetAnchor( &aPos
);
196 pFmt
->SetFmtAttr( aTmp
);
198 if( FLY_IN_CNTNT
== rAnchor
.GetAnchorId() )
200 SwTxtNode
*pTxtNd
= aIdx
.GetNode().GetTxtNode();
201 ASSERT( pTxtNd
, "Kein Textnode gefunden" );
202 pTxtNd
->InsertItem( SwFmtFlyCnt( (SwFrmFmt
*)pFmt
),
203 nCntntPos
, nCntntPos
);
208 SwUndoDrawGroup::SwUndoDrawGroup( USHORT nCnt
)
209 : SwUndo( UNDO_DRAWGROUP
), nSize( nCnt
+ 1 ), bDelFmt( TRUE
)
211 pObjArr
= new SwUndoGroupObjImpl
[ nSize
];
214 SwUndoDrawGroup::~SwUndoDrawGroup()
218 SwUndoGroupObjImpl
* pTmp
= pObjArr
+ 1;
219 for( USHORT n
= 1; n
< nSize
; ++n
, ++pTmp
)
223 delete pObjArr
->pFmt
; // das GroupObject-Format
228 void SwUndoDrawGroup::Undo( SwUndoIter
& )
232 // das Group-Object sichern
233 SwDrawFrmFmt
* pFmt
= pObjArr
->pFmt
;
234 SwDrawContact
* pDrawContact
= (SwDrawContact
*)pFmt
->FindContactObj();
235 SdrObject
* pObj
= pDrawContact
->GetMaster();
236 pObjArr
->pObj
= pObj
;
238 //loescht sich selbst!
239 pDrawContact
->Changed( *pObj
, SDRUSERCALL_DELETE
, pObj
->GetLastBoundRect() );
240 pObj
->SetUserCall( 0 );
242 ::lcl_SaveAnchor( pFmt
, pObjArr
->nNodeIdx
);
244 // alle Uno-Objecte sollten sich jetzt abmelden
245 ::lcl_SendRemoveToUno( *pFmt
);
247 // aus dem Array austragen
248 SwDoc
* pDoc
= pFmt
->GetDoc();
249 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
250 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
252 for( USHORT n
= 1; n
< nSize
; ++n
)
254 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
256 ::lcl_RestoreAnchor( rSave
.pFmt
, rSave
.nNodeIdx
);
257 rFlyFmts
.Insert( rSave
.pFmt
, rFlyFmts
.Count() );
261 SwDrawContact
*pContact
= new SwDrawContact( rSave
.pFmt
, pObj
);
262 pContact
->ConnectToLayout();
263 // --> OD 2005-03-22 #i45718# - follow-up of #i35635#
264 // move object to visible layer
265 pContact
->MoveObjToVisibleLayer( pObj
);
267 // --> OD 2005-05-10 #i45952# - notify that position attributes
269 ASSERT( rSave
.pFmt
->ISA(SwDrawFrmFmt
),
270 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
271 if ( rSave
.pFmt
->ISA(SwDrawFrmFmt
) )
273 static_cast<SwDrawFrmFmt
*>(rSave
.pFmt
)->PosAttrSet();
279 void SwUndoDrawGroup::Redo( SwUndoIter
& )
283 // aus dem Array austragen
284 SwDoc
* pDoc
= pObjArr
->pFmt
->GetDoc();
285 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
288 for( USHORT n
= 1; n
< nSize
; ++n
)
290 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
294 SwDrawContact
*pContact
= (SwDrawContact
*)GetUserCall(pObj
);
295 //loescht sich selbst!
296 pContact
->Changed( *pObj
, SDRUSERCALL_DELETE
, pObj
->GetLastBoundRect() );
297 pObj
->SetUserCall( 0 );
299 ::lcl_SaveAnchor( rSave
.pFmt
, rSave
.nNodeIdx
);
301 // alle Uno-Objecte sollten sich jetzt abmelden
302 ::lcl_SendRemoveToUno( *rSave
.pFmt
);
304 rFlyFmts
.Remove( rFlyFmts
.GetPos( rSave
.pFmt
));
307 // das Group-Object wieder einfuegen
308 ::lcl_RestoreAnchor( pObjArr
->pFmt
, pObjArr
->nNodeIdx
);
309 rFlyFmts
.Insert( pObjArr
->pFmt
, rFlyFmts
.Count() );
311 SwDrawContact
*pContact
= new SwDrawContact( pObjArr
->pFmt
, pObjArr
->pObj
);
312 // OD 2004-04-15 #i26791# - correction: connect object to layout
313 pContact
->ConnectToLayout();
314 // --> OD 2005-03-22 #i45718# - follow-up of #i35635#
315 // move object to visible layer
316 pContact
->MoveObjToVisibleLayer( pObjArr
->pObj
);
318 // --> OD 2005-05-10 #i45952# - notify that position attributes
320 ASSERT( pObjArr
->pFmt
->ISA(SwDrawFrmFmt
),
321 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
322 if ( pObjArr
->pFmt
->ISA(SwDrawFrmFmt
) )
324 static_cast<SwDrawFrmFmt
*>(pObjArr
->pFmt
)->PosAttrSet();
329 void SwUndoDrawGroup::AddObj( USHORT nPos
, SwDrawFrmFmt
* pFmt
, SdrObject
* pObj
)
331 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ nPos
+ 1 );
334 ::lcl_SaveAnchor( pFmt
, rSave
.nNodeIdx
);
336 // alle Uno-Objecte sollten sich jetzt abmelden
337 ::lcl_SendRemoveToUno( *pFmt
);
339 // aus dem Array austragen
340 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pFmt
->GetDoc()->GetSpzFrmFmts();
341 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
344 void SwUndoDrawGroup::SetGroupFmt( SwDrawFrmFmt
* pFmt
)
347 pObjArr
->pFmt
= pFmt
;
351 // ------------------------------
353 SwUndoDrawUnGroup::SwUndoDrawUnGroup( SdrObjGroup
* pObj
)
354 : SwUndo( UNDO_DRAWUNGROUP
), bDelFmt( FALSE
)
356 nSize
= (USHORT
)pObj
->GetSubList()->GetObjCount() + 1;
357 pObjArr
= new SwUndoGroupObjImpl
[ nSize
];
359 SwDrawContact
*pContact
= (SwDrawContact
*)GetUserCall(pObj
);
360 SwDrawFrmFmt
* pFmt
= (SwDrawFrmFmt
*)pContact
->GetFmt();
362 pObjArr
->pObj
= pObj
;
363 pObjArr
->pFmt
= pFmt
;
365 //loescht sich selbst!
366 pContact
->Changed( *pObj
, SDRUSERCALL_DELETE
, pObj
->GetLastBoundRect() );
367 pObj
->SetUserCall( 0 );
369 ::lcl_SaveAnchor( pFmt
, pObjArr
->nNodeIdx
);
371 // alle Uno-Objecte sollten sich jetzt abmelden
372 ::lcl_SendRemoveToUno( *pFmt
);
374 // aus dem Array austragen
375 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pFmt
->GetDoc()->GetSpzFrmFmts();
376 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
379 SwUndoDrawUnGroup::~SwUndoDrawUnGroup()
383 SwUndoGroupObjImpl
* pTmp
= pObjArr
+ 1;
384 for( USHORT n
= 1; n
< nSize
; ++n
, ++pTmp
)
388 delete pObjArr
->pFmt
; // das GroupObject-Format
393 void SwUndoDrawUnGroup::Undo( SwUndoIter
& rIter
)
397 // aus dem Array austragen
398 SwDoc
* pDoc
= &rIter
.GetDoc();
399 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
401 for( USHORT n
= 1; n
< nSize
; ++n
)
403 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
405 // --> OD 2006-11-01 #130889# - taken over by <SwUndoDrawUnGroupConnectToLayout>
406 // SwDrawContact* pContact = (SwDrawContact*)rSave.pFmt->FindContactObj();
408 // rSave.pObj = pContact->GetMaster();
410 // //loescht sich selbst!
411 // pContact->Changed( *rSave.pObj, SDRUSERCALL_DELETE,
412 // rSave.pObj->GetLastBoundRect() );
413 // rSave.pObj->SetUserCall( 0 );
416 ::lcl_SaveAnchor( rSave
.pFmt
, rSave
.nNodeIdx
);
418 // alle Uno-Objecte sollten sich jetzt abmelden
419 ::lcl_SendRemoveToUno( *rSave
.pFmt
);
421 rFlyFmts
.Remove( rFlyFmts
.GetPos( rSave
.pFmt
));
424 // das Group-Object wieder einfuegen
425 ::lcl_RestoreAnchor( pObjArr
->pFmt
, pObjArr
->nNodeIdx
);
426 rFlyFmts
.Insert( pObjArr
->pFmt
, rFlyFmts
.Count() );
428 SwDrawContact
*pContact
= new SwDrawContact( pObjArr
->pFmt
, pObjArr
->pObj
);
429 pContact
->ConnectToLayout();
430 // --> OD 2005-03-22 #i45718# - follow-up of #i35635#
431 // move object to visible layer
432 pContact
->MoveObjToVisibleLayer( pObjArr
->pObj
);
434 // --> OD 2005-05-10 #i45952# - notify that position attributes
436 ASSERT( pObjArr
->pFmt
->ISA(SwDrawFrmFmt
),
437 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
438 if ( pObjArr
->pFmt
->ISA(SwDrawFrmFmt
) )
440 static_cast<SwDrawFrmFmt
*>(pObjArr
->pFmt
)->PosAttrSet();
445 void SwUndoDrawUnGroup::Redo( SwUndoIter
& )
449 // das Group-Object sichern
450 SwDrawFrmFmt
* pFmt
= pObjArr
->pFmt
;
451 SwDrawContact
* pContact
= (SwDrawContact
*)pFmt
->FindContactObj();
453 //loescht sich selbst!
454 pContact
->Changed( *pObjArr
->pObj
, SDRUSERCALL_DELETE
,
455 pObjArr
->pObj
->GetLastBoundRect() );
456 pObjArr
->pObj
->SetUserCall( 0 );
458 ::lcl_SaveAnchor( pFmt
, pObjArr
->nNodeIdx
);
460 // alle Uno-Objecte sollten sich jetzt abmelden
461 ::lcl_SendRemoveToUno( *pFmt
);
463 // aus dem Array austragen
464 SwDoc
* pDoc
= pFmt
->GetDoc();
465 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
466 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
468 for( USHORT n
= 1; n
< nSize
; ++n
)
470 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
472 ::lcl_RestoreAnchor( rSave
.pFmt
, rSave
.nNodeIdx
);
473 rFlyFmts
.Insert( rSave
.pFmt
, rFlyFmts
.Count() );
475 // --> OD 2006-11-01 #130889# - taken over by <SwUndoDrawUnGroupConnectToLayout>
476 // SdrObject* pObj = rSave.pObj;
478 // SwDrawContact *pContact = new SwDrawContact( rSave.pFmt, rSave.pObj );
479 // pContact->ConnectToLayout();
480 // // --> OD 2005-03-22 #i45718# - follow-up of #i35635#
481 // // move object to visible layer
482 // pContact->MoveObjToVisibleLayer( rSave.pObj );
485 // --> OD 2005-05-10 #i45952# - notify that position attributes
487 ASSERT( rSave
.pFmt
->ISA(SwDrawFrmFmt
),
488 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
489 if ( rSave
.pFmt
->ISA(SwDrawFrmFmt
) )
491 static_cast<SwDrawFrmFmt
*>(rSave
.pFmt
)->PosAttrSet();
497 void SwUndoDrawUnGroup::AddObj( USHORT nPos
, SwDrawFrmFmt
* pFmt
)
499 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ nPos
+ 1 );
504 //-------------------------------------
505 // --> OD 2006-11-01 #130889#
506 SwUndoDrawUnGroupConnectToLayout::SwUndoDrawUnGroupConnectToLayout()
507 : SwUndo( UNDO_DRAWUNGROUP
)
511 SwUndoDrawUnGroupConnectToLayout::~SwUndoDrawUnGroupConnectToLayout()
515 void SwUndoDrawUnGroupConnectToLayout::Undo( SwUndoIter
& )
517 for ( std::vector
< SdrObject
>::size_type i
= 0;
518 i
< aDrawFmtsAndObjs
.size(); ++i
)
520 SdrObject
* pObj( aDrawFmtsAndObjs
[i
].second
);
521 SwDrawContact
* pDrawContact( dynamic_cast<SwDrawContact
*>(pObj
->GetUserCall()) );
522 ASSERT( pDrawContact
,
523 "<SwUndoDrawUnGroupConnectToLayout::Undo(..)> -- missing SwDrawContact instance" );
526 // deletion of instance <pDrawContact> and thus disconnection from
527 // the Writer layout.
528 pDrawContact
->Changed( *pObj
, SDRUSERCALL_DELETE
, pObj
->GetLastBoundRect() );
529 pObj
->SetUserCall( 0 );
534 void SwUndoDrawUnGroupConnectToLayout::Redo( SwUndoIter
& )
536 for ( std::vector
< std::pair
< SwDrawFrmFmt
*, SdrObject
* > >::size_type i
= 0;
537 i
< aDrawFmtsAndObjs
.size(); ++i
)
539 SwDrawFrmFmt
* pFmt( aDrawFmtsAndObjs
[i
].first
);
540 SdrObject
* pObj( aDrawFmtsAndObjs
[i
].second
);
541 SwDrawContact
*pContact
= new SwDrawContact( pFmt
, pObj
);
542 pContact
->ConnectToLayout();
543 pContact
->MoveObjToVisibleLayer( pObj
);
547 void SwUndoDrawUnGroupConnectToLayout::AddFmtAndObj( SwDrawFrmFmt
* pDrawFrmFmt
,
548 SdrObject
* pDrawObject
)
550 aDrawFmtsAndObjs
.push_back(
551 std::pair
< SwDrawFrmFmt
*, SdrObject
* >( pDrawFrmFmt
, pDrawObject
) );
555 //-------------------------------------
557 SwUndoDrawDelete::SwUndoDrawDelete( USHORT nCnt
)
558 : SwUndo( UNDO_DRAWDELETE
), nSize( nCnt
), bDelFmt( TRUE
)
560 pObjArr
= new SwUndoGroupObjImpl
[ nSize
];
561 pMarkLst
= new SdrMarkList();
564 SwUndoDrawDelete::~SwUndoDrawDelete()
568 SwUndoGroupObjImpl
* pTmp
= pObjArr
;
569 for( USHORT n
= 0; n
< pMarkLst
->GetMarkCount(); ++n
, ++pTmp
)
576 void SwUndoDrawDelete::Undo( SwUndoIter
&rIter
)
579 SwSpzFrmFmts
& rFlyFmts
= *rIter
.GetDoc().GetSpzFrmFmts();
580 for( USHORT n
= 0; n
< pMarkLst
->GetMarkCount(); ++n
)
582 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
583 ::lcl_RestoreAnchor( rSave
.pFmt
, rSave
.nNodeIdx
);
584 rFlyFmts
.Insert( rSave
.pFmt
, rFlyFmts
.Count() );
585 SdrObject
*pObj
= rSave
.pObj
;
586 SwDrawContact
*pContact
= new SwDrawContact( rSave
.pFmt
, pObj
);
587 pContact
->_Changed( *pObj
, SDRUSERCALL_INSERTED
, NULL
);
588 // --> OD 2005-03-22 #i45718# - follow-up of #i35635#
589 // move object to visible layer
590 pContact
->MoveObjToVisibleLayer( pObj
);
592 // --> OD 2005-05-10 #i45952# - notify that position attributes
594 ASSERT( rSave
.pFmt
->ISA(SwDrawFrmFmt
),
595 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
596 if ( rSave
.pFmt
->ISA(SwDrawFrmFmt
) )
598 static_cast<SwDrawFrmFmt
*>(rSave
.pFmt
)->PosAttrSet();
602 rIter
.pMarkList
= pMarkLst
;
605 void SwUndoDrawDelete::Redo( SwUndoIter
&rIter
)
608 SwSpzFrmFmts
& rFlyFmts
= *rIter
.GetDoc().GetSpzFrmFmts();
609 for( USHORT n
= 0; n
< pMarkLst
->GetMarkCount(); ++n
)
611 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ n
);
612 SdrObject
*pObj
= rSave
.pObj
;
613 SwDrawContact
*pContact
= (SwDrawContact
*)GetUserCall(pObj
);
614 SwDrawFrmFmt
*pFmt
= (SwDrawFrmFmt
*)pContact
->GetFmt();
615 //loescht sich selbst!
616 pContact
->Changed( *pObj
, SDRUSERCALL_DELETE
, pObj
->GetLastBoundRect() );
617 pObj
->SetUserCall( 0 );
619 // alle Uno-Objecte sollten sich jetzt abmelden
620 ::lcl_SendRemoveToUno( *pFmt
);
622 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
623 ::lcl_SaveAnchor( pFmt
, rSave
.nNodeIdx
);
627 void SwUndoDrawDelete::AddObj( USHORT
, SwDrawFrmFmt
* pFmt
,
628 const SdrMark
& rMark
)
630 SwUndoGroupObjImpl
& rSave
= *( pObjArr
+ pMarkLst
->GetMarkCount() );
631 rSave
.pObj
= rMark
.GetMarkedSdrObj();
633 ::lcl_SaveAnchor( pFmt
, rSave
.nNodeIdx
);
635 // alle Uno-Objecte sollten sich jetzt abmelden
636 ::lcl_SendRemoveToUno( *pFmt
);
638 // aus dem Array austragen
639 SwDoc
* pDoc
= pFmt
->GetDoc();
640 SwSpzFrmFmts
& rFlyFmts
= *(SwSpzFrmFmts
*)pDoc
->GetSpzFrmFmts();
641 rFlyFmts
.Remove( rFlyFmts
.GetPos( pFmt
));
643 pMarkLst
->InsertEntry( rMark
);