summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-01-10 13:58:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-10 14:59:31 +0100
commit8f453c674f19188360ba5895c2bd9bd80273a83b (patch)
treece569bb8caeaea0b110e1e23e845716cb841588f /svx/source
parentc5367ee0a60966b755e726de6d175dfcd1630741 (diff)
static_cast after dynamic_cast
Change-Id: I3792ddadad9582a7e6f4740829c081d9571ddaff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109049 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/form/navigatortree.cxx7
-rw-r--r--svx/source/svdraw/svdcrtv.cxx9
-rw-r--r--svx/source/svdraw/svddrgv.cxx4
-rw-r--r--svx/source/svdraw/svdpage.cxx35
-rw-r--r--svx/source/tbxctrls/colrctrl.cxx14
5 files changed, 33 insertions, 36 deletions
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 310a1dd1b507..4d6fc09559b8 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -595,13 +595,12 @@ namespace svxform
m_xTreeView->set_image(*m_xRootEntry, RID_SVXBMP_FORMS);
m_xTreeView->set_sensitive(*m_xRootEntry, true);
}
- else if (dynamic_cast<const FmNavRequestSelectHint*>(&rHint))
+ else if (auto pSelectHint = dynamic_cast<FmNavRequestSelectHint*>(const_cast<SfxHint*>(&rHint)))
{
- FmNavRequestSelectHint* pershHint = const_cast<FmNavRequestSelectHint*>(static_cast<const FmNavRequestSelectHint*>(&rHint));
- FmEntryDataArray& arredToSelect = pershHint->GetItems();
+ FmEntryDataArray& arredToSelect = pSelectHint->GetItems();
SynchronizeSelection(arredToSelect);
- if (pershHint->IsMixedSelection())
+ if (pSelectHint->IsMixedSelection())
// in this case I deselect all, although the view had a mixed selection
// during next selection, I must adapt the navigator to the view
m_bPrevSelectionMixed = true;
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index de4d6b0ef466..936bbbfb269a 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -804,19 +804,18 @@ void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/)
}
}
- if(dynamic_cast<const SdrPathObj*>( pCurrentCreate) != nullptr)
+ if(auto pPathObj = dynamic_cast<SdrPathObj*>( pCurrentCreate))
{
// The up-to-now created path needs to be set at the object to have something
// that can be visualized
- SdrPathObj& rPathObj(static_cast<SdrPathObj&>(*pCurrentCreate));
- const basegfx::B2DPolyPolygon aCurrentPolyPolygon(rPathObj.getObjectPolyPolygon(maDragStat));
+ const basegfx::B2DPolyPolygon aCurrentPolyPolygon(pPathObj->getObjectPolyPolygon(maDragStat));
if(aCurrentPolyPolygon.count())
{
- rPathObj.NbcSetPathPoly(aCurrentPolyPolygon);
+ pPathObj->NbcSetPathPoly(aCurrentPolyPolygon);
}
- aDragPolyPolygon = rPathObj.getDragPolyPolygon(maDragStat);
+ aDragPolyPolygon = pPathObj->getDragPolyPolygon(maDragStat);
}
// use the SdrObject directly for overlay
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 62aea371e758..bd5c0249f31f 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -145,9 +145,9 @@ bool SdrDragView::TakeDragObjAnchorPos(Point& rPos, bool bTR ) const
dynamic_cast<const SdrDragMovHdl*>( mpCurrentSdrDragMethod.get() ) == nullptr) // not when moving handles
{
SdrObject* pObj=GetMarkedObjectByIndex(0);
- if (dynamic_cast<const SdrCaptionObj*>( pObj) != nullptr)
+ if (auto pCaptionObj = dynamic_cast<SdrCaptionObj*>(pObj))
{
- Point aPt(static_cast<SdrCaptionObj*>(pObj)->GetTailPos());
+ Point aPt(pCaptionObj->GetTailPos());
bool bTail=meDragHdl==SdrHdlKind::Poly; // drag tail
bool bOwn=dynamic_cast<const SdrDragObjOwn*>( mpCurrentSdrDragMethod.get() ) != nullptr; // specific to object
if (!bTail)
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index c1f8980f4236..e199d38b43c5 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -793,28 +793,27 @@ void SdrObjList::UnGroupObj( size_t nObjNum )
if( pUngroupObj )
{
SdrObjList* pSrcLst = pUngroupObj->GetSubList();
- if( dynamic_cast<const SdrObjGroup*>( pUngroupObj) != nullptr && pSrcLst )
- {
- SdrObjGroup* pUngroupGroup = static_cast< SdrObjGroup* > (pUngroupObj);
+ if(pSrcLst)
+ if(auto pUngroupGroup = dynamic_cast<SdrObjGroup*>( pUngroupObj))
+ {
+ // ungroup recursively (has to be head recursion,
+ // otherwise our indices will get trashed when doing it in
+ // the loop)
+ pSrcLst->FlattenGroups();
- // ungroup recursively (has to be head recursion,
- // otherwise our indices will get trashed when doing it in
- // the loop)
- pSrcLst->FlattenGroups();
+ // the position at which we insert the members of rUngroupGroup
+ size_t nInsertPos( pUngroupGroup->GetOrdNum() );
- // the position at which we insert the members of rUngroupGroup
- size_t nInsertPos( pUngroupGroup->GetOrdNum() );
+ const size_t nCount = pSrcLst->GetObjCount();
+ for( size_t i=0; i<nCount; ++i )
+ {
+ SdrObject* pObj = pSrcLst->RemoveObject(0);
+ InsertObject(pObj, nInsertPos);
+ ++nInsertPos;
+ }
- const size_t nCount = pSrcLst->GetObjCount();
- for( size_t i=0; i<nCount; ++i )
- {
- SdrObject* pObj = pSrcLst->RemoveObject(0);
- InsertObject(pObj, nInsertPos);
- ++nInsertPos;
+ RemoveObject(nInsertPos);
}
-
- RemoveObject(nInsertPos);
- }
}
#ifdef DBG_UTIL
else
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
index e38c49e4916c..ae4153954130 100644
--- a/svx/source/tbxctrls/colrctrl.cxx
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -249,13 +249,13 @@ void SvxColorDockingWindow::dispose()
void SvxColorDockingWindow::Notify( SfxBroadcaster& , const SfxHint& rHint )
{
const SfxPoolItemHint* pPoolItemHint = dynamic_cast<const SfxPoolItemHint*>(&rHint);
- if ( pPoolItemHint
- && ( dynamic_cast<const SvxColorListItem*>(pPoolItemHint->GetObject()) != nullptr ) )
- {
- // The list of colors has changed
- pColorList = static_cast<SvxColorListItem*>( pPoolItemHint->GetObject() )->GetColorList();
- FillValueSet();
- }
+ if ( pPoolItemHint )
+ if (auto pColorListItem = dynamic_cast<const SvxColorListItem*>(pPoolItemHint->GetObject()))
+ {
+ // The list of colors has changed
+ pColorList = pColorListItem->GetColorList();
+ FillValueSet();
+ }
}
void SvxColorDockingWindow::FillValueSet()