[Libreoffice-commits] core.git: include/svx sd/source svx/source
Armin Le Grand
Armin.Le.Grand at cib.de
Fri Jun 15 22:20:42 UTC 2018
include/svx/obj3d.hxx | 1
include/svx/scene3d.hxx | 3 -
sd/source/ui/func/fucon3d.cxx | 2
svx/source/customshapes/EnhancedCustomShape3d.cxx | 8 +-
svx/source/dialog/dlgctl3d.cxx | 14 ++--
svx/source/engine3d/obj3d.cxx | 8 --
svx/source/engine3d/scene3d.cxx | 66 ++++++++--------------
svx/source/engine3d/view3d.cxx | 6 +-
8 files changed, 41 insertions(+), 67 deletions(-)
New commits:
commit 2c85607101e2e04e870e3b87362f39f9a9148e6c
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Fri Jun 15 20:34:37 2018 +0200
AW080: Cleanup of 3D Object methods
Change-Id: I3a8247aabd2fd24b53faf9e1e8da29856dde70bf
Reviewed-on: https://gerrit.libreoffice.org/55897
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>
diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx
index a14279523de1..bfb730d28df0 100644
--- a/include/svx/obj3d.hxx
+++ b/include/svx/obj3d.hxx
@@ -93,7 +93,6 @@ private:
bool mbIsSelected : 1;
protected:
- virtual void NewObjectInserted(const E3dObject* p3DObj);
virtual void StructureChanged();
virtual basegfx::B3DRange RecalcBoundVolume() const;
diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx
index 1ebf4ac9728b..9b8e4b4f88bd 100644
--- a/include/svx/scene3d.hxx
+++ b/include/svx/scene3d.hxx
@@ -78,7 +78,6 @@ protected:
bool mbSkipSettingDirty : 1;
- virtual void NewObjectInserted(const E3dObject* p3DObj) override;
virtual void StructureChanged() override;
void RebuildLists();
@@ -195,8 +194,6 @@ public:
virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
virtual SdrObjList* GetSubList() const override;
- void Insert3DObj(E3dObject* p3DObj);
- void Remove3DObj(E3dObject const * p3DObj);
virtual void SetTransformChanged() override;
protected:
diff --git a/sd/source/ui/func/fucon3d.cxx b/sd/source/ui/func/fucon3d.cxx
index f74db13144eb..6761ad0e8295 100644
--- a/sd/source/ui/func/fucon3d.cxx
+++ b/sd/source/ui/func/fucon3d.cxx
@@ -407,7 +407,7 @@ SdrObject* FuConstruct3dObject::CreateDefaultObject(const sal_uInt16 nID, const
aCam.SetFocalLength(mpView->GetDefaultCamFocal());
aCam.SetDefaults(::basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt);
pScene->SetCamera(aCam);
- pScene->Insert3DObj(p3DObj);
+ pScene->InsertObject(p3DObj);
pScene->NbcSetSnapRect(a3DRect);
ImpPrepareBasic3DShape(p3DObj, pScene);
SfxItemSet aAttr(mpDoc->GetPool());
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 7741fa46b170..752054bce703 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -531,7 +531,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
p3DObj->SetMergedItem(XFillBitmapItem(OUString(), Graphic(aFillBmp)));
}
}
- pScene->Insert3DObj( p3DObj );
+ pScene->InsertObject( p3DObj );
p3DObj = new E3dExtrudeObj(
rSdrObjCustomShape.getSdrModelFromSdrObject(),
a3DDefaultAttr,
@@ -544,7 +544,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
p3DObj->SetMergedItem( XFillStyleItem( drawing::FillStyle_SOLID ) );
p3DObj->SetMergedItem( Svx3DCloseFrontItem( false ) );
p3DObj->SetMergedItem( Svx3DCloseBackItem( false ) );
- pScene->Insert3DObj( p3DObj );
+ pScene->InsertObject( p3DObj );
// #i122777# depth 0 is okay for planes when using double-sided
p3DObj = new E3dExtrudeObj(
@@ -573,7 +573,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
p3DObj->SetMergedItem( Svx3DCloseFrontItem( false ) );
p3DObj->SetMergedItem( Svx3DCloseBackItem( false ) );
}
- pScene->Insert3DObj( p3DObj );
+ pScene->InsertObject( p3DObj );
bSceneHasObjects = true;
}
}
@@ -742,7 +742,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
for (std::vector< E3dCompoundObject* >::iterator aObjectListIter( aPlaceholderObjectList.begin() ); aObjectListIter != aPlaceholderObjectList.end(); )
{
E3dCompoundObject* pTemp(*aObjectListIter++);
- pScene->Remove3DObj( pTemp );
+ pScene->RemoveObject( pTemp->GetOrdNum() );
// always use SdrObject::Free(...) for SdrObjects (!)
SdrObject* pTemp2(pTemp);
SdrObject::Free(pTemp2);
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index 6d9831fa15ae..9f96d6277866 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -194,7 +194,7 @@ void Svx3DPreviewControl::SetObjectType(SvxPreviewObjectType nType)
if( mp3DObj )
{
aSet.Put(mp3DObj->GetMergedItemSet());
- mpScene->Remove3DObj( mp3DObj );
+ mpScene->RemoveObject( mp3DObj->GetOrdNum() );
// always use SdrObject::Free(...) for SdrObjects (!)
SdrObject* pTemp(mp3DObj);
SdrObject::Free(pTemp);
@@ -225,7 +225,7 @@ void Svx3DPreviewControl::SetObjectType(SvxPreviewObjectType nType)
if (mp3DObj)
{
- mpScene->Insert3DObj( mp3DObj );
+ mpScene->InsertObject( mp3DObj );
mp3DObj->SetMergedItemSet(aSet);
}
@@ -293,7 +293,7 @@ void Svx3DLightControl::Construct2()
mp3DView->Get3DDefaultAttributes(),
basegfx::B3DPoint(-fMaxExpansion, -fMaxExpansion, -fMaxExpansion),
basegfx::B3DVector(2.0 * fMaxExpansion, 2.0 * fMaxExpansion, 2.0 * fMaxExpansion));
- mpScene->Insert3DObj( mpExpansionObject );
+ mpScene->InsertObject( mpExpansionObject );
SfxItemSet aSet(mpModel->GetItemPool());
aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
@@ -315,7 +315,7 @@ void Svx3DLightControl::Construct2()
mpLampBottomObject = new E3dPolygonObj(
*mpModel,
basegfx::B3DPolyPolygon(a3DCircle));
- mpScene->Insert3DObj( mpLampBottomObject );
+ mpScene->InsertObject( mpLampBottomObject );
// half circle with stand
basegfx::B2DPolygon a2DHalfCircle;
@@ -329,7 +329,7 @@ void Svx3DLightControl::Construct2()
mpLampShaftObject = new E3dPolygonObj(
*mpModel,
basegfx::B3DPolyPolygon(a3DHalfCircle));
- mpScene->Insert3DObj( mpLampShaftObject );
+ mpScene->InsertObject( mpLampShaftObject );
// initially invisible
SfxItemSet aSet(mpModel->GetItemPool());
@@ -375,7 +375,7 @@ void Svx3DLightControl::ConstructLightObjects()
// get rid of possible existing light object
if(maLightObjects[a])
{
- mpScene->Remove3DObj(maLightObjects[a]);
+ mpScene->RemoveObject(maLightObjects[a]->GetOrdNum());
// always use SdrObject::Free(...) for SdrObjects (!)
SdrObject* pTemp(maLightObjects[a]);
SdrObject::Free(pTemp);
@@ -395,7 +395,7 @@ void Svx3DLightControl::ConstructLightObjects()
mp3DView->Get3DDefaultAttributes(),
basegfx::B3DPoint( 0, 0, 0 ),
basegfx::B3DVector( fLampSize, fLampSize, fLampSize));
- mpScene->Insert3DObj(pNewLight);
+ mpScene->InsertObject(pNewLight);
basegfx::B3DHomMatrix aTransform;
aTransform.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 670dbb9ccd04..b4b8b876cd7d 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -262,14 +262,6 @@ void E3dObject::RecalcSnapRect()
maSnapRect = tools::Rectangle();
}
-// Inform the parent about insertion of a 3D object, so that the parent is able
-// treat the particular objects in a special way (eg Light / Label in E3dScene)
-void E3dObject::NewObjectInserted(const E3dObject* p3DObj)
-{
- if(GetParentObj())
- GetParentObj()->NewObjectInserted(p3DObj);
-}
-
// Inform parent of changes in the structure (eg by transformation), in this
// process the object in which the change has occurred is returned.
void E3dObject::StructureChanged()
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 465cdbd836fa..cd9ac07e5219 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -348,16 +348,6 @@ void E3dScene::SetCamera(const Camera3D& rNewCamera)
ImpCleanup3DDepthMapper();
}
-void E3dScene::NewObjectInserted(const E3dObject* p3DObj)
-{
- E3dObject::NewObjectInserted(p3DObj);
-
- if ( p3DObj == this )
- return;
-
- ImpCleanup3DDepthMapper();
-}
-
// Inform parent of changes of a child
void E3dScene::StructureChanged()
@@ -492,8 +482,9 @@ void E3dScene::RebuildLists()
{
E3dObject* p3DObj(static_cast< E3dObject* >(a3DIterator.Next()));
p3DObj->NbcSetLayer(nCurrLayerID);
- NewObjectInserted(p3DObj);
}
+
+ ImpCleanup3DDepthMapper();
}
SdrObjGeoData *E3dScene::NewGeoData() const
@@ -753,9 +744,12 @@ void E3dScene::NbcInsertObject(SdrObject* pObj, size_t nPos)
// Is it even a 3D object?
if(nullptr != dynamic_cast< const E3dObject* >(pObj))
{
- // Normal 3D object, insert means
- // call parent
+ // Normal 3D object, insert means call parent
SdrObjList::NbcInsertObject(pObj, nPos);
+
+ // local needed stuff
+ InvalidateBoundVolume();
+ StructureChanged();
}
else
{
@@ -766,10 +760,21 @@ void E3dScene::NbcInsertObject(SdrObject* pObj, size_t nPos)
void E3dScene::InsertObject(SdrObject* pObj, size_t nPos)
{
- // call parent
- SdrObjList::InsertObject(pObj, nPos);
+ // Is it even a 3D object?
+ if(nullptr != dynamic_cast< const E3dObject* >(pObj))
+ {
+ // call parent
+ SdrObjList::InsertObject(pObj, nPos);
- Cleanup3DDepthMapper();
+ // local needed stuff
+ InvalidateBoundVolume();
+ StructureChanged();
+ }
+ else
+ {
+ // No 3D object, inserted a page in place in a scene ...
+ getSdrObjectFromSdrObjList()->getSdrPageFromSdrObject()->InsertObject(pObj, nPos);
+ }
}
SdrObject* E3dScene::NbcRemoveObject(size_t nObjNum)
@@ -777,7 +782,8 @@ SdrObject* E3dScene::NbcRemoveObject(size_t nObjNum)
// call parent
SdrObject* pRetval = SdrObjList::NbcRemoveObject(nObjNum);
- Cleanup3DDepthMapper();
+ InvalidateBoundVolume();
+ StructureChanged();
return pRetval;
}
@@ -785,9 +791,10 @@ SdrObject* E3dScene::NbcRemoveObject(size_t nObjNum)
SdrObject* E3dScene::RemoveObject(size_t nObjNum)
{
// call parent
- SdrObject* pRetval = SdrObjList::RemoveObject(nObjNum);
+ SdrObject* pRetval(SdrObjList::RemoveObject(nObjNum));
- Cleanup3DDepthMapper();
+ InvalidateBoundVolume();
+ StructureChanged();
return pRetval;
}
@@ -852,27 +859,6 @@ SdrObjList* E3dScene::GetSubList() const
return const_cast< E3dScene* >(this);
}
-void E3dScene::Insert3DObj(E3dObject* p3DObj)
-{
- DBG_ASSERT(p3DObj, "Insert3DObj with NULL-pointer!");
- InsertObject(p3DObj);
- InvalidateBoundVolume();
- NewObjectInserted(p3DObj);
- StructureChanged();
-}
-
-void E3dScene::Remove3DObj(E3dObject const * p3DObj)
-{
- DBG_ASSERT(p3DObj, "Remove3DObj with NULL-pointer!");
-
- if(p3DObj->GetParentObj() == this)
- {
- RemoveObject(p3DObj->GetOrdNum());
- InvalidateBoundVolume();
- StructureChanged();
- }
-}
-
basegfx::B3DRange E3dScene::RecalcBoundVolume() const
{
basegfx::B3DRange aRetval;
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 8be7aae2abe4..f663874efaf8 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -583,7 +583,7 @@ bool E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene const * pSrcScene, E3dSce
// fill and insert new object
pNewCompoundObj->NbcSetLayer(pCompoundObj->GetLayer());
pNewCompoundObj->NbcSetStyleSheet(pCompoundObj->GetStyleSheet(), true);
- pDstScene->Insert3DObj(pNewCompoundObj);
+ pDstScene->InsertObject(pNewCompoundObj);
bRetval = true;
// Create undo
@@ -763,7 +763,7 @@ void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, boo
p3DObj->NbcSetStyleSheet(pObj->GetStyleSheet(), true);
// Insert a new extrude object
- pScene->Insert3DObj(p3DObj);
+ pScene->InsertObject(p3DObj);
}
}
}
@@ -1290,7 +1290,7 @@ E3dScene* E3dView::SetCurrent3DObj(E3dObject* p3DObj)
InitScene(pScene, fW, fH, aVolume.getMaxZ() + ((fW + fH) / 4.0));
- pScene->Insert3DObj(p3DObj);
+ pScene->InsertObject(p3DObj);
pScene->NbcSetSnapRect(aRect);
return pScene;
More information about the Libreoffice-commits
mailing list