diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-28 14:55:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-29 08:36:11 +0200 |
commit | 160ea29f0003812ab1d4e1f6689c608c879ef509 (patch) | |
tree | 2d5e7e652eb4b01b2611557ce9ef668bd11962e5 /vcl/source/control | |
parent | 0c12b34ac593ea5ac6615f844f709074ab1b6c1c (diff) |
maLayoutLineToPageId and maLayoutPageIdToLine are dead.
I removed the code in ImplDrawItem that added data to them,
because ImplDrawItem was only ever called with bLayout with false,
and removing the bLayout param removed that code.
That removal happened in:
commit f0f973da8560e16cba85d2c9465c3a8c4c0ebbb3
Author: Noel Grandin <noel@peralex.com>
Date: Wed Mar 16 08:49:35 2016 +0200
loplugin:constantparams in vcl/
And that happened because....
I noticed that ImplPaint was only ever called with bLayout==false,
which meant I removed that param and passed bLayout==false to
ImplDrawItem,
in:
commit 911ae0aeca443fb4b5e400ae0f939567b580e443
Author: Noel Grandin <noel@peralex.com>
Date: Fri Feb 26 09:36:26 2016 +0200
loplugin:unuseddefaultparams in /include/vcl
which was because the last call to ImplPaint with bLayout == true
was removed in:
commit a6b9d9a19fb8c5c9f166682f52941aee25b89c94
Author: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Date: Wed May 6 13:00:13 2015 +0900
refactor "TabControl" to use RenderContext
Change-Id: Id234257201726de95e2c10bfacb30670123ca8a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153713
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/control')
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index f59431401137..a2461c5a0f80 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -90,8 +90,6 @@ ImplTabItem::ImplTabItem(sal_uInt16 nId) struct ImplTabCtrlData { - std::unordered_map< int, int > maLayoutPageIdToLine; - std::unordered_map< int, int > maLayoutLineToPageId; std::vector< ImplTabItem > maItemList; VclPtr<ListBox> mpListBox; }; @@ -187,16 +185,6 @@ void TabControl::ImplInitSettings( bool bBackground ) } } -void TabControl::ImplFreeLayoutData() -{ - if( HasLayoutData() ) - { - ImplClearLayoutData(); - mpTabCtrlData->maLayoutPageIdToLine.clear(); - mpTabCtrlData->maLayoutLineToPageId.clear(); - } -} - TabControl::TabControl( vcl::Window* pParent, WinBits nStyle ) : Control( WindowType::TABCONTROL ) { @@ -215,8 +203,6 @@ void TabControl::dispose() if (pParent && pParent->IsDialog()) GetParent()->RemoveChildEventListener( LINK( this, TabControl, ImplWindowEventListener ) ); - ImplFreeLayoutData(); - // delete TabCtrl data if (mpTabCtrlData) mpTabCtrlData->mpListBox.disposeAndClear(); @@ -633,8 +619,6 @@ tools::Rectangle TabControl::ImplGetTabRect(const ImplTabItem* pItem, tools::Lon void TabControl::ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId ) { - ImplFreeLayoutData(); - ImplTabItem* pOldItem = ImplGetItem( nOldId ); ImplTabItem* pItem = ImplGetItem( nId ); TabPage* pOldPage = pOldItem ? pOldItem->mpTabPage.get() : nullptr; @@ -1276,8 +1260,6 @@ void TabControl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectang void TabControl::setAllocation(const Size &rAllocation) { - ImplFreeLayoutData(); - if ( !IsReallyShown() ) return; @@ -1645,8 +1627,6 @@ bool TabControl::DeactivatePage() void TabControl::SetTabPageSizePixel( const Size& rSize ) { - ImplFreeLayoutData(); - Size aNewSize( rSize ); aNewSize.AdjustWidth(TAB_OFFSET*2 ); tools::Rectangle aRect = ImplGetTabRect( TAB_PAGERECT, @@ -1698,7 +1678,6 @@ void TabControl::InsertPage( sal_uInt16 nPageId, const OUString& rText, if ( IsUpdateMode() ) Invalidate(); - ImplFreeLayoutData(); if( mpTabCtrlData->mpListBox ) // reposition/resize listbox Resize(); @@ -1746,8 +1725,6 @@ void TabControl::RemovePage( sal_uInt16 nPageId ) if ( IsUpdateMode() ) Invalidate(); - ImplFreeLayoutData(); - CallEventListeners( VclEventId::TabpageRemoved, reinterpret_cast<void*>(nPageId) ); } @@ -1886,8 +1863,6 @@ void TabControl::SelectTabPage( sal_uInt16 nPageId ) if ( !nPageId || (nPageId == mnCurPageId) ) return; - ImplFreeLayoutData(); - CallEventListeners( VclEventId::TabpageDeactivate, reinterpret_cast<void*>(mnCurPageId) ); if ( DeactivatePage() ) { @@ -1956,7 +1931,6 @@ void TabControl::SetPageText( sal_uInt16 nPageId, const OUString& rText ) } if ( IsUpdateMode() ) Invalidate(); - ImplFreeLayoutData(); CallEventListeners( VclEventId::TabpagePageTextChanged, reinterpret_cast<void*>(nPageId) ); } @@ -2048,65 +2022,6 @@ void TabControl::SetPageImage( sal_uInt16 i_nPageId, const Image& i_rImage ) } } -tools::Rectangle TabControl::GetCharacterBounds( sal_uInt16 nPageId, tools::Long nIndex ) const -{ - tools::Rectangle aRet; - - if( !HasLayoutData() || mpTabCtrlData->maLayoutPageIdToLine.empty() ) - FillLayoutData(); - - if( HasLayoutData() ) - { - std::unordered_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( static_cast<int>(nPageId) ); - if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) - { - Pair aPair = mxLayoutData->GetLineStartEnd( it->second ); - if( (aPair.B() - aPair.A()) >= nIndex ) - aRet = mxLayoutData->GetCharacterBounds( aPair.A() + nIndex ); - } - } - - return aRet; -} - -tools::Long TabControl::GetIndexForPoint( const Point& rPoint, sal_uInt16& rPageId ) const -{ - tools::Long nRet = -1; - - if( !HasLayoutData() || mpTabCtrlData->maLayoutPageIdToLine.empty() ) - FillLayoutData(); - - if( HasLayoutData() ) - { - int nIndex = mxLayoutData->GetIndexForPoint( rPoint ); - if( nIndex != -1 ) - { - // what line (->pageid) is this index in ? - int nLines = mxLayoutData->GetLineCount(); - int nLine = -1; - while( ++nLine < nLines ) - { - Pair aPair = mxLayoutData->GetLineStartEnd( nLine ); - if( aPair.A() <= nIndex && aPair.B() >= nIndex ) - { - nRet = nIndex - aPair.A(); - rPageId = static_cast<sal_uInt16>(mpTabCtrlData->maLayoutLineToPageId[ nLine ]); - break; - } - } - } - } - - return nRet; -} - -void TabControl::FillLayoutData() const -{ - mpTabCtrlData->maLayoutLineToPageId.clear(); - mpTabCtrlData->maLayoutPageIdToLine.clear(); - const_cast<TabControl*>(this)->Invalidate(); -} - tools::Rectangle TabControl::GetTabBounds( sal_uInt16 nPageId ) const { tools::Rectangle aRet; |