diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-11-23 00:00:28 -0500 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-12-07 11:52:34 +0100 |
commit | e86f5a07efbb533a072aca841d040771484d388b (patch) | |
tree | ecdf251b34e182bf713f63935dff6ab703e49cd7 | |
parent | 50dccc1d59bc851f1c877d4cf2e060f3e4c60ca2 (diff) |
LOK: dialogs: limit listbox/combobox drop-down length
Dialogs routed to the LOK client have limited real
estate on the screen because dialogs are rendered
on a canvas. When the listbox drop-down bleeds outside
the dialog area, on the desktop it's no problem, but
in the browser, that requires a larger canvas and
that brings a host of problems.
Here we limit the maximum length of listbox/combobox
drop-down lists to avoid this situation.
This would ideally be configured via ListBoxMaximumLineCount
alas it doesn't work.
Change-Id: I55fff28dbfc59dec36714e221f76cf4160ba1505
-rw-r--r-- | vcl/source/control/combobox.cxx | 10 | ||||
-rw-r--r-- | vcl/source/control/listbox.cxx | 9 |
2 files changed, 14 insertions, 5 deletions
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 9d34f9001182..3eca5c6f0598 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -34,7 +34,7 @@ #include <svdata.hxx> #include <listbox.hxx> #include <controldata.hxx> - +#include <comphelper/lok.hxx> struct ComboBoxBounds { @@ -530,8 +530,12 @@ void ComboBox::SetDropDownLineCount( sal_uInt16 nLines ) void ComboBox::AdaptDropDownLineCountToMaximum() { - // adapt to maximum allowed number - SetDropDownLineCount(GetSettings().GetStyleSettings().GetListBoxMaximumLineCount()); + // Adapt to maximum allowed number. + // Limit for LOK as we can't render outside of the dialog canvas. + if (comphelper::LibreOfficeKit::isActive()) + SetDropDownLineCount(11); + else + SetDropDownLineCount(GetSettings().GetStyleSettings().GetListBoxMaximumLineCount()); } sal_uInt16 ComboBox::GetDropDownLineCount() const diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index 5de0f2fe1a0b..52960a762d17 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -35,6 +35,7 @@ #include <controldata.hxx> #include <listbox.hxx> #include <dndeventdispatcher.hxx> +#include <comphelper/lok.hxx> #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> @@ -537,8 +538,12 @@ void ListBox::SetDropDownLineCount( sal_uInt16 nLines ) void ListBox::AdaptDropDownLineCountToMaximum() { - // adapt to maximum allowed number - SetDropDownLineCount(GetSettings().GetStyleSettings().GetListBoxMaximumLineCount()); + // Adapt to maximum allowed number. + // Limit for LOK as we can't render outside of the dialog canvas. + if (comphelper::LibreOfficeKit::isActive()) + SetDropDownLineCount(11); + else + SetDropDownLineCount(GetSettings().GetStyleSettings().GetListBoxMaximumLineCount()); } sal_uInt16 ListBox::GetDropDownLineCount() const |