summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-06-17 19:40:23 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-06-18 20:37:12 +0200
commit35245a605f3889fb3edbdab6fbe9f9233912fc59 (patch)
treeb2ae3247789051ce4b7692dcaaef864969229ca6
parente5ef9a396b5808fc561e92216071e18815344dd9 (diff)
mbStackMode is always false now
Change-Id: I3d6c9b0cc07b3750a3f24b4cfc5138b49e62d06d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96600 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/lstbox.hxx1
-rw-r--r--vcl/inc/listbox.hxx7
-rw-r--r--vcl/source/control/imp_listbox.cxx114
-rw-r--r--vcl/source/control/listbox.cxx7
4 files changed, 14 insertions, 115 deletions
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index 403d429f2605..b5c495aacfff 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -205,7 +205,6 @@ public:
bool IsInDropDown() const;
void ToggleDropDown();
- void EnableMultiSelection( bool bMulti, bool bStackSelection );
void EnableMultiSelection( bool bMulti );
bool IsMultiSelectionEnabled() const;
diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx
index 65cd4d2089a5..0485001216b0 100644
--- a/vcl/inc/listbox.hxx
+++ b/vcl/inc/listbox.hxx
@@ -206,7 +206,6 @@ private:
bool mbSort : 1; ///< ListBox sorted
bool mbTrack : 1; ///< Tracking
bool mbMulti : 1; ///< MultiListBox
- bool mbStackMode : 1; ///< StackSelection
bool mbSimpleMode : 1; ///< SimpleMode for MultiListBox
bool mbTravelSelect : 1; ///< TravelSelect
bool mbTrackingSelect : 1; ///< Selected at a MouseMove
@@ -327,13 +326,13 @@ public:
void EnableUserDraw( bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; }
bool IsUserDrawEnabled() const { return mbUserDrawEnabled; }
- void EnableMultiSelection( bool bMulti, bool bStackMode ) { mbMulti = bMulti; mbStackMode = bStackMode; }
+ void EnableMultiSelection( bool bMulti ) { mbMulti = bMulti; }
bool IsMultiSelectionEnabled() const { return mbMulti; }
void SetMultiSelectionSimpleMode( bool bSimple ) { mbSimpleMode = bSimple; }
void EnableMouseMoveSelect( bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; }
- bool IsMouseMoveSelect() const { return mbMouseMoveSelect||mbStackMode; }
+ bool IsMouseMoveSelect() const { return mbMouseMoveSelect; }
Size CalcSize(sal_Int32 nMaxLines) const;
tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const;
@@ -459,7 +458,7 @@ public:
bool IsTravelSelect() const { return maLBWindow->IsTravelSelect(); }
bool IsTrackingSelect() const { return maLBWindow->IsTrackingSelect(); }
- void EnableMultiSelection( bool bMulti, bool bStackMode ) { maLBWindow->EnableMultiSelection( bMulti, bStackMode ); }
+ void EnableMultiSelection( bool bMulti ) { maLBWindow->EnableMultiSelection( bMulti ); }
bool IsMultiSelectionEnabled() const { return maLBWindow->IsMultiSelectionEnabled(); }
void SetMultiSelectionSimpleMode( bool bSimple ) { maLBWindow->SetMultiSelectionSimpleMode( bSimple ); }
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index a1b704eec9b8..4ca534e1d7a3 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -457,7 +457,6 @@ ImplListBoxWindow::ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle )
mbSelectionChanged = false;
mbMouseMoveSelect = false;
mbMulti = false;
- mbStackMode = false;
mbGrabFocus = false;
mbUserDrawEnabled = false;
mbInUserDraw = false;
@@ -880,27 +879,7 @@ void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt )
void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt )
{
- if ( rMEvt.IsLeaveWindow() )
- {
- if ( mbStackMode && IsMouseMoveSelect() && IsReallyVisible() )
- {
- if ( rMEvt.GetPosPixel().Y() < 0 )
- {
- DeselectAll();
- mnCurrentPos = LISTBOX_ENTRY_NOTFOUND;
- SetTopEntry( 0 );
- if ( mbStackMode )
- {
- mbTravelSelect = true;
- mnSelectModifier = rMEvt.GetModifier();
- ImplCallSelect();
- mbTravelSelect = false;
- }
-
- }
- }
- }
- else if ( ( ( !mbMulti && IsMouseMoveSelect() ) || mbStackMode ) && mpEntryList->GetEntryCount() )
+ if (!rMEvt.IsLeaveWindow() && !mbMulti && IsMouseMoveSelect() && mpEntryList->GetEntryCount())
{
tools::Rectangle aRect( Point(), GetOutputSizePixel() );
if( aRect.IsInside( rMEvt.GetPosPixel() ) )
@@ -920,19 +899,9 @@ void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt )
mbTrackingSelect = true;
if ( SelectEntries( nSelect, LET_TRACKING ) )
{
- if ( mbStackMode )
- {
- mbTravelSelect = true;
- mnSelectModifier = rMEvt.GetModifier();
- ImplCallSelect();
- mbTravelSelect = false;
- }
// When list box selection change by mouse move, notify
// VclEventId::ListboxSelect vcl event.
- else
- {
- maListItemSelectHdl.Call(nullptr);
- }
+ maListItemSelectHdl.Call(nullptr);
}
mbTrackingSelect = false;
}
@@ -947,9 +916,6 @@ void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt )
else
mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND;
- if ( mbStackMode && ( mpEntryList->GetSelectionAnchor() == LISTBOX_ENTRY_NOTFOUND ) )
- mpEntryList->SetSelectionAnchor( 0 );
-
StartTracking( StartTrackingFlags::ScrollRepeat );
}
}
@@ -1052,45 +1018,30 @@ bool ImplListBoxWindow::SelectEntries( sal_Int32 nSelect, LB_EVENT_TYPE eLET, bo
mpEntryList->SetSelectionAnchor( nSelect );
}
// MultiListBox only with CTRL/SHIFT or not in SimpleMode
- else if( ( !mbSimpleMode /* && !bShift */ ) || ( (mbSimpleMode && ( bCtrl || bShift )) || mbStackMode ) )
+ else if( ( !mbSimpleMode /* && !bShift */ ) || ( mbSimpleMode && ( bCtrl || bShift ) ) )
{
// Space for selection change
if( !bShift && ( ( eLET == LET_KEYSPACE ) || ( eLET == LET_MBDOWN ) ) )
{
- bool bSelect = ( mbStackMode && IsMouseMoveSelect() ) || !mpEntryList->IsEntryPosSelected( nSelect );
- if ( mbStackMode )
- {
- sal_Int32 n;
- if ( bSelect )
- {
- // All entries before nSelect must be selected...
- for ( n = 0; n < nSelect; n++ )
- SelectEntry( n, true );
- }
- if ( !bSelect )
- {
- for ( n = nSelect+1; n < mpEntryList->GetEntryCount(); n++ )
- SelectEntry( n, false );
- }
- }
+ bool bSelect = !mpEntryList->IsEntryPosSelected( nSelect );
SelectEntry( nSelect, bSelect );
mpEntryList->SetLastSelected( nSelect );
- mpEntryList->SetSelectionAnchor( mbStackMode ? 0 : nSelect );
+ mpEntryList->SetSelectionAnchor( nSelect );
if ( !mpEntryList->IsEntryPosSelected( nSelect ) )
mpEntryList->SetSelectionAnchor( LISTBOX_ENTRY_NOTFOUND );
bFocusChanged = true;
bSelectionChanged = true;
}
else if( ( ( eLET == LET_TRACKING ) && ( nSelect != mnCurrentPos ) ) ||
- ( (bShift||mbStackMode) && ( ( eLET == LET_KEYMOVE ) || ( eLET == LET_MBDOWN ) ) ) )
+ ( bShift && ( ( eLET == LET_KEYMOVE ) || ( eLET == LET_MBDOWN ) ) ) )
{
mnCurrentPos = nSelect;
bFocusChanged = true;
sal_Int32 nAnchor = mpEntryList->GetSelectionAnchor();
- if( ( nAnchor == LISTBOX_ENTRY_NOTFOUND ) && ( mpEntryList->GetSelectedEntryCount() || mbStackMode ) )
+ if( ( nAnchor == LISTBOX_ENTRY_NOTFOUND ) && mpEntryList->GetSelectedEntryCount() )
{
- nAnchor = mbStackMode ? 0 : mpEntryList->GetSelectedEntryPos( mpEntryList->GetSelectedEntryCount() - 1 );
+ nAnchor = mpEntryList->GetSelectedEntryPos( mpEntryList->GetSelectedEntryCount() - 1 );
}
if( nAnchor != LISTBOX_ENTRY_NOTFOUND )
{
@@ -1260,16 +1211,7 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt )
if ( ( nSelect != mnCurrentPos ) || !GetEntryList()->GetSelectedEntryCount() )
{
mbTrackingSelect = true;
- if ( SelectEntries( nSelect, LET_TRACKING, bShift, bCtrl ) )
- {
- if ( mbStackMode )
- {
- mbTravelSelect = true;
- mnSelectModifier = rTEvt.GetMouseEvent().GetModifier();
- ImplCallSelect();
- mbTravelSelect = false;
- }
- }
+ SelectEntries(nSelect, LET_TRACKING, bShift, bCtrl);
mbTrackingSelect = false;
}
}
@@ -1281,42 +1223,6 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt )
SelectEntry( GetEntryList()->GetSelectedEntryPos( 0 ), false );
mbTrackingSelect = false;
}
- else if ( mbStackMode )
- {
- if ( ( rTEvt.GetMouseEvent().GetPosPixel().X() > 0 ) && ( rTEvt.GetMouseEvent().GetPosPixel().X() < aRect.Right() ) )
- {
- if ( ( rTEvt.GetMouseEvent().GetPosPixel().Y() < 0 ) || ( rTEvt.GetMouseEvent().GetPosPixel().Y() > GetOutputSizePixel().Height() ) )
- {
- bool bSelectionChanged = false;
- if ( ( rTEvt.GetMouseEvent().GetPosPixel().Y() < 0 )
- && !mnCurrentPos )
- {
- if ( mpEntryList->IsEntryPosSelected( 0 ) )
- {
- SelectEntry( 0, false );
- bSelectionChanged = true;
- nSelect = LISTBOX_ENTRY_NOTFOUND;
-
- }
- }
- else
- {
- mbTrackingSelect = true;
- bSelectionChanged = SelectEntries( nSelect, LET_TRACKING, bShift, bCtrl );
- mbTrackingSelect = false;
- }
-
- if ( bSelectionChanged )
- {
- mbSelectionChanged = true;
- mbTravelSelect = true;
- mnSelectModifier = rTEvt.GetMouseEvent().GetModifier();
- ImplCallSelect();
- mbTravelSelect = false;
- }
- }
- }
- }
}
mnCurrentPos = nSelect;
if ( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND )
@@ -1559,7 +1465,7 @@ bool ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
{
if ( !bMod2 && !IsReadOnly() )
{
- if( mbMulti && ( !mbSimpleMode || ( mbSimpleMode && bCtrl && !bShift ) || mbStackMode ) )
+ if( mbMulti && ( !mbSimpleMode || ( mbSimpleMode && bCtrl && !bShift ) ) )
{
nSelect = mnCurrentPos;
eLET = LET_KEYSPACE;
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index ab993d3f102f..2e5e51e77fa9 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -1123,12 +1123,7 @@ tools::Rectangle ListBox::GetBoundingRectangle( sal_Int32 nItem ) const
void ListBox::EnableMultiSelection( bool bMulti )
{
- EnableMultiSelection( bMulti, false );
-}
-
-void ListBox::EnableMultiSelection( bool bMulti, bool bStackSelection )
-{
- mpImplLB->EnableMultiSelection( bMulti, bStackSelection );
+ mpImplLB->EnableMultiSelection( bMulti );
// WB_SIMPLEMODE:
// The MultiListBox behaves just like a normal ListBox