summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-04-14 15:16:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-04-14 18:32:46 +0200
commitd20f118dbcef41f6e3613d3ad947af48be4fd34e (patch)
treec65ac1d8dce488aeddff713c4b620b1e7715e3e5 /svx/source
parent94afb3663b1618b66daa7cc7199cbd5c9f387e0f (diff)
static_cast after dynamic_cast
Change-Id: I77cbf11e26c91bf634d708117eb801c8d8057050 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114098 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx57
1 files changed, 22 insertions, 35 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 8e12ad83672d..28684e59e5c7 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -263,25 +263,21 @@ void SetTemporary( uno::Reference< drawing::XShape > const & xShape )
Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
{
- const bool bIsSdrObjCustomShape(nullptr != dynamic_cast< SdrObjCustomShape* >(GetSdrObjectFromXShape(mxShape)));
+ SdrObjCustomShape* pSdrObjCustomShape = dynamic_cast< SdrObjCustomShape* >(GetSdrObjectFromXShape(mxShape));
- if(!bIsSdrObjCustomShape)
+ if(!pSdrObjCustomShape)
{
return Reference< drawing::XShape >();
}
- SdrObjCustomShape& rSdrObjCustomShape(
- static_cast< SdrObjCustomShape& >(
- *GetSdrObjectFromXShape(mxShape)));
-
// retrieving the TextPath property to check if feature is enabled
- const SdrCustomShapeGeometryItem& rGeometryItem(rSdrObjCustomShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
+ const SdrCustomShapeGeometryItem& rGeometryItem(pSdrObjCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
bool bTextPathOn = false;
const uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "TextPath" );
if ( pAny )
*pAny >>= bTextPathOn;
- EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+ EnhancedCustomShape2d aCustomShape2d(*pSdrObjCustomShape);
Degree100 nRotateAngle = aCustomShape2d.GetRotateAngle();
bool bFlipV = aCustomShape2d.IsFlipVert();
@@ -296,14 +292,14 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
std::unique_ptr<SdrObject, SdrObjectFreeOp> xRenderedFontWork(
EnhancedCustomShapeFontWork::CreateFontWork(
xRenderedShape.get(),
- rSdrObjCustomShape));
+ *pSdrObjCustomShape));
if (xRenderedFontWork)
{
xRenderedShape = std::move(xRenderedFontWork);
}
}
- std::unique_ptr<SdrObject, SdrObjectFreeOp> xRenderedShape3d(EnhancedCustomShape3d::Create3DObject(xRenderedShape.get(), rSdrObjCustomShape));
+ std::unique_ptr<SdrObject, SdrObjectFreeOp> xRenderedShape3d(EnhancedCustomShape3d::Create3DObject(xRenderedShape.get(), *pSdrObjCustomShape));
if (xRenderedShape3d)
{
bFlipV = bFlipH = false;
@@ -311,8 +307,8 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
xRenderedShape = std::move(xRenderedShape3d);
}
- tools::Rectangle aRect(rSdrObjCustomShape.GetSnapRect());
- const GeoStat& rGeoStat(rSdrObjCustomShape.GetGeoStat());
+ tools::Rectangle aRect(pSdrObjCustomShape->GetSnapRect());
+ const GeoStat& rGeoStat(pSdrObjCustomShape->GetGeoStat());
if ( rGeoStat.nShearAngle )
{
@@ -324,10 +320,10 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
nTan = -nTan;
}
- xRenderedShape->Shear(rSdrObjCustomShape.GetSnapRect().Center(), nShearAngle, nTan, false);
+ xRenderedShape->Shear(pSdrObjCustomShape->GetSnapRect().Center(), nShearAngle, nTan, false);
}
if(nRotateAngle )
- xRenderedShape->NbcRotate(rSdrObjCustomShape.GetSnapRect().Center(), nRotateAngle);
+ xRenderedShape->NbcRotate(pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle);
if ( bFlipV )
{
Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
@@ -341,14 +337,14 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
xRenderedShape->NbcMirror( aTop, aBottom );
}
- xRenderedShape->NbcSetStyleSheet(rSdrObjCustomShape.GetStyleSheet(), true);
+ xRenderedShape->NbcSetStyleSheet(pSdrObjCustomShape->GetStyleSheet(), true);
xRenderedShape->RecalcSnapRect();
}
if ( mbForceGroupWithText )
{
xRenderedShape = ImplForceGroupWithText(
- rSdrObjCustomShape,
+ *pSdrObjCustomShape,
std::move(xRenderedShape));
}
@@ -370,16 +366,13 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
{
awt::Rectangle aTextRect;
- const bool bIsSdrObjCustomShape(nullptr != dynamic_cast< SdrObjCustomShape* >(GetSdrObjectFromXShape(mxShape)));
-
- if(bIsSdrObjCustomShape)
+ if (SdrObjCustomShape* pSdrObjCustomShape = dynamic_cast< SdrObjCustomShape* >(GetSdrObjectFromXShape(mxShape)))
{
- SdrObjCustomShape& rSdrObjCustomShape(static_cast< SdrObjCustomShape& >(*GetSdrObjectFromXShape(mxShape)));
uno::Reference< document::XActionLockable > xLockable( mxShape, uno::UNO_QUERY );
if(xLockable.is() && !xLockable->isActionLocked())
{
- EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+ EnhancedCustomShape2d aCustomShape2d(*pSdrObjCustomShape);
tools::Rectangle aRect( aCustomShape2d.GetTextRect() );
aTextRect.X = aRect.Left();
aTextRect.Y = aRect.Top();
@@ -394,22 +387,19 @@ awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeometry()
{
drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
- const bool bIsSdrObjCustomShape(nullptr != dynamic_cast< SdrObjCustomShape* >(GetSdrObjectFromXShape(mxShape)));
+ SdrObjCustomShape* pSdrObjCustomShape = dynamic_cast< SdrObjCustomShape* >(GetSdrObjectFromXShape(mxShape));
- if(bIsSdrObjCustomShape)
+ if(pSdrObjCustomShape)
{
- SdrObjCustomShape& rSdrObjCustomShape(
- static_cast< SdrObjCustomShape& >(
- *GetSdrObjectFromXShape(mxShape)));
- EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+ EnhancedCustomShape2d aCustomShape2d(*pSdrObjCustomShape);
SdrObjectUniquePtr pObj = aCustomShape2d.CreateLineGeometry();
if ( pObj )
{
- tools::Rectangle aRect(rSdrObjCustomShape.GetSnapRect());
+ tools::Rectangle aRect(pSdrObjCustomShape->GetSnapRect());
bool bFlipV = aCustomShape2d.IsFlipVert();
bool bFlipH = aCustomShape2d.IsFlipHorz();
- const GeoStat& rGeoStat(rSdrObjCustomShape.GetGeoStat());
+ const GeoStat& rGeoStat(pSdrObjCustomShape->GetGeoStat());
if ( rGeoStat.nShearAngle )
{
@@ -473,14 +463,11 @@ drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeom
Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL EnhancedCustomShapeEngine::getInteraction()
{
sal_uInt32 i, nHdlCount = 0;
- const bool bIsSdrObjCustomShape(nullptr != dynamic_cast< SdrObjCustomShape* >(GetSdrObjectFromXShape(mxShape)));
+ SdrObjCustomShape* pSdrObjCustomShape = dynamic_cast< SdrObjCustomShape* >(GetSdrObjectFromXShape(mxShape));
- if(bIsSdrObjCustomShape)
+ if(pSdrObjCustomShape)
{
- SdrObjCustomShape& rSdrObjCustomShape(
- static_cast< SdrObjCustomShape& >(
- *GetSdrObjectFromXShape(mxShape)));
- EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+ EnhancedCustomShape2d aCustomShape2d(*pSdrObjCustomShape);
nHdlCount = aCustomShape2d.GetHdlCount();
}