summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-11-23 21:37:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-24 07:10:29 +0100
commit5ca88c4a1a97b95c829f6c7c570c4e5219e80e2e (patch)
tree2c66640aafc90448d32908a7c40960a21e596122 /svx
parent356006712320c524515a959a022a0f2b02fa63bb (diff)
static_cast after dynamic_cast
Change-Id: I196d4e9065961d6f4e3fef4475dd5f406e998447 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106451 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/engine3d/view3d.cxx7
-rw-r--r--svx/source/svdraw/svdview.cxx7
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx38
3 files changed, 25 insertions, 27 deletions
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 3c0fb45a0df0..e1cc81e5ad5d 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -1189,10 +1189,9 @@ bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* pOut,
SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
if(pObj)
{
- if(nullptr != dynamic_cast< const E3dScene* >(pObj) && static_cast< E3dScene* >(pObj)->getRootE3dSceneFromE3dObject() == pObj)
- {
- bThereAreRootScenes = true;
- }
+ if( auto pScene = dynamic_cast< const E3dScene* >(pObj) )
+ if( pScene->getRootE3dSceneFromE3dObject() == pObj )
+ bThereAreRootScenes = true;
if(dynamic_cast< const E3dObject* >(pObj) != nullptr)
{
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index f266478927b8..f591334dea08 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -506,10 +506,9 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
tools::Rectangle aBoundRect(pHitObj->GetCurrentBoundRect());
// Force to SnapRect when Fontwork
- if( dynamic_cast<const SdrTextObj*>( pHitObj) != nullptr && static_cast<SdrTextObj*>(pHitObj)->IsFontwork())
- {
- aBoundRect = pHitObj->GetSnapRect();
- }
+ if( auto pTextObj = dynamic_cast<const SdrTextObj*>(pHitObj) )
+ if( pTextObj->IsFontwork() )
+ aBoundRect = pHitObj->GetSnapRect();
sal_Int32 nTolerance(mnHitTolLog);
bool bBoundRectHit(false);
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 4180b33b0713..87f2e40bfc36 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -817,29 +817,29 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
{
if( !bVectorType )
{
- SdrObject* pObj = aShapes.front();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && !static_cast<SdrGrafObj*>(pObj)->HasText() )
- {
- aGraphic = static_cast<SdrGrafObj*>(pObj)->GetTransformedGraphic();
- if ( aGraphic.GetType() == GraphicType::Bitmap )
+ if( auto pGrafObj = dynamic_cast<const SdrGrafObj*>(aShapes.front()) )
+ if (pGrafObj->HasText() )
{
- Size aSizePixel( aGraphic.GetSizePixel() );
- if( rSettings.mnWidth && rSettings.mnHeight &&
- ( ( rSettings.mnWidth != aSizePixel.Width() ) ||
- ( rSettings.mnHeight != aSizePixel.Height() ) ) )
+ aGraphic = pGrafObj->GetTransformedGraphic();
+ if ( aGraphic.GetType() == GraphicType::Bitmap )
{
- BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
- // export: use highest quality
- aBmpEx.Scale( Size( rSettings.mnWidth, rSettings.mnHeight ), BmpScaleFlag::Lanczos );
- aGraphic = aBmpEx;
+ Size aSizePixel( aGraphic.GetSizePixel() );
+ if( rSettings.mnWidth && rSettings.mnHeight &&
+ ( ( rSettings.mnWidth != aSizePixel.Width() ) ||
+ ( rSettings.mnHeight != aSizePixel.Height() ) ) )
+ {
+ BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
+ // export: use highest quality
+ aBmpEx.Scale( Size( rSettings.mnWidth, rSettings.mnHeight ), BmpScaleFlag::Lanczos );
+ aGraphic = aBmpEx;
+ }
+
+ // #118804# only accept for bitmap graphics, else the
+ // conversion to bitmap will happen anywhere without size control
+ // as evtl. defined in rSettings.mnWidth/mnHeight
+ bSingleGraphic = true;
}
-
- // #118804# only accept for bitmap graphics, else the
- // conversion to bitmap will happen anywhere without size control
- // as evtl. defined in rSettings.mnWidth/mnHeight
- bSingleGraphic = true;
}
- }
}
else if( rSettings.mbScrollText )
{