summaryrefslogtreecommitdiff
path: root/vcl/source/control
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-07-03 10:44:46 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-07-04 06:32:44 +0200
commitc04fd602ea58b9a373b3363441f0e5971165c1a6 (patch)
treea8b20ba9be0c4410330f3233e0a7892ea9d935df /vcl/source/control
parent5b94bedf779f36f2b77b04171e7f6cc28cecbfc6 (diff)
tdf#161853 Drop always null SvxIconChoiceCtrl_Impl::pHead
With Change-Id: I13ae34ffc51972bef746e53fcd46e65ea9fbf82c Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Jul 3 10:38:56 2024 +0200 tdf#161853 Drop unused SvxIconChoiceCtrl_Impl::InitPredecessors in place, it can be seen that `SvxIconChoiceCtrl_Impl::pHead` is always nullptr as it's initialized to that and never assigned a different value afterwards. Therefore, drop it and all related code. Drop the now unused `bKeepPredecessors` param from `SvxIconChoiceCtrl_Impl::Arrange` and `SvxIconChoiceCtrl_Impl::ImpArrange`. (Use `git show --ignore-space change` to more clearly see the "actual changes"). Change-Id: I44eceb41866bb6d99ccea032f98637a42dabc9ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169914 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
Diffstat (limited to 'vcl/source/control')
-rw-r--r--vcl/source/control/imivctl.hxx11
-rw-r--r--vcl/source/control/imivctl1.cxx98
-rw-r--r--vcl/source/control/ivctrl.cxx8
3 files changed, 23 insertions, 94 deletions
diff --git a/vcl/source/control/imivctl.hxx b/vcl/source/control/imivctl.hxx
index b5d31de8e6e0..a782b2a56f58 100644
--- a/vcl/source/control/imivctl.hxx
+++ b/vcl/source/control/imivctl.hxx
@@ -133,7 +133,6 @@ class SvxIconChoiceCtrl_Impl
DrawTextFlags nCurTextDrawFlags;
ImplSVEvent * nUserEventAdjustScrBars;
SvxIconChoiceCtrlEntry* pCurHighlightFrame;
- SvxIconChoiceCtrlEntry* pHead = nullptr; // top left entry
SvxIconChoiceCtrlEntry* pCursor;
LocalFocus aFocus; // Data for focusrect
::vcl::AccessibleFactoryAccess aAccFactory;
@@ -143,7 +142,7 @@ class SvxIconChoiceCtrl_Impl
void ShowCursor( bool bShow );
- void ImpArrange( bool bKeepPredecessors );
+ void ImpArrange();
void AdjustVirtSize( const tools::Rectangle& );
void ResetVirtSize();
void CheckScrollBars();
@@ -180,8 +179,6 @@ class SvxIconChoiceCtrl_Impl
void ClipAtVirtOutRect( tools::Rectangle& rRect ) const;
GridId GetPredecessorGrid( const Point& rDocPos) const;
- void ClearPredecessors();
-
bool CheckVerScrollBar();
bool CheckHorScrollBar();
void CancelUserEvents();
@@ -252,11 +249,7 @@ public:
void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, bool bBound = true );
- void Arrange(
- bool bKeepPredecessors,
- tools::Long nSetMaxVirtWidth,
- tools::Long nSetMaxVirtHeight
- );
+ void Arrange(tools::Long nSetMaxVirtWidth, tools::Long nSetMaxVirtHeight);
tools::Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* );
tools::Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = nullptr );
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index c3402a5ff8fc..960ad1ed9822 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -63,7 +63,6 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
pView(pCurView), nMaxVirtWidth(DEFAULT_MAX_VIRT_WIDTH), nMaxVirtHeight(DEFAULT_MAX_VIRT_HEIGHT),
nFlags(IconChoiceFlags::NONE), nUserEventAdjustScrBars(nullptr),
pCurHighlightFrame(nullptr),
- pHead(nullptr),
pCursor(nullptr),
ePositionMode(SvxIconChoiceCtrlPositionMode::Free)
{
@@ -177,9 +176,6 @@ void SvxIconChoiceCtrl_Impl::InsertEntry( std::unique_ptr<SvxIconChoiceCtrlEntry
maEntries.push_back( std::move(pEntry1) );
}
- if( pHead )
- pEntry->SetBacklink( pHead->pblink );
-
if( (nFlags & IconChoiceFlags::EntryListPosValid) && nPos >= maEntries.size() - 1 )
pEntry->nPos = maEntries.size() - 1;
else
@@ -351,22 +347,7 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const tools::Rectangle& rRect )
DocRectChanged();
}
-void SvxIconChoiceCtrl_Impl::ClearPredecessors()
-{
- if( pHead )
- {
- size_t nCount = maEntries.size();
- for( size_t nCur = 0; nCur < nCount; nCur++ )
- {
- SvxIconChoiceCtrlEntry* pCur = maEntries[ nCur ].get();
- pCur->pflink = nullptr;
- pCur->pblink = nullptr;
- }
- pHead = nullptr;
- }
-}
-
-void SvxIconChoiceCtrl_Impl::Arrange( bool bKeepPredecessors, tools::Long nSetMaxVirtWidth, tools::Long nSetMaxVirtHeight )
+void SvxIconChoiceCtrl_Impl::Arrange(tools::Long nSetMaxVirtWidth, tools::Long nSetMaxVirtHeight )
{
if ( nSetMaxVirtWidth != 0 )
nMaxVirtWidth = nSetMaxVirtWidth;
@@ -378,17 +359,15 @@ void SvxIconChoiceCtrl_Impl::Arrange( bool bKeepPredecessors, tools::Long nSetMa
else
nMaxVirtHeight = aOutputSize.Height();
- ImpArrange( bKeepPredecessors );
+ ImpArrange();
}
-void SvxIconChoiceCtrl_Impl::ImpArrange( bool bKeepPredecessors )
+void SvxIconChoiceCtrl_Impl::ImpArrange()
{
aAutoArrangeIdle.Stop();
nFlags |= IconChoiceFlags::Arranging;
ShowCursor( false );
ResetVirtSize();
- if( !bKeepPredecessors )
- ClearPredecessors();
bBoundRectsDirty = false;
SetOrigin( Point() );
VisRectChanged();
@@ -1335,41 +1314,18 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart()
SvxIconChoiceCtrlEntry* pEntry;
const size_t nCount = maEntries.size();
- if( !IsAutoArrange() || !pHead )
+ for( nCur = 0; nCur < nCount; nCur++ )
{
- for( nCur = 0; nCur < nCount; nCur++ )
+ pEntry = maEntries[ nCur ].get();
+ if( IsBoundingRectValid( pEntry->aRect ))
{
- pEntry = maEntries[ nCur ].get();
- if( IsBoundingRectValid( pEntry->aRect ))
- {
- Size aBoundSize( pEntry->aRect.GetSize() );
- if( aBoundSize.Height() > nMaxBoundHeight )
- nMaxBoundHeight = aBoundSize.Height();
- }
- else
- FindBoundingRect( pEntry );
- maZOrderList.push_back( pEntry );
- }
- }
- else
- {
- nCur = 0;
- pEntry = pHead;
- while( nCur != nCount )
- {
- DBG_ASSERT(pEntry->pflink&&pEntry->pblink,"SvxIconChoiceCtrl_Impl::RecalcAllBoundingRect > Bad link(s)");
- if( IsBoundingRectValid( pEntry->aRect ))
- {
- Size aBoundSize( pEntry->aRect.GetSize() );
- if( aBoundSize.Height() > nMaxBoundHeight )
- nMaxBoundHeight = aBoundSize.Height();
- }
- else
- FindBoundingRect( pEntry );
- maZOrderList.push_back( pEntry );
- pEntry = pEntry->pflink;
- nCur++;
+ Size aBoundSize( pEntry->aRect.GetSize() );
+ if( aBoundSize.Height() > nMaxBoundHeight )
+ nMaxBoundHeight = aBoundSize.Height();
}
+ else
+ FindBoundingRect( pEntry );
+ maZOrderList.push_back( pEntry );
}
AdjustScrollBars();
}
@@ -1835,7 +1791,7 @@ bool SvxIconChoiceCtrl_Impl::IsOver(const std::vector<tools::Rectangle>& rRects,
IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, AutoArrangeHdl, Timer *, void)
{
aAutoArrangeIdle.Stop();
- Arrange( IsAutoArrange(), 0, 0 );
+ Arrange(0, 0);
}
IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, VisRectChangedHdl, Timer *, void)
@@ -1953,32 +1909,12 @@ void SvxIconChoiceCtrl_Impl::InvalidateEntry( SvxIconChoiceCtrlEntry* pEntry )
SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry() const
{
size_t nCount = maEntries.size();
- if( !pHead )
- {
- for( size_t nCur = 0; nCur < nCount; nCur++ )
- {
- SvxIconChoiceCtrlEntry* pEntry = maEntries[ nCur ].get();
- if( pEntry->IsSelected() )
- {
- return pEntry;
- }
- }
- }
- else
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = pHead;
- while( nCount-- )
+ SvxIconChoiceCtrlEntry* pEntry = maEntries[ nCur ].get();
+ if( pEntry->IsSelected() )
{
- if( pEntry->IsSelected() )
- {
- return pEntry;
- }
- pEntry = pEntry->pflink;
- if( nCount && pEntry == pHead )
- {
- OSL_FAIL("SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry > infinite loop!");
- return nullptr;
- }
+ return pEntry;
}
}
return nullptr;
diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx
index 9d4da5e434ce..765f1f0b2637 100644
--- a/vcl/source/control/ivctrl.cxx
+++ b/vcl/source/control/ivctrl.cxx
@@ -151,7 +151,7 @@ void SvtIconChoiceCtrl::ArrangeIcons()
aFullSize.setWidth ( aFullSize.getWidth()+aEntryRect.GetWidth() );
}
- _pImpl->Arrange ( false, aFullSize.getWidth(), 0 );
+ _pImpl->Arrange(aFullSize.getWidth(), 0);
}
else if ( GetStyle() & WB_ALIGN_LEFT )
{
@@ -166,13 +166,13 @@ void SvtIconChoiceCtrl::ArrangeIcons()
aFullSize.setHeight ( aFullSize.getHeight()+aEntryRect.GetHeight() );
}
- _pImpl->Arrange ( false, 0, aFullSize.getHeight() );
+ _pImpl->Arrange(0, aFullSize.getHeight());
}
else
{
- _pImpl->Arrange(false, 0, 0);
+ _pImpl->Arrange(0, 0);
}
- _pImpl->Arrange( false, 0, 1000 );
+ _pImpl->Arrange(0, 1000 );
}
void SvtIconChoiceCtrl::Resize()
{