summaryrefslogtreecommitdiff
path: root/svx/source/unodraw/unoshape.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-07-01 14:04:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-04 15:49:04 +0200
commit3e8f89f80ca0405c01d9b068ca9e85328e87404b (patch)
tree06afbb057b5156351f38b1eecd166ab80fbdc99c /svx/source/unodraw/unoshape.cxx
parent1a6833a00fb7fcf04c71fcaa05dbee1f15a075d4 (diff)
tdf#137544 avoid some dynamic_cast cost
Change-Id: Ib60369eabb2ce5e9cde2dce80137b786130c0eec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136804 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/unodraw/unoshape.cxx')
-rw-r--r--svx/source/unodraw/unoshape.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 0ef2f314d19f..e618c209d697 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -3105,15 +3105,17 @@ void SvxShape::setAllPropertiesToDefault()
{
::SolarMutexGuard aGuard;
- if( !HasSdrObject() )
+ SdrObject* pSdrObj = GetSdrObject();
+ if( !pSdrObj )
throw lang::DisposedException();
- GetSdrObject()->ClearMergedItem(); // nWhich == 0 => all
+ pSdrObj->ClearMergedItem(); // nWhich == 0 => all
- if(dynamic_cast<const SdrGrafObj*>(GetSdrObject()) != nullptr)
+ const SdrObjKind nObjId = pSdrObj->GetObjIdentifier();
+ if(nObjId == SdrObjKind::Graphic) // SdrGrafObj
{
// defaults for graphic objects have changed:
- GetSdrObject()->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE ) );
- GetSdrObject()->SetMergedItem( XLineStyleItem( drawing::LineStyle_NONE ) );
+ pSdrObj->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE ) );
+ pSdrObj->SetMergedItem( XLineStyleItem( drawing::LineStyle_NONE ) );
}
// #i68523# special handling for Svx3DCharacterModeItem, this is not saved
@@ -3121,12 +3123,12 @@ void SvxShape::setAllPropertiesToDefault()
// does not load lathe or extrude objects, it is possible to set the items
// here.
// For other solution possibilities, see task description.
- if( dynamic_cast<const E3dLatheObj* >(GetSdrObject()) != nullptr|| dynamic_cast<const E3dExtrudeObj* >(GetSdrObject()) != nullptr)
+ if( nObjId == SdrObjKind::E3D_Lathe /*E3dLatheObj*/ || nObjId == SdrObjKind::E3D_Extrusion /*E3dExtrudeObj*/ )
{
- GetSdrObject()->SetMergedItem(Svx3DCharacterModeItem(true));
+ pSdrObj->SetMergedItem(Svx3DCharacterModeItem(true));
}
- GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
+ pSdrObj->getSdrModelFromSdrObject().SetChanged();
}
void SvxShape::setPropertiesToDefault(