tdf#161853 vcl: Pass vector by const ref instead of pointer
Pass the vector of rectangles by const ref instead of
as pointer for both variants of
`SvxIconChoiceCtrl_Impl::SelectRect`, which also
makes it clearer that this is never nullptr.
Change-Id: I10c9ff27602128eb878d03125d966e1fbf198237
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169797
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
diff --git a/vcl/source/control/imivctl.hxx b/vcl/source/control/imivctl.hxx
index 569e8e4..a139529 100644
--- a/vcl/source/control/imivctl.hxx
+++ b/vcl/source/control/imivctl.hxx
@@ -194,7 +194,7 @@ class SvxIconChoiceCtrl_Impl
SvxIconChoiceCtrlEntry* pEntry1,
SvxIconChoiceCtrlEntry* pEntry2,
bool bAdd,
std::vector<tools::Rectangle>* pOtherRects
const std::vector<tools::Rectangle>& rOtherRects
);
void SelectRange(
@@ -365,7 +365,7 @@ public:
void SelectRect(
const tools::Rectangle&,
bool bAdd,
std::vector<tools::Rectangle>* pOtherRects
const std::vector<tools::Rectangle>& rOtherRects
);
void MakeVisible(
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index bb811e1..f8aaf42 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -633,7 +633,7 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt)
aRect.Union( aTempRect );
}
aCurSelectionRect = aRect;
SelectRect( aRect, bool(nFlags & IconChoiceFlags::AddMode), &aSelectedRectList );
SelectRect(aRect, bool(nFlags & IconChoiceFlags::AddMode), aSelectedRectList);
}
else if( rMEvt.IsMod1() )
{
@@ -828,7 +828,7 @@ void SvxIconChoiceCtrl_Impl::SetCursor_Impl( SvxIconChoiceCtrlEntry* pOldCursor,
if ( nWinBits & WB_ALIGN_LEFT )
SelectRange( pAnchor, pNewCursor, bool(nFlags & IconChoiceFlags::AddMode) );
else
SelectRect(pAnchor,pNewCursor, bool(nFlags & IconChoiceFlags::AddMode), &aSelectedRectList);
SelectRect(pAnchor,pNewCursor, bool(nFlags & IconChoiceFlags::AddMode), aSelectedRectList);
}
else
{
@@ -2219,16 +2219,16 @@ static tools::Rectangle GetHotSpot( const tools::Rectangle& rRect )
}
void SvxIconChoiceCtrl_Impl::SelectRect( SvxIconChoiceCtrlEntry* pEntry1, SvxIconChoiceCtrlEntry* pEntry2,
bool bAdd, std::vector<tools::Rectangle>* pOtherRects )
bool bAdd, const std::vector<tools::Rectangle>& rOtherRects)
{
DBG_ASSERT(pEntry1 && pEntry2,"SelectEntry: Invalid Entry-Ptr");
tools::Rectangle aRect( GetEntryBoundRect( pEntry1 ) );
aRect.Union( GetEntryBoundRect( pEntry2 ) );
SelectRect( aRect, bAdd, pOtherRects );
SelectRect(aRect, bAdd, rOtherRects);
}
void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAdd,
std::vector<tools::Rectangle>* pOtherRects )
const std::vector<tools::Rectangle>& rOtherRects)
{
aCurSelectionRect = rRect;
if( maZOrderList.empty() )
@@ -2244,7 +2244,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAd
tools::Rectangle aRect( rRect );
aRect.Normalize();
bool bCalcOverlap = (bAdd && pOtherRects && !pOtherRects->empty());
bool bCalcOverlap = (bAdd && !rOtherRects.empty());
bool bResetClipRegion = false;
if( !pView->GetOutDev()->IsClipRegion() )
@@ -2264,7 +2264,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAd
bool bOverlaps;
if( bCalcOverlap )
bOverlaps = IsOver(*pOtherRects, aBoundRect);
bOverlaps = IsOver(rOtherRects, aBoundRect);
else
bOverlaps = false;
bool bOver = aRect.Overlaps( aBoundRect );