summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-07-01 11:29:28 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2022-07-08 13:35:51 +0200
commit77f4389f38feea54e6c777e86f7ee4a79331eb75 (patch)
treeaa8fe78525749296b391092492006f638ef8d14a /sc
parent855f4a5f0f4721c80af0694421d20533833f6dd0 (diff)
lok: allow shrinking too big widgets
This is followup for: https://cgit.freedesktop.org/libreoffice/core/commit/?id=2b58a0979f9206cfca6d78cb2f3d5e65cd735f8b Add sanity check to avoid potential crash in the Collabora Online server nExtraSpace can be negative for shrinking the widget - this is correct. For example listbox can have many entries, in GetOptimalSize it returns size required to show all of them, then here we calculate how much of that size we can allow to be used. When we have too many entries we use negative nExtraSpace. The original problem is not that we get negative number but case when we get value that is much bigger than size of a widget and it becomes invisible. So this reverts hack which makes impossible to shrink widget what causes problems with listboxes in tunneled dialogs. Also it setups better size request for csv import dialog grid widget - so we don't paint it as 10px rectangle - what was workarounded by the previous patches. Change-Id: I478660b12cf0b6a783c704201800018e9849cc23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136728 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mert Tumer <mert.tumer@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/dbgui/csvgrid.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index aa6acd6ba9b2..0f98eb693875 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <comphelper/lok.hxx>
#include <csvgrid.hxx>
#include <csvtablebox.hxx>
@@ -107,6 +108,8 @@ void ScCsvGrid::SetDrawingArea(weld::DrawingArea* pDrawingArea)
// the left edge will be lost. If this widget is smaller than the scrolling
// window it is stretched to fit the parent and the problem doesn't arise.
Size aInitialSize(10, 10);
+ if (comphelper::LibreOfficeKit::isActive())
+ aInitialSize = Size(-1, 150);
ScCsvControl::SetDrawingArea(pDrawingArea);
pDrawingArea->set_size_request(aInitialSize.Width(), aInitialSize.Height());
SetOutputSizePixel(aInitialSize);