summaryrefslogtreecommitdiff
path: root/sc
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 /sc
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 'sc')
-rw-r--r--sc/source/filter/xml/XMLTableShapeImportHelper.cxx17
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx12
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx11
-rw-r--r--sc/source/ui/unoobj/docuno.cxx29
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx7
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx40
-rw-r--r--sc/source/ui/vba/vbasheetobject.cxx4
7 files changed, 45 insertions, 75 deletions
diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
index 966204506256..1bfcd6064c00 100644
--- a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
+++ b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
@@ -137,15 +137,12 @@ void XMLTableShapeImportHelper::finishShape(
}
SetLayer(rShape, nLayerID, rShape->getShapeType());
- if (SvxShape* pShapeImp = comphelper::getUnoTunnelImplementation<SvxShape>(rShape))
+ if (SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape(rShape))
{
- if (SdrObject *pSdrObj = pShapeImp->GetSdrObject())
- {
- if (!bOnTable)
- ScDrawLayer::SetCellAnchored(*pSdrObj, aAnchor);
- else
- ScDrawLayer::SetPageAnchored(*pSdrObj);
- }
+ if (!bOnTable)
+ ScDrawLayer::SetCellAnchored(*pSdrObj, aAnchor);
+ else
+ ScDrawLayer::SetPageAnchored(*pSdrObj);
}
if (xRangeList)
@@ -193,9 +190,9 @@ void XMLTableShapeImportHelper::finishShape(
// the group
Point aStartPoint( rShape->getPosition().X,rShape->getPosition().Y );
uno::Reference< drawing::XShape > xChild( rShapes, uno::UNO_QUERY );
- if (SvxShape* pGroupShapeImp = xChild.is() ? comphelper::getUnoTunnelImplementation<SvxShape>(lcl_getTopLevelParent(xChild)) : nullptr)
+ if (xChild)
{
- if (SdrObject *pSdrObj = pGroupShapeImp->GetSdrObject())
+ if (SdrObject *pSdrObj = SdrObject::getSdrObjectFromXShape(lcl_getTopLevelParent(xChild)))
{
if ( ScDrawObjData* pAnchor = ScDrawLayer::GetObjData( pSdrObj ) )
{
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 0e07542dcbd4..9ff4d37195b5 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -536,11 +536,7 @@ void ScXMLExport::CollectSharedData(SCTAB& nTableCount, sal_Int32& nShapesCount)
++nShapesCount;
- SvxShape* pShapeImp = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
- if (!pShapeImp)
- continue;
-
- SdrObject* pSdrObj = pShapeImp->GetSdrObject();
+ SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape(xShape);
if (!pSdrObj)
continue;
@@ -2670,11 +2666,7 @@ void ScXMLExport::ExportMasterStyles_()
void ScXMLExport::CollectInternalShape( uno::Reference< drawing::XShape > const & xShape )
{
// detective objects and notes
- SvxShape* pShapeImp = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
- if( !pShapeImp )
- return;
-
- SdrObject* pObject = pShapeImp->GetSdrObject();
+ SdrObject* pObject = SdrObject::getSdrObjectFromXShape( xShape );
if( !pObject )
return;
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index f5193c6a80a2..5ea1219d2616 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1122,15 +1122,12 @@ std::optional<ScAddress> ScChildrenShapes::GetAnchor(const uno::Reference<drawin
{
if (mpViewShell)
{
- SvxShape* pShapeImp = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
+ SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape(xShape);
uno::Reference<beans::XPropertySet> xShapeProp(xShape, uno::UNO_QUERY);
- if (pShapeImp && xShapeProp.is())
+ if (pSdrObj && xShapeProp.is())
{
- if (SdrObject *pSdrObj = pShapeImp->GetSdrObject())
- {
- if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjData(pSdrObj))
- return std::optional<ScAddress>(pAnchor->maStart);
- }
+ if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjData(pSdrObj))
+ return std::optional<ScAddress>(pAnchor->maStart);
}
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 0f0807c325f1..2bdcf14ab49c 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1583,26 +1583,19 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection,
//print a selected ole object
// multi selection isn't supported yet
uno::Reference< drawing::XShape > xShape( xShapes->getByIndex(0), uno::UNO_QUERY );
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
- if( pShape )
+ SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape( xShape );
+ if( pSdrObj && pDocShell )
{
- SdrObject *pSdrObj = pShape->GetSdrObject();
- if( pDocShell )
- {
- ScDocument& rDoc = pDocShell->GetDocument();
- if( pSdrObj )
- {
- tools::Rectangle aObjRect = pSdrObj->GetCurrentBoundRect();
- SCTAB nCurrentTab = ScDocShell::GetCurTab();
- ScRange aRange = rDoc.GetRange( nCurrentTab, aObjRect );
- rMark.SetMarkArea( aRange );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ tools::Rectangle aObjRect = pSdrObj->GetCurrentBoundRect();
+ SCTAB nCurrentTab = ScDocShell::GetCurTab();
+ ScRange aRange = rDoc.GetRange( nCurrentTab, aObjRect );
+ rMark.SetMarkArea( aRange );
- if( rMark.IsMarked() && !rMark.IsMultiMarked() )
- {
- rStatus.SetMode( SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS );
- bDone = true;
- }
- }
+ if( rMark.IsMarked() && !rMark.IsMultiMarked() )
+ {
+ rStatus.SetMode( SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS );
+ bDone = true;
}
}
}
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index fa5bb8359334..6dbd130e2e56 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -1308,12 +1308,7 @@ uno::Sequence<sal_Int8> SAL_CALL ScShapeObj::getImplementationId()
SdrObject* ScShapeObj::GetSdrObject() const throw()
{
if(mxShapeAgg.is())
- {
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( mxShapeAgg );
- if(pShape)
- return pShape->GetSdrObject();
- }
-
+ return SdrObject::getSdrObjectFromXShape( mxShapeAgg );
return nullptr;
}
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 957370396254..8f10ffc1e0e2 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -776,30 +776,26 @@ sal_Bool SAL_CALL ScTabViewObj::select( const uno::Any& aSelection )
uno::Reference<drawing::XShape> xShapeInt(xShapeColl->getByIndex(i), uno::UNO_QUERY);
if (xShapeInt.is())
{
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShapeInt );
- if (pShape)
+ SdrObject* pObj = SdrObject::getSdrObjectFromXShape( xShapeInt );
+ if (pObj)
{
- SdrObject *pObj = pShape->GetSdrObject();
- if (pObj)
+ if (!bDrawSelModeSet && (pObj->GetLayer() == SC_LAYER_BACK))
{
- if (!bDrawSelModeSet && (pObj->GetLayer() == SC_LAYER_BACK))
- {
- pViewSh->SetDrawSelMode(true);
- pViewSh->UpdateLayerLocks();
- bDrawSelModeSet = true;
- }
- if (!pPV) // first object
- {
- lcl_ShowObject( *pViewSh, *pDrawView, pObj );
- pPV = pDrawView->GetSdrPageView();
- }
- if ( pPV && pObj->getSdrPageFromSdrObject() == pPV->GetPage() )
- {
- if (pDrawView->IsObjMarkable( pObj, pPV ))
- pDrawView->MarkObj( pObj, pPV );
- else
- bAllMarked = false;
- }
+ pViewSh->SetDrawSelMode(true);
+ pViewSh->UpdateLayerLocks();
+ bDrawSelModeSet = true;
+ }
+ if (!pPV) // first object
+ {
+ lcl_ShowObject( *pViewSh, *pDrawView, pObj );
+ pPV = pDrawView->GetSdrPageView();
+ }
+ if ( pPV && pObj->getSdrPageFromSdrObject() == pPV->GetPage() )
+ {
+ if (pDrawView->IsObjMarkable( pObj, pPV ))
+ pDrawView->MarkObj( pObj, pPV );
+ else
+ bAllMarked = false;
}
}
}
diff --git a/sc/source/ui/vba/vbasheetobject.cxx b/sc/source/ui/vba/vbasheetobject.cxx
index 6f54e00ddc06..400a1b88b47a 100644
--- a/sc/source/ui/vba/vbasheetobject.cxx
+++ b/sc/source/ui/vba/vbasheetobject.cxx
@@ -231,7 +231,7 @@ sal_Int32 SAL_CALL ScVbaSheetObjectBase::getPlacement()
{
sal_Int32 const nRet = excel::XlPlacement::xlMoveAndSize;
#if 0 // TODO: not working at the moment.
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( mxShape );
+ SvxShape* pShape = SdrObject::getSdrObjectFromXShape( mxShape );
if(pShape)
{
SdrObject* pObj = pShape->GetSdrObject();
@@ -249,7 +249,7 @@ sal_Int32 SAL_CALL ScVbaSheetObjectBase::getPlacement()
void SAL_CALL ScVbaSheetObjectBase::setPlacement( sal_Int32 /*nPlacement*/ )
{
#if 0 // TODO: not working at the moment.
- SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( mxShape );
+ SvxShape* pShape = SdrObject::getSdrObjectFromXShape( mxShape );
if(pShape)
{
SdrObject* pObj = pShape->GetSdrObject();