diff options
author | Kurt Zenker <kz@openoffice.org> | 2004-02-26 16:46:32 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2004-02-26 16:46:32 +0000 |
commit | fd1008ffeb9486c37a7179b9425b3ab7d086c9fa (patch) | |
tree | 0c8788a8f0e5acbd18524d8e5ad7cbe90f4f9cb4 /svx | |
parent | c77c85010ee20c0fcb122dd08856512e06cc9c47 (diff) |
INTEGRATION: CWS aw008 (1.2.42); FILE MERGED
2004/02/17 12:51:05 aw 1.2.42.2: #114735# Added removal from DrawHierarchy BaseLevel when ViewObjectContact is removed.
2004/02/05 11:20:32 aw 1.2.42.1: #114735#
Added mechanism to remember all created VOCs at OC to be able to delete such ones which may not be in DrawHierarchy. Added TryToGet(SdrObject/SdrPage) methods to VC.
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sdr/contact/objectcontact.cxx | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/svx/source/sdr/contact/objectcontact.cxx b/svx/source/sdr/contact/objectcontact.cxx index 14968d26dfaa..8e5ea91d375c 100644 --- a/svx/source/sdr/contact/objectcontact.cxx +++ b/svx/source/sdr/contact/objectcontact.cxx @@ -2,9 +2,9 @@ * * $RCSfile: objectcontact.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: rt $ $Date: 2003-11-24 16:44:14 $ + * last change: $Author: kz $ $Date: 2004-02-26 17:46:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -106,6 +106,8 @@ namespace sdr ObjectContact::~ObjectContact() { #ifdef DBG_UTIL + DBG_ASSERT(0L == maVOCList.Count(), + "ObjectContact destructor: ViewObjectContactList is not empty, call PrepareDelete() before deleting (!)"); DBG_ASSERT(0L == mpObjectAnimator, "ObjectContact destructor: still an ObjectAnimator existing, call PrepareDelete() before deleting (!)"); DBG_ASSERT(0L == mpEventHandler, @@ -121,17 +123,19 @@ namespace sdr // it is required to first call PrepareDelete(). void ObjectContact::PrepareDelete() { - // get rid of all contacts - while(maDrawHierarchy.Count()) + // #114735# clear DrawHierarchy, empty maDrawHierarchy + ClearDrawHierarchy(); + + // get rid of all registered contacts + while(maVOCList.Count()) { - ViewObjectContact* pCandidate = maDrawHierarchy.GetLastObjectAndRemove(); + ViewObjectContact* pCandidate = maVOCList.GetLastObjectAndRemove(); DBG_ASSERT(pCandidate, "Corrupted ViewObjectContactList (!)"); // ViewObjectContacts only make sense with View and Object contacts. // When the contact to the SdrObject is deleted like in this case, // all ViewObjectContacts can be deleted, too. pCandidate->PrepareDelete(); - pCandidate->SetParent(0L); delete pCandidate; } @@ -143,6 +147,36 @@ namespace sdr DeleteEventHandler(); } + // A new ViewObjectContact was created and shall be remembered. + void ObjectContact::AddViewObjectContact(ViewObjectContact& rVOContact) + { + maVOCList.Append(&rVOContact); + } + + // A ViewObjectContact was deleted and shall be forgotten. + void ObjectContact::RemoveViewObjectContact(ViewObjectContact& rVOContact) + { + if(maVOCList.Count()) + { + maVOCList.Remove(&rVOContact); + } + + // #114735# also remove from base level DrawHierarchy + if(maDrawHierarchy.Count()) + { + if(maDrawHierarchy.Remove(&rVOContact)) + { + MarkDrawHierarchyInvalid(); + } + } + } + + // Test if ViewObjectContact is registered here + sal_Bool ObjectContact::ContainsViewObjectContact(ViewObjectContact& rVOContact) + { + return maVOCList.Contains(&rVOContact); + } + // Clear Draw Hierarchy data. void ObjectContact::ClearDrawHierarchy() { |