summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-02-04 10:22:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-04 11:19:35 +0100
commit18982376918c88ec09c2c7fd42ef635e93897b05 (patch)
tree33745acca3f3b8155628981b81438a15131fc157 /sd
parent380ab85b6594a013f34f5e6ec69fb569336bbb48 (diff)
use more getSdrObjectFromXShape
Change-Id: Ia237643ab040425f231f781c86e7e060f0b53717 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110400 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/unoidl/SdUnoDrawView.cxx11
-rw-r--r--sd/source/ui/unoidl/unolayer.cxx6
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx21
-rw-r--r--sd/source/ui/unoidl/unopage.cxx22
4 files changed, 21 insertions, 39 deletions
diff --git a/sd/source/ui/unoidl/SdUnoDrawView.cxx b/sd/source/ui/unoidl/SdUnoDrawView.cxx
index c880b0b4d1df..e66c572a70a9 100644
--- a/sd/source/ui/unoidl/SdUnoDrawView.cxx
+++ b/sd/source/ui/unoidl/SdUnoDrawView.cxx
@@ -159,10 +159,9 @@ sal_Bool SAL_CALL SdUnoDrawView::select( const Any& aSelection )
if(xShape.is())
{
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
- if( pShape && (pShape->GetSdrObject() != nullptr) )
+ SdrObject* pObj = SdrObject::getSdrObjectFromXShape( xShape );
+ if( pObj )
{
- SdrObject* pObj = pShape->GetSdrObject();
pSdrPage = pObj->getSdrPageFromSdrObject();
aObjects.push_back( pObj );
}
@@ -183,15 +182,13 @@ sal_Bool SAL_CALL SdUnoDrawView::select( const Any& aSelection )
xShapes->getByIndex(i) >>= xShape;
if( xShape.is() )
{
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
- if( (pShape == nullptr) || (pShape->GetSdrObject() == nullptr) )
+ SdrObject* pObj = SdrObject::getSdrObjectFromXShape(xShape);
+ if( !pObj )
{
bOk = false;
break;
}
- SdrObject* pObj = pShape->GetSdrObject();
-
if( pSdrPage == nullptr )
{
pSdrPage = pObj->getSdrPageFromSdrObject();
diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx
index 18e92d383038..dff010b3722e 100644
--- a/sd/source/ui/unoidl/unolayer.cxx
+++ b/sd/source/ui/unoidl/unolayer.cxx
@@ -483,8 +483,7 @@ void SAL_CALL SdLayerManager::attachShapeToLayer( const uno::Reference< drawing:
if(pSdrLayer==nullptr)
return;
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
- SdrObject* pSdrObject = pShape?pShape->GetSdrObject():nullptr;
+ SdrObject* pSdrObject = SdrObject::getSdrObjectFromXShape( xShape );
if(pSdrObject)
pSdrObject->SetLayer(pSdrLayer->GetID());
@@ -503,8 +502,7 @@ uno::Reference< drawing::XLayer > SAL_CALL SdLayerManager::getLayerForShape( con
if(mpModel->mpDoc)
{
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
- SdrObject* pObj = pShape?pShape->GetSdrObject():nullptr;
+ SdrObject* pObj = SdrObject::getSdrObjectFromXShape( xShape );
if(pObj)
{
SdrLayerID aId = pObj->GetLayer();
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 5ad1afb6c58e..230eeefeb420 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2174,21 +2174,16 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
if( xShape.is() )
{
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
-
- if( pShape )
+ SdrObject* pObj = SdrObject::getSdrObjectFromXShape( xShape );
+ if( pObj && pObj->getSdrPageFromSdrObject()
+ && aImplRenderPaintProc.IsVisible( pObj )
+ && aImplRenderPaintProc.IsPrintable( pObj ) )
{
- SdrObject* pObj = pShape->GetSdrObject();
- if( pObj && pObj->getSdrPageFromSdrObject()
- && aImplRenderPaintProc.IsVisible( pObj )
- && aImplRenderPaintProc.IsPrintable( pObj ) )
- {
- if( !pPV )
- pPV = pView->ShowSdrPage( pObj->getSdrPageFromSdrObject() );
+ if( !pPV )
+ pPV = pView->ShowSdrPage( pObj->getSdrPageFromSdrObject() );
- if( pPV )
- pView->MarkObj( pObj, pPV );
- }
+ if( pPV )
+ pView->MarkObj( pObj, pPV );
}
}
}
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 0e23d10c07c6..af642f7b1f36 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2407,15 +2407,11 @@ void SAL_CALL SdDrawPage::remove( const Reference< drawing::XShape >& xShape )
throwIfDisposed();
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
- if( pShape )
+ SdrObject* pObj = SdrObject::getSdrObjectFromXShape( xShape );
+ if( pObj )
{
- SdrObject* pObj = pShape->GetSdrObject();
- if( pObj )
- {
- GetPage()->RemovePresObj(pObj);
- pObj->SetUserCall(nullptr);
- }
+ GetPage()->RemovePresObj(pObj);
+ pObj->SetUserCall(nullptr);
}
SdGenericDrawPage::remove( xShape );
@@ -3008,13 +3004,9 @@ void SAL_CALL SdMasterPage::remove( const Reference< drawing::XShape >& xShape )
throwIfDisposed();
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
- if( pShape )
- {
- SdrObject* pObj = pShape->GetSdrObject();
- if( pObj && GetPage()->IsPresObj( pObj ) )
- GetPage()->RemovePresObj(pObj);
- }
+ SdrObject* pObj = SdrObject::getSdrObjectFromXShape( xShape );
+ if( pObj && GetPage()->IsPresObj( pObj ) )
+ GetPage()->RemovePresObj(pObj);
SdGenericDrawPage::remove( xShape );
}