diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-05-12 15:57:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-05-12 20:24:32 +0200 |
commit | 822f94e260b8351dc3459d2c05180af2de96d4c7 (patch) | |
tree | f8db82090851f7c7844f7403b3bac37d8371eb38 | |
parent | b3d03b315b5b86994214ac6f0167248ff5bc187b (diff) |
tdf#132435 only place menu vertically if up/down requested
don't fallback to left/right if it doesn't fit, just scroll the
menu instead
Change-Id: I20b261fd7fee78555bf87b25dfeed33c23602493
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94065
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/source/window/floatwin.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 749ceacd09d0..a9a3e7163bb2 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -265,6 +265,7 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, Application::GetBestScreen( bRTL ? devRectRTL : devRect ) ); FloatWinPopupFlags nArrangeAry[5]; + sal_uInt16 nArrangeAttempts = 5; Point e1,e2; // the common edge between the item rect and the floating window if ( nFlags & FloatWinPopupFlags::Left ) @@ -287,23 +288,21 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, { nArrangeAry[0] = FloatWinPopupFlags::Up; nArrangeAry[1] = FloatWinPopupFlags::Down; - nArrangeAry[2] = FloatWinPopupFlags::Right; - nArrangeAry[3] = FloatWinPopupFlags::Left; - nArrangeAry[4] = FloatWinPopupFlags::Up; + nArrangeAry[2] = FloatWinPopupFlags::Up; + nArrangeAttempts = 3; } else { nArrangeAry[0] = FloatWinPopupFlags::Down; nArrangeAry[1] = FloatWinPopupFlags::Up; - nArrangeAry[2] = FloatWinPopupFlags::Right; - nArrangeAry[3] = FloatWinPopupFlags::Left; - nArrangeAry[4] = FloatWinPopupFlags::Down; + nArrangeAry[2] = FloatWinPopupFlags::Down; + nArrangeAttempts = 3; } sal_uInt16 nArrangeIndex = 0; const bool bLOKActive = comphelper::LibreOfficeKit::isActive(); - for ( ; nArrangeIndex < 5; nArrangeIndex++ ) + for ( ; nArrangeIndex < nArrangeAttempts; nArrangeIndex++ ) { bool bBreak = true; switch ( nArrangeAry[nArrangeIndex] ) @@ -428,8 +427,8 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, if ( bBreak ) break; } - if ( nArrangeIndex > 4 ) - nArrangeIndex = 4; + if (nArrangeIndex >= nArrangeAttempts) + nArrangeIndex = nArrangeAttempts - 1; rArrangeIndex = nArrangeIndex; |