summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-02-21 16:14:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-22 08:07:23 +0100
commit56cd3b2b5d395165cd4add2f46ac4ba25a4ea4af (patch)
treee8c7e48c7ddc4ff85fbcd01c1826a50fd623723d /svx
parent44c7cbd93fa5ad8e9a6eb8494e64cfcfcb019c29 (diff)
tdf#64914 slow opening large chart
shaves 2% off the load time by avoid the cost of comphelper::getFromUnoTunnel Change-Id: I9d0438bd0ad3cf753d34fe181481f3a57193651c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130284 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/unoshap2.cxx21
-rw-r--r--svx/source/unodraw/unoshap3.cxx21
2 files changed, 36 insertions, 6 deletions
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index e68676b577c8..057b55de9fde 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -169,22 +169,31 @@ void SAL_CALL SvxShapeGroup::leaveGroup( )
void SvxShapeGroup::addUnoShape( const uno::Reference< drawing::XShape >& xShape, size_t nPos )
{
- if (!HasSdrObject() || !mxPage.is())
+ SvxShape* pShape = comphelper::getFromUnoTunnel<SvxShape>( xShape );
+ if (!pShape)
{
OSL_FAIL("could not add XShape to group shape!");
return;
}
+ addShape(*pShape, nPos);
+}
- SvxShape* pShape = comphelper::getFromUnoTunnel<SvxShape>( xShape );
- if (!pShape)
+void SvxShapeGroup::addShape( SvxShape& rShape )
+{
+ addShape(rShape, SAL_MAX_SIZE);
+}
+
+void SvxShapeGroup::addShape( SvxShape& rShape, size_t nPos )
+{
+ if (!HasSdrObject() || !mxPage.is())
{
OSL_FAIL("could not add XShape to group shape!");
return;
}
- SdrObject* pSdrShape = pShape->GetSdrObject();
+ SdrObject* pSdrShape = rShape.GetSdrObject();
if( pSdrShape == nullptr )
- pSdrShape = mxPage->CreateSdrObject_( xShape );
+ pSdrShape = mxPage->CreateSdrObject_( &rShape );
if( pSdrShape->IsInserted() )
pSdrShape->getParentSdrObjListFromSdrObject()->RemoveObject( pSdrShape->GetOrdNum() );
@@ -205,7 +214,7 @@ void SvxShapeGroup::addUnoShape( const uno::Reference< drawing::XShape >& xShape
// Establish connection between new SdrObject and its wrapper before
// inserting the new shape into the group. There a new wrapper
// would be created when this connection would not already exist.
- pShape->Create( pSdrShape, mxPage.get() );
+ rShape.Create( pSdrShape, mxPage.get() );
GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index f1763aeb041d..0704a4e5caa1 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -131,6 +131,27 @@ void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape
GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
+void Svx3DSceneObject::addShape( SvxShape& rShape )
+{
+ SolarMutexGuard aGuard;
+
+ if(!HasSdrObject() || !mxPage.is() || nullptr != rShape.GetSdrObject() )
+ throw uno::RuntimeException();
+
+ SdrObject* pSdrShape = mxPage->CreateSdrObject_( &rShape );
+ if( dynamic_cast<const E3dObject* >(pSdrShape) != nullptr )
+ {
+ GetSdrObject()->GetSubList()->NbcInsertObject( pSdrShape );
+ rShape.Create(pSdrShape, mxPage.get());
+ }
+ else
+ {
+ SdrObject::Free( pSdrShape );
+ throw uno::RuntimeException();
+ }
+
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
+}
void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xShape )
{