[Libreoffice-commits] core.git: sd/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 10 06:21:20 UTC 2018
sd/source/core/drawdoc4.cxx | 2 +-
sd/source/filter/eppt/eppt.cxx | 4 ++--
sd/source/ui/app/sdxfer.cxx | 4 +---
sd/source/ui/docshell/docshel4.cxx | 3 +--
sd/source/ui/func/fubullet.cxx | 4 ++--
sd/source/ui/func/fuinsert.cxx | 2 +-
sd/source/ui/func/fuinsfil.cxx | 2 +-
sd/source/ui/func/fumorph.cxx | 8 ++++----
sd/source/ui/func/fuoltext.cxx | 4 ++--
sd/source/ui/func/fupoor.cxx | 13 +++++--------
sd/source/ui/func/fuprlout.cxx | 4 +---
sd/source/ui/func/fuscale.cxx | 2 +-
sd/source/ui/func/futext.cxx | 12 ++++++------
sd/source/ui/func/futhes.cxx | 4 ++--
sd/source/ui/func/fuvect.cxx | 4 ++--
sd/source/ui/func/sdundogr.cxx | 4 ++--
sd/source/ui/unoidl/unopage.cxx | 10 ++--------
sd/source/ui/view/GraphicObjectBar.cxx | 4 ++--
sd/source/ui/view/MediaObjectBar.cxx | 4 ++--
sd/source/ui/view/Outliner.cxx | 8 ++++----
sd/source/ui/view/ViewShellBase.cxx | 3 +--
sd/source/ui/view/drviews2.cxx | 8 +++-----
sd/source/ui/view/drviews4.cxx | 4 ++--
sd/source/ui/view/drviews6.cxx | 2 +-
sd/source/ui/view/sdview2.cxx | 4 ++--
sd/source/ui/view/sdview4.cxx | 2 +-
sd/source/ui/view/sdwindow.cxx | 9 ++++-----
27 files changed, 58 insertions(+), 76 deletions(-)
New commits:
commit 4e63c00f4dd5f8ac6496481e687c59209f9aee07
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Aug 9 16:30:29 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 10 08:20:52 2018 +0200
unnecessary null check before dynamic_cast, in sd
Change-Id: I91579ece17b85b1ae9926b7a05eb641672e8ecbd
Reviewed-on: https://gerrit.libreoffice.org/58772
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index c1cef8344c39..202f4e88b875 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -971,7 +971,7 @@ void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo const * pInfo, Sdr
// restart when add to dictionary takes place, too.
|| nCommand == SpellCallbackCommand::ADDTODICTIONARY)
{
- if(pObj && pOutl && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr)
+ if(pOutl && dynamic_cast< const SdrTextObj *>( pObj ))
{
bool bModified(IsChanged());
static_cast<SdrTextObj*>(pObj)->SetOutlinerParaObject(pOutl->CreateParaObject());
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index 28edf2321323..cef343773891 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -1268,9 +1268,9 @@ void PPTWriter::ImplWriteOLE( )
case NORMAL_OLE_OBJECT :
{
SdrObject* pSdrObj = GetSdrObjectFromXShape( pPtr->xShape );
- if ( pSdrObj && dynamic_cast<const SdrOle2Obj* >(pSdrObj) != nullptr )
+ if ( auto pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >(pSdrObj) )
{
- ::uno::Reference < embed::XEmbeddedObject > xObj( static_cast<SdrOle2Obj*>(pSdrObj)->GetObjRef() );
+ ::uno::Reference < embed::XEmbeddedObject > xObj( pSdrOle2Obj->GetObjRef() );
if( xObj.is() )
{
tools::SvRef<SotStorage> xTempStorage( new SotStorage( new SvMemoryStream(), true ) );
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 7523b53af472..aef82807b809 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -220,10 +220,8 @@ void SdTransferable::CreateObjectReplacement( SdrObject* pObj )
{
const SvxFieldData* pData = pField->GetField();
- if( pData && dynamic_cast< const SvxURLField *>( pData ) != nullptr )
+ if( auto pURL = dynamic_cast< const SvxURLField *>( pData ) )
{
- const SvxURLField* pURL = static_cast<const SvxURLField*>(pData);
-
// #i63399# This special code identifies TextFrames which have just an URL
// as content and directly add this to the clipboard, probably to avoid adding
// an unnecessary DrawObject to the target where paste may take place. This is
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index d6f7ec0127ec..288e0b15c9df 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -725,9 +725,8 @@ SfxStyleSheetBasePool* DrawDocShell::GetStyleSheetPool()
void DrawDocShell::GotoBookmark(const OUString& rBookmark)
{
- if (mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr)
+ if (auto pDrawViewShell = dynamic_cast<DrawViewShell *>( mpViewShell ))
{
- DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell);
ViewShellBase& rBase (mpViewShell->GetViewShellBase());
bool bIsMasterPage = false;
diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx
index 1574d2d6b7ba..deacffc1b0ef 100644
--- a/sd/source/ui/func/fubullet.cxx
+++ b/sd/source/ui/func/fubullet.cxx
@@ -205,7 +205,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq )
::Outliner* pOL = nullptr;
// determine depending on ViewShell Outliner and OutlinerView
- if(mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr)
+ if(dynamic_cast< const DrawViewShell *>( mpViewShell ))
{
pOV = mpView->GetTextEditOutlinerView();
if (pOV)
@@ -213,7 +213,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq )
pOL = mpView->GetTextEditOutliner();
}
}
- else if(mpViewShell && dynamic_cast< const OutlineViewShell *>( mpViewShell ) != nullptr)
+ else if(dynamic_cast< const OutlineViewShell *>( mpViewShell ))
{
pOL = &static_cast<OutlineView*>(mpView)->GetOutliner();
pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 2ba29aa2e041..d9b7e9c5b555 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -168,7 +168,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
}
}
}
- if( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr)
+ if( dynamic_cast< DrawViewShell *>( mpViewShell ) )
{
sal_Int8 nAction = DND_ACTION_COPY;
SdrObject* pPickObj;
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index 92ea81841391..aeedf65ff0fd 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -266,7 +266,7 @@ void FuInsertFile::DoExecute( SfxRequest& rReq )
SfxGetpApp()->GetFilterMatcher().GuessFilter(*xMedium, pFilter);
- bool bDrawMode = mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr;
+ bool bDrawMode = dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr;
bool bInserted = false;
if( pFilter )
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
index 45fd78f522a3..d69085ed82a6 100644
--- a/sd/source/ui/func/fumorph.cxx
+++ b/sd/source/ui/func/fumorph.cxx
@@ -110,15 +110,15 @@ void FuMorph::DoExecute( SfxRequest& )
while(aIter1.IsMore())
{
SdrObject* pObj = aIter1.Next();
- if(pObj && dynamic_cast< SdrPathObj *>( pObj ) != nullptr)
- aPolyPoly1.append(static_cast<SdrPathObj*>(pObj)->GetPathPoly());
+ if(auto pPathObj = dynamic_cast< SdrPathObj *>( pObj ))
+ aPolyPoly1.append(pPathObj->GetPathPoly());
}
while(aIter2.IsMore())
{
SdrObject* pObj = aIter2.Next();
- if(pObj && dynamic_cast< SdrPathObj *>( pObj ) != nullptr)
- aPolyPoly2.append(static_cast<SdrPathObj*>(pObj)->GetPathPoly());
+ if(auto pPathObj = dynamic_cast< SdrPathObj *>( pObj ))
+ aPolyPoly2.append(pPathObj->GetPathPoly());
}
// perform morphing
diff --git a/sd/source/ui/func/fuoltext.cxx b/sd/source/ui/func/fuoltext.cxx
index 5510866ae957..5d53b3aa09f5 100644
--- a/sd/source/ui/func/fuoltext.cxx
+++ b/sd/source/ui/func/fuoltext.cxx
@@ -164,11 +164,11 @@ bool FuOutlineText::MouseButtonUp(const MouseEvent& rMEvt)
{
const SvxFieldData* pField = pFieldItem->GetField();
- if( pField && dynamic_cast< const SvxURLField *>( pField ) != nullptr )
+ if( auto pURLField = dynamic_cast< const SvxURLField *>( pField ) )
{
bReturn = true;
mpWindow->ReleaseMouse();
- SfxStringItem aStrItem( SID_FILE_NAME, static_cast<const SvxURLField*>(pField)->GetURL() );
+ SfxStringItem aStrItem( SID_FILE_NAME, pURLField->GetURL() );
SfxStringItem aReferer( SID_REFERER, mpDocSh->GetMedium()->GetName() );
SfxBoolItem aBrowseItem( SID_BROWSE, true );
SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index a8ba3eb89d22..2e939b91d11b 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -214,7 +214,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
{
SdrObject* pObj = aIter.Next();
- if(pObj && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr)
+ if(dynamic_cast< const SdrTextObj *>( pObj ))
{
SdrInventor nInv(pObj->GetObjInventor());
sal_uInt16 nKnd(pObj->GetObjIdentifier());
@@ -257,7 +257,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< const SdrOle2Obj* >( pObj ) != nullptr && !mpDocSh->IsUIActive() )
+ if( dynamic_cast< const SdrOle2Obj* >( pObj ) && !mpDocSh->IsUIActive() )
{
//HMHmpView->HideMarkHdl();
mpViewShell->ActivateObject( static_cast< SdrOle2Obj* >( pObj ), 0 );
@@ -623,7 +623,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
bool bOldSuppress = false;
SdrEdgeObj* pEdgeObj = nullptr;
- if(pHdl && pHdl->GetObj() && nullptr != dynamic_cast< const SdrEdgeObj *>( pHdl->GetObj() ) && 0 == pHdl->GetPolyNum())
+ if(pHdl && dynamic_cast< const SdrEdgeObj *>( pHdl->GetObj() ) && 0 == pHdl->GetPolyNum())
{
pEdgeObj = static_cast<SdrEdgeObj*>(pHdl->GetObj());
@@ -846,7 +846,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
{
SdrObject* pObj = aIter.Next();
- if(pObj && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr)
+ if(dynamic_cast< const SdrTextObj *>( pObj ))
{
SdrInventor nInv(pObj->GetObjInventor());
sal_uInt16 nKnd(pObj->GetObjIdentifier());
@@ -1055,11 +1055,8 @@ void FuPoor::ImpForceQuadratic(::tools::Rectangle& rRect)
void FuPoor::SwitchLayer (sal_Int32 nOffset)
{
- if(mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr)
+ if(auto pDrawViewShell = dynamic_cast<DrawViewShell *>( mpViewShell ))
{
- DrawViewShell* pDrawViewShell =
- static_cast<DrawViewShell*>(mpViewShell);
-
// Calculate the new index.
sal_Int32 nIndex = pDrawViewShell->GetActiveTabLayerIndex() + nOffset;
diff --git a/sd/source/ui/func/fuprlout.cxx b/sd/source/ui/func/fuprlout.cxx
index 4d6002d46571..8f3aaca436c7 100644
--- a/sd/source/ui/func/fuprlout.cxx
+++ b/sd/source/ui/func/fuprlout.cxx
@@ -271,10 +271,8 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq )
// fake a mode change to repaint the page tab bar
- if( mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr )
+ if( auto pDrawViewSh = dynamic_cast<DrawViewShell *>( mpViewShell ) )
{
- DrawViewShell* pDrawViewSh =
- static_cast<DrawViewShell*>(mpViewShell);
EditMode eMode = pDrawViewSh->GetEditMode();
bool bLayer = pDrawViewSh->IsLayerModeActive();
pDrawViewSh->ChangeEditMode( eMode, !bLayer );
diff --git a/sd/source/ui/func/fuscale.cxx b/sd/source/ui/func/fuscale.cxx
index 49b0cff83f8f..9a486d488d39 100644
--- a/sd/source/ui/func/fuscale.cxx
+++ b/sd/source/ui/func/fuscale.cxx
@@ -75,7 +75,7 @@ void FuScale::DoExecute( SfxRequest& rReq )
nValue = static_cast<sal_Int16>(mpWindow->GetZoom());
// zoom on page size?
- if( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr &&
+ if( dynamic_cast< DrawViewShell *>( mpViewShell ) &&
static_cast<DrawViewShell*>(mpViewShell)->IsZoomOnPage() )
{
pZoomItem.reset(new SvxZoomItem( SvxZoomType::WHOLEPAGE, nValue ));
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 8ce4589973d6..ae817ac5d000 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -337,9 +337,9 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
if (bMarkChanges)
mpView->MarkObj(aVEvt.pRootObj, pPV);
- if (aVEvt.pObj && dynamic_cast< const SdrTextObj *>( aVEvt.pObj ) != nullptr)
+ if (auto pSdrTextObj = dynamic_cast<SdrTextObj *>( aVEvt.pObj ))
{
- mxTextObj.reset( static_cast<SdrTextObj*>(aVEvt.pObj) );
+ mxTextObj.reset( pSdrTextObj );
}
SetInEditMode(rMEvt, true);
@@ -1196,10 +1196,10 @@ bool FuText::RequestHelp(const HelpEvent& rHEvt)
const SvxFieldItem* pFieldItem = pOLV->GetFieldUnderMousePointer();
const SvxFieldData* pField = pFieldItem->GetField();
- if (pField && dynamic_cast< const SvxURLField *>( pField ) != nullptr)
+ if (auto pURLField = dynamic_cast< const SvxURLField *>( pField ))
{
// URL-Field
- aHelpText = INetURLObject::decode( static_cast<const SvxURLField*>(pField)->GetURL(), INetURLObject::DecodeMechanism::WithCharset );
+ aHelpText = INetURLObject::decode( pURLField->GetURL(), INetURLObject::DecodeMechanism::WithCharset );
}
if (!aHelpText.isEmpty())
{
@@ -1255,9 +1255,9 @@ void FuText::ReceiveRequest(SfxRequest& rReq)
mpView->PickAnything(aMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt);
mpView->MarkObj(aVEvt.pRootObj, pPV);
- if (aVEvt.pObj && dynamic_cast< SdrTextObj *>( aVEvt.pObj ) != nullptr)
+ if (auto pSdrTextObj = dynamic_cast< SdrTextObj *>( aVEvt.pObj ))
{
- mxTextObj.reset( static_cast< SdrTextObj* >( aVEvt.pObj ) );
+ mxTextObj.reset( pSdrTextObj );
}
}
}
diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx
index 75d0e665b207..b6596189d0cc 100644
--- a/sd/source/ui/func/futhes.cxx
+++ b/sd/source/ui/func/futhes.cxx
@@ -66,7 +66,7 @@ void FuThesaurus::DoExecute( SfxRequest& )
SfxErrorContext aContext(ERRCTX_SVX_LINGU_THESAURUS, OUString(),
mpWindow->GetFrameWeld(), RID_SVXERRCTX, SvxResLocale());
- if (mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr)
+ if (dynamic_cast< DrawViewShell *>( mpViewShell ))
{
SdrTextObj* pTextObj = nullptr;
@@ -108,7 +108,7 @@ void FuThesaurus::DoExecute( SfxRequest& )
DBG_ASSERT(eState != EESpellState::NoSpeller, "No SpellChecker");
}
}
- else if (mpViewShell && dynamic_cast< OutlineViewShell *>( mpViewShell ) != nullptr)
+ else if (dynamic_cast< OutlineViewShell *>( mpViewShell ))
{
Outliner* pOutliner = mpDoc->GetOutliner();
OutlinerView* pOutlView = pOutliner->GetView(0);
diff --git a/sd/source/ui/func/fuvect.cxx b/sd/source/ui/func/fuvect.cxx
index b2591437653a..d7fa7dc25378 100644
--- a/sd/source/ui/func/fuvect.cxx
+++ b/sd/source/ui/func/fuvect.cxx
@@ -59,12 +59,12 @@ void FuVectorize::DoExecute( SfxRequest& )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr )
+ if( auto pSdrGrafObj = dynamic_cast< const SdrGrafObj *>( pObj ) )
{
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
ScopedVclPtr<AbstractSdVectorizeDlg> pDlg(
pFact->CreateSdVectorizeDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr,
- static_cast<SdrGrafObj*>( pObj )->GetGraphic().GetBitmapEx().GetBitmap(), mpDocSh ) );
+ pSdrGrafObj->GetGraphic().GetBitmapEx().GetBitmap(), mpDocSh ) );
if( pDlg->Execute() == RET_OK )
{
const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile();
diff --git a/sd/source/ui/func/sdundogr.cxx b/sd/source/ui/func/sdundogr.cxx
index 64a6aae8c4b5..37b243f2b208 100644
--- a/sd/source/ui/func/sdundogr.cxx
+++ b/sd/source/ui/func/sdundogr.cxx
@@ -26,9 +26,9 @@ bool SdUndoGroup::Merge( SfxUndoAction* pNextAction )
{
bool bRet = false;
- if( pNextAction && dynamic_cast< const SdUndoAction *>( pNextAction ) != nullptr )
+ if( auto pSdUndoAction = dynamic_cast<SdUndoAction *>( pNextAction ) )
{
- SdUndoAction* pClone = static_cast< SdUndoAction* >( pNextAction )->Clone();
+ SdUndoAction* pClone = pSdUndoAction->Clone();
if( pClone )
{
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 5afbce097cee..f3641695697e 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2282,11 +2282,8 @@ void SAL_CALL SdDrawPage::setName( const OUString& rName )
// fake a mode change to repaint the page tab bar
::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr;
- if( pViewSh && dynamic_cast< const ::sd::DrawViewShell* >(pViewSh) != nullptr)
+ if( auto pDrawViewSh = dynamic_cast<::sd::DrawViewShell* >(pViewSh) )
{
- ::sd::DrawViewShell* pDrawViewSh = static_cast<
- ::sd::DrawViewShell*>(pViewSh);
-
EditMode eMode = pDrawViewSh->GetEditMode();
if( eMode == EditMode::Page )
{
@@ -2978,11 +2975,8 @@ void SAL_CALL SdMasterPage::setName( const OUString& rName )
// fake a mode change to repaint the page tab bar
::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr;
- if( pViewSh && dynamic_cast< const ::sd::DrawViewShell* >(pViewSh) != nullptr )
+ if( auto pDrawViewSh = dynamic_cast< ::sd::DrawViewShell* >(pViewSh) )
{
- ::sd::DrawViewShell* pDrawViewSh =
- static_cast< ::sd::DrawViewShell*>(pViewSh);
-
EditMode eMode = pDrawViewSh->GetEditMode();
if( eMode == EditMode::MasterPage )
{
diff --git a/sd/source/ui/view/GraphicObjectBar.cxx b/sd/source/ui/view/GraphicObjectBar.cxx
index acecdffd7dac..e4974b1758fd 100644
--- a/sd/source/ui/view/GraphicObjectBar.cxx
+++ b/sd/source/ui/view/GraphicObjectBar.cxx
@@ -102,7 +102,7 @@ void GraphicObjectBar::GetFilterState( SfxItemSet& rSet )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< SdrGrafObj *>( pObj ) != nullptr && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) )
+ if( dynamic_cast< SdrGrafObj *>( pObj ) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) )
bEnable = true;
}
@@ -118,7 +118,7 @@ void GraphicObjectBar::ExecuteFilter( SfxRequest const & rReq )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< SdrGrafObj *>( pObj ) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
+ if( dynamic_cast< SdrGrafObj *>( pObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
{
GraphicObject aFilterObj( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() );
diff --git a/sd/source/ui/view/MediaObjectBar.cxx b/sd/source/ui/view/MediaObjectBar.cxx
index ae9554124df3..b84d7b9ffac0 100644
--- a/sd/source/ui/view/MediaObjectBar.cxx
+++ b/sd/source/ui/view/MediaObjectBar.cxx
@@ -88,7 +88,7 @@ void MediaObjectBar::GetState( SfxItemSet& rSet )
{
SdrObject* pObj =pMarkList->GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< SdrMediaObj *>( pObj ) != nullptr )
+ if( dynamic_cast< SdrMediaObj *>( pObj ) )
{
::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
@@ -124,7 +124,7 @@ void MediaObjectBar::Execute( SfxRequest const & rReq )
{
SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< SdrMediaObj *>( pObj ) != nullptr )
+ if( dynamic_cast< SdrMediaObj *>( pObj ) )
{
static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
static_cast< const ::avmedia::MediaItem& >( *pItem ) );
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 1628d1c25693..4209c7ae90cf 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -307,7 +307,7 @@ void SdOutliner::EndSpelling()
// When in <member>PrepareSpelling()</member> a new outline view has
// been created then delete it here.
- bool bViewIsDrawViewShell(pViewShell && nullptr != dynamic_cast< const sd::DrawViewShell *>( pViewShell.get() ));
+ bool bViewIsDrawViewShell(dynamic_cast< const sd::DrawViewShell *>( pViewShell.get() ));
if (bViewIsDrawViewShell)
{
SetStatusEventHdl(Link<EditStatus&,void>());
@@ -335,8 +335,8 @@ void SdOutliner::EndSpelling()
// changes were done at SpellCheck
if(IsModified())
{
- if(mpView && dynamic_cast< const sd::OutlineView *>( mpView ) != nullptr)
- static_cast<sd::OutlineView*>(mpView)->PrepareClose();
+ if(auto pOutlineView = dynamic_cast<sd::OutlineView *>( mpView ))
+ pOutlineView->PrepareClose();
if(mpDrawDocument && !mpDrawDocument->IsChanged())
mpDrawDocument->SetChanged();
}
@@ -1650,7 +1650,7 @@ void SdOutliner::EndConversion()
bool SdOutliner::ConvertNextDocument()
{
std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
- if (pViewShell && nullptr != dynamic_cast< const sd::OutlineViewShell *>( pViewShell.get() ) )
+ if (dynamic_cast< const sd::OutlineViewShell *>( pViewShell.get() ) )
return false;
mpDrawDocument->GetDocSh()->SetWaitCursor( true );
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 2f86b677ae67..a01519d09661 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -397,8 +397,7 @@ ViewShellBase* ViewShellBase::GetViewShellBase (SfxViewFrame const * pViewFrame)
// Get the view shell for the frame and cast it to
// sd::ViewShellBase.
SfxViewShell* pSfxViewShell = pViewFrame->GetViewShell();
- if (pSfxViewShell!=nullptr && dynamic_cast< ::sd::ViewShellBase *>( pSfxViewShell ) != nullptr)
- pBase = static_cast<ViewShellBase*>(pSfxViewShell);
+ pBase = dynamic_cast< ::sd::ViewShellBase *>( pSfxViewShell );
}
return pBase;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 40ade045b23e..45364638b196 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1327,7 +1327,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
if( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
+ if( dynamic_cast< const SdrGrafObj *>( pObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
{
GraphicObject aGraphicObject( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() );
m_ExternalEdits.push_back(
@@ -1348,7 +1348,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
+ 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() );
@@ -2095,10 +2095,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
if ( pFieldItem )
{
const SvxFieldData* pField = pFieldItem->GetField();
- if( pField && dynamic_cast< const SvxURLField *>( pField ) != nullptr )
+ if( auto pURLField = dynamic_cast< const SvxURLField *>( pField ) )
{
- const SvxURLField* pURLField = static_cast< const SvxURLField* >( pField );
-
SfxStringItem aUrl( SID_FILE_NAME, pURLField->GetURL() );
SfxStringItem aTarget( SID_TARGETNAME, pURLField->GetTargetFrame() );
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index f8aca149a4ae..32f9fcf96c0f 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -155,7 +155,7 @@ bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin)
{
SdrObject* pObj = aIter.Next();
- if(pObj && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr)
+ if(auto pSdrTextObj = dynamic_cast<SdrTextObj *>( pObj ))
{
SdrInventor nInv(pObj->GetObjInventor());
sal_uInt16 nKnd(pObj->GetObjIdentifier());
@@ -164,7 +164,7 @@ bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin)
(OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd)
&& bDidVisitOldObject)
{
- pCandidate = static_cast<SdrTextObj*>(pObj);
+ pCandidate = pSdrTextObj;
}
if(pObj == pOldObj)
diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx
index bfc0fe363e43..78330fcd6be8 100644
--- a/sd/source/ui/view/drviews6.cxx
+++ b/sd/source/ui/view/drviews6.cxx
@@ -337,7 +337,7 @@ void DrawViewShell::GetBmpMaskState( SfxItemSet& rSet )
pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
// valid graphic object?
- if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr &&
+ if( dynamic_cast< const SdrGrafObj *>( pObj ) &&
!static_cast<const SdrGrafObj*>(pObj)->IsEPS() &&
!mpDrawView->IsTextEdit() )
{
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index ce98918f0021..539d69b4dfc4 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -114,7 +114,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDat
{
SdrObject* pObj = GetMarkedObjectByIndex(0);
- if( pObj && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr && static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() )
+ 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
@@ -160,7 +160,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateDragDataObje
{
SdrObject* pObj = GetMarkedObjectByIndex( 0 );
- if( pObj && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr && static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() )
+ 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
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 61671f11d991..aa2d41b41440 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -317,7 +317,7 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM
pPV = nullptr;
}
- if( mnAction == DND_ACTION_LINK && pPickObj && pPV && dynamic_cast< SdrMediaObj *>( pPickObj ) != nullptr )
+ if( mnAction == DND_ACTION_LINK && pPV && dynamic_cast< SdrMediaObj *>( pPickObj ) )
{
pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->CloneSdrObject(pPickObj->getSdrModelFromSdrObject()) );
pNewMediaObj->setURL( rMediaURL, ""/*TODO?*/, rMimeType );
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 5b3240157bfc..b807e2997bbb 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -353,9 +353,8 @@ long Window::SetZoomFactor(long nZoom)
UpdateMapOrigin();
// Update the view's snapping to the new zoom factor.
- if ( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr )
- static_cast<DrawViewShell*>(mpViewShell)->GetView()->
- RecalcLogicSnapMagnetic(*this);
+ if ( auto pDrawViewShell = dynamic_cast< DrawViewShell *>( mpViewShell ) )
+ pDrawViewShell->GetView()->RecalcLogicSnapMagnetic(*this);
// Return the zoom factor just in case it has been changed above to lie
// inside the valid range.
@@ -592,7 +591,7 @@ void Window::UpdateMapMode()
// removed old stuff here which still forced zoom to be
// %BRUSH_SIZE which is outdated now
- if (mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr)
+ if (dynamic_cast< DrawViewShell *>( mpViewShell ))
{
// page should not "stick" to the window border
if (aPix.Width() == 0)
@@ -959,7 +958,7 @@ css::uno::Reference<css::accessibility::XAccessible>
Window::CreateAccessible()
{
// If current viewshell is PresentationViewShell, just return empty because the correct ShowWin will be created later.
- if (mpViewShell && dynamic_cast< PresentationViewShell *>( mpViewShell ) != nullptr)
+ if (dynamic_cast< PresentationViewShell *>( mpViewShell ))
{
return vcl::Window::CreateAccessible ();
}
More information about the Libreoffice-commits
mailing list