summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-16 22:34:50 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-05-25 12:31:32 +0200
commit4b4942224b550235da228655677b5c068a053254 (patch)
treea660a04a1f7a3eee910da780ece271d68942201d /svx/source
parentf8edef392245c292398a80f6a858ca19f32df9c3 (diff)
SOSAW080: Derive SdrObjGroup from SdrObjList
Also simplify parent/child relationships, get rid of double data (SdrPage/Parent infos in SdrObjects, also in SdrObjList). This is all not needed - when a SdrObject is inserted to a SdrPage, get SdrPage by traveling over parents (no double info, member as soon as inserted, ...). More cleanups/reworks included, will need some more cleanups, too. Stabilizing: SetRectsDirty/DefaultStyleSheet Had to correct the SetRectsDirty stuff for 3D due to going down the hierarchy while the 2D implementation goes the other direction -> endless loops. Added special handling for 3D stuff for now (will be chnaged again when SnapRect is no longer needed at SdrObject level). Also had to adapt how the DefaultStyleSheet is set at incarnated SdrObjects - better: their properties. Since we now always have a SdrModel, it is possible to correctly initialize with the correct default StyleSheet from that SdrModel. This needs to be done after ForceDefaultAttributes and in a way that again deletes Items that are set in the StyleSheet. This leads to an error in CppunitTest_sd_import_tests where I checked tdf100491 - it is okay and thus I change the control instance of the imported, XML-dumped file. The less hard attributes, the better for Styles in general. Cleanup of comments for last two commits Corrected SvxShape::getParent() Needed to get the direct parent, so test for SdrObject first (to get SdrObjGroup/E3DScene), for SdrPage second Fixed CppunitTest_sc_subsequent_export_test Several problems arose. The used SdrCaptionObj was Cloned, but the clone not inserted to a SdrPage. This leads to not being able to access a UNO API imlementation of the SdrPage (SvxPage) on lower levels. It worked before due to SdrObject having a SdrPage* additionally to being added to a SdrPage - this is exactly the main cleanup this change does. Looked for why it is cloned, could see no reasons. The SdrCaptionObj exists during all im/export, not difference to other SdrObjects (that do not get cloned). It is not changed in any way. It *might* be to suppress a crash that happened due to UNO API Service emfio/emfio not being available in the UnitTest scenario. Interestingly it did not crash with the cloned SdrCaptionObj, but the Graphic exported was probably wrong. Fixed by no longer Cloning the SdrCaptionObj and adding emfio/emfio UNO API Service. d139f821a5b39535a3e7b9c6261df7e18f8ae8ac 910e7f4bc628a715fda7545dffaf3369d5e76ea0 ca1de01b723051e09ac37d7ec7bba978beea41c5 3a76da1471dfe75e69847f64a6a3519ad21c8c9c Change-Id: I986586e326b563acebf00d931a7084c6eb09e5f8 Reviewed-on: https://gerrit.libreoffice.org/54689 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx2
-rw-r--r--svx/source/engine3d/helperhittest3d.cxx4
-rw-r--r--svx/source/engine3d/obj3d.cxx10
-rw-r--r--svx/source/engine3d/scene3d.cxx88
-rw-r--r--svx/source/engine3d/view3d.cxx18
-rw-r--r--svx/source/form/fmobj.cxx32
-rw-r--r--svx/source/form/fmpgeimp.cxx6
-rw-r--r--svx/source/form/fmshell.cxx2
-rw-r--r--svx/source/form/fmshimp.cxx8
-rw-r--r--svx/source/form/fmundo.cxx8
-rw-r--r--svx/source/form/fmview.cxx2
-rw-r--r--svx/source/form/fmvwimp.cxx16
-rw-r--r--svx/source/form/navigatortree.cxx6
-rw-r--r--svx/source/form/navigatortreemodel.cxx4
-rw-r--r--svx/source/inc/fmobj.hxx3
-rw-r--r--svx/source/sdr/contact/objectcontactofpageview.cxx8
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobj.cxx4
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpathobj.cxx2
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgraphic.cxx2
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx61
-rw-r--r--svx/source/sdr/properties/graphicproperties.cxx17
-rw-r--r--svx/source/sdr/properties/itemsettools.cxx2
-rw-r--r--svx/source/sdr/properties/oleproperties.cxx19
-rw-r--r--svx/source/sdr/properties/properties.cxx6
-rw-r--r--svx/source/svdraw/svdcrtv.cxx8
-rw-r--r--svx/source/svdraw/svdedtv.cxx6
-rw-r--r--svx/source/svdraw/svdedtv1.cxx10
-rw-r--r--svx/source/svdraw/svdedtv2.cxx14
-rw-r--r--svx/source/svdraw/svdedxv.cxx2
-rw-r--r--svx/source/svdraw/svdetc.cxx2
-rw-r--r--svx/source/svdraw/svditer.cxx118
-rw-r--r--svx/source/svdraw/svdmark.cxx2
-rw-r--r--svx/source/svdraw/svdmodel.cxx2
-rw-r--r--svx/source/svdraw/svdmrkv.cxx4
-rw-r--r--svx/source/svdraw/svdoashp.cxx7
-rw-r--r--svx/source/svdraw/svdobj.cxx127
-rw-r--r--svx/source/svdraw/svdoedge.cxx99
-rw-r--r--svx/source/svdraw/svdograf.cxx31
-rw-r--r--svx/source/svdraw/svdogrp.cxx303
-rw-r--r--svx/source/svdraw/svdoole2.cxx31
-rw-r--r--svx/source/svdraw/svdotext.cxx19
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx15
-rw-r--r--svx/source/svdraw/svdouno.cxx4
-rw-r--r--svx/source/svdraw/svdpage.cxx240
-rw-r--r--svx/source/svdraw/svdpagv.cxx10
-rw-r--r--svx/source/svdraw/svdsnpv.cxx2
-rw-r--r--svx/source/svdraw/svdundo.cxx13
-rw-r--r--svx/source/svdraw/svdviter.cxx2
-rw-r--r--svx/source/svdraw/svdxcgv.cxx12
-rw-r--r--svx/source/table/tablecontroller.cxx2
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx9
-rw-r--r--svx/source/unodraw/unopage.cxx1
-rw-r--r--svx/source/unodraw/unoshap2.cxx2
-rw-r--r--svx/source/unodraw/unoshap3.cxx4
-rw-r--r--svx/source/unodraw/unoshape.cxx57
-rw-r--r--svx/source/unodraw/unoshtxt.cxx6
56 files changed, 853 insertions, 641 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 003a43ff7d20..2a62c0ac1daf 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -255,8 +255,6 @@ SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText(
pRenderedShape = new SdrObjGroup(rSdrObjCustomShape.getSdrModelFromSdrObject());
static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
}
-
- pRenderedShape->SetPage(rSdrObjCustomShape.GetPage());
}
}
diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx
index 09dbdf45cd8d..db71e75da574 100644
--- a/svx/source/engine3d/helperhittest3d.cxx
+++ b/svx/source/engine3d/helperhittest3d.cxx
@@ -162,7 +162,7 @@ void getAllHit3DObjectsSortedFrontToBack(
o_rResult.clear();
SdrObjList* pList = rScene.GetSubList();
- if(pList && pList->GetObjCount())
+ if(nullptr != pList && 0 != pList->GetObjCount())
{
// prepare relative HitPoint. To do so, get the VC of the 3DScene and from there
// the Scene's 2D transformation. Multiplying with the inverse transformation
@@ -175,7 +175,7 @@ void getAllHit3DObjectsSortedFrontToBack(
// check if test point is inside scene's area at all
if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0)
{
- SdrObjListIter aIterator(*pList, SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIterator(pList, SdrIterMode::DeepNoGroups);
::std::vector< ImplPairDephAndObject > aDepthAndObjectResults;
const uno::Sequence< beans::PropertyValue > aEmptyParameters;
drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 522bf6de5e7e..670dbb9ccd04 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -285,9 +285,9 @@ E3dObject* E3dObject::GetParentObj() const
{
E3dObject* pRetval = nullptr;
- if(getParentOfSdrObject() && getParentOfSdrObject()->GetOwnerObj())
+ if(getParentOfSdrObject())
{
- pRetval = dynamic_cast<E3dObject*>(getParentOfSdrObject()->GetOwnerObj());
+ pRetval = dynamic_cast< E3dObject* >(getParentOfSdrObject()->getSdrObjectFromSdrObjList());
}
return pRetval;
@@ -677,11 +677,9 @@ basegfx::B2DPolyPolygon E3dCompoundObject::TransformToScreenCoor(const basegfx::
bool E3dCompoundObject::IsAOrdNumRemapCandidate(E3dScene*& prScene) const
{
- if(getParentOfSdrObject()
- && getParentOfSdrObject()->GetOwnerObj()
- && dynamic_cast<const E3dObject*>(getParentOfSdrObject()->GetOwnerObj()))
+ if(getParentOfSdrObject() && getParentOfSdrObject()->getSdrObjectFromSdrObjList())
{
- prScene = static_cast<E3dScene*>(getParentOfSdrObject()->GetOwnerObj());
+ prScene = static_cast< E3dScene* >(getParentOfSdrObject()->getSdrObjectFromSdrObjList());
return true;
}
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 01fa06cc1b37..465cdbd836fa 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -178,9 +178,6 @@ E3dScene::E3dScene(SdrModel& rSdrModel)
bDrawOnlySelected(false),
mbSkipSettingDirty(false)
{
- SetOwnerObj(this);
- SetListKind(SdrObjListKind::GroupObj);
-
// Set defaults
SetDefaultAttributes();
}
@@ -218,6 +215,26 @@ E3dScene::~E3dScene()
ImpCleanup3DDepthMapper();
}
+SdrPage* E3dScene::getSdrPageFromSdrObjList() const
+{
+ return getSdrPageFromSdrObject();
+}
+
+SdrObject* E3dScene::getSdrObjectFromSdrObjList() const
+{
+ return const_cast< E3dScene* >(this);
+}
+
+SdrModel& E3dScene::getSdrModelFromSdrObjList() const
+{
+ return getSdrModelFromSdrObject();
+}
+
+SdrObjList* E3dScene::getChildrenOfSdrObject() const
+{
+ return const_cast< E3dScene* >(this);
+}
+
basegfx::B2DPolyPolygon E3dScene::TakeXorPoly() const
{
const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(GetViewContact());
@@ -467,14 +484,13 @@ void E3dScene::SetAllSceneRectsDirty()
void E3dScene::RebuildLists()
{
// first delete
- SdrLayerID nCurrLayerID = GetLayer();
-
- SdrObjListIter a3DIterator(static_cast< SdrObjList& >(*this), SdrIterMode::Flat);
+ const SdrLayerID nCurrLayerID(GetLayer());
+ SdrObjListIter a3DIterator(GetSubList(), SdrIterMode::Flat);
// then examine all the objects in the scene
- while ( a3DIterator.IsMore() )
+ while(a3DIterator.IsMore())
{
- E3dObject* p3DObj = static_cast<E3dObject*>(a3DIterator.Next());
+ E3dObject* p3DObj(static_cast< E3dObject* >(a3DIterator.Next()));
p3DObj->NbcSetLayer(nCurrLayerID);
NewObjectInserted(p3DObj);
}
@@ -657,7 +673,7 @@ void E3dScene::RecalcSnapRect()
bool E3dScene::IsBreakObjPossible()
{
// Break scene, if all members are able to break
- SdrObjListIter a3DIterator(static_cast< SdrObjList& >(*this), SdrIterMode::DeepWithGroups);
+ SdrObjListIter a3DIterator(GetSubList(), SdrIterMode::DeepWithGroups);
while ( a3DIterator.IsMore() )
{
@@ -734,11 +750,8 @@ void E3dScene::SetSelected(bool bNew)
void E3dScene::NbcInsertObject(SdrObject* pObj, size_t nPos)
{
- // Get owner
- DBG_ASSERT(dynamic_cast<const E3dObject*>(GetOwnerObj()), "Insert 3D object in parent != 3DObject");
-
// Is it even a 3D object?
- if(pObj && nullptr != dynamic_cast< const E3dObject* >(pObj))
+ if(nullptr != dynamic_cast< const E3dObject* >(pObj))
{
// Normal 3D object, insert means
// call parent
@@ -747,14 +760,12 @@ void E3dScene::NbcInsertObject(SdrObject* pObj, size_t nPos)
else
{
// No 3D object, inserted a page in place in a scene ...
- GetOwnerObj()->GetPage()->InsertObject(pObj, nPos);
+ getSdrObjectFromSdrObjList()->getSdrPageFromSdrObject()->InsertObject(pObj, nPos);
}
}
void E3dScene::InsertObject(SdrObject* pObj, size_t nPos)
{
- OSL_ENSURE(dynamic_cast<const E3dObject*>(GetOwnerObj()), "Insert 3D object in non-3D Parent");
-
// call parent
SdrObjList::InsertObject(pObj, nPos);
@@ -763,8 +774,6 @@ void E3dScene::InsertObject(SdrObject* pObj, size_t nPos)
SdrObject* E3dScene::NbcRemoveObject(size_t nObjNum)
{
- DBG_ASSERT(dynamic_cast<const E3dObject*>(GetOwnerObj()), "Remove 3D object from Parent != 3DObject");
-
// call parent
SdrObject* pRetval = SdrObjList::NbcRemoveObject(nObjNum);
@@ -775,8 +784,6 @@ SdrObject* E3dScene::NbcRemoveObject(size_t nObjNum)
SdrObject* E3dScene::RemoveObject(size_t nObjNum)
{
- OSL_ENSURE(dynamic_cast<const E3dObject*>(GetOwnerObj()), "3D object is removed from non-3D Parent");
-
// call parent
SdrObject* pRetval = SdrObjList::RemoveObject(nObjNum);
@@ -785,10 +792,10 @@ SdrObject* E3dScene::RemoveObject(size_t nObjNum)
return pRetval;
}
-void E3dScene::SetRectsDirty(bool bNotMyself)
+void E3dScene::SetRectsDirty(bool bNotMyself, bool bRecursive)
{
// call parent
- E3dObject::SetRectsDirty(bNotMyself);
+ E3dObject::SetRectsDirty(bNotMyself, bRecursive);
for(size_t a = 0; a < GetObjCount(); ++a)
{
@@ -796,7 +803,7 @@ void E3dScene::SetRectsDirty(bool bNotMyself)
if(pCandidate)
{
- pCandidate->SetRectsDirty(bNotMyself);
+ pCandidate->SetRectsDirty(bNotMyself, false);
}
}
}
@@ -817,21 +824,27 @@ void E3dScene::NbcSetLayer(SdrLayerID nLayer)
}
}
-void E3dScene::setParentOfSdrObject(SdrObjList* pNewObjList)
+void E3dScene::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
- // call parent
- E3dObject::setParentOfSdrObject(pNewObjList);
-
- SetUpList(pNewObjList);
-}
+ if(pOldPage != pNewPage)
+ {
+ // call parent
+ E3dObject::handlePageChange(pOldPage, pNewPage);
-void E3dScene::SetPage(SdrPage* pNewPage)
-{
- // call parent
- E3dObject::SetPage(pNewPage);
+ for(size_t a(0); a < GetObjCount(); a++)
+ {
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));
- // set at SdrObjList
- SdrObjList::SetPage(pNewPage);
+ if(pCandidate)
+ {
+ pCandidate->handlePageChange(pOldPage, pNewPage);
+ }
+ else
+ {
+ OSL_ENSURE(false, "E3dScene::handlePageChange invalid object list (!)");
+ }
+ }
+ }
}
SdrObjList* E3dScene::GetSubList() const
@@ -842,9 +855,7 @@ SdrObjList* E3dScene::GetSubList() const
void E3dScene::Insert3DObj(E3dObject* p3DObj)
{
DBG_ASSERT(p3DObj, "Insert3DObj with NULL-pointer!");
- SdrPage* pPg = pPage;
InsertObject(p3DObj);
- pPage = pPg;
InvalidateBoundVolume();
NewObjectInserted(p3DObj);
StructureChanged();
@@ -856,10 +867,7 @@ void E3dScene::Remove3DObj(E3dObject const * p3DObj)
if(p3DObj->GetParentObj() == this)
{
- SdrPage* pPg = pPage;
RemoveObject(p3DObj->GetOrdNum());
- pPage = pPg;
-
InvalidateBoundVolume();
StructureChanged();
}
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 7431cb2e875a..8be7aae2abe4 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -456,10 +456,10 @@ bool E3dView::Paste(
return false;
// Get owner of the list
- SdrObject* pOwner = pDstList->GetOwnerObj();
- if(pOwner && dynamic_cast< const E3dScene* >(pOwner) != nullptr)
+ E3dScene* pDstScene(dynamic_cast< E3dScene* >(pDstList->getSdrObjectFromSdrObjList()));
+
+ if(nullptr != pDstScene)
{
- E3dScene* pDstScene = static_cast<E3dScene*>(pOwner);
BegUndo(SvxResId(RID_SVX_3D_UNDO_EXCHANGE_PASTE));
// Copy all objects from E3dScenes and insert them directly
@@ -581,7 +581,6 @@ bool E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene const * pSrcScene, E3dSce
pNewCompoundObj->SetTransform(aModifyingTransform * aNewObjectTrans);
// fill and insert new object
- pNewCompoundObj->SetPage(pDstScene->E3dObject::GetPage());
pNewCompoundObj->NbcSetLayer(pCompoundObj->GetLayer());
pNewCompoundObj->NbcSetStyleSheet(pCompoundObj->GetStyleSheet(), true);
pDstScene->Insert3DObj(pNewCompoundObj);
@@ -655,7 +654,7 @@ void E3dView::ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj)
if(rTextColorItem.GetValue() == COL_BLACK)
{
//For black text objects, the color set to gray
- if(pObj->GetPage())
+ if(pObj->getSdrPageFromSdrObject())
{
// if black is only default attribute from
// pattern set it hard so that it is used in undo.
@@ -685,8 +684,11 @@ void E3dView::ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj)
&& !nLineWidth
&& eFillStyle != drawing::FillStyle_NONE)
{
- if(pObj->GetPage() && GetModel()->IsUndoEnabled() )
+ if(pObj->getSdrPageFromSdrObject() && GetModel()->IsUndoEnabled() )
+ {
AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
+ }
+
pObj->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
pObj->SetMergedItem(XLineWidthItem(0));
}
@@ -1035,7 +1037,7 @@ void E3dView::DoDepthArrange(E3dScene const * pScene, double fDepth)
if(pScene && pScene->GetSubList() && pScene->GetSubList()->GetObjCount() > 1)
{
SdrObjList* pSubList = pScene->GetSubList();
- SdrObjListIter aIter(*pSubList, SdrIterMode::Flat);
+ SdrObjListIter aIter(pSubList, SdrIterMode::Flat);
E3dDepthLayer* pBaseLayer = nullptr;
E3dDepthLayer* pLayer = nullptr;
sal_Int32 nNumLayers = 0;
@@ -1550,7 +1552,7 @@ void E3dView::BreakSingle3DObj(E3dObject* pObj)
if(dynamic_cast< const E3dScene* >(pObj) != nullptr)
{
SdrObjList* pSubList = pObj->GetSubList();
- SdrObjListIter aIter(*pSubList, SdrIterMode::Flat);
+ SdrObjListIter aIter(pSubList, SdrIterMode::Flat);
while(aIter.IsMore())
{
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
index 8b3ee18c806f..cb9b4ca44c29 100644
--- a/svx/source/form/fmobj.cxx
+++ b/svx/source/form/fmobj.cxx
@@ -164,26 +164,21 @@ void FmFormObj::impl_isolateControlModel_nothrow()
}
-void FmFormObj::SetPage(SdrPage* _pNewPage)
+void FmFormObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
- if ( GetPage() == _pNewPage )
- {
- SdrUnoObj::SetPage(_pNewPage);
- return;
- }
-
- FmFormPage* pOldFormPage = dynamic_cast<FmFormPage*>( GetPage() );
+ FmFormPage* pOldFormPage(dynamic_cast< FmFormPage* >(getSdrPageFromSdrObject()));
if ( pOldFormPage )
pOldFormPage->GetImpl().formObjectRemoved( *this );
- FmFormPage* pNewFormPage = dynamic_cast<FmFormPage*>( _pNewPage );
+ FmFormPage* pNewFormPage = dynamic_cast<FmFormPage*>( pNewPage );
if ( !pNewFormPage )
- { // Maybe it makes sense to create an environment history here : if somebody set's our page to NULL, and we have a valid page before,
+ {
+ // Maybe it makes sense to create an environment history here : if somebody set's our page to NULL, and we have a valid page before,
// me may want to remember our place within the old page. For this we could create a new m_xEnvironmentHistory to store it.
// So the next SetPage with a valid new page would restore that environment within the new page.
// But for the original Bug (#57300#) we don't need that, so I omit it here. Maybe this will be implemented later.
impl_isolateControlModel_nothrow();
- SdrUnoObj::SetPage(_pNewPage);
+ SdrUnoObj::handlePageChange(pOldPage, pNewPage);
return;
}
@@ -195,7 +190,7 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
// do we have a history ? (from :Clone)
if ( m_xEnvironmentHistory.is() )
{
- // the element in m_xEnvironmentHistory which is equivalent to my new parent (which (perhaps) has to be created within _pNewPage->GetForms)
+ // the element in m_xEnvironmentHistory which is equivalent to my new parent (which (perhaps) has to be created within pNewPage->GetForms)
// is the right-most element in the tree.
Reference< XIndexContainer > xRightMostLeaf( m_xEnvironmentHistory, UNO_QUERY_THROW );
try
@@ -268,7 +263,7 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
}
// now set the page
- SdrUnoObj::SetPage(_pNewPage);
+ SdrUnoObj::handlePageChange(pOldPage, pNewPage);
// place my model within the new parent container
if (xNewParent.is())
@@ -284,6 +279,7 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
if (nPos > -1)
xOldParent->removeByIndex(nPos);
}
+
// and insert into the new container
xNewParent->insertByIndex(xNewParent->getCount(), makeAny(xMeAsFormComp));
@@ -614,7 +610,7 @@ void FmFormObj::SetUnoControlModel( const Reference< css::awt::XControlModel >&
{
SdrUnoObj::SetUnoControlModel( _rxModel );
- FmFormPage* pFormPage = dynamic_cast<FmFormPage*>( GetPage() );
+ FmFormPage* pFormPage(dynamic_cast< FmFormPage* >(getSdrPageFromSdrObject()));
if ( pFormPage )
pFormPage->GetImpl().formModelAssigned( *this );
@@ -627,10 +623,10 @@ bool FmFormObj::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd )
bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
if ( bResult && SdrCreateCmd::ForceEnd == eCmd && rStat.GetView() )
{
- if ( pPage )
- {
- FmFormPage& rPage = dynamic_cast< FmFormPage& >( *pPage );
+ FmFormPage* pFormPage(dynamic_cast< FmFormPage* >(getSdrPageFromSdrObject()));
+ if (nullptr != pFormPage)
+ {
try
{
Reference< XFormComponent > xContent( xUnoControlModel, UNO_QUERY_THROW );
@@ -640,7 +636,7 @@ bool FmFormObj::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd )
if ( !xParentForm.is() )
{ // model is not yet part of a form component hierarchy
- xParentForm.set( rPage.GetImpl().findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW );
+ xParentForm.set( pFormPage->GetImpl().findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW );
xFormToInsertInto.set( xParentForm, UNO_QUERY_THROW );
}
diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx
index d72e39af505f..a6e23f277e3a 100644
--- a/svx/source/form/fmpgeimp.cxx
+++ b/svx/source/form/fmpgeimp.cxx
@@ -166,8 +166,8 @@ void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl )
aVisitor.process( FormComponentPair( xForeignForms, m_xForms ), aAssignmentProcessor );
// assign the cloned models to their SdrObjects
- SdrObjListIter aForeignIter( i_foreignImpl.m_rPage );
- SdrObjListIter aOwnIter( m_rPage );
+ SdrObjListIter aForeignIter( &i_foreignImpl.m_rPage );
+ SdrObjListIter aOwnIter( &m_rPage );
OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (1)!" );
while ( aForeignIter.IsMore() && aOwnIter.IsMore() )
@@ -278,7 +278,7 @@ Reference< XMap > FmFormPageImpl::impl_createControlShapeMap_nothrow()
::cppu::UnoType< XControlShape >::get()
).get(), UNO_SET_THROW );
- SdrObjListIter aPageIter( m_rPage );
+ SdrObjListIter aPageIter( &m_rPage );
while ( aPageIter.IsMore() )
{
// only FmFormObjs are what we're interested in
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index d23f5f821743..4a77bfc43496 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -1274,7 +1274,7 @@ namespace
{
SdrUnoObj* lcl_findUnoObject( const SdrObjList& _rObjList, const Reference< XControlModel >& _rxModel )
{
- SdrObjListIter aIter( _rObjList );
+ SdrObjListIter aIter( &_rObjList );
while ( aIter.IsMore() )
{
SdrObject* pObject = aIter.Next();
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 560b2fa5c70b..606d5039d8f1 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -288,7 +288,7 @@ namespace
std::unique_ptr<SdrObjListIter> pGroupIterator;
if ( pCurrent->IsGroupObject() )
{
- pGroupIterator.reset(new SdrObjListIter( *pCurrent->GetSubList() ));
+ pGroupIterator.reset(new SdrObjListIter( pCurrent->GetSubList() ));
pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr;
}
@@ -577,7 +577,7 @@ bool isControlList(const SdrMarkList& rMarkList)
{
if (pObj->IsGroupObject())
{
- SdrObjListIter aIter(*pObj->GetSubList());
+ SdrObjListIter aIter(pObj->GetSubList());
while (aIter.IsMore() && bControlList)
{
bControlList = SdrInventor::FmForm == aIter.Next()->GetObjInventor();
@@ -1100,7 +1100,7 @@ bool FmXFormShell::executeControlConversionSlot_Lock(const Reference<XFormCompon
Reference< XInterface > xNormalizedObject( _rxObject, UNO_QUERY );
FmFormObj* pFormObject = nullptr;
- SdrObjListIter aPageIter( *pFormPage );
+ SdrObjListIter aPageIter( pFormPage );
while ( aPageIter.IsMore() )
{
SdrObject* pCurrent = aPageIter.Next();
@@ -2349,7 +2349,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest_Lock, FmSearchContext&, rfmscCont
// Search all SdrControls of this page...
OUString sControlSource, aName;
- SdrObjListIter aPageIter( *pCurrentPage );
+ SdrObjListIter aPageIter( pCurrentPage );
while ( aPageIter.IsMore() )
{
SdrObject* pCurrent = aPageIter.Next();
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index b29e55358a60..5a7ce3fe8813 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -340,7 +340,7 @@ void FmXUndoEnvironment::Inserted(SdrObject* pObj)
}
else if (pObj->IsGroupObject())
{
- SdrObjListIter aIter(*pObj->GetSubList());
+ SdrObjListIter aIter(pObj->GetSubList());
while ( aIter.IsMore() )
Inserted( aIter.Next() );
}
@@ -392,7 +392,7 @@ void FmXUndoEnvironment::Inserted(FmFormObj* pObj)
// is the control still assigned to a form
Reference< XInterface > xModel(pObj->GetUnoControlModel(), UNO_QUERY);
Reference< XFormComponent > xContent(xModel, UNO_QUERY);
- if (xContent.is() && pObj->GetPage())
+ if (xContent.is() && pObj->getSdrPageFromSdrObject())
{
// if the component doesn't belong to a form, yet, find one to insert into
if (!xContent->getParent().is())
@@ -401,7 +401,7 @@ void FmXUndoEnvironment::Inserted(FmFormObj* pObj)
{
Reference< XIndexContainer > xObjectParent = pObj->GetOriginalParent();
- FmFormPage& rPage = dynamic_cast< FmFormPage& >( *pObj->GetPage() );
+ FmFormPage& rPage(dynamic_cast< FmFormPage& >( *pObj->getSdrPageFromSdrObject()));
Reference< XIndexAccess > xForms( rPage.GetForms(), UNO_QUERY_THROW );
Reference< XIndexContainer > xNewParent;
@@ -454,7 +454,7 @@ void FmXUndoEnvironment::Removed(SdrObject* pObj)
}
else if (pObj->IsGroupObject())
{
- SdrObjListIter aIter(*pObj->GetSubList());
+ SdrObjListIter aIter(pObj->GetSubList());
while ( aIter.IsMore() )
Removed( aIter.Next() );
}
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 6acd8b890e2d..1d9aadc0ab90 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -273,7 +273,7 @@ void FmFormView::ChangeDesignMode(bool bDesign)
// redraw UNO objects
if ( GetSdrPageView() )
{
- SdrObjListIter aIter(*pCurPage);
+ SdrObjListIter aIter(pCurPage);
while( aIter.IsMore() )
{
SdrObject* pObj = aIter.Next();
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 9547171a9ef6..f31659ea3a40 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -885,7 +885,7 @@ namespace
{
Reference< XInterface > xNormalizedForm( _rxForm, UNO_QUERY_THROW );
- SdrObjListIter aSdrObjectLoop( _rPage, SdrIterMode::DeepNoGroups );
+ SdrObjListIter aSdrObjectLoop( &_rPage, SdrIterMode::DeepNoGroups );
while ( aSdrObjectLoop.IsMore() )
{
FmFormObj* pFormObject = FmFormObj::GetFormObject( aSdrObjectLoop.Next() );
@@ -1539,7 +1539,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
const Reference< XPropertySet >& _rxField,
const Reference< XNumberFormats >& _rxNumberFormats, sal_uInt16 _nControlObjectID,
const OUString& _rFieldPostfix, SdrInventor _nInventor, sal_uInt16 _nLabelObjectID,
- SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl)
+ SdrPage* /*_pLabelPage*/, SdrPage* /*_pControlPage*/, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl)
{
sal_Int32 nDataType = 0;
OUString sFieldName;
@@ -1584,8 +1584,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
SdrObjFactory::MakeNewObject(
*_pModel,
_nInventor,
- _nLabelObjectID,
- _pLabelPage)));
+ _nLabelObjectID)));
OSL_ENSURE( pLabel.get(), "FmXFormView::createControlLabelPair: could not create the label!" );
@@ -1617,8 +1616,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
SdrObjFactory::MakeNewObject(
*_pModel,
_nInventor,
- _nControlObjectID,
- _pControlPage)));
+ _nControlObjectID)));
OSL_ENSURE( pControl.get(), "FmXFormView::createControlLabelPair: could not create the control!" );
@@ -1782,7 +1780,7 @@ void FmXFormView::saveMarkList()
{
if ( pObj->IsGroupObject() )
{
- SdrObjListIter aIter( *pObj->GetSubList() );
+ SdrObjListIter aIter( pObj->GetSubList() );
bool bMixed = false;
while ( aIter.IsMore() && !bMixed )
bMixed = ( aIter.Next()->GetObjInventor() != SdrInventor::FmForm );
@@ -1866,7 +1864,7 @@ void FmXFormView::restoreMarkList( SdrMarkList& _rRestoredMarkList )
// it is important that the objects of the mark list are not accessed,
// because they can be already destroyed
SdrPageView* pCurPageView = m_pView->GetSdrPageView();
- SdrObjListIter aPageIter( *pPage );
+ SdrObjListIter aPageIter( pPage );
bool bFound = true;
// do all objects still exist
@@ -1877,7 +1875,7 @@ void FmXFormView::restoreMarkList( SdrMarkList& _rRestoredMarkList )
SdrObject* pObj = pMark->GetMarkedSdrObj();
if (pObj->IsGroupObject())
{
- SdrObjListIter aIter(*pObj->GetSubList());
+ SdrObjListIter aIter(pObj->GetSubList());
while (aIter.IsMore() && bFound)
bFound = lcl_hasObject(aPageIter, aIter.Next());
}
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 864a66913e47..ca831645b4cf 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -93,7 +93,7 @@ namespace svxform
_rMapping.clear();
- SdrObjListIter aIter( *_pPage );
+ SdrObjListIter aIter( _pPage );
while ( aIter.IsMore() )
{
SdrObject* pSdrObject = aIter.Next();
@@ -2049,7 +2049,7 @@ namespace svxform
SdrPage* pPage = pPageView->GetPage();
//FmFormPage* pFormPage = dynamic_cast< FmFormPage* >( pPage );
- SdrObjListIter aIter( *pPage );
+ SdrObjListIter aIter( pPage );
while ( aIter.IsMore() )
{
SdrObject* pSdrObject = aIter.Next();
@@ -2110,7 +2110,7 @@ namespace svxform
SdrPage* pPage = pPageView->GetPage();
bool bPaint = false;
- SdrObjListIter aIter( *pPage );
+ SdrObjListIter aIter( pPage );
while ( aIter.IsMore() )
{
SdrObject* pSdrObject = aIter.Next();
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index 0b9a98d44012..01136bf189b0 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -704,7 +704,7 @@ namespace svxform
}
else if ( pObj->IsGroupObject() )
{
- SdrObjListIter aIter( *pObj->GetSubList() );
+ SdrObjListIter aIter( pObj->GetSubList() );
while ( aIter.IsMore() )
InsertSdrObj( aIter.Next() );
}
@@ -730,7 +730,7 @@ namespace svxform
}
else if ( pObj->IsGroupObject() )
{
- SdrObjListIter aIter( *pObj->GetSubList() );
+ SdrObjListIter aIter( pObj->GetSubList() );
while ( aIter.IsMore() )
RemoveSdrObj( aIter.Next() );
}
diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx
index 0533327d6aee..476c3c52d0ae 100644
--- a/svx/source/inc/fmobj.hxx
+++ b/svx/source/inc/fmobj.hxx
@@ -70,7 +70,8 @@ public:
SAL_DLLPRIVATE void ClearObjEnv();
public:
- SAL_DLLPRIVATE virtual void SetPage(SdrPage* pNewPage) override;
+ // react on page change
+ virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
SAL_DLLPRIVATE virtual SdrInventor GetObjInventor() const override;
SAL_DLLPRIVATE virtual sal_uInt16 GetObjIdentifier() const override;
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index badb9f4aa121..bbd8f48a4c13 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -339,15 +339,15 @@ namespace sdr
if(pActiveGroupList)
{
- if(dynamic_cast<const SdrPage*>( pActiveGroupList) != nullptr)
+ if(nullptr != pActiveGroupList->getSdrPageFromSdrObjList())
{
// It's a Page itself
- return &(static_cast<SdrPage*>(pActiveGroupList)->GetViewContact());
+ return &(pActiveGroupList->getSdrPageFromSdrObjList()->GetViewContact());
}
- else if(pActiveGroupList->GetOwnerObj())
+ else if(pActiveGroupList->getSdrObjectFromSdrObjList())
{
// Group object
- return &(pActiveGroupList->GetOwnerObj()->GetViewContact());
+ return &(pActiveGroupList->getSdrObjectFromSdrObjList()->GetViewContact());
}
}
else if(GetSdrPage())
diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
index 67ba3c507967..6d3dfb2f80e3 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
@@ -99,9 +99,9 @@ ViewContact* ViewContactOfSdrObj::GetParentContact() const
else
{
// Is a group?
- if(pObjList->GetOwnerObj())
+ if(pObjList->getSdrObjectFromSdrObjList())
{
- pRetval = &(pObjList->GetOwnerObj()->GetViewContact());
+ pRetval = &(pObjList->getSdrObjectFromSdrObjList()->GetViewContact());
}
}
}
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index 3c7598115363..9cf85e52d530 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -96,7 +96,7 @@ namespace sdr
//width/height to avoid oom and massive churn generating a huge
//polygon chain to cover the length in applyLineDashing if this
//line is dashed
- const SdrPage* pPage = GetPathObj().GetPage();
+ const SdrPage* pPage(GetPathObj().getSdrPageFromSdrObject());
sal_Int32 nPageWidth = pPage ? pPage->GetWidth() : 0;
sal_Int32 nPageHeight = pPage ? pPage->GetHeight() : 0;
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index f6e425fb1cfa..db34c85e2c14 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -248,7 +248,7 @@ namespace sdr
{
// sometimes it is needed that each graphic is completely available and swapped in
// for these cases a ForceSwapIn is called later at the graphic object
- if ( rGrafObj.GetPage() && rGrafObj.GetPage()->IsMasterPage() )
+ if ( rGrafObj.getSdrPageFromSdrObject() && rGrafObj.getSdrPageFromSdrObject()->IsMasterPage() )
{
// #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation
bDoAsynchronGraphicLoading = false;
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
index 07987534b19b..4e8711341b82 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -44,32 +44,11 @@
#include <svx/svdmodel.hxx>
#include <svx/svdtrans.hxx>
#include <svx/svdpage.hxx>
-#include <svx/svdograf.hxx>
-#include <svx/svdoole2.hxx>
namespace sdr
{
namespace properties
{
- SfxStyleSheet* AttributeProperties::ImpGetDefaultStyleSheet() const
- {
- // use correct default stylesheet #119287#
- const SdrGrafObj* pIsSdrGrafObj(dynamic_cast< const SdrGrafObj* >(&GetSdrObject()));
- const SdrOle2Obj* pIsSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(&GetSdrObject()));
- SfxStyleSheet* pRetval(nullptr);
-
- if(pIsSdrGrafObj || pIsSdrOle2Obj)
- {
- pRetval = GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj();
- }
- else
- {
- pRetval = GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet();
- }
-
- return pRetval;
- }
-
void AttributeProperties::ImpSetParentAtSfxItemSet(bool bDontRemoveHardAttr)
{
if(HasSfxItemSet() && mpStyleSheet)
@@ -260,25 +239,29 @@ namespace sdr
if(!bHadSfxItemSet)
{
- if(GetStyleSheet())
+ // SfxItemSet was created and ForceDefaultAttributes() is done.
+ // We now need to set a default SfxStyleSheet at the SdrObject. This
+ // is possible now since we always have the SdrModel in SdrObject,
+ // so use applyDefaultStyleSheetFromSdrModel() which will do the
+ // right thing in each derivation of BaseProperties.
+ // We also need to 'rescue' mpStyleSheet if it is already set,
+ // which means a SfxStyleSheet was already set/ocopied but not
+ // yet set at the SdrObject. See copy-constructor and how it remembers
+ // the SfxStyleSheet there. This time, do not reset the
+ // attributes already set - this is done above.
+ SfxStyleSheet* pImplicitelyAlreadySet(mpStyleSheet);
+
+ // Set missing defaults and do RemoveHardAttributes. This is
+ // important, it deletes again the attributes set in
+ // ForceDefaultAttributes() which are set in the default
+ // SfxStyleSheet.
+ const_cast< AttributeProperties* >(this)->applyDefaultStyleSheetFromSdrModel();
+
+ if(pImplicitelyAlreadySet)
{
// Late-Init of setting parent to SfxStyleSheet after
- // it's creation. See copy-constructor and how it remembers
- // the SfxStyleSheet there.
- // It is necessary to reset mpStyleSheet to nullptr to
- // not trigger alarm inside ImpAddStyleSheet (!)
- SfxStyleSheet* pNew(mpStyleSheet);
- const_cast< AttributeProperties* >(this)->mpStyleSheet = nullptr;
- const_cast< AttributeProperties* >(this)->ImpAddStyleSheet(
- pNew,
- true);
- }
- else
- {
- // Set missing defaults and do not RemoveHardAttributes
- const_cast< AttributeProperties* >(this)->ImpAddStyleSheet(
- ImpGetDefaultStyleSheet(),
- true);
+ // it's creation.
+ const_cast< AttributeProperties* >(this)->SetStyleSheet(pImplicitelyAlreadySet, true);
}
}
@@ -535,7 +518,7 @@ namespace sdr
const SdrObject& rObj(GetSdrObject());
if (rObj.IsInserted())
{
- const SdrPage* const pPage(rObj.GetPage());
+ const SdrPage* const pPage(rObj.getSdrPageFromSdrObject());
if (pPage && pPage->IsInserted())
return true;
}
diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx
index 6c624a4108d3..2c606b80d433 100644
--- a/svx/source/sdr/properties/graphicproperties.cxx
+++ b/svx/source/sdr/properties/graphicproperties.cxx
@@ -27,12 +27,27 @@
#include <editeng/eeitem.hxx>
#include <svx/svdograf.hxx>
#include <svx/sdgcpitm.hxx>
-
+#include <svx/svdmodel.hxx>
namespace sdr
{
namespace properties
{
+ void GraphicProperties::applyDefaultStyleSheetFromSdrModel()
+ {
+ SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
+
+ if(pStyleSheet)
+ {
+ SetStyleSheet(pStyleSheet, false);
+ }
+ else
+ {
+ SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
+ SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
+ }
+ }
+
// create a new itemset
std::unique_ptr<SfxItemSet> GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
{
diff --git a/svx/source/sdr/properties/itemsettools.cxx b/svx/source/sdr/properties/itemsettools.cxx
index 7c3bea85aac9..63b0ca75acda 100644
--- a/svx/source/sdr/properties/itemsettools.cxx
+++ b/svx/source/sdr/properties/itemsettools.cxx
@@ -36,7 +36,7 @@ namespace sdr
{
if (const SdrObjGroup* pGroupObj = dynamic_cast<const SdrObjGroup*>(&rObj))
{
- SdrObjListIter aIter(*pGroupObj, SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(pGroupObj->GetSubList(), SdrIterMode::DeepNoGroups);
maRectangles.reserve(aIter.Count());
while(aIter.IsMore())
diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx
index f740e9cc259b..096e3e2ec71f 100644
--- a/svx/source/sdr/properties/oleproperties.cxx
+++ b/svx/source/sdr/properties/oleproperties.cxx
@@ -17,17 +17,32 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include <sdr/properties/oleproperties.hxx>
#include <svl/itemset.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xlineit0.hxx>
-
+#include <svx/svdobj.hxx>
+#include <svx/svdmodel.hxx>
namespace sdr
{
namespace properties
{
+ void OleProperties::applyDefaultStyleSheetFromSdrModel()
+ {
+ SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
+
+ if(pStyleSheet)
+ {
+ SetStyleSheet(pStyleSheet, false);
+ }
+ else
+ {
+ SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
+ SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
+ }
+ }
+
OleProperties::OleProperties(SdrObject& rObj)
: RectangleProperties(rObj)
{
diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx
index 256e6ea275bb..9670c743722f 100644
--- a/svx/source/sdr/properties/properties.cxx
+++ b/svx/source/sdr/properties/properties.cxx
@@ -24,6 +24,7 @@
#include <svx/svditer.hxx>
#include <svx/xfillit0.hxx>
#include <vcl/outdev.hxx>
+#include <svx/svdmodel.hxx>
using namespace com::sun::star;
@@ -40,6 +41,11 @@ namespace sdr
{
}
+ void BaseProperties::applyDefaultStyleSheetFromSdrModel()
+ {
+ SetStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet(), false);
+ }
+
const SdrObject& BaseProperties::GetSdrObject() const
{
return mrObject;
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index 9a495596b372..070d20dec458 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -402,19 +402,13 @@ bool SdrCreateView::ImpBegCreateObj(SdrInventor nInvent, sal_uInt16 nIdent, cons
if(pPreparedFactoryObject)
{
pCurrentCreate = pPreparedFactoryObject;
-
- if(pCreatePV->GetPage())
- {
- pCurrentCreate->SetPage(pCreatePV->GetPage());
- }
}
else
{
pCurrentCreate = SdrObjFactory::MakeNewObject(
*mpModel,
nInvent,
- nIdent,
- pCreatePV->GetPage());
+ nIdent);
}
Point aPnt(rPnt);
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index 78ade77c3c49..980399c0d6c6 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -789,9 +789,9 @@ void SdrEditView::DeleteMarkedObj()
for(size_t a = 0; a < nCount; ++a)
{
// in the first run, add all found parents, but only once
- SdrMark* pMark = rMarkList.GetMark(a);
- SdrObject* pObject = pMark->GetMarkedSdrObj();
- SdrObject* pParent = pObject->getParentOfSdrObject()->GetOwnerObj();
+ SdrMark* pMark(rMarkList.GetMark(a));
+ SdrObject* pObject(pMark->GetMarkedSdrObj());
+ SdrObject* pParent(pObject->getParentOfSdrObject()->getSdrObjectFromSdrObjList());
if(pParent)
{
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index cffae4f8bed4..666fac2edbe8 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -143,10 +143,10 @@ std::vector< SdrUndoAction* > SdrEditView::CreateConnectorUndo( SdrObject& rO )
if ( rO.GetBroadcaster() )
{
- const SdrPage* pPage = rO.GetPage();
+ const SdrPage* pPage = rO.getSdrPageFromSdrObject();
if ( pPage )
{
- SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
+ SdrObjListIter aIter(pPage, SdrIterMode::DeepWithGroups);
while( aIter.IsMore() )
{
SdrObject* pPartObj = aIter.Next();
@@ -600,7 +600,7 @@ void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookM
if (bNoContortion || pOL==nullptr) {
ImpCrookObj(pO,rRef,rRad,eMode,bVertical,bNoContortion,bRotate,aMarkRect);
} else {
- SdrObjListIter aIter(*pOL,SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(pOL,SdrIterMode::DeepNoGroups);
while (aIter.IsMore()) {
SdrObject* pO1=aIter.Next();
ImpCrookObj(pO1,rRef,rRad,eMode,bVertical,bNoContortion,bRotate,aMarkRect);
@@ -674,7 +674,7 @@ void SdrEditView::DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon&
if (bNoContortion || pOL==nullptr) {
ImpDistortObj(pO,aRefRect,rDistortedRect,bNoContortion);
} else {
- SdrObjListIter aIter(*pOL,SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(pOL,SdrIterMode::DeepNoGroups);
while (aIter.IsMore()) {
SdrObject* pO1=aIter.Next();
ImpDistortObj(pO1,aRefRect,rDistortedRect,bNoContortion);
@@ -1805,7 +1805,7 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert)
if (nMarkCount==1)
{ // align single object to page
const SdrObject* pObj=GetMarkedObjectByIndex(0);
- const SdrPage* pPage=pObj->GetPage();
+ const SdrPage* pPage=pObj->getSdrPageFromSdrObject();
const SdrPageGridFrameList* pGFL=pPage->GetGridFrameList(GetSdrPageViewOfMarkedByIndex(0),&(pObj->GetSnapRect()));
const SdrPageGridFrame* pFrame=nullptr;
if (pGFL!=nullptr && pGFL->GetCount()!=0)
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index 53f109ad414d..7f1f061527d1 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -540,7 +540,7 @@ void SdrEditView::ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest)
if (pSource!=nullptr) {
SdrObjList* pOL=pSource->GetSubList();
if (pOL!=nullptr && !pSource->Is3DObj()) { // get first non-group object from group
- SdrObjListIter aIter(*pOL,SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(pOL,SdrIterMode::DeepNoGroups);
pSource=aIter.Next();
}
}
@@ -586,7 +586,7 @@ bool SdrEditView::ImpCanConvertForCombine(const SdrObject* pObj)
if(pOL && !pObj->Is3DObj())
{
- SdrObjListIter aIter(*pOL, SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(pOL, SdrIterMode::DeepNoGroups);
while(aIter.IsMore())
{
@@ -629,7 +629,7 @@ basegfx::B2DPolyPolygon SdrEditView::ImpGetPolyPolygon1(const SdrObject* pObj)
if(pOL)
{
- SdrObjListIter aIter(*pOL, SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(pOL, SdrIterMode::DeepNoGroups);
while(aIter.IsMore())
{
@@ -666,7 +666,7 @@ basegfx::B2DPolyPolygon SdrEditView::ImpGetPolyPolygon(const SdrObject* pObj)
if(pOL && !pObj->Is3DObj())
{
basegfx::B2DPolyPolygon aRetval;
- SdrObjListIter aIter(*pOL, SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(pOL, SdrIterMode::DeepNoGroups);
while(aIter.IsMore())
{
@@ -1433,7 +1433,7 @@ bool SdrEditView::ImpCanDismantle(const SdrObject* pObj, bool bMakeLines)
if(pOL)
{
// group object -- check all members if they're PathObjs
- SdrObjListIter aIter(*pOL, SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(pOL, SdrIterMode::DeepNoGroups);
while(aIter.IsMore() && !bOtherObjs)
{
@@ -1685,7 +1685,7 @@ void SdrEditView::DismantleMarkedObjects(bool bMakeLines)
size_t nPos=nPos0+1;
SdrObjList* pSubList=pObj->GetSubList();
if (pSubList!=nullptr && !pObj->Is3DObj()) {
- SdrObjListIter aIter(*pSubList,SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(pSubList,SdrIterMode::DeepNoGroups);
while (aIter.IsMore()) {
const SdrObject* pObj1=aIter.Next();
ImpDismantleOneObject(pObj1,*pOL,nPos,pPV,bMakeLines);
@@ -1970,7 +1970,7 @@ void SdrEditView::ImpConvertTo(bool bPath, bool bLineToArea)
SdrPageView* pPV=pM->GetPageView();
if (pObj->IsGroupObject() && !pObj->Is3DObj()) {
SdrObject* pGrp=pObj;
- SdrObjListIter aIter(*pGrp,SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(*pGrp, SdrIterMode::DeepNoGroups);
while (aIter.IsMore()) {
pObj=aIter.Next();
ImpConvertOneObj(pObj,bPath,bLineToArea);
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 93d317ff0fbf..fc0de4bdcf29 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1240,7 +1240,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
// Register an outliner view for all other sdr views that
// show the same page, so that when the text edit changes,
// all interested windows get an invalidation.
- SdrViewIter aIter(pObj->GetPage());
+ SdrViewIter aIter(pObj->getSdrPageFromSdrObject());
for (SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView())
{
if (pView == this)
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index fb8aab8a82ec..526b3ca82cde 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -518,7 +518,7 @@ namespace
Color& rCol)
{
bool bRet(false);
- bool bMaster(rList.GetPage() && rList.GetPage()->IsMasterPage());
+ bool bMaster(rList.getSdrPageFromSdrObjList() && rList.getSdrPageFromSdrObjList()->IsMasterPage());
for(size_t no(rList.GetObjCount()); !bRet && no > 0; )
{
diff --git a/svx/source/svdraw/svditer.cxx b/svx/source/svdraw/svditer.cxx
index 859b9d3390a4..2e8b8a8e1035 100644
--- a/svx/source/svdraw/svditer.cxx
+++ b/svx/source/svdraw/svditer.cxx
@@ -24,73 +24,117 @@
#include <svx/svdmark.hxx>
#include <svx/scene3d.hxx>
-SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode, bool bReverse)
-: mnIndex(0),
- mbReverse(bReverse)
+SdrObjListIter::SdrObjListIter(const SdrObjList* pObjList, SdrIterMode eMode, bool bReverse)
+: maObjList(),
+ mnIndex(0),
+ mbReverse(bReverse),
+ mbUseZOrder(true)
{
- ImpProcessObjectList(rObjList, eMode, true);
+ if(nullptr != pObjList)
+ {
+ ImpProcessObjectList(*pObjList, eMode);
+ }
+
+ Reset();
+}
+
+SdrObjListIter::SdrObjListIter(const SdrObjList* pObjList, bool bUseZOrder, SdrIterMode eMode, bool bReverse)
+: maObjList(),
+ mnIndex(0),
+ mbReverse(bReverse),
+ mbUseZOrder(bUseZOrder)
+{
+ if(nullptr != pObjList)
+ {
+ // correct when we have no ObjectNavigationOrder
+ if(!mbUseZOrder && !pObjList->HasObjectNavigationOrder())
+ {
+ mbUseZOrder = false;
+ }
+
+ ImpProcessObjectList(*pObjList, eMode);
+ }
+
Reset();
}
-SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, bool bUseZOrder, SdrIterMode eMode)
-: mnIndex(0),
- mbReverse(false)
+SdrObjListIter::SdrObjListIter(const SdrObject& rSdrObject, SdrIterMode eMode, bool bReverse)
+: maObjList(),
+ mnIndex(0),
+ mbReverse(bReverse),
+ mbUseZOrder(true)
{
- ImpProcessObjectList(rObjList, eMode, bUseZOrder);
+ ImpProcessObj(rSdrObject, eMode);
Reset();
}
-SdrObjListIter::SdrObjListIter( const SdrObject& rObj, SdrIterMode eMode )
-: mnIndex(0),
- mbReverse(false)
+SdrObjListIter::SdrObjListIter(const SdrPage* pSdrPage, SdrIterMode eMode, bool bReverse)
+: maObjList(),
+ mnIndex(0),
+ mbReverse(bReverse),
+ mbUseZOrder(true)
{
- if ( dynamic_cast<const SdrObjGroup*>(&rObj) != nullptr )
- ImpProcessObjectList(*rObj.GetSubList(), eMode, true);
- else
- maObjList.push_back(const_cast<SdrObject*>(&rObj));
+ if(nullptr != pSdrPage)
+ {
+ ImpProcessObjectList(*dynamic_cast< const SdrObjList* >(pSdrPage), eMode);
+ }
+
Reset();
}
SdrObjListIter::SdrObjListIter( const SdrMarkList& rMarkList, SdrIterMode eMode )
-: mnIndex(0),
- mbReverse(false)
+: maObjList(),
+ mnIndex(0),
+ mbReverse(false),
+ mbUseZOrder(true)
{
ImpProcessMarkList(rMarkList, eMode);
Reset();
}
-void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, bool bUseZOrder)
-{
- for( size_t nIdx = 0, nCount = rObjList.GetObjCount(); nIdx < nCount; ++nIdx )
+void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode)
+{ for(size_t nIdx(0), nCount(rObjList.GetObjCount()); nIdx < nCount; ++nIdx)
{
- SdrObject* pObj = bUseZOrder ?
- rObjList.GetObj( nIdx ) : rObjList.GetObjectForNavigationPosition( nIdx );
- OSL_ASSERT( pObj != nullptr );
- if( pObj )
- ImpProcessObj( pObj, eMode, bUseZOrder );
+ const SdrObject* pSdrObject(mbUseZOrder
+ ? rObjList.GetObj(nIdx)
+ : rObjList.GetObjectForNavigationPosition(nIdx));
+
+ if(nullptr == pSdrObject)
+ {
+ OSL_ENSURE(false, "SdrObjListIter: corrupted SdrObjList (!)");
+ }
+ else
+ {
+ ImpProcessObj(*pSdrObject, eMode);
+ }
}
}
-void SdrObjListIter::ImpProcessMarkList( const SdrMarkList& rMarkList, SdrIterMode eMode )
+void SdrObjListIter::ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode)
{
for( size_t nIdx = 0, nCount = rMarkList.GetMarkCount(); nIdx < nCount; ++nIdx )
+ {
if( SdrObject* pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj() )
- ImpProcessObj( pObj, eMode, false );
+ {
+ ImpProcessObj(*pObj, eMode);
+ }
+ }
}
-void SdrObjListIter::ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, bool bUseZOrder)
+void SdrObjListIter::ImpProcessObj(const SdrObject& rSdrObject, SdrIterMode eMode)
{
- bool bIsGroup = pObj->IsGroupObject();
- // 3D objects are not group objects, IsGroupObject()
- // only tests if pSub is not null ptr :-(
- if( bIsGroup && dynamic_cast<const E3dObject* >(pObj) != nullptr && dynamic_cast<const E3dScene* >(pObj) == nullptr)
- bIsGroup = false;
+ const SdrObjList* pChildren(rSdrObject.getChildrenOfSdrObject());
+ const bool bIsGroup(nullptr != pChildren);
- if( !bIsGroup || (eMode != SdrIterMode::DeepNoGroups) )
- maObjList.push_back(pObj);
+ if(!bIsGroup || (SdrIterMode::DeepNoGroups != eMode))
+ {
+ maObjList.push_back(&rSdrObject);
+ }
- if( bIsGroup && (eMode != SdrIterMode::Flat) )
- ImpProcessObjectList( *pObj->GetSubList(), eMode, bUseZOrder );
+ if(bIsGroup && (SdrIterMode::Flat != eMode))
+ {
+ ImpProcessObjectList(*pChildren, eMode);
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index 00901afc309e..562b14ff1b78 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -762,7 +762,7 @@ namespace sdr
SfxListener* pLst = pBC->GetListener(nl);
SdrEdgeObj* pEdge = dynamic_cast<SdrEdgeObj*>( pLst );
- if(pEdge && pEdge->IsInserted() && pEdge->GetPage() == pCandidate->GetPage())
+ if(pEdge && pEdge->IsInserted() && pEdge->getSdrPageFromSdrObject() == pCandidate->getSdrPageFromSdrObject())
{
SdrMark aM(pEdge, maMarkedObjectList.GetMark(a)->GetPageView());
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 1b17da722a86..bde671498fd1 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -2061,7 +2061,7 @@ SdrHint::SdrHint(SdrHintKind eNewHint)
SdrHint::SdrHint(SdrHintKind eNewHint, const SdrObject& rNewObj)
: meHint(eNewHint),
mpObj(&rNewObj),
- mpPage(rNewObj.GetPage())
+ mpPage(rNewObj.getSdrPageFromSdrObject())
{
}
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index f8ad13562968..ea0255ba2865 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1753,8 +1753,8 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nT
if (pOL!=nullptr)
{
bool bBack(nOptions & SdrSearchOptions::BACKWARD);
- bool bRemap(pOL->GetOwnerObj() && dynamic_cast< const E3dScene* >(pOL->GetOwnerObj()) != nullptr);
- E3dScene* pRemapScene = (bRemap ? static_cast<E3dScene*>(pOL->GetOwnerObj()) : nullptr);
+ bool bRemap(pOL->getSdrObjectFromSdrObjList() && dynamic_cast< const E3dScene* >(pOL->getSdrObjectFromSdrObjList()) != nullptr);
+ E3dScene* pRemapScene = (bRemap ? static_cast< E3dScene* >(pOL->getSdrObjectFromSdrObjList()) : nullptr);
const size_t nObjCount=pOL->GetObjCount();
size_t nObjNum=bBack ? 0 : nObjCount;
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index a6a4a756fd90..23308b4eaf40 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -2836,11 +2836,12 @@ void SdrObjCustomShape::NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, bool bD
SdrObject::NbcSetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
}
-void SdrObjCustomShape::SetPage( SdrPage* pNewPage )
+void SdrObjCustomShape::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
- SdrTextObj::SetPage( pNewPage );
+ // call parent
+ SdrTextObj::handlePageChange(pOldPage, pNewPage);
- if( pNewPage )
+ if(nullptr != pNewPage)
{
// invalidating rectangles by SetRectsDirty is not sufficient,
// AdjustTextFrameWidthAndHeight() also has to be made, both
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 2ee6999ac93a..5b313c907358 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -279,6 +279,52 @@ void SdrObject::ActionChanged() const
GetViewContact().ActionChanged();
}
+SdrPage* SdrObject::getSdrPageFromSdrObject() const
+{
+ if(getParentOfSdrObject())
+ {
+ return getParentOfSdrObject()->getSdrPageFromSdrObjList();
+ }
+
+ return nullptr;
+}
+
+SdrModel& SdrObject::getSdrModelFromSdrObject() const
+{
+ return mrSdrModelFromSdrObject;
+}
+
+void SdrObject::setParentOfSdrObject(SdrObjList* pNewObjList)
+{
+ if(getParentOfSdrObject() != pNewObjList)
+ {
+ // remember current page
+ SdrPage* pOldPage(getSdrPageFromSdrObject());
+
+ // set new parent
+ mpParentOfSdrObject = pNewObjList;
+
+ // get new page
+ SdrPage* pNewPage(getSdrPageFromSdrObject());
+
+ // broadcast page change over objects if needed
+ if(pOldPage != pNewPage)
+ {
+ handlePageChange(pOldPage, pNewPage);
+ }
+ }
+}
+
+SdrObjList* SdrObject::getParentOfSdrObject() const
+{
+ return mpParentOfSdrObject;
+}
+
+SdrObjList* SdrObject::getChildrenOfSdrObject() const
+{
+ // default has no children
+ return nullptr;
+}
void SdrObject::SetBoundRectDirty()
{
@@ -289,7 +335,6 @@ void SdrObject::SetBoundRectDirty()
SdrObject::SdrObject(SdrModel& rSdrModel)
: mpFillGeometryDefiningShape(nullptr)
,mrSdrModelFromSdrObject(rSdrModel)
- ,pPage(nullptr)
,pUserCall(nullptr)
,pPlusData(nullptr)
,mpImpl(new Impl)
@@ -393,48 +438,22 @@ void SdrObject::Free( SdrObject*& _rpObject )
delete pObject;
}
-void SdrObject::SetRectsDirty(bool bNotMyself)
+void SdrObject::SetRectsDirty(bool bNotMyself, bool bRecursive)
{
- if (!bNotMyself) {
+ if (!bNotMyself)
+ {
SetBoundRectDirty();
bSnapRectDirty=true;
}
- if (nullptr != getParentOfSdrObject())
+ if (bRecursive && nullptr != getParentOfSdrObject())
{
- getParentOfSdrObject()->SetRectsDirty();
+ getParentOfSdrObject()->SetSdrObjListRectsDirty();
}
}
-void SdrObject::setParentOfSdrObject(SdrObjList* pNewObjList)
+void SdrObject::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
- if(getParentOfSdrObject() != pNewObjList)
- {
- mpParentOfSdrObject = pNewObjList;
- }
-}
-
-
-void SdrObject::SetPage(SdrPage* pNewPage)
-{
- SdrModel* pOldModel(&getSdrModelFromSdrObject());
- SdrPage* pOldPage(pPage);
-
- pPage = pNewPage;
-
- // TTTT Possibility here to add a warning for the future -> SdrModel
- // of SdrObject (this) and SdrPage. It is added to *have* the
- // same SdrModel
- // if(nullptr != pPage)
- // {
- // SdrModel* pMod(&pPage->getSdrModelFromSdrPage());
- //
- // if(pMod != &getSdrModelFromSdrObject())
- // {
- // SetModel(pMod);
- // }
- // }
-
// The creation of the UNO shape in SdrObject::getUnoShape is influenced
// by pPage, so when the page changes we need to discard the cached UNO
// shape so that a new one will be created.
@@ -447,16 +466,18 @@ void SdrObject::SetPage(SdrPage* pNewPage)
// good to think about if this is really needed - it *seems* to be intended
// for a xShape being a on-demand-creatable resource - wit hthe argument that
// the SdrPage/UnoPage used influences the SvxShape creation. This uses
- // resources and would be nice to get rid of anyways.
- if (pOldPage != pPage && !(pOldPage && pPage && pOldModel == &getSdrModelFromSdrObject()))
+ // ressources and would be nice to get rid of anyways.
+ if(nullptr == pOldPage || nullptr == pNewPage)
{
SvxShape* const pShape(getSvxShape());
+
if (pShape && !pShape->HasSdrObjectOwnership())
+ {
setUnoShape(nullptr);
+ }
}
}
-
// init global static itempool
SdrItemPool* SdrObject::mpGlobalItemPool = nullptr;
@@ -626,7 +647,7 @@ SdrObjList* SdrObject::GetSubList() const
SdrObject* SdrObject::GetUpGroup() const
{
- return nullptr != getParentOfSdrObject() ? getParentOfSdrObject()->GetOwnerObj() : nullptr;
+ return nullptr != getParentOfSdrObject() ? getParentOfSdrObject()->getSdrObjectFromSdrObjList() : nullptr;
}
void SdrObject::SetName(const OUString& rStr)
@@ -921,7 +942,7 @@ void SdrObject::SingleObjectPainter(OutputDevice& rOut) const
sdr::contact::SdrObjectVector aObjectVector;
aObjectVector.push_back(const_cast< SdrObject* >(this));
- sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aObjectVector, GetPage());
+ sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aObjectVector, getSdrPageFromSdrObject());
sdr::contact::DisplayInfo aDisplayInfo;
aPainter.ProcessDisplay(aDisplayInfo);
@@ -957,7 +978,6 @@ SdrObject& SdrObject::operator=(const SdrObject& rObj)
// draw object, an SdrObject needs to be provided, as in the normal constructor.
mpProperties = rObj.GetProperties().Clone(*this);
- pPage = rObj.pPage;
aOutRect=rObj.aOutRect;
mnLayerID = rObj.mnLayerID;
aAnchor =rObj.aAnchor;
@@ -2045,7 +2065,9 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
if (rAttr.GetItemState(SDRATTR_LAYERNAME,true,&pPoolItem)==SfxItemState::SET)
{
OUString aLayerName = static_cast<const SdrLayerNameItem*>(pPoolItem)->GetValue();
- const SdrLayerAdmin& rLayAd(nullptr != pPage ? pPage->GetLayerAdmin() : getSdrModelFromSdrObject().GetLayerAdmin());
+ const SdrLayerAdmin& rLayAd(nullptr != getSdrPageFromSdrObject()
+ ? getSdrPageFromSdrObject()->GetLayerAdmin()
+ : getSdrModelFromSdrObject().GetLayerAdmin());
const SdrLayer* pLayer = rLayAd.GetLayer(aLayerName);
if(nullptr != pLayer)
@@ -2114,7 +2136,9 @@ void SdrObject::TakeNotPersistAttr(SfxItemSet& rAttr) const
}
rAttr.Put(SdrLayerIdItem(GetLayer()));
- const SdrLayerAdmin& rLayAd(nullptr != pPage ? pPage->GetLayerAdmin() : getSdrModelFromSdrObject().GetLayerAdmin());
+ const SdrLayerAdmin& rLayAd(nullptr != getSdrPageFromSdrObject()
+ ? getSdrPageFromSdrObject()->GetLayerAdmin()
+ : getSdrModelFromSdrObject().GetLayerAdmin());
const SdrLayer* pLayer = rLayAd.GetLayerPerID(GetLayer());
if(nullptr != pLayer)
{
@@ -2653,9 +2677,9 @@ void SdrObject::SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle&
{
SdrObject* pGroup = nullptr;
- if(nullptr != getParentOfSdrObject() && SdrObjListKind::GroupObj == getParentOfSdrObject()->GetListKind())
+ if(nullptr != getParentOfSdrObject()) // && SdrObjListKind::GroupObj == getParentOfSdrObject()->GetListKind())
{
- pGroup = getParentOfSdrObject()->GetOwnerObj();
+ pGroup = getParentOfSdrObject()->getSdrObjectFromSdrObjList();
}
if ( pUserCall )
@@ -2702,11 +2726,10 @@ void SdrObject::SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle&
pGroup->GetUserCall()->Changed( *this, eChildUserType, rBoundRect );
}
- if( pGroup->getParentOfSdrObject() &&
- pGroup->getParentOfSdrObject()->GetListKind() == SdrObjListKind::GroupObj &&
- pGroup != getParentOfSdrObject()->GetOwnerObj() )
+ if( pGroup->getParentOfSdrObject() &&
+ pGroup != getParentOfSdrObject()->getSdrObjectFromSdrObjList() )
{
- pGroup = getParentOfSdrObject()->GetOwnerObj();
+ pGroup = getParentOfSdrObject()->getSdrObjectFromSdrObjList();
}
else
{
@@ -2792,9 +2815,9 @@ css::uno::Reference< css::uno::XInterface > SdrObject::getUnoShape()
if( !xShape.is() )
{
OSL_ENSURE( mpSvxShape == nullptr, "SdrObject::getUnoShape: XShape already dead, but still an IMPL pointer!" );
- if ( pPage )
+ if ( getSdrPageFromSdrObject() )
{
- uno::Reference< uno::XInterface > xPage( pPage->getUnoPage() );
+ uno::Reference< uno::XInterface > xPage( getSdrPageFromSdrObject()->getUnoPage() );
if( xPage.is() )
{
SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation(xPage);
@@ -2996,7 +3019,6 @@ SdrObject* SdrObjFactory::MakeNewObject(
SdrModel& rSdrModel,
SdrInventor nInventor,
sal_uInt16 nIdentifier,
- SdrPage* pPage,
const tools::Rectangle* pSnapRect)
{
SdrObject* pObj(nullptr);
@@ -3126,11 +3148,6 @@ SdrObject* SdrObjFactory::MakeNewObject(
return nullptr;
}
- if(nullptr != pPage)
- {
- pObj->SetPage(pPage);
- }
-
if(bSetSnapRect && nullptr != pSnapRect)
{
pObj->SetSnapRect(*pSnapRect);
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 575b31e5e719..860b4f018a81 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -182,6 +182,20 @@ SdrEdgeObj::~SdrEdgeObj()
SdrEdgeObj::DisconnectFromNode(false);
}
+void SdrEdgeObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
+{
+ // call parent
+ SdrTextObj::handlePageChange(pOldPage, pNewPage);
+
+ if(nullptr != GetConnection(true).GetObject() || nullptr != GetConnection(false).GetObject())
+ {
+ // check broadcasters; when we are not inserted we do not need broadcasters
+ // TTTT not yet added, but keep hint to do this here
+ // mpCon1->ownerPageChange();
+ // mpCon2->ownerPageChange();
+ }
+}
+
void SdrEdgeObj::ImpSetAttrToEdgeInfo()
{
const SfxItemSet& rSet = GetObjectItemSet();
@@ -471,8 +485,14 @@ void SdrEdgeObj::DisconnectFromNode(bool bTail1)
SdrObject* SdrEdgeObj::GetConnectedNode(bool bTail1) const
{
- SdrObject* pObj=GetConnection(bTail1).pObj;
- if (pObj!=nullptr && (pObj->GetPage()!=pPage || !pObj->IsInserted())) pObj=nullptr;
+ SdrObject* pObj(GetConnection(bTail1).pObj);
+
+ if(nullptr != pObj
+ && (pObj->getSdrPageFromSdrObject() != getSdrPageFromSdrObject() || !pObj->IsInserted()))
+ {
+ pObj = nullptr;
+ }
+
return pObj;
}
@@ -481,7 +501,9 @@ bool SdrEdgeObj::CheckNodeConnection(bool bTail1) const
bool bRet = false;
const SdrObjConnection& rCon=GetConnection(bTail1);
sal_uInt16 nPointCount=pEdgeTrack->GetPointCount();
- if (rCon.pObj!=nullptr && rCon.pObj->GetPage()==pPage && nPointCount!=0) {
+
+ if(nullptr != rCon.pObj && rCon.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject() && 0 != nPointCount)
+ {
const SdrGluePointList* pGPL=rCon.pObj->GetGluePointList();
sal_uInt16 nConAnz=pGPL==nullptr ? 0 : pGPL->GetCount();
sal_uInt16 nGesAnz=nConAnz+8;
@@ -707,12 +729,12 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
}
// #i54102# To allow interactive preview, do also if not inserted
- bool bCon1=rCon1.pObj!=nullptr && rCon1.pObj->GetPage()==pPage;
- bool bCon2=rCon2.pObj!=nullptr && rCon2.pObj->GetPage()==pPage;
-
+ const bool bCon1(nullptr != rCon1.pObj && rCon1.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
+ const bool bCon2(nullptr != rCon2.pObj && rCon2.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
const SfxItemSet& rSet = GetObjectItemSet();
- if (bCon1) {
+ if (bCon1)
+ {
if (rCon1.pObj==static_cast<SdrObject const *>(this))
{
// check, just in case
@@ -722,44 +744,50 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
{
aBoundRect1 = rCon1.pObj->GetCurrentBoundRect();
}
+
aBoundRect1.Move(rCon1.aObjOfs.X(),rCon1.aObjOfs.Y());
aBewareRect1=aBoundRect1;
-
sal_Int32 nH = rSet.Get(SDRATTR_EDGENODE1HORZDIST).GetValue();
sal_Int32 nV = rSet.Get(SDRATTR_EDGENODE1VERTDIST).GetValue();
-
aBewareRect1.AdjustLeft( -nH );
aBewareRect1.AdjustRight(nH );
aBewareRect1.AdjustTop( -nV );
aBewareRect1.AdjustBottom(nV );
- } else {
+ }
+ else
+ {
aBoundRect1=tools::Rectangle(aPt1,aPt1);
aBoundRect1.Move(rCon1.aObjOfs.X(),rCon1.aObjOfs.Y());
aBewareRect1=aBoundRect1;
}
- if (bCon2) {
- if (rCon2.pObj==static_cast<SdrObject const *>(this)) { // check, just in case
+
+ if (bCon2)
+ {
+ if (rCon2.pObj==static_cast<SdrObject const *>(this))
+ { // check, just in case
aBoundRect2=aOutRect;
}
else
{
aBoundRect2 = rCon2.pObj->GetCurrentBoundRect();
}
+
aBoundRect2.Move(rCon2.aObjOfs.X(),rCon2.aObjOfs.Y());
aBewareRect2=aBoundRect2;
-
sal_Int32 nH = rSet.Get(SDRATTR_EDGENODE2HORZDIST).GetValue();
sal_Int32 nV = rSet.Get(SDRATTR_EDGENODE2VERTDIST).GetValue();
-
aBewareRect2.AdjustLeft( -nH );
aBewareRect2.AdjustRight(nH );
aBewareRect2.AdjustTop( -nV );
aBewareRect2.AdjustBottom(nV );
- } else {
+ }
+ else
+ {
aBoundRect2=tools::Rectangle(aPt2,aPt2);
aBoundRect2.Move(rCon2.aObjOfs.X(),rCon2.aObjOfs.Y());
aBewareRect2=aBoundRect2;
}
+
XPolygon aBestXP;
sal_uIntPtr nBestQual=0xFFFFFFFF;
SdrEdgeInfoRec aBestInfo;
@@ -771,30 +799,39 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
sal_uInt16 nBestAuto2=0;
sal_uInt16 nCount1=bAuto1 ? 4 : 1;
sal_uInt16 nCount2=bAuto2 ? 4 : 1;
- for (sal_uInt16 nNum1=0; nNum1<nCount1; nNum1++) {
+
+ for (sal_uInt16 nNum1=0; nNum1<nCount1; nNum1++)
+ {
if (bAuto1) rCon1.nConId=nNum1;
- if (bCon1 && rCon1.TakeGluePoint(aGP1)) {
+ if (bCon1 && rCon1.TakeGluePoint(aGP1))
+ {
aPt1=aGP1.GetPos();
nEsc1=aGP1.GetEscDir();
if (nEsc1==SdrEscapeDirection::SMART) nEsc1=ImpCalcEscAngle(rCon1.pObj,aPt1-rCon1.aObjOfs);
}
- for (sal_uInt16 nNum2=0; nNum2<nCount2; nNum2++) {
+ for (sal_uInt16 nNum2=0; nNum2<nCount2; nNum2++)
+ {
if (bAuto2) rCon2.nConId=nNum2;
- if (bCon2 && rCon2.TakeGluePoint(aGP2)) {
+ if (bCon2 && rCon2.TakeGluePoint(aGP2))
+ {
aPt2=aGP2.GetPos();
nEsc2=aGP2.GetEscDir();
if (nEsc2==SdrEscapeDirection::SMART) nEsc2=ImpCalcEscAngle(rCon2.pObj,aPt2-rCon2.aObjOfs);
}
- for (long nA1=0; nA1<36000; nA1+=9000) {
+ for (long nA1=0; nA1<36000; nA1+=9000)
+ {
SdrEscapeDirection nE1 = nA1==0 ? SdrEscapeDirection::RIGHT : nA1==9000 ? SdrEscapeDirection::TOP : nA1==18000 ? SdrEscapeDirection::LEFT : nA1==27000 ? SdrEscapeDirection::BOTTOM : SdrEscapeDirection::SMART;
- for (long nA2=0; nA2<36000; nA2+=9000) {
+ for (long nA2=0; nA2<36000; nA2+=9000)
+ {
SdrEscapeDirection nE2 = nA2==0 ? SdrEscapeDirection::RIGHT : nA2==9000 ? SdrEscapeDirection::TOP : nA2==18000 ? SdrEscapeDirection::LEFT : nA2==27000 ? SdrEscapeDirection::BOTTOM : SdrEscapeDirection::SMART;
- if ((nEsc1&nE1) && (nEsc2&nE2)) {
+ if ((nEsc1&nE1) && (nEsc2&nE2))
+ {
sal_uIntPtr nQual=0;
SdrEdgeInfoRec aInfo;
if (pInfo!=nullptr) aInfo=*pInfo;
XPolygon aXP(ImpCalcEdgeTrack(aPt1,nA1,aBoundRect1,aBewareRect1,aPt2,nA2,aBoundRect2,aBewareRect2,&nQual,&aInfo));
- if (nQual<nBestQual) {
+ if (nQual<nBestQual)
+ {
aBestXP=aXP;
nBestQual=nQual;
aBestInfo=aInfo;
@@ -1581,8 +1618,8 @@ void SdrEdgeObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
ImpSetAttrToEdgeInfo(); // when changing templates, copy values from Pool to aEdgeInfo
}
if (bDataChg ||
- (bObj1 && aCon1.pObj->GetPage()==pPage) ||
- (bObj2 && aCon2.pObj->GetPage()==pPage) ||
+ (bObj1 && aCon1.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject()) ||
+ (bObj2 && aCon2.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject()) ||
(pSdrHint && pSdrHint->GetKind()==SdrHintKind::ObjectRemoved))
{
// broadcasting only, if on the same page
@@ -2271,8 +2308,8 @@ void SdrEdgeObj::NbcRotate(const Point& rRef, long nAngle, double sn, double cs)
else
{
// handle start and end point if not connected
- bool bCon1=aCon1.pObj!=nullptr && aCon1.pObj->GetPage()==pPage;
- bool bCon2=aCon2.pObj!=nullptr && aCon2.pObj->GetPage()==pPage;
+ const bool bCon1(nullptr != aCon1.pObj && aCon1.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
+ const bool bCon2(nullptr != aCon2.pObj && aCon2.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
if(!bCon1 && pEdgeTrack)
{
@@ -2302,8 +2339,8 @@ void SdrEdgeObj::NbcMirror(const Point& rRef1, const Point& rRef2)
else
{
// handle start and end point if not connected
- bool bCon1=aCon1.pObj!=nullptr && aCon1.pObj->GetPage()==pPage;
- bool bCon2=aCon2.pObj!=nullptr && aCon2.pObj->GetPage()==pPage;
+ const bool bCon1(nullptr != aCon1.pObj && aCon1.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
+ const bool bCon2(nullptr != aCon2.pObj && aCon2.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
if(!bCon1 && pEdgeTrack)
{
@@ -2333,8 +2370,8 @@ void SdrEdgeObj::NbcShear(const Point& rRef, long nAngle, double tn, bool bVShea
else
{
// handle start and end point if not connected
- bool bCon1=aCon1.pObj!=nullptr && aCon1.pObj->GetPage()==pPage;
- bool bCon2=aCon2.pObj!=nullptr && aCon2.pObj->GetPage()==pPage;
+ const bool bCon1(nullptr != aCon1.pObj && aCon1.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
+ const bool bCon2(nullptr != aCon2.pObj && aCon2.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
if(!bCon1 && pEdgeTrack)
{
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 1f623faeffe9..0c6f2cfb936f 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -981,10 +981,10 @@ void SdrGrafObj::RestGeoData(const SdrObjGeoData& rGeo)
bMirrored=rGGeo.bMirrored;
}
-void SdrGrafObj::SetPage( SdrPage* pNewPage )
+void SdrGrafObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
- bool bRemove = pNewPage == nullptr && pPage != nullptr;
- bool bInsert = pNewPage != nullptr && pPage == nullptr;
+ const bool bRemove(pNewPage == nullptr && pOldPage != nullptr);
+ const bool bInsert(pNewPage != nullptr && pOldPage == nullptr);
if( bRemove )
{
@@ -996,30 +996,13 @@ void SdrGrafObj::SetPage( SdrPage* pNewPage )
ImpDeregisterLink();
}
- if(!GetStyleSheet() && pNewPage)
- {
- // #i119287# Set default StyleSheet for SdrGrafObj here, it is different from 'Default'. This
- // needs to be done before the style 'Default' is set from the :SetModel() call which is triggered
- // from the following :SetPage().
- // TTTT: Needs to be moved in branch aw080 due to having a SdrModel from the beginning, is at this
- // place for convenience currently (works in both versions, is not in the way)
- SfxStyleSheet* pSheet(pNewPage->getSdrModelFromSdrPage().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
-
- if(pSheet)
- {
- SetStyleSheet(pSheet, false);
- }
- else
- {
- SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
- SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
- }
- }
-
- SdrRectObj::SetPage( pNewPage );
+ // call parent
+ SdrRectObj::handlePageChange(pOldPage, pNewPage);
if (!aFileName.isEmpty() && bInsert)
+ {
ImpRegisterLink();
+ }
}
void SdrGrafObj::StartAnimation()
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 47a71bdb9a31..919909fc3888 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -64,11 +64,9 @@ sdr::contact::ViewContact* SdrObjGroup::CreateObjectSpecificViewContact()
SdrObjGroup::SdrObjGroup(SdrModel& rSdrModel)
: SdrObject(rSdrModel),
- maSdrObjList(),
+ SdrObjList(),
aRefPoint(0, 0)
{
- maSdrObjList.SetOwnerObj(this);
- maSdrObjList.SetListKind(SdrObjListKind::GroupObj);
bClosedObj=false;
}
@@ -76,12 +74,32 @@ SdrObjGroup::~SdrObjGroup()
{
}
+SdrPage* SdrObjGroup::getSdrPageFromSdrObjList() const
+{
+ return getSdrPageFromSdrObject();
+}
+
+SdrObject* SdrObjGroup::getSdrObjectFromSdrObjList() const
+{
+ return const_cast< SdrObjGroup* >(this);
+}
+
+SdrModel& SdrObjGroup::getSdrModelFromSdrObjList() const
+{
+ return getSdrModelFromSdrObject();
+}
+
+SdrObjList* SdrObjGroup::getChildrenOfSdrObject() const
+{
+ return const_cast< SdrObjGroup* >(this);
+}
+
void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
{
rInfo.bNoContortion=false;
- const size_t nObjCount = maSdrObjList.GetObjCount();
+ const size_t nObjCount(GetObjCount());
for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
+ SdrObject* pObj(GetObj(i));
SdrObjTransformInfoRec aInfo;
pObj->TakeObjInfo(aInfo);
if (!aInfo.bMoveAllowed ) rInfo.bMoveAllowed =false;
@@ -140,50 +158,46 @@ SdrLayerID SdrObjGroup::GetLayer() const
{
bool b1st = true;
SdrLayerID nLay = SdrObject::GetLayer();
- const size_t nObjCount = maSdrObjList.GetObjCount();
+ const size_t nObjCount(GetObjCount());
for (size_t i=0; i<nObjCount; ++i) {
- SdrLayerID nLay1=maSdrObjList.GetObj(i)->GetLayer();
+ SdrLayerID nLay1(GetObj(i)->GetLayer());
if (b1st) { nLay=nLay1; b1st = false; }
else if (nLay1!=nLay) return SdrLayerID(0);
}
return nLay;
}
-
void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer)
{
SdrObject::NbcSetLayer(nLayer);
- const size_t nObjCount = maSdrObjList.GetObjCount();
+ const size_t nObjCount(GetObjCount());
for (size_t i=0; i<nObjCount; ++i) {
- maSdrObjList.GetObj(i)->NbcSetLayer(nLayer);
+ GetObj(i)->NbcSetLayer(nLayer);
}
}
-
-void SdrObjGroup::setParentOfSdrObject(SdrObjList* pNewObjList)
+void SdrObjGroup::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
- SdrObject::setParentOfSdrObject(pNewObjList);
- maSdrObjList.SetUpList(pNewObjList);
-}
+ // call patrent
+ SdrObject::handlePageChange(pOldPage, pNewPage);
-
-void SdrObjGroup::SetPage(SdrPage* pNewPage)
-{
- SdrObject::SetPage(pNewPage);
- maSdrObjList.SetPage(pNewPage);
+ for(size_t i(0); i < GetObjCount(); i++)
+ {
+ GetObj(i)->handlePageChange(pOldPage, pNewPage);
+ }
}
SdrObjList* SdrObjGroup::GetSubList() const
{
- return const_cast< SdrObjList* >(&maSdrObjList);
+ return const_cast< SdrObjGroup* >(this);
}
const tools::Rectangle& SdrObjGroup::GetCurrentBoundRect() const
{
// <aOutRect> has to contain the bounding rectangle
- if ( maSdrObjList.GetObjCount()!=0 )
+ if(0 != GetObjCount())
{
- const_cast<SdrObjGroup*>(this)->aOutRect = maSdrObjList.GetAllObjBoundRect();
+ const_cast< SdrObjGroup* >(this)->aOutRect = GetAllObjBoundRect();
}
return aOutRect;
@@ -192,9 +206,9 @@ const tools::Rectangle& SdrObjGroup::GetCurrentBoundRect() const
const tools::Rectangle& SdrObjGroup::GetSnapRect() const
{
// <aOutRect> has to contain the bounding rectangle
- if ( maSdrObjList.GetObjCount()!=0 )
+ if(0 != GetObjCount())
{
- return maSdrObjList.GetAllObjSnapRect();
+ return GetAllObjSnapRect();
}
else
{
@@ -221,8 +235,7 @@ SdrObjGroup& SdrObjGroup::operator=(const SdrObjGroup& rObj)
// #i36404# Copy SubList, init model and page first
const SdrObjList& rSourceSubList(*rObj.GetSubList());
- maSdrObjList.SetPage(rSourceSubList.GetPage());
- maSdrObjList.CopyObjects(rSourceSubList);
+ CopyObjects(rSourceSubList);
// tdf#116979: needed here, we need bSnapRectDirty to be true
// which it is after using SdrObject::operator= (see above),
@@ -240,7 +253,7 @@ OUString SdrObjGroup::TakeObjNameSingul() const
{
OUStringBuffer sName;
- if(!maSdrObjList.GetObjCount())
+ if(0 == GetObjCount())
{
sName.append(SvxResId(STR_ObjNameSingulGRUPEMPTY));
}
@@ -265,7 +278,7 @@ OUString SdrObjGroup::TakeObjNameSingul() const
OUString SdrObjGroup::TakeObjNamePlural() const
{
- if (maSdrObjList.GetObjCount()==0)
+ if(0 == GetObjCount())
return SvxResId(STR_ObjNamePluralGRUPEMPTY);
return SvxResId(STR_ObjNamePluralGRUP);
}
@@ -279,11 +292,11 @@ void SdrObjGroup::RecalcSnapRect()
basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
{
basegfx::B2DPolyPolygon aRetval;
- const size_t nObjCount(maSdrObjList.GetObjCount());
+ const size_t nObjCount(GetObjCount());
for(size_t a = 0; a < nObjCount; ++a)
{
- SdrObject* pObj = maSdrObjList.GetObj(a);
+ SdrObject* pObj(GetObj(a));
aRetval.append(pObj->TakeXorPoly());
}
@@ -312,9 +325,9 @@ long SdrObjGroup::GetRotateAngle() const
{
long nRetval(0);
- if(maSdrObjList.GetObjCount())
+ if(0 != GetObjCount())
{
- SdrObject* pObj = maSdrObjList.GetObj(0);
+ SdrObject* pObj(GetObj(0));
nRetval = pObj->GetRotateAngle();
}
@@ -327,9 +340,9 @@ long SdrObjGroup::GetShearAngle(bool /*bVertical*/) const
{
long nRetval(0);
- if(maSdrObjList.GetObjCount())
+ if(0 != GetObjCount())
{
- SdrObject* pObj = maSdrObjList.GetObj(0);
+ SdrObject* pObj(GetObj(0));
nRetval = pObj->GetShearAngle();
}
@@ -367,13 +380,18 @@ void SdrObjGroup::NbcSetLogicRect(const tools::Rectangle& rRect)
void SdrObjGroup::NbcMove(const Size& rSiz)
{
aRefPoint.Move(rSiz);
- if (maSdrObjList.GetObjCount()!=0) {
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
+ const size_t nObjCount(GetObjCount());
+
+ if(0 != nObjCount)
+ {
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
pObj->NbcMove(rSiz);
}
- } else {
+ }
+ else
+ {
aOutRect.Move(rSiz);
SetRectsDirty();
}
@@ -397,14 +415,20 @@ void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Frac
NbcMirrorGluePoints(aRef1,aRef2);
}
}
+
ResizePoint(aRefPoint,rRef,xFact,yFact);
- if (maSdrObjList.GetObjCount()!=0) {
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
+
+ const size_t nObjCount(GetObjCount());
+ if(0 != nObjCount)
+ {
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
pObj->NbcResize(rRef,xFact,yFact);
}
- } else {
+ }
+ else
+ {
ResizeRect(aOutRect,rRef,xFact,yFact);
SetRectsDirty();
}
@@ -415,11 +439,14 @@ void SdrObjGroup::NbcRotate(const Point& rRef, long nAngle, double sn, double cs
{
SetGlueReallyAbsolute(true);
RotatePoint(aRefPoint,rRef,sn,cs);
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
+ const size_t nObjCount(GetObjCount());
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
pObj->NbcRotate(rRef,nAngle,sn,cs);
}
+
NbcRotateGluePoints(rRef,nAngle,sn,cs);
SetGlueReallyAbsolute(false);
}
@@ -429,11 +456,14 @@ void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
{
SetGlueReallyAbsolute(true);
MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
+ const size_t nObjCount(GetObjCount());
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
pObj->NbcMirror(rRef1,rRef2);
}
+
NbcMirrorGluePoints(rRef1,rRef2);
SetGlueReallyAbsolute(false);
}
@@ -443,11 +473,14 @@ void SdrObjGroup::NbcShear(const Point& rRef, long nAngle, double tn, bool bVShe
{
SetGlueReallyAbsolute(true);
ShearPoint(aRefPoint,rRef,tn);
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
+ const size_t nObjCount(GetObjCount());
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
pObj->NbcShear(rRef,nAngle,tn,bVShear);
}
+
NbcShearGluePoints(rRef,tn,bVShear);
SetGlueReallyAbsolute(false);
}
@@ -458,9 +491,11 @@ void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt)
aAnchor=rPnt;
Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
aRefPoint.Move(aSiz);
- const size_t nObjCount=maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
+ const size_t nObjCount(GetObjCount());
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
pObj->NbcSetAnchorPos(rPnt);
}
}
@@ -502,18 +537,27 @@ void SdrObjGroup::Move(const Size& rSiz)
if (rSiz.Width()!=0 || rSiz.Height()!=0) {
tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
aRefPoint.Move(rSiz);
- if (maSdrObjList.GetObjCount()!=0) {
+ const size_t nObjCount(GetObjCount());
+
+ if(0 != nObjCount)
+ {
// first move the connectors, then everything else
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (pObj->IsEdgeObj()) pObj->Move(rSiz);
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (pObj->IsEdgeObj())
+ pObj->Move(rSiz);
}
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (!pObj->IsEdgeObj()) pObj->Move(rSiz);
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (!pObj->IsEdgeObj())
+ pObj->Move(rSiz);
}
- } else {
+ }
+ else
+ {
aOutRect.Move(rSiz);
SetRectsDirty();
}
@@ -545,18 +589,27 @@ void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fractio
}
tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
ResizePoint(aRefPoint,rRef,xFact,yFact);
- if (maSdrObjList.GetObjCount()!=0) {
+ const size_t nObjCount(GetObjCount());
+
+ if(0 != nObjCount)
+ {
// move the connectors first, everything else afterwards
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (pObj->IsEdgeObj())
+ pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
}
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (!pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (!pObj->IsEdgeObj())
+ pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
}
- } else {
+ }
+ else
+ {
ResizeRect(aOutRect,rRef,xFact,yFact);
SetRectsDirty();
}
@@ -577,15 +630,22 @@ void SdrObjGroup::Rotate(const Point& rRef, long nAngle, double sn, double cs)
tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
RotatePoint(aRefPoint,rRef,sn,cs);
// move the connectors first, everything else afterwards
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (pObj->IsEdgeObj()) pObj->Rotate(rRef,nAngle,sn,cs);
+ const size_t nObjCount(GetObjCount());
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (pObj->IsEdgeObj())
+ pObj->Rotate(rRef,nAngle,sn,cs);
}
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (!pObj->IsEdgeObj()) pObj->Rotate(rRef,nAngle,sn,cs);
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (!pObj->IsEdgeObj())
+ pObj->Rotate(rRef,nAngle,sn,cs);
}
+
NbcRotateGluePoints(rRef,nAngle,sn,cs);
SetGlueReallyAbsolute(false);
SetChanged();
@@ -600,15 +660,22 @@ void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
// move the connectors first, everything else afterwards
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
+ const size_t nObjCount(GetObjCount());
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (pObj->IsEdgeObj())
+ pObj->Mirror(rRef1,rRef2);
}
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (!pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (!pObj->IsEdgeObj())
+ pObj->Mirror(rRef1,rRef2);
}
+
NbcMirrorGluePoints(rRef1,rRef2);
SetGlueReallyAbsolute(false);
SetChanged();
@@ -626,15 +693,22 @@ void SdrObjGroup::Shear(const Point& rRef, long nAngle, double tn, bool bVShear)
tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
ShearPoint(aRefPoint,rRef,tn);
// move the connectors first, everything else afterwards
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (pObj->IsEdgeObj()) pObj->Shear(rRef,nAngle,tn,bVShear);
+ const size_t nObjCount(GetObjCount());
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (pObj->IsEdgeObj())
+ pObj->Shear(rRef,nAngle,tn,bVShear);
}
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (!pObj->IsEdgeObj()) pObj->Shear(rRef,nAngle,tn,bVShear);
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (!pObj->IsEdgeObj())
+ pObj->Shear(rRef,nAngle,tn,bVShear);
}
+
NbcShearGluePoints(rRef,tn,bVShear);
SetGlueReallyAbsolute(false);
SetChanged();
@@ -652,16 +726,24 @@ void SdrObjGroup::SetAnchorPos(const Point& rPnt)
Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
aRefPoint.Move(aSiz);
// move the connectors first, everything else afterwards
- const size_t nObjCount = maSdrObjList.GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=maSdrObjList.GetObj(i);
- if (pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
+ const size_t nObjCount(GetObjCount());
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (pObj->IsEdgeObj())
+ pObj->SetAnchorPos(rPnt);
}
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj = maSdrObjList.GetObj(i);
- if (!pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
+
+ for (size_t i=0; i<nObjCount; ++i)
+ {
+ SdrObject* pObj(GetObj(i));
+ if (!pObj->IsEdgeObj())
+ pObj->SetAnchorPos(rPnt);
}
- if (bChg) {
+
+ if (bChg)
+ {
SetChanged();
BroadcastObjectChange();
SendUserCall(SdrUserCallType::MoveOnly,aBoundRect0);
@@ -685,22 +767,23 @@ void SdrObjGroup::SetRelativePos(const Point& rPnt)
void SdrObjGroup::NbcReformatText()
{
- maSdrObjList.NbcReformatAllTextObjects();
+ NbcReformatAllTextObjects();
}
void SdrObjGroup::ReformatText()
{
- maSdrObjList.ReformatAllTextObjects();
+ ReformatAllTextObjects();
}
SdrObject* SdrObjGroup::DoConvertToPolyObj(bool bBezier, bool bAddText) const
{
SdrObject* pGroup = new SdrObjGroup(getSdrModelFromSdrObject());
+ const size_t nObjCount(GetObjCount());
- for(size_t a=0; a<maSdrObjList.GetObjCount(); ++a)
+ for(size_t a=0; a < nObjCount; ++a)
{
- SdrObject* pIterObj = maSdrObjList.GetObj(a);
- SdrObject* pResult = pIterObj->DoConvertToPolyObj(bBezier, bAddText);
+ SdrObject* pIterObj(GetObj(a));
+ SdrObject* pResult(pIterObj->DoConvertToPolyObj(bBezier, bAddText));
// pResult can be NULL e.g. for empty objects
if( pResult )
@@ -716,8 +799,8 @@ void SdrObjGroup::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
SdrObject::dumpAsXml(pWriter);
+ SdrObjList::dumpAsXml(pWriter);
- maSdrObjList.dumpAsXml(pWriter);
xmlTextWriterEndElement(pWriter);
}
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 30a41a8b4cd1..cddbd3285444 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1238,38 +1238,23 @@ SdrObject* SdrOle2Obj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
return nullptr;
}
-void SdrOle2Obj::SetPage(SdrPage* pNewPage)
+void SdrOle2Obj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
- bool bRemove=pNewPage==nullptr && pPage!=nullptr;
- bool bInsert=pNewPage!=nullptr && pPage==nullptr;
+ const bool bRemove(pNewPage == nullptr && pOldPage != nullptr);
+ const bool bInsert(pNewPage != nullptr && pOldPage == nullptr);
if (bRemove && mpImpl->mbConnected )
- Disconnect();
-
- if(!GetStyleSheet() && pNewPage)
{
- // #i119287# Set default StyleSheet for SdrGrafObj here, it is different from 'Default'. This
- // needs to be done before the style 'Default' is set from the :SetModel() call which is triggered
- // from the following :SetPage().
- // TTTT: Needs to be moved in branch aw080 due to having a SdrModel from the beginning, is at this
- // place for convenience currently (works in both versions, is not in the way)
- SfxStyleSheet* pSheet = pNewPage->getSdrModelFromSdrPage().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj();
-
- if(pSheet)
- {
- SetStyleSheet(pSheet, false);
- }
- else
- {
- SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
- SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
- }
+ Disconnect();
}
- SdrRectObj::SetPage(pNewPage);
+ // call parent
+ SdrRectObj::handlePageChange(pOldPage, pNewPage);
if (bInsert && !mpImpl->mbConnected )
+ {
Connect();
+ }
}
void SdrOle2Obj::SetObjRef( const css::uno::Reference < css::embed::XEmbeddedObject >& rNewObjRef )
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 9469e79843a1..41bd67eb19d5 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -452,19 +452,22 @@ bool SdrTextObj::HasTextImpl( SdrOutliner const * pOutliner )
return bRet;
}
-void SdrTextObj::SetPage(SdrPage* pNewPage)
+void SdrTextObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
- bool bRemove=pNewPage==nullptr && pPage!=nullptr;
- bool bInsert=pNewPage!=nullptr && pPage==nullptr;
- bool bLinked=IsLinkedText();
+ const bool bRemove(pNewPage == nullptr && pOldPage != nullptr);
+ const bool bInsert(pNewPage != nullptr && pOldPage == nullptr);
+ const bool bLinked(IsLinkedText());
- if (bLinked && bRemove) {
+ if (bLinked && bRemove)
+ {
ImpDeregisterLink();
}
- SdrAttrObj::SetPage(pNewPage);
+ // call parent
+ SdrAttrObj::handlePageChange(pOldPage, pNewPage);
- if (bLinked && bInsert) {
+ if (bLinked && bInsert)
+ {
ImpRegisterLink();
}
}
@@ -1949,7 +1952,7 @@ void ImpUpdateChainLinks(SdrTextObj *pTextObj, OUString const& aNextLinkName)
return;
}
- SdrPage *pPage = pTextObj->GetPage();
+ SdrPage *pPage(pTextObj->getSdrPageFromSdrObject());
assert(pPage);
SdrTextObj *pNextTextObj = dynamic_cast< SdrTextObj * >
(ImpGetObjByName(pPage, aNextLinkName));
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 75830c864536..0ef85952b253 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -889,7 +889,7 @@ void SdrTextObj::impDecomposeBlockTextPrimitive(
if (drawing::FillStyle_NONE == pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue())
{
- SdrPage *pOwnerPage = GetPage();
+ SdrPage* pOwnerPage(getSdrPageFromSdrObject());
if (pOwnerPage)
{
pBackgroundFillSet = &pOwnerPage->getSdrPageProperties().GetItemSet();
@@ -1438,16 +1438,19 @@ void SdrTextObj::impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutlin
TextChainFlow aTxtChainFlow(const_cast<SdrTextObj*>(this));
bool bIsOverflow;
+#ifdef DBG_UTIL
// Some debug output
- size_t nObjCount = pPage->GetObjCount();
- for (size_t i = 0; i < nObjCount; i++) {
- SdrTextObj *pCurObj = static_cast<SdrTextObj *>(pPage->GetObj(i));
-
- if (pCurObj == this) {
+ size_t nObjCount(getSdrPageFromSdrObject()->GetObjCount());
+ for (size_t i = 0; i < nObjCount; i++)
+ {
+ SdrTextObj* pCurObj(dynamic_cast< SdrTextObj* >(getSdrPageFromSdrObject()->GetObj(i)));
+ if(pCurObj == this)
+ {
SAL_INFO("svx.chaining", "Working on TextBox " << i);
break;
}
}
+#endif
aTxtChainFlow.CheckForFlowEvents(&rOutliner);
diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index 3a1cb78770e8..94bd1cf7492b 100644
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -485,8 +485,8 @@ uno::Reference< awt::XControl > SdrUnoObj::GetUnoControl(const SdrView& _rView,
uno::Reference< awt::XControl > xControl;
SdrPageView* pPageView = _rView.GetSdrPageView();
- OSL_ENSURE( pPageView && GetPage() == pPageView->GetPage(), "SdrUnoObj::GetUnoControl: This object is not displayed in that particular view!" );
- if ( !pPageView || GetPage() != pPageView->GetPage() )
+ OSL_ENSURE( pPageView && getSdrPageFromSdrObject() == pPageView->GetPage(), "SdrUnoObj::GetUnoControl: This object is not displayed in that particular view!" );
+ if ( !pPageView || getSdrPageFromSdrObject() != pPageView->GetPage() )
return nullptr;
SdrPageWindow* pPageWindow = pPageView->FindPageWindow( _rOut );
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 1b25b3f7df4f..cf3ae4d41eb9 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -66,22 +66,28 @@ public:
: ::std::vector<tools::WeakReference<SdrObject>>(nInitialSize) {};
};
-
static const sal_Int32 InitialObjectContainerCapacity (64);
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// helper to allow changing parent at SdrObject, but only from SdrObjList
+
+void SetParentAtSdrObjectFromSdrObjList(SdrObject& rSdrObject, SdrObjList* pNew)
+{
+ rSdrObject.setParentOfSdrObject(pNew);
+}
+
+//////////////////////////////////////////////////////////////////////////////
-SdrObjList::SdrObjList(SdrPage* pNewPage)
+SdrObjList::SdrObjList()
: maList(),
+ maSdrObjListOutRect(),
+ maSdrObjListSnapRect(),
+ mbObjOrdNumsDirty(false),
+ mbRectsDirty(false),
mxNavigationOrder(),
mbIsNavigationOrderDirty(false)
{
maList.reserve(InitialObjectContainerCapacity);
- mpPage=pNewPage;
- pUpList=nullptr;
- bObjOrdNumsDirty=false;
- bRectsDirty=false;
- pOwnerObj=nullptr;
- eListKind=SdrObjListKind::Unknown;
}
void SdrObjList::impClearSdrObjList(bool bBroadcast)
@@ -91,7 +97,7 @@ void SdrObjList::impClearSdrObjList(bool bBroadcast)
while(!maList.empty())
{
// remove last object from list
- SdrObject* pObj = maList.back();
+ SdrObject* pObj(maList.back());
RemoveObjectFromContainer(maList.size()-1);
// flushViewObjectContacts() is done since SdrObject::Free is not guaranteed
@@ -106,7 +112,8 @@ void SdrObjList::impClearSdrObjList(bool bBroadcast)
}
// sent remove hint (after removal, see RemoveObject())
- SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj, mpPage);
+ // TTTT SdrPage not needed, can be accessed using SdrObject
+ SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj, getSdrPageFromSdrObjList());
pObj->getSdrModelFromSdrObject().Broadcast(aHint);
}
@@ -132,12 +139,16 @@ SdrObjList::~SdrObjList()
impClearSdrObjList(false);
}
-void SdrObjList::copyDataFromSdrObjList(const SdrObjList& rSrcList)
+SdrPage* SdrObjList::getSdrPageFromSdrObjList() const
+{
+ // default is no page and returns zero
+ return nullptr;
+}
+
+SdrObject* SdrObjList::getSdrObjectFromSdrObjList() const
{
- // this function is only supposed to be called once, right after construction
- assert(maList.empty());
- eListKind=rSrcList.eListKind;
- CopyObjects(rSrcList);
+ // default is no SdrObject (SdrObjGroup)
+ return nullptr;
}
void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
@@ -145,20 +156,20 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
// clear SdrObjects with broadcasting
ClearSdrObjList();
- bObjOrdNumsDirty = false;
- bRectsDirty = false;
+ mbObjOrdNumsDirty = false;
+ mbRectsDirty = false;
size_t nCloneErrCnt(0);
const size_t nCount(rSrcList.GetObjCount());
- if(nullptr == GetOwnerObj() && nullptr == GetPage())
+ if(nullptr == getSdrObjectFromSdrObjList() && nullptr == getSdrPageFromSdrObjList())
{
OSL_ENSURE(false, "SdrObjList which is not part of SdrPage or SdrObject (!)");
return;
}
- SdrModel& rTargetSdrModel(nullptr == GetOwnerObj()
- ? GetPage()->getSdrModelFromSdrPage()
- : GetOwnerObj()->getSdrModelFromSdrObject());
+ SdrModel& rTargetSdrModel(nullptr == getSdrObjectFromSdrObjList()
+ ? getSdrPageFromSdrObjList()->getSdrModelFromSdrPage()
+ : getSdrObjectFromSdrObjList()->getSdrModelFromSdrObject());
for (size_t no(0); no < nCount; ++no)
{
@@ -167,7 +178,6 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
if(nullptr != pDO)
{
- pDO->SetPage(mpPage);
NbcInsertObject(pDO, SAL_MAX_SIZE);
}
else
@@ -242,23 +252,6 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
}
}
-SdrPage* SdrObjList::GetPage() const
-{
- return mpPage;
-}
-
-void SdrObjList::SetPage(SdrPage* pNewPage)
-{
- if (mpPage!=pNewPage) {
- mpPage=pNewPage;
- const size_t nCount = GetObjCount();
- for (size_t no=0; no<nCount; ++no) {
- SdrObject* pObj=GetObj(no);
- pObj->SetPage(mpPage);
- }
- }
-}
-
void SdrObjList::RecalcObjOrdNums()
{
const size_t nCount = GetObjCount();
@@ -266,30 +259,35 @@ void SdrObjList::RecalcObjOrdNums()
SdrObject* pObj=GetObj(no);
pObj->SetOrdNum(no);
}
- bObjOrdNumsDirty=false;
+ mbObjOrdNumsDirty=false;
}
void SdrObjList::RecalcRects()
{
- maOutRect=tools::Rectangle();
- aSnapRect=maOutRect;
+ maSdrObjListOutRect=tools::Rectangle();
+ maSdrObjListSnapRect=maSdrObjListOutRect;
const size_t nCount = GetObjCount();
for (size_t i=0; i<nCount; ++i) {
SdrObject* pObj=GetObj(i);
if (i==0) {
- maOutRect=pObj->GetCurrentBoundRect();
- aSnapRect=pObj->GetSnapRect();
+ maSdrObjListOutRect=pObj->GetCurrentBoundRect();
+ maSdrObjListSnapRect=pObj->GetSnapRect();
} else {
- maOutRect.Union(pObj->GetCurrentBoundRect());
- aSnapRect.Union(pObj->GetSnapRect());
+ maSdrObjListOutRect.Union(pObj->GetCurrentBoundRect());
+ maSdrObjListSnapRect.Union(pObj->GetSnapRect());
}
}
}
-void SdrObjList::SetRectsDirty()
+void SdrObjList::SetSdrObjListRectsDirty()
{
- bRectsDirty=true;
- if (pUpList!=nullptr) pUpList->SetRectsDirty();
+ mbRectsDirty=true;
+ SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());
+
+ if(nullptr != pParentSdrObject)
+ {
+ pParentSdrObject->SetRectsDirty();
+ }
}
void SdrObjList::impChildInserted(SdrObject const & rChild)
@@ -313,18 +311,17 @@ void SdrObjList::NbcInsertObject(SdrObject* pObj, size_t nPos)
if (nPos>nCount) nPos=nCount;
InsertObjectIntoContainer(*pObj,nPos);
- if (nPos<nCount) bObjOrdNumsDirty=true;
+ if (nPos<nCount) mbObjOrdNumsDirty=true;
pObj->SetOrdNum(nPos);
- pObj->setParentOfSdrObject(this);
- pObj->SetPage(mpPage);
+ SetParentAtSdrObjectFromSdrObjList(*pObj, this);
// Inform the parent about change to allow invalidations at
// evtl. existing parent visualisations
impChildInserted(*pObj);
- if (!bRectsDirty) {
- maOutRect.Union(pObj->GetCurrentBoundRect());
- aSnapRect.Union(pObj->GetSnapRect());
+ if (!mbRectsDirty) {
+ maSdrObjListOutRect.Union(pObj->GetCurrentBoundRect());
+ maSdrObjListSnapRect.Union(pObj->GetSnapRect());
}
pObj->SetInserted(true); // calls the UserCall (among others)
}
@@ -336,7 +333,7 @@ void SdrObjList::InsertObject(SdrObject* pObj, size_t nPos)
if(pObj)
{
// if anchor is used, reset it before grouping
- if(GetOwnerObj())
+ if(getSdrObjectFromSdrObjList())
{
const Point& rAnchorPos = pObj->GetAnchorPos();
if(rAnchorPos.X() || rAnchorPos.Y())
@@ -348,15 +345,17 @@ void SdrObjList::InsertObject(SdrObject* pObj, size_t nPos)
// In case the object is inserted into a group and doesn't overlap with
// the group's other members, it needs an own repaint.
- if(pOwnerObj)
+ SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());
+
+ if(pParentSdrObject)
{
// only repaint here
- pOwnerObj->ActionChanged();
+ pParentSdrObject->ActionChanged();
}
// TODO: We need a different broadcast here!
// Repaint from object number ... (heads-up: GroupObj)
- if(pObj->GetPage())
+ if(pObj->getSdrPageFromSdrObject())
{
SdrHint aHint(SdrHintKind::ObjectInserted, *pObj);
pObj->getSdrModelFromSdrObject().Broadcast(aHint);
@@ -379,20 +378,22 @@ SdrObject* SdrObjList::NbcRemoveObject(size_t nObjNum)
RemoveObjectFromContainer(nObjNum);
DBG_ASSERT(pObj!=nullptr,"Could not find object to remove.");
- if (pObj!=nullptr) {
+ if (pObj!=nullptr)
+ {
// flushViewObjectContacts() clears the VOC's and those invalidate
pObj->GetViewContact().flushViewObjectContacts();
DBG_ASSERT(pObj->IsInserted(),"The object does not have the status Inserted.");
pObj->SetInserted(false); // calls UserCall, among other
- pObj->setParentOfSdrObject(nullptr);
- pObj->SetPage(nullptr);
- if (!bObjOrdNumsDirty) { // optimizing for the case that the last object has to be removed
+ SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);
+ if (!mbObjOrdNumsDirty)
+ {
+ // optimizing for the case that the last object has to be removed
if (nObjNum+1!=nCount) {
- bObjOrdNumsDirty=true;
+ mbObjOrdNumsDirty=true;
}
}
- SetRectsDirty();
+ SetSdrObjListRectsDirty();
}
return pObj;
}
@@ -417,7 +418,7 @@ SdrObject* SdrObjList::RemoveObject(size_t nObjNum)
DBG_ASSERT(pObj->IsInserted(),"The object does not have the status Inserted.");
// TODO: We need a different broadcast here.
- if (pObj->GetPage()!=nullptr)
+ if (pObj->getSdrPageFromSdrObject()!=nullptr)
{
SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj);
pObj->getSdrModelFromSdrObject().Broadcast(aHint);
@@ -426,20 +427,24 @@ SdrObject* SdrObjList::RemoveObject(size_t nObjNum)
pObj->getSdrModelFromSdrObject().SetChanged();
pObj->SetInserted(false); // calls, among other things, the UserCall
- pObj->setParentOfSdrObject(nullptr);
- pObj->SetPage(nullptr);
- if (!bObjOrdNumsDirty) { // optimization for the case that the last object is removed
+ SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);
+
+ if (!mbObjOrdNumsDirty)
+ {
+ // optimization for the case that the last object is removed
if (nObjNum+1!=nCount) {
- bObjOrdNumsDirty=true;
+ mbObjOrdNumsDirty=true;
}
}
- SetRectsDirty();
- if(pOwnerObj && !GetObjCount())
+ SetSdrObjListRectsDirty();
+ SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());
+
+ if(pParentSdrObject && !GetObjCount())
{
// empty group created; it needs to be repainted since it's
// visualization changes
- pOwnerObj->ActionChanged();
+ pParentSdrObject->ActionChanged();
}
}
return pObj;
@@ -459,23 +464,21 @@ SdrObject* SdrObjList::NbcReplaceObject(SdrObject* pNewObj, size_t nObjNum)
if (pObj!=nullptr) {
DBG_ASSERT(pObj->IsInserted(),"SdrObjList::ReplaceObject: the object does not have status Inserted.");
pObj->SetInserted(false);
- pObj->setParentOfSdrObject(nullptr);
- pObj->SetPage(nullptr);
+ SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);
ReplaceObjectInContainer(*pNewObj,nObjNum);
// flushViewObjectContacts() clears the VOC's and those invalidate
pObj->GetViewContact().flushViewObjectContacts();
pNewObj->SetOrdNum(nObjNum);
- pNewObj->setParentOfSdrObject(this);
- pNewObj->SetPage(mpPage);
+ SetParentAtSdrObjectFromSdrObjList(*pNewObj, this);
// Inform the parent about change to allow invalidations at
// evtl. existing parent visualisations
impChildInserted(*pNewObj);
pNewObj->SetInserted(true);
- SetRectsDirty();
+ SetSdrObjListRectsDirty();
}
return pObj;
}
@@ -499,23 +502,21 @@ SdrObject* SdrObjList::ReplaceObject(SdrObject* pNewObj, size_t nObjNum)
DBG_ASSERT(pObj->IsInserted(),"SdrObjList::ReplaceObject: the object does not have status Inserted.");
// TODO: We need a different broadcast here.
- if (pObj->GetPage()!=nullptr)
+ if (pObj->getSdrPageFromSdrObject()!=nullptr)
{
SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj);
pObj->getSdrModelFromSdrObject().Broadcast(aHint);
}
pObj->SetInserted(false);
- pObj->setParentOfSdrObject(nullptr);
- pObj->SetPage(nullptr);
+ SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);
ReplaceObjectInContainer(*pNewObj,nObjNum);
// flushViewObjectContacts() clears the VOC's and those invalidate
pObj->GetViewContact().flushViewObjectContacts();
pNewObj->SetOrdNum(nObjNum);
- pNewObj->setParentOfSdrObject(this);
- pNewObj->SetPage(mpPage);
+ SetParentAtSdrObjectFromSdrObjList(*pNewObj, this);
// Inform the parent about change to allow invalidations at
// evtl. existing parent visualisations
@@ -524,14 +525,14 @@ SdrObject* SdrObjList::ReplaceObject(SdrObject* pNewObj, size_t nObjNum)
pNewObj->SetInserted(true);
// TODO: We need a different broadcast here.
- if (pNewObj->GetPage()!=nullptr) {
+ if (pNewObj->getSdrPageFromSdrObject()!=nullptr) {
SdrHint aHint(SdrHintKind::ObjectInserted, *pNewObj);
pNewObj->getSdrModelFromSdrObject().Broadcast(aHint);
}
pNewObj->getSdrModelFromSdrObject().SetChanged();
- SetRectsDirty();
+ SetSdrObjListRectsDirty();
}
return pObj;
}
@@ -558,10 +559,10 @@ SdrObject* SdrObjList::SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
pObj->ActionChanged();
pObj->SetOrdNum(nNewObjNum);
- bObjOrdNumsDirty=true;
+ mbObjOrdNumsDirty=true;
// TODO: We need a different broadcast here.
- if (pObj->GetPage()!=nullptr)
+ if (pObj->getSdrPageFromSdrObject()!=nullptr)
pObj->getSdrModelFromSdrObject().Broadcast(SdrHint(SdrHintKind::ObjectChange, *pObj));
pObj->getSdrModelFromSdrObject().SetChanged();
}
@@ -570,11 +571,11 @@ SdrObject* SdrObjList::SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
const tools::Rectangle& SdrObjList::GetAllObjSnapRect() const
{
- if (bRectsDirty) {
+ if (mbRectsDirty) {
const_cast<SdrObjList*>(this)->RecalcRects();
- const_cast<SdrObjList*>(this)->bRectsDirty=false;
+ const_cast<SdrObjList*>(this)->mbRectsDirty=false;
}
- return aSnapRect;
+ return maSdrObjListSnapRect;
}
const tools::Rectangle& SdrObjList::GetAllObjBoundRect() const
@@ -582,14 +583,14 @@ const tools::Rectangle& SdrObjList::GetAllObjBoundRect() const
// #i106183# for deep group hierarchies like in chart2, the invalidates
// through the hierarchy are not correct; use a 2nd hint for the needed
// recalculation. Future versions will have no bool flag at all, but
- // just maOutRect in empty state to represent an invalid state, thus
+ // just maSdrObjListOutRect in empty state to represent an invalid state, thus
// it's a step in the right direction.
- if (bRectsDirty || maOutRect.IsEmpty())
+ if (mbRectsDirty || maSdrObjListOutRect.IsEmpty())
{
const_cast<SdrObjList*>(this)->RecalcRects();
- const_cast<SdrObjList*>(this)->bRectsDirty=false;
+ const_cast<SdrObjList*>(this)->mbRectsDirty=false;
}
- return maOutRect;
+ return maSdrObjListOutRect;
}
void SdrObjList::NbcReformatAllTextObjects()
@@ -620,7 +621,7 @@ void SdrObjList::ReformatAllTextObjects()
void SdrObjList::ReformatAllEdgeObjects()
{
// #i120437# go over whole hierarchy, not only over object level null (seen from grouping)
- SdrObjListIter aIter(*this, SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(this, SdrIterMode::DeepNoGroups);
while(aIter.IsMore())
{
@@ -661,8 +662,19 @@ SdrObject* SdrObjList::GetObj(size_t nNum) const
bool SdrObjList::IsReadOnly() const
{
- bool bRet = false;
- if (mpPage!=nullptr && mpPage!=this) bRet=mpPage->IsReadOnly();
+ bool bRet(false);
+ SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());
+
+ if(nullptr != pParentSdrObject)
+ {
+ SdrPage* pSdrPage(pParentSdrObject->getSdrPageFromSdrObject());
+
+ if(nullptr != pSdrPage)
+ {
+ bRet = pSdrPage->IsReadOnly();
+ }
+ }
+
return bRet;
}
@@ -847,7 +859,9 @@ void SdrObjList::SetNavigationOrder (const uno::Reference<container::XIndexAcces
mbIsNavigationOrderDirty = true;
}
else
+ {
ClearObjectNavigationOrder();
+ }
}
@@ -873,7 +887,7 @@ void SdrObjList::InsertObjectIntoContainer (
maList.push_back(&rObject);
else
maList.insert(maList.begin()+nInsertPosition, &rObject);
- bObjOrdNumsDirty=true;
+ mbObjOrdNumsDirty=true;
}
@@ -908,7 +922,7 @@ void SdrObjList::ReplaceObjectInContainer (
}
maList[nObjectPosition] = &rNewObject;
- bObjOrdNumsDirty=true;
+ mbObjOrdNumsDirty=true;
}
@@ -935,7 +949,7 @@ void SdrObjList::RemoveObjectFromContainer (
}
maList.erase(maList.begin()+nObjectPosition);
- bObjOrdNumsDirty=true;
+ mbObjOrdNumsDirty=true;
}
void SdrObjList::dumpAsXml(xmlTextWriterPtr pWriter) const
@@ -1118,7 +1132,7 @@ void SdrPageProperties::SetStyleSheet(SfxStyleSheet* pStyleSheet)
SdrPage::SdrPage(SdrModel& rModel, bool bMasterPage)
: tools::WeakBase(),
- SdrObjList(this),
+ SdrObjList(),
maPageUsers(),
mpViewContact(nullptr),
mrSdrModelFromSdrPage(rModel),
@@ -1140,8 +1154,6 @@ SdrPage::SdrPage(SdrModel& rModel, bool bMasterPage)
mbPageBorderOnlyLeftRight(false)
{
aPrefVisiLayers.SetAll();
- eListKind = bMasterPage ? SdrObjListKind::MasterPage : SdrObjListKind::DrawPage;
-
mpSdrPageProperties.reset(new SdrPageProperties(*this));
}
@@ -1182,11 +1194,14 @@ SdrPage::~SdrPage()
mpSdrPageProperties.reset();
}
+SdrModel& SdrPage::getSdrModelFromSdrObjList() const
+{
+ return getSdrModelFromSdrPage();
+}
+
void SdrPage::lateInit(const SdrPage& rSrcPage)
{
assert(!mpViewContact);
- // SdrPageProperties get set by SdrPage::SdrPage already, so do not assert anymore
- // assert(!mpSdrPageProperties);
assert(!mxUnoPage.is());
// copy all the local parameters to make this instance
@@ -1227,11 +1242,10 @@ void SdrPage::lateInit(const SdrPage& rSrcPage)
}
// Now copy the contained objects
- SdrObjList::copyDataFromSdrObjList(rSrcPage);
-
- // be careful and correct eListKind, a member of SdrObjList which
- // will be changed by the SdrObjList::lateInit before...
- eListKind = (mbMaster) ? SdrObjListKind::MasterPage : SdrObjListKind::DrawPage;
+ if(0 != rSrcPage.GetObjCount())
+ {
+ CopyObjects(rSrcPage);
+ }
}
SdrPage* SdrPage::CloneSdrPage(SdrModel& rTargetModel) const
@@ -1424,6 +1438,10 @@ void SdrPage::SetChanged()
getSdrModelFromSdrPage().SetChanged();
}
+SdrPage* SdrPage::getSdrPageFromSdrObjList() const
+{
+ return const_cast< SdrPage* >(this);
+}
// MasterPage interface
@@ -1515,7 +1533,7 @@ void SdrPage::SetInserted( bool bIns )
mbInserted = bIns;
// #i120437# go over whole hierarchy, not only over object level null (seen from grouping)
- SdrObjListIter aIter(*this, SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(this, SdrIterMode::DeepNoGroups);
while ( aIter.IsMore() )
{
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 76d30c43d145..b5052c422502 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -665,8 +665,12 @@ bool SdrPageView::IsObjMarkable(SdrObject const * pObj) const
return true;
}
}
- if (!pObj->Is3DObj() && pObj->GetPage()!=GetPage())
- return false; // Obj suddenly in different Page
+ if (!pObj->Is3DObj() && pObj->getSdrPageFromSdrObject() != GetPage())
+ {
+ // Obj suddenly in different Page
+ return false;
+ }
+
// the layer has to be visible and must not be locked
SdrLayerID nL = pObj->GetLayer();
if (!aLayerVisi.IsSet(nL))
@@ -901,7 +905,7 @@ void SdrPageView::CheckCurrentGroup()
SdrObject* pGrp(GetCurrentGroup());
while(nullptr != pGrp &&
- (!pGrp->IsInserted() || nullptr == pGrp->getParentOfSdrObject() || nullptr == pGrp->GetPage()))
+ (!pGrp->IsInserted() || nullptr == pGrp->getParentOfSdrObject() || nullptr == pGrp->getSdrPageFromSdrObject()))
{
// anything outside of the borders?
pGrp = pGrp->GetUpGroup();
diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx
index 10aacc3f87fd..1dc96f0c6a51 100644
--- a/svx/source/svdraw/svdsnpv.cxx
+++ b/svx/source/svdraw/svdsnpv.cxx
@@ -325,7 +325,7 @@ SdrSnap SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const
sal_uInt32 nMaxFrameSnapCount=200;
// go back to SdrIterMode::DeepNoGroups runthrough for snap to object comparisons
- SdrObjListIter aIter(*pPV->GetPage(),SdrIterMode::DeepNoGroups,true);
+ SdrObjListIter aIter(pPV->GetPage(),SdrIterMode::DeepNoGroups,true);
while (aIter.IsMore() && (nMaxPointSnapCount>0 || nMaxFrameSnapCount>0)) {
SdrObject* pO=aIter.Next();
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index c08bd7785e38..b70efa10699c 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -237,9 +237,9 @@ void SdrUndoObj::ImpTakeDescriptionStr(const char* pStrCacheID, OUString& rStr,
// common call method for possible change of the page when UNDO/REDO is triggered
void SdrUndoObj::ImpShowPageOfThisObject()
{
- if(pObj && pObj->IsInserted() && pObj->GetPage())
+ if(pObj && pObj->IsInserted() && pObj->getSdrPageFromSdrObject())
{
- SdrHint aHint(SdrHintKind::SwitchToPage, *pObj, pObj->GetPage());
+ SdrHint aHint(SdrHintKind::SwitchToPage, *pObj, pObj->getSdrPageFromSdrObject());
pObj->getSdrModelFromSdrObject().Broadcast(aHint);
}
}
@@ -700,12 +700,12 @@ void SdrUndoRemoveObj::Undo()
// position of the target object.
Point aOwnerAnchorPos(0, 0);
- if (dynamic_cast<const SdrObjGroup*>(pObjList->GetOwnerObj()) != nullptr)
+ if (dynamic_cast< const SdrObjGroup* >(pObjList->getSdrObjectFromSdrObjList()) != nullptr)
{
- aOwnerAnchorPos = pObjList->GetOwnerObj()->GetAnchorPos();
+ aOwnerAnchorPos = pObjList->getSdrObjectFromSdrObjList()->GetAnchorPos();
}
- E3DModifySceneSnapRectUpdater aUpdater(pObjList->GetOwnerObj());
+ E3DModifySceneSnapRectUpdater aUpdater(pObjList->getSdrObjectFromSdrObjList());
pObjList->InsertObject(pObj,nOrdNum);
// #i11426#
@@ -759,7 +759,8 @@ void SdrUndoInsertObj::Redo()
// which becomes a member of a group, because its cleared in method
// <InsertObject(..)>. Needed for correct Redo in Writer. (#i45952#)
Point aAnchorPos( 0, 0 );
- if (dynamic_cast<const SdrObjGroup*>(pObjList->GetOwnerObj()) != nullptr)
+
+ if (dynamic_cast<const SdrObjGroup*>(pObjList->getSdrObjectFromSdrObjList()) != nullptr)
{
aAnchorPos = pObj->GetAnchorPos();
}
diff --git a/svx/source/svdraw/svdviter.cxx b/svx/source/svdraw/svdviter.cxx
index d77f7a3780fc..1d4c9b035661 100644
--- a/svx/source/svdraw/svdviter.cxx
+++ b/svx/source/svdraw/svdviter.cxx
@@ -48,7 +48,7 @@ SdrViewIter::SdrViewIter(const SdrObject* pObject)
{
mpObject = pObject;
mpModel = pObject ? &pObject->getSdrModelFromSdrObject() : nullptr;
- mpPage = pObject ? pObject->GetPage() : nullptr;
+ mpPage = pObject ? pObject->getSdrPageFromSdrObject() : nullptr;
if(!mpModel || !mpPage)
{
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 67ec4033ae96..f549df42426e 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -115,7 +115,7 @@ bool SdrExchangeView::ImpGetPasteLayer(const SdrObjList* pObjList, SdrLayerID& r
bool bRet=false;
rLayer=SdrLayerID(0);
if (pObjList!=nullptr) {
- const SdrPage* pPg=pObjList->GetPage();
+ const SdrPage* pPg=pObjList->getSdrPageFromSdrObjList();
if (pPg!=nullptr) {
rLayer=pPg->GetLayerAdmin().GetLayerID(maActualLayer);
if (rLayer==SDRLAYER_NOTFOUND) rLayer=SdrLayerID(0);
@@ -142,7 +142,7 @@ bool SdrExchangeView::Paste(const OUString& rStr, const Point& rPos, SdrObjList*
bool bUnmark = (nOptions & (SdrInsertFlags::DONTMARK|SdrInsertFlags::ADDMARK))==SdrInsertFlags::NONE && !IsTextEdit();
if (bUnmark) UnmarkAllObj();
tools::Rectangle aTextRect(0,0,500,500);
- SdrPage* pPage=pLst->GetPage();
+ SdrPage* pPage=pLst->getSdrPageFromSdrObjList();
if (pPage!=nullptr) {
aTextRect.SetSize(pPage->GetSize());
}
@@ -182,7 +182,7 @@ bool SdrExchangeView::Paste(SvStream& rInput, EETextFormat eFormat, const Point&
bool bUnmark=(nOptions&(SdrInsertFlags::DONTMARK|SdrInsertFlags::ADDMARK))==SdrInsertFlags::NONE && !IsTextEdit();
if (bUnmark) UnmarkAllObj();
tools::Rectangle aTextRect(0,0,500,500);
- SdrPage* pPage=pLst->GetPage();
+ SdrPage* pPage=pLst->getSdrPageFromSdrObjList();
if (pPage!=nullptr) {
aTextRect.SetSize(pPage->GetSize());
}
@@ -320,10 +320,9 @@ bool SdrExchangeView::Paste(
}
// #i39861#
- pNewObj->SetPage(pDstLst->GetPage());
pNewObj->NbcMove(aSiz);
- const SdrPage* pPg = pDstLst->GetPage();
+ const SdrPage* pPg = pDstLst->getSdrPageFromSdrObjList();
if(pPg)
{
@@ -702,7 +701,7 @@ void SdrExchangeView::DrawMarkedObj(OutputDevice& rOut) const
if(aSdrObjects.size())
{
- sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aSdrObjects, aSdrObjects[0]->GetPage());
+ sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aSdrObjects, aSdrObjects[0]->getSdrPageFromSdrObject());
sdr::contact::DisplayInfo aDisplayInfo;
// do processing
@@ -755,7 +754,6 @@ SdrModel* SdrExchangeView::GetMarkedObjModel() const
if(pNewObj)
{
- pNewObj->SetPage(pNewPage);
pNewPage->InsertObject(pNewObj, SAL_MAX_SIZE);
// #i13033#
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 3241f2c7d304..284493ac78fd 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -1878,7 +1878,7 @@ void SvxTableController::EditCell(const CellPos& rPos, vcl::Window* pWindow, Tbl
SdrTableObj& rTableObj(*mxTableObj.get());
- if(rTableObj.GetPage() == pPV->GetPage())
+ if(rTableObj.getSdrPageFromSdrObject() == pPV->GetPage())
{
bool bEmptyOutliner = false;
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 11337bb12195..2f7d8085c084 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -302,8 +302,11 @@ drawinglayer::primitive2d::Primitive2DContainer ImplExportCheckVisisbilityRedire
if(pObject)
{
SdrPage* pPage = mpCurrentPage;
- if( pPage == nullptr )
- pPage = pObject->GetPage();
+
+ if(nullptr == pPage)
+ {
+ pPage = pObject->getSdrPageFromSdrObject();
+ }
if( (pPage == nullptr) || pPage->checkVisibility(rOriginal, rDisplayInfo, false) )
{
@@ -1181,7 +1184,7 @@ void SAL_CALL GraphicExporter::setSourceDocument( const Reference< lang::XCompon
{
mxShapes->getByIndex( nIndex ) >>= xShape;
pObj = GetSdrObjectFromXShape( xShape );
- bOk = pObj && pObj->GetPage() == pPage;
+ bOk = pObj && pObj->getSdrPageFromSdrObject() == pPage;
}
if( !bOk )
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index d77df5f01276..8f252456b107 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -510,7 +510,6 @@ SdrObject* SvxDrawPage::CreateSdrObject_(const Reference< drawing::XShape > & xS
*mpModel,
nInventor,
nType,
- mpPage,
&aRect);
if (!pNewObj)
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index fbed04557448..22bf9eecf25f 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -243,7 +243,7 @@ void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xS
if( pShape )
pSdrShape = pShape->GetSdrObject();
- if( !HasSdrObject() || pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->GetOwnerObj() != GetSdrObject() )
+ if( !HasSdrObject() || pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->getSdrObjectFromSdrObjList() != GetSdrObject() )
throw uno::RuntimeException();
SdrObjList& rList = *pSdrShape->getParentOfSdrObject();
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index 9f694bd8a130..3988d6654a33 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -150,7 +150,7 @@ void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xSha
throw uno::RuntimeException();
SdrObject* pSdrShape = pShape->GetSdrObject();
- if(pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->GetOwnerObj() != GetSdrObject())
+ if(pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->getSdrObjectFromSdrObjList() != GetSdrObject())
{
throw uno::RuntimeException();
}
@@ -280,7 +280,7 @@ bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxIte
aSceneTAR.maRect = pScene->GetSnapRect();
// rescue object transformations
- SdrObjListIter aIter(*pScene->GetSubList(), SdrIterMode::DeepWithGroups);
+ SdrObjListIter aIter(pScene->GetSubList(), SdrIterMode::DeepWithGroups);
std::vector<basegfx::B3DHomMatrix*> aObjTrans;
while(aIter.IsMore())
{
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 1ea93dde6d34..12d8b49765fc 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -691,12 +691,12 @@ uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
DBG_TESTSOLARMUTEX();
uno::Any aAny;
- if( !HasSdrObject() || !GetSdrObject()->IsInserted() || nullptr == GetSdrObject()->GetPage() )
+ if( !HasSdrObject() || !GetSdrObject()->IsInserted() || nullptr == GetSdrObject()->getSdrPageFromSdrObject() )
return aAny;
ScopedVclPtrInstance< VirtualDevice > pVDev;
pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
- SdrPage* pPage = GetSdrObject()->GetPage();
+ SdrPage* pPage = GetSdrObject()->getSdrPageFromSdrObject();
std::unique_ptr<E3dView> pView(
new E3dView(
@@ -1342,13 +1342,13 @@ void SAL_CALL SvxShape::dispose()
EndListening( GetSdrObject()->getSdrModelFromSdrObject() );
bool bFreeSdrObject = false;
- if ( GetSdrObject()->IsInserted() && GetSdrObject()->GetPage() )
+ if ( GetSdrObject()->IsInserted() && GetSdrObject()->getSdrPageFromSdrObject() )
{
OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
// normally, we are allowed to free the SdrObject only if we have its ownership.
// Why isn't this checked here?
- SdrPage* pPage = GetSdrObject()->GetPage();
+ SdrPage* pPage = GetSdrObject()->getSdrPageFromSdrObject();
// delete the SdrObject from the page
const size_t nCount = pPage->GetObjCount();
for ( size_t nNum = 0; nNum < nCount; ++nNum )
@@ -3738,28 +3738,47 @@ uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
uno::Reference<uno::XInterface> SAL_CALL SvxShape::getParent()
{
::SolarMutexGuard aGuard;
+ const SdrObject* pSdrObject(GetSdrObject());
- if( HasSdrObject() && GetSdrObject()->getParentOfSdrObject() )
+ if(nullptr != pSdrObject)
{
- SdrObjList* pObjList = GetSdrObject()->getParentOfSdrObject();
+ const SdrObjList* pParentSdrObjList(GetSdrObject()->getParentOfSdrObject());
- switch (pObjList->GetListKind())
+ if(nullptr != pParentSdrObjList)
{
- case SdrObjListKind::GroupObj:
- if (SdrObjGroup *pGroup = dynamic_cast<SdrObjGroup*>(pObjList->GetOwnerObj()))
- return pGroup->getUnoShape();
- else if (E3dScene *pScene = dynamic_cast<E3dScene*>(pObjList->GetOwnerObj()))
- return pScene->getUnoShape();
- break;
- case SdrObjListKind::DrawPage:
- case SdrObjListKind::MasterPage:
- return dynamic_cast<SdrPage&>(*pObjList).getUnoPage();
- default:
- OSL_FAIL( "SvxShape::getParent( ): unexpected SdrObjListKind" );
- break;
+ // SdrObject is member of a SdrObjList. That may be a SdrObject
+ // (SdrObjGroup or E3dScene) or a SdrPage.
+ // Check for SdrObject first - using getSdrPageFromSdrObjList
+ // *will* get the SdrPage even when the SdrObject is deep buried
+ // in a construct of SdrObjGroup.
+ // We want to ask for the direct parent here...
+ SdrObject* pParentSdrObject(pParentSdrObjList->getSdrObjectFromSdrObjList());
+
+ if(nullptr != pParentSdrObject)
+ {
+ // SdrObject is member of a SdrObject-based Group (SdrObjGroup or E3dScene).
+ return pParentSdrObject->getUnoShape();
+ }
+ else
+ {
+ SdrPage* pParentSdrPage(pParentSdrObjList->getSdrPageFromSdrObjList());
+
+ if(nullptr != pParentSdrPage)
+ {
+ // SdrObject is inserted to a SdrPage. Since
+ // we checked for getSdrObjectFromSdrObjList first,
+ // we can even say that it is directly member of that
+ // SdrPage.
+ return pParentSdrPage->getUnoPage();
+ }
+ }
+
+ // not member of any SdrObjList, no parent
+ OSL_FAIL( "SvxShape::getParent( ): unexpected Parent SdrObjList" );
}
}
+ // no SdrObject, no parent
return uno::Reference<uno::XInterface>();
}
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 5c9f669b37cc..af313e15731e 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -540,7 +540,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
mbDataValid = false;
}
- if( mpObject && mpText && !mbDataValid && mpObject->IsInserted() && mpObject->GetPage() )
+ if( mpObject && mpText && !mbDataValid && mpObject->IsInserted() && mpObject->getSdrPageFromSdrObject() )
{
mpTextForwarder->flushCache();
@@ -555,7 +555,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
else
pOutlinerParaObject = mpText->GetOutlinerParaObject();
- if( pOutlinerParaObject && ( bOwnParaObj || !mpObject->IsEmptyPresObj() || mpObject->GetPage()->IsMasterPage() ) )
+ if( pOutlinerParaObject && ( bOwnParaObj || !mpObject->IsEmptyPresObj() || mpObject->getSdrPageFromSdrObject()->IsMasterPage() ) )
{
mpOutliner->SetText( *pOutlinerParaObject );
@@ -579,7 +579,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
if( pPool )
mpOutliner->SetStyleSheetPool( pPool );
- SfxStyleSheet* pStyleSheet = mpObject->GetPage()->GetTextStyleSheetForObject( mpObject );
+ SfxStyleSheet* pStyleSheet = mpObject->getSdrPageFromSdrObject()->GetTextStyleSheetForObject( mpObject );
if( pStyleSheet )
mpOutliner->SetStyleSheet( 0, pStyleSheet );