diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-07-02 12:34:57 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-07-03 08:19:58 +0200 |
commit | 35775e291d6570b29dc0120e4839c720152b5149 (patch) | |
tree | c0f7d8d00d2a53dd9940b25c5f2096c7a0478f76 /vcl/source | |
parent | 150f61fb0056b9f26796e491ffe6e3094b805236 (diff) |
tdf#161853 Drop now unused SvxIconChoiceCtrl_Impl::SelectRect etc.
`SvxIconChoiceCtrl_Impl::SelectRect` is unused since:
Change-Id: Ifd60c030b91636acc58298f0e7b97b69c1312be1
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Tue Jul 2 12:02:05 2024 +0200
tdf#161853 Simplify SvxIconChoiceCtrl_Impl::SetCursor_Impl
Drop it, and drop the `GetHotSpot` helper that was only
used by it.
Also drop `SvxIconChoiceCtrl_Impl::aCurSelectionRect`
that is by now only written to, but never read.
Change-Id: I1fb833acce1d4a0d96c45bca2eda2d5969baff77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169877
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/imivctl.hxx | 13 | ||||
-rw-r--r-- | vcl/source/control/imivctl1.cxx | 122 |
2 files changed, 0 insertions, 135 deletions
diff --git a/vcl/source/control/imivctl.hxx b/vcl/source/control/imivctl.hxx index 9ebbf3cb2a71..ecbb3020dd56 100644 --- a/vcl/source/control/imivctl.hxx +++ b/vcl/source/control/imivctl.hxx @@ -116,7 +116,6 @@ class SvxIconChoiceCtrl_Impl VclPtr<ScrollBar> aVerSBar; VclPtr<ScrollBar> aHorSBar; VclPtr<ScrollBarBox> aScrBarBox; - tools::Rectangle aCurSelectionRect; Idle aAutoArrangeIdle; Idle aDocRectChangedIdle; Idle aVisRectChangedIdle; @@ -184,12 +183,6 @@ class SvxIconChoiceCtrl_Impl void DeselectAllBut( SvxIconChoiceCtrlEntry const * ); void Center( SvxIconChoiceCtrlEntry* pEntry ) const; void CallSelectHandler(); - void SelectRect( - SvxIconChoiceCtrlEntry* pEntry1, - SvxIconChoiceCtrlEntry* pEntry2, - bool bAdd, - const std::vector<tools::Rectangle>& rOtherRects - ); tools::Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const; @@ -331,12 +324,6 @@ public: const tools::Rectangle& rEntryBoundRect ); - void SelectRect( - const tools::Rectangle&, - bool bAdd, - const std::vector<tools::Rectangle>& rOtherRects - ); - void MakeVisible( const tools::Rectangle& rDocPos, bool bInScrollBarEvent=false diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index 136226bdca82..9cc1e385fd2e 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -701,7 +701,6 @@ void SvxIconChoiceCtrl_Impl::SetCursor_Impl(SvxIconChoiceCtrlEntry* pNewCursor) SetCursor( pNewCursor ); SelectEntry( pCursor, true, false ); - aCurSelectionRect = GetEntryBoundRect( pCursor ); CallEventListeners( VclEventId::ListboxSelect, pCursor ); } @@ -2005,127 +2004,6 @@ tools::Rectangle SvxIconChoiceCtrl_Impl::CalcFocusRect( SvxIconChoiceCtrlEntry* aTextRect.Bottom()); } -// the hot spot is the inner 50% of the rectangle -static tools::Rectangle GetHotSpot( const tools::Rectangle& rRect ) -{ - tools::Rectangle aResult( rRect ); - aResult.Normalize(); - Size aSize( rRect.GetSize() ); - tools::Long nDelta = aSize.Width() / 4; - aResult.AdjustLeft(nDelta ); - aResult.AdjustRight( -nDelta ); - nDelta = aSize.Height() / 4; - aResult.AdjustTop(nDelta ); - aResult.AdjustBottom( -nDelta ); - return aResult; -} - -void SvxIconChoiceCtrl_Impl::SelectRect( SvxIconChoiceCtrlEntry* pEntry1, SvxIconChoiceCtrlEntry* pEntry2, - 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, rOtherRects); -} - -void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAdd, - const std::vector<tools::Rectangle>& rOtherRects) -{ - aCurSelectionRect = rRect; - if( maZOrderList.empty() ) - return; - - // set flag, so ToTop won't be called in Select - bool bAlreadySelectingRect(nFlags & IconChoiceFlags::SelectingRect); - nFlags |= IconChoiceFlags::SelectingRect; - - CheckBoundingRects(); - pView->PaintImmediately(); - const size_t nCount = maZOrderList.size(); - - tools::Rectangle aRect( rRect ); - aRect.Normalize(); - bool bCalcOverlap = (bAdd && !rOtherRects.empty()); - - bool bResetClipRegion = false; - if( !pView->GetOutDev()->IsClipRegion() ) - { - bResetClipRegion = true; - pView->GetOutDev()->SetClipRegion(vcl::Region(GetOutputRect())); - } - - for( size_t nPos = 0; nPos < nCount; nPos++ ) - { - SvxIconChoiceCtrlEntry* pEntry = maZOrderList[ nPos ]; - - if( !IsBoundingRectValid( pEntry->aRect )) - FindBoundingRect( pEntry ); - tools::Rectangle aBoundRect( GetHotSpot( pEntry->aRect ) ); - bool bSelected = pEntry->IsSelected(); - - bool bOverlaps; - if( bCalcOverlap ) - bOverlaps = IsOver(rOtherRects, aBoundRect); - else - bOverlaps = false; - bool bOver = aRect.Overlaps( aBoundRect ); - - if( bOver && !bOverlaps ) - { - // is inside the new selection rectangle and outside of any old one - // => select - if( !bSelected ) - SelectEntry( pEntry, true, true ); - } - else if( !bAdd ) - { - // is outside of the selection rectangle - // => deselect - if( bSelected ) - SelectEntry( pEntry, false, true ); - } - else if (bOverlaps) - { - // The entry is inside an old (=>span multiple rectangles with Ctrl) - // selection rectangle. - - // There is still a bug here! The selection status of an entry in a - // previous rectangle has to be restored, if it was touched by the - // current selection rectangle but is not inside it any more. - // For simplicity's sake, let's assume that all entries in the old - // rectangles were correctly selected. It is wrong to just deselect - // the intersection. - // Possible solution: remember a snapshot of the selection before - // spanning the rectangle. - if( aBoundRect.Overlaps( rRect)) - { - // deselect intersection between old rectangles and current rectangle - if( bSelected ) - SelectEntry( pEntry, false, true ); - } - else - { - // select entry of an old rectangle - if( !bSelected ) - SelectEntry( pEntry, true, true ); - } - } - else if( !bOver && bSelected ) - { - // this entry is completely outside the rectangle => deselect it - SelectEntry( pEntry, false, true ); - } - } - - if( !bAlreadySelectingRect ) - nFlags &= ~IconChoiceFlags::SelectingRect; - - pView->PaintImmediately(); - if( bResetClipRegion ) - pView->GetOutDev()->SetClipRegion(); -} - bool SvxIconChoiceCtrl_Impl::IsOver(const std::vector<tools::Rectangle>& rRects, const tools::Rectangle& rBoundRect) { for (const tools::Rectangle& rRect : rRects) |