[Libreoffice-commits] core.git: sc/source sd/source svx/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Nov 24 06:11:09 UTC 2020
sc/source/ui/drawfunc/graphsh.cxx | 143 +++++++++++++++---------------
sd/source/ui/view/GraphicObjectBar.cxx | 42 ++++----
sd/source/ui/view/drviews2.cxx | 41 ++++----
sd/source/ui/view/drviews7.cxx | 7 -
sd/source/ui/view/sdview2.cxx | 42 ++++----
svx/source/engine3d/view3d.cxx | 7 -
svx/source/svdraw/svdview.cxx | 7 -
svx/source/unodraw/UnoGraphicExporter.cxx | 38 +++----
8 files changed, 169 insertions(+), 158 deletions(-)
New commits:
commit 5ca88c4a1a97b95c829f6c7c570c4e5219e80e2e
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Nov 23 21:37:10 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Nov 24 07:10:29 2020 +0100
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 at collabora.co.uk>
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index 32091e5329ce..c4487d45d724 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -90,7 +90,8 @@ void ScGraphicShell::GetFilterState( SfxItemSet& rSet )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) )
+ if( auto pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
bEnable = true;
}
@@ -107,26 +108,27 @@ void ScGraphicShell::ExecuteFilter( const SfxRequest& rReq )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
- {
- GraphicObject aFilterObj( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() );
-
- if( SvxGraphicFilterResult::NONE ==
- SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
+ if( auto pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
{
- SdrPageView* pPageView = pView->GetSdrPageView();
+ GraphicObject aFilterObj( pGraphicObj->GetGraphicObject() );
- if( pPageView )
+ if( SvxGraphicFilterResult::NONE ==
+ SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
{
- SdrGrafObj* pFilteredObj(static_cast<SdrGrafObj*>(pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject())));
- OUString aStr = pView->GetDescriptionOfMarkedObjects() + " " + ScResId(SCSTR_UNDO_GRAFFILTER);
- pView->BegUndo( aStr );
- pFilteredObj->SetGraphicObject( aFilterObj );
- pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
- pView->EndUndo();
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if( pPageView )
+ {
+ SdrGrafObj* pFilteredObj(static_cast<SdrGrafObj*>(pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject())));
+ OUString aStr = pView->GetDescriptionOfMarkedObjects() + " " + ScResId(SCSTR_UNDO_GRAFFILTER);
+ pView->BegUndo( aStr );
+ pFilteredObj->SetGraphicObject( aFilterObj );
+ pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
+ pView->EndUndo();
+ }
}
}
- }
}
Invalidate();
@@ -141,7 +143,8 @@ void ScGraphicShell::GetExternalEditState( SfxItemSet& rSet )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) )
+ if( auto pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
bEnable = true;
}
@@ -161,13 +164,14 @@ void ScGraphicShell::ExecuteExternalEdit( SAL_UNUSED_PARAMETER SfxRequest& )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
- {
- GraphicObject aGraphicObject( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() );
- m_ExternalEdits.push_back( std::make_unique<SdrExternalToolEdit>(
- pView, pObj));
- m_ExternalEdits.back()->Edit( &aGraphicObject );
- }
+ if( auto pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
+ {
+ GraphicObject aGraphicObject( pGraphicObj->GetGraphicObject() );
+ m_ExternalEdits.push_back( std::make_unique<SdrExternalToolEdit>(
+ pView, pObj));
+ m_ExternalEdits.back()->Edit( &aGraphicObject );
+ }
}
Invalidate();
@@ -182,8 +186,9 @@ void ScGraphicShell::GetCompressGraphicState( SfxItemSet& rSet )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) )
- bEnable = true;
+ if( auto pGraphicObj = dynamic_cast<const SdrGrafObj*>( pObj) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
+ bEnable = true;
}
if( !bEnable )
@@ -199,20 +204,20 @@ void ScGraphicShell::ExecuteCompressGraphic( SAL_UNUSED_PARAMETER SfxRequest& )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
- {
- SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj);
- CompressGraphicsDialog dialog(GetViewData().GetDialogParent(), pGraphicObj, GetViewData().GetBindings());
- if (dialog.run() == RET_OK)
+ if( auto pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
{
- SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj();
- SdrPageView* pPageView = pView->GetSdrPageView();
- OUString aUndoString = pView->GetDescriptionOfMarkedObjects() + " Compress";
- pView->BegUndo( aUndoString );
- pView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
- pView->EndUndo();
+ CompressGraphicsDialog dialog(GetViewData().GetDialogParent(), pGraphicObj, GetViewData().GetBindings());
+ if (dialog.run() == RET_OK)
+ {
+ SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj();
+ SdrPageView* pPageView = pView->GetSdrPageView();
+ OUString aUndoString = pView->GetDescriptionOfMarkedObjects() + " Compress";
+ pView->BegUndo( aUndoString );
+ pView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
+ pView->EndUndo();
+ }
}
- }
}
Invalidate();
@@ -227,8 +232,9 @@ void ScGraphicShell::GetCropGraphicState( SfxItemSet& rSet )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) )
- bEnable = true;
+ if( auto pGraphicObj = dynamic_cast<const SdrGrafObj*>( pObj) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
+ bEnable = true;
}
if( !bEnable )
@@ -244,11 +250,12 @@ void ScGraphicShell::ExecuteCropGraphic( SAL_UNUSED_PARAMETER SfxRequest& )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
- {
- pView->SetEditMode(SdrViewEditMode::Edit);
- pView->SetDragMode(SdrDragMode::Crop);
- }
+ if( auto pGraphicObj = dynamic_cast<const SdrGrafObj*>( pObj) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
+ {
+ pView->SetEditMode(SdrViewEditMode::Edit);
+ pView->SetDragMode(SdrDragMode::Crop);
+ }
}
Invalidate();
@@ -303,8 +310,9 @@ void ScGraphicShell::GetSaveGraphicState(SfxItemSet &rSet)
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) )
- bEnable = true;
+ if( auto pGraphicObj = dynamic_cast<const SdrGrafObj*>( pObj) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
+ bEnable = true;
}
if (GetObjectShell()->isExportLocked())
@@ -323,28 +331,28 @@ void ScGraphicShell::ExecuteChangePicture( SAL_UNUSED_PARAMETER SfxRequest& /*rR
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
- {
- SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj);
- vcl::Window* pWin = GetViewData().GetActiveWin();
- SvxOpenGraphicDialog aDlg(ScResId(STR_INSERTGRAPHIC), pWin ? pWin->GetFrameWeld() : nullptr);
-
- if( aDlg.Execute() == ERRCODE_NONE )
+ if( auto pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
{
- Graphic aGraphic;
- ErrCode nError = aDlg.GetGraphic(aGraphic);
- if( nError == ERRCODE_NONE )
+ vcl::Window* pWin = GetViewData().GetActiveWin();
+ SvxOpenGraphicDialog aDlg(ScResId(STR_INSERTGRAPHIC), pWin ? pWin->GetFrameWeld() : nullptr);
+
+ if( aDlg.Execute() == ERRCODE_NONE )
{
- SdrGrafObj* pNewObject(pGraphicObj->CloneSdrObject(pGraphicObj->getSdrModelFromSdrObject()));
- pNewObject->SetGraphic( aGraphic );
- SdrPageView* pPageView = pView->GetSdrPageView();
- OUString aUndoString = pView->GetDescriptionOfMarkedObjects() + " Change";
- pView->BegUndo( aUndoString );
- pView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
- pView->EndUndo();
+ Graphic aGraphic;
+ ErrCode nError = aDlg.GetGraphic(aGraphic);
+ if( nError == ERRCODE_NONE )
+ {
+ SdrGrafObj* pNewObject(pGraphicObj->CloneSdrObject(pGraphicObj->getSdrModelFromSdrObject()));
+ pNewObject->SetGraphic( aGraphic );
+ SdrPageView* pPageView = pView->GetSdrPageView();
+ OUString aUndoString = pView->GetDescriptionOfMarkedObjects() + " Change";
+ pView->BegUndo( aUndoString );
+ pView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
+ pView->EndUndo();
+ }
}
}
- }
}
Invalidate();
@@ -359,8 +367,9 @@ void ScGraphicShell::GetChangePictureState(SfxItemSet &rSet)
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) )
- bEnable = true;
+ if( auto pGrafObj = dynamic_cast<const SdrGrafObj*>( pObj) )
+ if( pGrafObj->GetGraphicType() == GraphicType::Bitmap )
+ bEnable = true;
}
if( !bEnable )
diff --git a/sd/source/ui/view/GraphicObjectBar.cxx b/sd/source/ui/view/GraphicObjectBar.cxx
index cba43660e629..b3f9b1468b28 100644
--- a/sd/source/ui/view/GraphicObjectBar.cxx
+++ b/sd/source/ui/view/GraphicObjectBar.cxx
@@ -90,8 +90,9 @@ void GraphicObjectBar::GetFilterState( SfxItemSet& rSet )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast< SdrGrafObj *>( pObj ) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) )
- bEnable = true;
+ if( auto pGrafObj = dynamic_cast< SdrGrafObj *>( pObj ) )
+ if( pGrafObj->GetGraphicType() == GraphicType::Bitmap )
+ bEnable = true;
}
if( !bEnable )
@@ -106,28 +107,29 @@ void GraphicObjectBar::ExecuteFilter( SfxRequest const & rReq )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast< SdrGrafObj *>( pObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
- {
- GraphicObject aFilterObj( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() );
-
- if( SvxGraphicFilterResult::NONE ==
- SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
+ if( auto pGrafObj = dynamic_cast< SdrGrafObj *>( pObj ) )
+ if( pGrafObj->GetGraphicType() == GraphicType::Bitmap )
{
- SdrPageView* pPageView = mpView->GetSdrPageView();
+ GraphicObject aFilterObj( pGrafObj->GetGraphicObject() );
- if( pPageView )
+ if( SvxGraphicFilterResult::NONE ==
+ SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
{
- SdrGrafObj* pFilteredObj = static_cast<SdrGrafObj*>( pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject()) );
- OUString aStr = mpView->GetDescriptionOfMarkedObjects() +
- " " + SdResId(STR_UNDO_GRAFFILTER);
- mpView->BegUndo( aStr );
- pFilteredObj->SetGraphicObject( aFilterObj );
- ::sd::View* const pView = mpView;
- pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
- pView->EndUndo();
- return;
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+
+ if( pPageView )
+ {
+ SdrGrafObj* pFilteredObj = static_cast<SdrGrafObj*>( pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject()) );
+ OUString aStr = mpView->GetDescriptionOfMarkedObjects() +
+ " " + SdResId(STR_UNDO_GRAFFILTER);
+ mpView->BegUndo( aStr );
+ pFilteredObj->SetGraphicObject( aFilterObj );
+ ::sd::View* const pView = mpView;
+ pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
+ pView->EndUndo();
+ return;
+ }
}
- }
}
}
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 279eb753af57..30a334bfd6ec 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1425,14 +1425,15 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
if( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast< const SdrGrafObj *>( pObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
- {
- GraphicObject aGraphicObject( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() );
- m_ExternalEdits.push_back(
- std::make_unique<SdrExternalToolEdit>(
- mpDrawView.get(), pObj));
- m_ExternalEdits.back()->Edit( &aGraphicObject );
- }
+ if( auto pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj ) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
+ {
+ GraphicObject aGraphicObject( pGraphicObj->GetGraphicObject() );
+ m_ExternalEdits.push_back(
+ std::make_unique<SdrExternalToolEdit>(
+ mpDrawView.get(), pObj));
+ m_ExternalEdits.back()->Edit( &aGraphicObject );
+ }
}
Cancel();
rReq.Ignore();
@@ -1446,20 +1447,20 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast< const SdrGrafObj *>( pObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
- {
- SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj);
- CompressGraphicsDialog dialog(GetFrameWeld(), pGraphicObj, GetViewFrame()->GetBindings() );
- if (dialog.run() == RET_OK)
+ if( auto pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj ) )
+ if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
{
- SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj();
- SdrPageView* pPageView = mpDrawView->GetSdrPageView();
- OUString aUndoString = mpDrawView->GetDescriptionOfMarkedObjects() + " Compress";
- mpDrawView->BegUndo( aUndoString );
- mpDrawView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
- mpDrawView->EndUndo();
+ CompressGraphicsDialog dialog(GetFrameWeld(), pGraphicObj, GetViewFrame()->GetBindings() );
+ if (dialog.run() == RET_OK)
+ {
+ SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj();
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+ OUString aUndoString = mpDrawView->GetDescriptionOfMarkedObjects() + " Compress";
+ mpDrawView->BegUndo( aUndoString );
+ mpDrawView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
+ mpDrawView->EndUndo();
+ }
}
- }
}
Cancel();
rReq.Ignore();
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index baac52ee46e1..93c1bc846a26 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -352,10 +352,9 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
{
bool bDisable = true;
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- if( dynamic_cast<const SdrGrafObj*>( pObj) && ( static_cast<SdrGrafObj*>(pObj)->getQrCode()))
- {
- bDisable = false;
- }
+ if( auto pGrafObj = dynamic_cast<const SdrGrafObj*>( pObj) )
+ if( pGrafObj->getQrCode() )
+ bDisable = false;
if(bDisable)
{
rSet.DisableItem(SID_EDIT_QRCODE);
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index e550a2291f87..7f5caafe6733 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -109,18 +109,19 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDat
{
SdrObject* pObj = GetMarkedObjectByIndex(0);
- if( dynamic_cast< const SdrOle2Obj *>( pObj ) && static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() )
- {
- // If object has no persistence it must be copied as part of the document
- try
+ if( auto pOle2Obj = dynamic_cast< const SdrOle2Obj *>( pObj ) )
+ if( pOle2Obj->GetObjRef() )
{
- uno::Reference< embed::XEmbedPersist > xPersObj( static_cast<SdrOle2Obj*>(pObj)->GetObjRef(), uno::UNO_QUERY );
- if ( xPersObj.is() && xPersObj->hasEntry() )
- pSdrOleObj = static_cast<SdrOle2Obj*>(pObj);
+ // If object has no persistence it must be copied as part of the document
+ try
+ {
+ uno::Reference< embed::XEmbedPersist > xPersObj( pOle2Obj->GetObjRef(), uno::UNO_QUERY );
+ if ( xPersObj.is() && xPersObj->hasEntry() )
+ pSdrOleObj = static_cast<SdrOle2Obj*>(pObj);
+ }
+ catch( uno::Exception& )
+ {}
}
- catch( uno::Exception& )
- {}
- }
}
if( pSdrOleObj )
@@ -155,18 +156,19 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateDragDataObje
{
SdrObject* pObj = GetMarkedObjectByIndex( 0 );
- if( dynamic_cast< const SdrOle2Obj *>( pObj ) && static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() )
- {
- // If object has no persistence it must be copied as part of the document
- try
+ if( auto pOle2Obj = dynamic_cast< const SdrOle2Obj *>( pObj ) )
+ if( pOle2Obj->GetObjRef() )
{
- uno::Reference< embed::XEmbedPersist > xPersObj( static_cast<SdrOle2Obj*>(pObj)->GetObjRef(), uno::UNO_QUERY );
- if ( xPersObj.is() && xPersObj->hasEntry() )
- pSdrOleObj = static_cast<SdrOle2Obj*>(pObj);
+ // If object has no persistence it must be copied as part of the document
+ try
+ {
+ uno::Reference< embed::XEmbedPersist > xPersObj( pOle2Obj->GetObjRef(), uno::UNO_QUERY );
+ if ( xPersObj.is() && xPersObj->hasEntry() )
+ pSdrOleObj = static_cast<SdrOle2Obj*>(pObj);
+ }
+ catch( uno::Exception& )
+ {}
}
- catch( uno::Exception& )
- {}
- }
}
if( mpDocSh )
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 )
{
More information about the Libreoffice-commits
mailing list