From e86f5a07efbb533a072aca841d040771484d388b Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Fri, 23 Nov 2018 00:00:28 -0500 Subject: 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 --- vcl/source/control/combobox.cxx | 10 +++++++--- 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 #include #include - +#include 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 #include #include +#include #include @@ -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 -- cgit