summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
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/svdraw
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/svdraw')
-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
25 files changed, 627 insertions, 456 deletions
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#