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>
This commit is contained in:
parent
94afb3663b
commit
d20f118dbc
@ -263,25 +263,21 @@ void SetTemporary( uno::Reference< drawing::XShape > const & xShape )
|
|||||||
|
|
||||||
Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
|
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 >();
|
return Reference< drawing::XShape >();
|
||||||
}
|
}
|
||||||
|
|
||||||
SdrObjCustomShape& rSdrObjCustomShape(
|
|
||||||
static_cast< SdrObjCustomShape& >(
|
|
||||||
*GetSdrObjectFromXShape(mxShape)));
|
|
||||||
|
|
||||||
// retrieving the TextPath property to check if feature is enabled
|
// 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;
|
bool bTextPathOn = false;
|
||||||
const uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "TextPath" );
|
const uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "TextPath" );
|
||||||
if ( pAny )
|
if ( pAny )
|
||||||
*pAny >>= bTextPathOn;
|
*pAny >>= bTextPathOn;
|
||||||
|
|
||||||
EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
|
EnhancedCustomShape2d aCustomShape2d(*pSdrObjCustomShape);
|
||||||
Degree100 nRotateAngle = aCustomShape2d.GetRotateAngle();
|
Degree100 nRotateAngle = aCustomShape2d.GetRotateAngle();
|
||||||
|
|
||||||
bool bFlipV = aCustomShape2d.IsFlipVert();
|
bool bFlipV = aCustomShape2d.IsFlipVert();
|
||||||
@ -296,14 +292,14 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
|
|||||||
std::unique_ptr<SdrObject, SdrObjectFreeOp> xRenderedFontWork(
|
std::unique_ptr<SdrObject, SdrObjectFreeOp> xRenderedFontWork(
|
||||||
EnhancedCustomShapeFontWork::CreateFontWork(
|
EnhancedCustomShapeFontWork::CreateFontWork(
|
||||||
xRenderedShape.get(),
|
xRenderedShape.get(),
|
||||||
rSdrObjCustomShape));
|
*pSdrObjCustomShape));
|
||||||
|
|
||||||
if (xRenderedFontWork)
|
if (xRenderedFontWork)
|
||||||
{
|
{
|
||||||
xRenderedShape = std::move(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)
|
if (xRenderedShape3d)
|
||||||
{
|
{
|
||||||
bFlipV = bFlipH = false;
|
bFlipV = bFlipH = false;
|
||||||
@ -311,8 +307,8 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
|
|||||||
xRenderedShape = std::move(xRenderedShape3d);
|
xRenderedShape = std::move(xRenderedShape3d);
|
||||||
}
|
}
|
||||||
|
|
||||||
tools::Rectangle aRect(rSdrObjCustomShape.GetSnapRect());
|
tools::Rectangle aRect(pSdrObjCustomShape->GetSnapRect());
|
||||||
const GeoStat& rGeoStat(rSdrObjCustomShape.GetGeoStat());
|
const GeoStat& rGeoStat(pSdrObjCustomShape->GetGeoStat());
|
||||||
|
|
||||||
if ( rGeoStat.nShearAngle )
|
if ( rGeoStat.nShearAngle )
|
||||||
{
|
{
|
||||||
@ -324,10 +320,10 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
|
|||||||
nTan = -nTan;
|
nTan = -nTan;
|
||||||
}
|
}
|
||||||
|
|
||||||
xRenderedShape->Shear(rSdrObjCustomShape.GetSnapRect().Center(), nShearAngle, nTan, false);
|
xRenderedShape->Shear(pSdrObjCustomShape->GetSnapRect().Center(), nShearAngle, nTan, false);
|
||||||
}
|
}
|
||||||
if(nRotateAngle )
|
if(nRotateAngle )
|
||||||
xRenderedShape->NbcRotate(rSdrObjCustomShape.GetSnapRect().Center(), nRotateAngle);
|
xRenderedShape->NbcRotate(pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle);
|
||||||
if ( bFlipV )
|
if ( bFlipV )
|
||||||
{
|
{
|
||||||
Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
|
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->NbcMirror( aTop, aBottom );
|
||||||
}
|
}
|
||||||
|
|
||||||
xRenderedShape->NbcSetStyleSheet(rSdrObjCustomShape.GetStyleSheet(), true);
|
xRenderedShape->NbcSetStyleSheet(pSdrObjCustomShape->GetStyleSheet(), true);
|
||||||
xRenderedShape->RecalcSnapRect();
|
xRenderedShape->RecalcSnapRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mbForceGroupWithText )
|
if ( mbForceGroupWithText )
|
||||||
{
|
{
|
||||||
xRenderedShape = ImplForceGroupWithText(
|
xRenderedShape = ImplForceGroupWithText(
|
||||||
rSdrObjCustomShape,
|
*pSdrObjCustomShape,
|
||||||
std::move(xRenderedShape));
|
std::move(xRenderedShape));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,16 +366,13 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
|
|||||||
awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
|
awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
|
||||||
{
|
{
|
||||||
awt::Rectangle aTextRect;
|
awt::Rectangle aTextRect;
|
||||||
const bool bIsSdrObjCustomShape(nullptr != dynamic_cast< SdrObjCustomShape* >(GetSdrObjectFromXShape(mxShape)));
|
if (SdrObjCustomShape* pSdrObjCustomShape = dynamic_cast< SdrObjCustomShape* >(GetSdrObjectFromXShape(mxShape)))
|
||||||
|
|
||||||
if(bIsSdrObjCustomShape)
|
|
||||||
{
|
{
|
||||||
SdrObjCustomShape& rSdrObjCustomShape(static_cast< SdrObjCustomShape& >(*GetSdrObjectFromXShape(mxShape)));
|
|
||||||
uno::Reference< document::XActionLockable > xLockable( mxShape, uno::UNO_QUERY );
|
uno::Reference< document::XActionLockable > xLockable( mxShape, uno::UNO_QUERY );
|
||||||
|
|
||||||
if(xLockable.is() && !xLockable->isActionLocked())
|
if(xLockable.is() && !xLockable->isActionLocked())
|
||||||
{
|
{
|
||||||
EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
|
EnhancedCustomShape2d aCustomShape2d(*pSdrObjCustomShape);
|
||||||
tools::Rectangle aRect( aCustomShape2d.GetTextRect() );
|
tools::Rectangle aRect( aCustomShape2d.GetTextRect() );
|
||||||
aTextRect.X = aRect.Left();
|
aTextRect.X = aRect.Left();
|
||||||
aTextRect.Y = aRect.Top();
|
aTextRect.Y = aRect.Top();
|
||||||
@ -394,22 +387,19 @@ awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
|
|||||||
drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeometry()
|
drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeometry()
|
||||||
{
|
{
|
||||||
drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
|
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(
|
EnhancedCustomShape2d aCustomShape2d(*pSdrObjCustomShape);
|
||||||
static_cast< SdrObjCustomShape& >(
|
|
||||||
*GetSdrObjectFromXShape(mxShape)));
|
|
||||||
EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
|
|
||||||
SdrObjectUniquePtr pObj = aCustomShape2d.CreateLineGeometry();
|
SdrObjectUniquePtr pObj = aCustomShape2d.CreateLineGeometry();
|
||||||
|
|
||||||
if ( pObj )
|
if ( pObj )
|
||||||
{
|
{
|
||||||
tools::Rectangle aRect(rSdrObjCustomShape.GetSnapRect());
|
tools::Rectangle aRect(pSdrObjCustomShape->GetSnapRect());
|
||||||
bool bFlipV = aCustomShape2d.IsFlipVert();
|
bool bFlipV = aCustomShape2d.IsFlipVert();
|
||||||
bool bFlipH = aCustomShape2d.IsFlipHorz();
|
bool bFlipH = aCustomShape2d.IsFlipHorz();
|
||||||
const GeoStat& rGeoStat(rSdrObjCustomShape.GetGeoStat());
|
const GeoStat& rGeoStat(pSdrObjCustomShape->GetGeoStat());
|
||||||
|
|
||||||
if ( rGeoStat.nShearAngle )
|
if ( rGeoStat.nShearAngle )
|
||||||
{
|
{
|
||||||
@ -473,14 +463,11 @@ drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeom
|
|||||||
Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL EnhancedCustomShapeEngine::getInteraction()
|
Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL EnhancedCustomShapeEngine::getInteraction()
|
||||||
{
|
{
|
||||||
sal_uInt32 i, nHdlCount = 0;
|
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(
|
EnhancedCustomShape2d aCustomShape2d(*pSdrObjCustomShape);
|
||||||
static_cast< SdrObjCustomShape& >(
|
|
||||||
*GetSdrObjectFromXShape(mxShape)));
|
|
||||||
EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
|
|
||||||
nHdlCount = aCustomShape2d.GetHdlCount();
|
nHdlCount = aCustomShape2d.GetHdlCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user