summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2018-08-09 16:30:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-10 08:20:28 +0200
commit7fdd5a12f6d20422ebda1d3afd5e5146cadbe0e5 (patch)
tree0370d19faf39b778517b2bce6c483cc0c82a11e0
parentb268ef57e97e692644335afeae834205ecb73557 (diff)
unnecessary null check before dynamic_cast, in svx
Change-Id: I5174c9530d18e5d88ad8a41cc2bb02c6d090f3cf Reviewed-on: https://gerrit.libreoffice.org/58771 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--svx/source/dialog/hdft.cxx10
-rw-r--r--svx/source/engine3d/view3d.cxx40
-rw-r--r--svx/source/form/fmshell.cxx2
-rw-r--r--svx/source/form/fmshimp.cxx2
-rw-r--r--svx/source/form/navigatortree.cxx2
-rw-r--r--svx/source/form/navigatortreemodel.cxx4
-rw-r--r--svx/source/sdr/properties/e3dsceneproperties.cxx4
-rw-r--r--svx/source/sdr/properties/textproperties.cxx2
-rw-r--r--svx/source/stbctrls/pszctrl.cxx4
-rw-r--r--svx/source/svdraw/sdrpagewindow.cxx4
-rw-r--r--svx/source/svdraw/svddrgmt.cxx2
-rw-r--r--svx/source/svdraw/svddrgv.cxx9
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx3
-rw-r--r--svx/source/tbxctrls/layctrl.cxx4
-rw-r--r--svx/source/tbxctrls/lboxctrl.cxx13
-rw-r--r--svx/source/tbxctrls/linectrl.cxx4
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx6
-rw-r--r--svx/source/unogallery/unogaltheme.cxx2
18 files changed, 54 insertions, 63 deletions
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index d23ad52bc89e..955586a23bbb 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -345,7 +345,7 @@ void SvxHFPage::Reset( const SfxItemSet* rSet )
bool bIsCalc = false;
const SfxPoolItem* pExt1 = GetItem(*rSet, SID_ATTR_PAGE_EXT1);
const SfxPoolItem* pExt2 = GetItem(*rSet, SID_ATTR_PAGE_EXT2);
- if (pExt1 && dynamic_cast<const SfxBoolItem*>(pExt1) != nullptr && pExt2 && dynamic_cast<const SfxBoolItem*>(pExt2) != nullptr )
+ if (dynamic_cast<const SfxBoolItem*>(pExt1) && dynamic_cast<const SfxBoolItem*>(pExt2) )
bIsCalc = true;
m_xCntSharedFirstBox->show(!bIsCalc);
@@ -945,18 +945,18 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
- if ( pItem && dynamic_cast<const SfxBoolItem*>( pItem) != nullptr )
+ if ( auto pBoolItem = dynamic_cast<const SfxBoolItem*>( pItem) )
{
m_aBspWin.SetTable( true );
- m_aBspWin.SetHorz( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
+ m_aBspWin.SetHorz( pBoolItem->GetValue() );
}
pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
- if ( pItem && dynamic_cast<const SfxBoolItem*>( pItem) != nullptr )
+ if ( auto pBoolItem = dynamic_cast<const SfxBoolItem*>( pItem) )
{
m_aBspWin.SetTable( true );
- m_aBspWin.SetVert( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
+ m_aBspWin.SetVert( pBoolItem->GetValue() );
}
ResetBackground_Impl( rSet );
RangeHdl();
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 2e5849b710bb..a048fce616d3 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -245,10 +245,10 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
{
SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
- if(pObj && dynamic_cast< const E3dCompoundObject*>(pObj) != nullptr)
+ if(auto pCompoundObject = dynamic_cast<E3dCompoundObject*>(pObj))
{
// related scene
- pScene = static_cast<E3dCompoundObject*>(pObj)->getRootE3dSceneFromE3dObject();
+ pScene = pCompoundObject->getRootE3dSceneFromE3dObject();
if(nullptr != pScene && !IsObjMarked(pScene))
{
@@ -256,9 +256,9 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
}
}
// Reset all selection flags
- if(pObj && dynamic_cast< const E3dObject*>(pObj) != nullptr)
+ if(auto p3dObject = dynamic_cast< const E3dObject*>(pObj))
{
- pScene = static_cast<E3dObject*>(pObj)->getRootE3dSceneFromE3dObject();
+ pScene = p3dObject->getRootE3dSceneFromE3dObject();
if(nullptr != pScene)
{
@@ -274,10 +274,10 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
{
SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
- if(pObj && dynamic_cast< const E3dCompoundObject*>(pObj) != nullptr)
+ if(auto pCompoundObject = dynamic_cast<E3dCompoundObject*>(pObj))
{
// related scene
- pScene = static_cast<E3dCompoundObject*>(pObj)->getRootE3dSceneFromE3dObject();
+ pScene = pCompoundObject->getRootE3dSceneFromE3dObject();
if(nullptr != pScene)
{
@@ -289,10 +289,9 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
{
SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
- if(pObj && dynamic_cast< const E3dObject*>(pObj) != nullptr)
+ if(auto p3DObj = dynamic_cast<E3dObject*>(pObj))
{
// Select object
- E3dObject* p3DObj = static_cast<E3dObject*>(pObj);
p3DObj->SetSelected(true);
pScene = p3DObj->getRootE3dSceneFromE3dObject();
}
@@ -312,10 +311,10 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
{
SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
- if(pObj && dynamic_cast< const E3dCompoundObject*>(pObj) != nullptr)
+ if(auto pCompoundObject = dynamic_cast<E3dCompoundObject*>(pObj))
{
// related scene
- pScene = static_cast<E3dCompoundObject*>(pObj)->getRootE3dSceneFromE3dObject();
+ pScene = pCompoundObject->getRootE3dSceneFromE3dObject();
if(nullptr != pScene)
{
@@ -345,7 +344,7 @@ SdrModel* E3dView::GetMarkedObjModel() const
{
const SdrObject* pObj = GetMarkedObjectByIndex(nObjs);
- if(!bSpecialHandling && pObj && dynamic_cast< const E3dCompoundObject*>(pObj) != nullptr)
+ if(!bSpecialHandling && dynamic_cast< const E3dCompoundObject*>(pObj))
{
// if the object is selected, but it's scene not,
// we need special handling
@@ -357,10 +356,10 @@ SdrModel* E3dView::GetMarkedObjModel() const
}
}
- if(pObj && dynamic_cast< const E3dObject*>(pObj) != nullptr)
+ if(auto p3dObject = dynamic_cast< const E3dObject*>(pObj))
{
// reset all selection flags at 3D objects
- pScene = static_cast<const E3dObject*>(pObj)->getRootE3dSceneFromE3dObject();
+ pScene = p3dObject->getRootE3dSceneFromE3dObject();
if(nullptr != pScene)
{
@@ -384,10 +383,9 @@ SdrModel* E3dView::GetMarkedObjModel() const
{
SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
- if(pObj && dynamic_cast< const E3dCompoundObject*>(pObj) != nullptr)
+ if(auto p3DObj = dynamic_cast<E3dCompoundObject*>(pObj))
{
// mark object, but not scenes
- E3dCompoundObject* p3DObj = static_cast<E3dCompoundObject*>(pObj);
p3DObj->SetSelected(true);
aSelectedSnapRect.Union(p3DObj->GetSnapRect());
}
@@ -404,9 +402,9 @@ SdrModel* E3dView::GetMarkedObjModel() const
{
SdrObject *pObj = aOldML.GetMark(nObjs)->GetMarkedSdrObj();
- if(pObj && dynamic_cast< const E3dObject* >(pObj) != nullptr)
+ if(auto p3dObject = dynamic_cast< E3dObject* >(pObj))
{
- pScene = static_cast<E3dObject*>(pObj)->getRootE3dSceneFromE3dObject();
+ pScene = p3dObject->getRootE3dSceneFromE3dObject();
if(nullptr != pScene && !IsObjMarked(pScene) && GetSdrPageView())
{
@@ -1527,9 +1525,9 @@ bool E3dView::IsBreak3DObjPossible() const
{
SdrObject* pObj = GetMarkedObjectByIndex(i);
- if (pObj && dynamic_cast< const E3dObject* >(pObj) != nullptr)
+ if (auto p3dObject = dynamic_cast< E3dObject* >(pObj))
{
- if(!(static_cast<E3dObject*>(pObj)->IsBreakObjPossible()))
+ if(!p3dObject->IsBreakObjPossible())
return false;
}
else
@@ -1603,9 +1601,9 @@ void E3dView::CheckPossibilities()
for(size_t nObjs = 0; (nObjs < nMarkCnt) && !bCoumpound; ++nObjs)
{
SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
- if(pObj && dynamic_cast< const E3dCompoundObject* >(pObj) != nullptr)
+ if(dynamic_cast< const E3dCompoundObject* >(pObj))
bCoumpound = true;
- if(pObj && dynamic_cast< const E3dObject* >(pObj) != nullptr)
+ if(dynamic_cast< const E3dObject* >(pObj))
b3DObject = true;
}
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index 763c1904107c..5732394ddf1c 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -1272,7 +1272,7 @@ namespace
while ( aIter.IsMore() )
{
SdrObject* pObject = aIter.Next();
- SdrUnoObj* pUnoObject = pObject ? dynamic_cast<SdrUnoObj*>( pObject ) : nullptr;
+ SdrUnoObj* pUnoObject = dynamic_cast<SdrUnoObj*>( pObject );
if ( !pUnoObject )
continue;
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index cfc0d7ba420d..3b46b5806320 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -1086,7 +1086,7 @@ bool FmXFormShell::executeControlConversionSlot_Lock(const Reference<XFormCompon
return false;
SdrPage* pPage = m_pShell->GetCurPage();
- FmFormPage* pFormPage = pPage ? dynamic_cast< FmFormPage* >( pPage ) : nullptr;
+ FmFormPage* pFormPage = dynamic_cast< FmFormPage* >( pPage );
OSL_ENSURE( pFormPage, "FmXFormShell::executeControlConversionSlot: no current (form) page!" );
if ( !pFormPage )
return false;
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 805aca14580e..a4a59c701c1a 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -683,7 +683,7 @@ namespace svxform
bool NavigatorTree::IsFormComponentEntry( SvTreeListEntry const * pEntry )
{
FmEntryData* pEntryData = static_cast<FmEntryData*>(pEntry->GetUserData());
- return pEntryData && dynamic_cast<const FmControlData*>( pEntryData) != nullptr;
+ return dynamic_cast<const FmControlData*>( pEntryData) != nullptr;
}
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index 9ae59cf81908..3e20a734582a 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -594,8 +594,8 @@ namespace svxform
)
{
FmEntryData* pData = FindData(xOld, GetRootList());
- assert(pData && dynamic_cast<const FmControlData*>( pData) != nullptr); //NavigatorTreeModel::ReplaceFormComponent : invalid argument
- if (!pData || dynamic_cast<const FmControlData*>( pData) == nullptr)
+ assert(dynamic_cast<const FmControlData*>( pData)); //NavigatorTreeModel::ReplaceFormComponent : invalid argument
+ if (!dynamic_cast<const FmControlData*>( pData))
return;
static_cast<FmControlData*>(pData)->ModelReplaced(xNew);
diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx
index 696e42b78f19..4548c796489a 100644
--- a/svx/source/sdr/properties/e3dsceneproperties.cxx
+++ b/svx/source/sdr/properties/e3dsceneproperties.cxx
@@ -75,7 +75,7 @@ namespace sdr
{
SdrObject* pObj = pSub->GetObj(a);
- if(pObj && dynamic_cast<const E3dCompoundObject* >(pObj) != nullptr)
+ if(dynamic_cast<const E3dCompoundObject* >(pObj))
{
const SfxItemSet& rSet = pObj->GetMergedItemSet();
SfxWhichIter aIter(rSet);
@@ -131,7 +131,7 @@ namespace sdr
{
SdrObject* pObj = pSub->GetObj(a);
- if(pObj && dynamic_cast<const E3dCompoundObject* >(pObj) != nullptr)
+ if(dynamic_cast<const E3dCompoundObject* >(pObj))
{
// set merged ItemSet at contained 3d object.
pObj->SetMergedItemSet(*pNewSet, bClearAllItems);
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index 1ca04d65a628..2ce79e9be992 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -464,7 +464,7 @@ namespace sdr
{
const SvxFieldData* pData = pFieldItem->GetField();
- if(pData && dynamic_cast<const SvxURLField*>( pData) != nullptr)
+ if(dynamic_cast<const SvxURLField*>( pData))
{
bHasURL = true;
break;
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
index 3205dccd32f0..1659a35c1f0e 100644
--- a/svx/source/stbctrls/pszctrl.cxx
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -275,8 +275,8 @@ void SvxPosSizeStatusBarControl::StateChanged( sal_uInt16 nSID, SfxItemState eSt
if ( eState == SfxItemState::DEFAULT )
{
pImpl->bHasMenu = true;
- if ( pState && dynamic_cast< const SfxUInt32Item* >(pState) != nullptr )
- pImpl->nFunctionSet = static_cast<const SfxUInt32Item*>(pState)->GetValue();
+ if ( auto pUInt32Item = dynamic_cast< const SfxUInt32Item* >(pState) )
+ pImpl->nFunctionSet = pUInt32Item->GetValue();
}
else
pImpl->bHasMenu = false;
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx
index 30d64a784f86..31ac45130533 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -255,7 +255,7 @@ namespace
SdrPage* pPage = rPageView.GetPage();
SdrObject* pObjA = pPage->GetObj(0);
- if(pObjA && dynamic_cast<const SdrPathObj*>( pObjA) != nullptr)
+ if(dynamic_cast<const SdrPathObj*>( pObjA))
{
basegfx::B2DPolyPolygon aPolyA(pObjA->GetPathPoly());
aPolyA = basegfx::utils::correctOrientations(aPolyA);
@@ -266,7 +266,7 @@ namespace
{
SdrObject* pObjB = pPage->GetObj(a);
- if(pObjB && dynamic_cast<const SdrPathObj*>( pObjB) != nullptr)
+ if(dynamic_cast<const SdrPathObj*>( pObjB))
{
basegfx::B2DPolyPolygon aCandidate(pObjB->GetPathPoly());
aCandidate = basegfx::utils::correctOrientations(aCandidate);
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index d826a2f12422..46dfcc322ab7 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -3602,7 +3602,7 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/)
// SDrObject destructor
pFullDragClone.reset(pSdrObject->getFullDragClone());
- if(pFullDragClone && dynamic_cast< SdrGrafObj* >(pFullDragClone.get()))
+ if(dynamic_cast< SdrGrafObj* >(pFullDragClone.get()))
{
bExternal = true;
pExternalSdrObject = pSdrObject;
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 55a5b8f36478..6c7ccedbb4dc 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -271,7 +271,7 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl
for(size_t a=0; !b3DObjSelected && a<GetMarkedObjectCount(); ++a)
{
SdrObject* pObj = GetMarkedObjectByIndex(a);
- if(pObj && dynamic_cast< const E3dObject* >(pObj) != nullptr)
+ if(dynamic_cast< const E3dObject* >(pObj))
b3DObjSelected = true;
}
// If yes, allow shear even when !IsShearAllowed,
@@ -624,9 +624,8 @@ bool SdrDragView::ImpBegInsObjPoint(bool bIdxZwang, const Point& rPnt, bool bNew
{
bool bRet(false);
- if(mpMarkedObj && dynamic_cast<const SdrPathObj*>( mpMarkedObj) != nullptr)
+ if(auto pMarkedPath = dynamic_cast<SdrPathObj*>( mpMarkedObj))
{
- SdrPathObj* pMarkedPath = static_cast<SdrPathObj*>(mpMarkedObj);
BrkAction();
mpInsPointUndo = dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mpMarkedObj) );
DBG_ASSERT( mpInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
@@ -853,8 +852,8 @@ void SdrDragView::SetDragStripes(bool bOn)
bool SdrDragView::IsOrthoDesired() const
{
- if(mpCurrentSdrDragMethod && (dynamic_cast< const SdrDragObjOwn* >( mpCurrentSdrDragMethod.get() ) != nullptr
- || dynamic_cast< const SdrDragResize* >(mpCurrentSdrDragMethod.get()) != nullptr))
+ if( dynamic_cast< const SdrDragObjOwn* >( mpCurrentSdrDragMethod.get() )
+ || dynamic_cast< const SdrDragResize* >(mpCurrentSdrDragMethod.get() ))
{
return bOrthoDesiredOnMarked;
}
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 4d9b24e52e41..7783a14dab88 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -662,8 +662,7 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
{
SdrGrafObj* pObj = static_cast<SdrGrafObj*>( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
- if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr &&
- ( pObj->GetGraphicType() != GraphicType::NONE ) &&
+ if( ( pObj->GetGraphicType() != GraphicType::NONE ) &&
( pObj->GetGraphicType() != GraphicType::Default ) )
{
SfxItemSet aGrfAttr( rPool, svl::Items<SDRATTR_GRAFCROP, SDRATTR_GRAFCROP>{} );
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index 62bf16fd30fc..872a63ac1315 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -699,9 +699,9 @@ VclPtr<SfxPopupWindow> SvxTableToolBoxControl::CreatePopupWindow()
void SvxTableToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
{
- if ( pState && dynamic_cast<const SfxUInt16Item* >(pState) != nullptr )
+ if ( auto pUInt16Item = dynamic_cast<const SfxUInt16Item* >(pState) )
{
- sal_Int16 nValue = static_cast< const SfxUInt16Item* >( pState )->GetValue();
+ sal_Int16 nValue = pUInt16Item->GetValue();
bEnabled = ( nValue != 0 );
}
else
diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx
index 8209c41e8f28..395f51eef891 100644
--- a/svx/source/tbxctrls/lboxctrl.cxx
+++ b/svx/source/tbxctrls/lboxctrl.cxx
@@ -197,11 +197,10 @@ void SvxUndoRedoControl::StateChanged(
ToolBox& rBox = GetToolBox();
rBox.SetQuickHelpText( GetId(), aDefaultTooltip );
}
- else if ( pState && dynamic_cast<const SfxStringItem*>( pState) != nullptr )
+ else if ( auto pStringItem = dynamic_cast<const SfxStringItem*>( pState) )
{
- const SfxStringItem& rItem = *static_cast<const SfxStringItem *>(pState);
ToolBox& rBox = GetToolBox();
- const OUString& aQuickHelpText = rItem.GetValue();
+ const OUString& aQuickHelpText = pStringItem->GetValue();
rBox.SetQuickHelpText( GetId(), aQuickHelpText );
}
GetToolBox().EnableItem( GetId(),
@@ -211,13 +210,9 @@ void SvxUndoRedoControl::StateChanged(
{
aUndoRedoList.clear();
- if ( pState && dynamic_cast<const SfxStringListItem*>( pState) != nullptr )
+ if ( auto pStringListItem = dynamic_cast<const SfxStringListItem*>( pState) )
{
- const SfxStringListItem &rItem = *static_cast<const SfxStringListItem *>(pState);
-
- const std::vector<OUString> &aLst = rItem.GetList();
- for(const auto & i : aLst)
- aUndoRedoList.push_back( i );
+ aUndoRedoList = pStringListItem->GetList();
}
}
}
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 10ca0115120f..f26249b451dc 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -163,7 +163,7 @@ void SvxLineStyleToolBoxControl::Update( const SfxPoolItem* pState )
}
}
- if ( pState && ( dynamic_cast<const SvxDashListItem*>( pState) != nullptr ) )
+ if ( auto pDashListItem = dynamic_cast<const SvxDashListItem*>( pState) )
{
// The list of line styles has changed
SvxLineBox* pBox = static_cast<SvxLineBox*>(GetToolBox().GetItemWindow( GetId() ));
@@ -173,7 +173,7 @@ void SvxLineStyleToolBoxControl::Update( const SfxPoolItem* pState )
pBox->Clear();
pBox->InsertEntry( SvxResId(RID_SVXSTR_INVISIBLE) );
pBox->InsertEntry( SvxResId(RID_SVXSTR_SOLID) );
- pBox->Fill( static_cast<const SvxDashListItem*>(pState)->GetDashList() );
+ pBox->Fill( pDashListItem->GetDashList() );
pBox->SelectEntry( aString );
}
}
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index fc3fb3b22eb9..c929114e82cf 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -340,7 +340,7 @@ IMPL_LINK(GraphicExporter, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
else if( mnPageNumber != -1 )
{
const SvxFieldData* pField = pInfo->GetField().GetField();
- if( pField && dynamic_cast<const SvxPageField*>( pField) != nullptr )
+ if( dynamic_cast<const SvxPageField*>( pField) )
{
OUString aPageNumValue;
bool bUpper = false;
@@ -833,7 +833,7 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
if( !bVectorType )
{
SdrObject* pObj = aShapes.front();
- if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && !static_cast<SdrGrafObj*>(pObj)->HasText() )
+ if( dynamic_cast<const SdrGrafObj*>( pObj) && !static_cast<SdrGrafObj*>(pObj)->HasText() )
{
aGraphic = static_cast<SdrGrafObj*>(pObj)->GetTransformedGraphic();
if ( aGraphic.GetType() == GraphicType::Bitmap )
@@ -859,7 +859,7 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
else if( rSettings.mbScrollText )
{
SdrObject* pObj = aShapes.front();
- if( pObj && dynamic_cast<const SdrTextObj*>( pObj) != nullptr
+ if( dynamic_cast<const SdrTextObj*>( pObj)
&& static_cast<SdrTextObj*>(pObj)->HasText() )
{
tools::Rectangle aScrollRectangle;
diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx
index c60e6c1a5d27..dbdfb5a2a79b 100644
--- a/svx/source/unogallery/unogaltheme.cxx
+++ b/svx/source/unogallery/unogaltheme.cxx
@@ -235,7 +235,7 @@ void SAL_CALL GalleryTheme::update( )
{
GalleryDrawingModel* pModel = GalleryDrawingModel::getImplementation( Drawing );
- if( pModel && pModel->GetDoc() && dynamic_cast<const FmFormModel*>(pModel->GetDoc()) != nullptr )
+ if( pModel && dynamic_cast<const FmFormModel*>(pModel->GetDoc()) )
{
// Here we're inserting something that's already a gallery theme drawing
nIndex = ::std::max( ::std::min( nIndex, getCount() ), sal_Int32( 0 ) );