[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/source vcl/source

2022-07-08 Thread Szymon Kłos (via logerrit)
 sc/source/ui/dbgui/csvgrid.cxx |3 +++
 vcl/source/window/layout.cxx   |   16 ++--
 2 files changed, 5 insertions(+), 14 deletions(-)

New commits:
commit 77f4389f38feea54e6c777e86f7ee4a79331eb75
Author: Szymon Kłos 
AuthorDate: Fri Jul 1 11:29:28 2022 +0200
Commit: Szymon Kłos 
CommitDate: Fri Jul 8 13:35:51 2022 +0200

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 
Reviewed-by: Mert Tumer 

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 
 #include 
 #include 
 
@@ -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);
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index c38790b6b2df..6b11d72eae17 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -279,20 +279,8 @@ void VclBox::setAllocation(const Size )
 else if (nExpandChildren)
 {
 Size aRequisition = calculateRequisition();
-nExtraSpace = (getPrimaryDimension(rAllocation) - 
getPrimaryDimension(aRequisition)) / nExpandChildren;
-// In mobile, the screen size is small and extraSpace can become negative
-// Though the dialogs are rendered in javascript for LOK Android some widgets 
like weld::DrawingArea
-// is sent as bitmap but it is rendered from only the visible part
-// when it gets negative, it shrinks instead of expands and it becomes 
invisible
-
-if (nExtraSpace < 0)
-{
-SAL_WARN("vcl.layout", "nExtraSpace went negative for VclBox: " << 
GetHelpId());
-if (comphelper::LibreOfficeKit::isActive())
-{
-nExtraSpace = 0;
-}
-}
+tools::Long nPrimaryDimension = getPrimaryDimension(rAllocation);
+nExtraSpace = (nPrimaryDimension - getPrimaryDimension(aRequisition)) 
/ nExpandChildren;
 }
 
 //Split into those we pack from the start onwards, and those we pack from 
the end backwards


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/source vcl/source

2022-03-14 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/gridwin.cxx  |8 +---
 sc/source/ui/view/gridwin2.cxx |3 ++-
 sc/source/ui/view/tabview3.cxx |4 +++-
 vcl/source/window/dockwin.cxx  |5 -
 4 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 06de346ffb712e43c9e1b9527a08c42349e78598
Author: Szymon Kłos 
AuthorDate: Fri Feb 25 13:22:36 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Mar 14 16:18:35 2022 +0100

lok: send logic autofilter position

we need to show popup relative to the grid window

Change-Id: Ib0cf66d2c0422b765a3b8035d5499b45e83f768d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130528
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131122
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index eced196db277..d050c59175fe 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -895,7 +895,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
 nSizeX = nSizeX / fZoomX;
 nSizeY = nSizeY / fZoomY;
 }
-tools::Rectangle aCellRect(OutputToScreenPixel(aPos), Size(nSizeX, 
nSizeY));
+tools::Rectangle aCellRect(bLOKActive ? aPos : OutputToScreenPixel(aPos), 
Size(nSizeX, nSizeY));
 
 ScDBData* pDBData = rDoc.GetDBAtCursor(nCol, nRow, nTab, 
ScDBDataPortion::AREA);
 if (!pDBData)
@@ -1207,7 +1207,8 @@ void ScGridWindow::LaunchPageFieldMenu( SCCOL nCol, SCROW 
nRow )
 Point aScrPos;
 Size aScrSize;
 getCellGeometry(aScrPos, aScrSize, mrViewData, nCol, nRow, eWhich);
-DPLaunchFieldPopupMenu(OutputToScreenPixel(aScrPos), aScrSize, 
ScAddress(nCol-1, nRow, nTab), pDPObj);
+bool bLOK = comphelper::LibreOfficeKit::isActive();
+DPLaunchFieldPopupMenu(bLOK ? aScrPos : OutputToScreenPixel(aScrPos), 
aScrSize, ScAddress(nCol-1, nRow, nTab), pDPObj);
 }
 
 void ScGridWindow::LaunchDPFieldMenu( SCCOL nCol, SCROW nRow )
@@ -1220,7 +1221,8 @@ void ScGridWindow::LaunchDPFieldMenu( SCCOL nCol, SCROW 
nRow )
 Point aScrPos;
 Size aScrSize;
 getCellGeometry(aScrPos, aScrSize, mrViewData, nCol, nRow, eWhich);
-DPLaunchFieldPopupMenu(OutputToScreenPixel(aScrPos), aScrSize, 
ScAddress(nCol, nRow, nTab), pDPObj);
+bool bLOK = comphelper::LibreOfficeKit::isActive();
+DPLaunchFieldPopupMenu(bLOK ? aScrPos : OutputToScreenPixel(aScrPos), 
aScrSize, ScAddress(nCol, nRow, nTab), pDPObj);
 }
 
 void ScGridWindow::ShowFilterMenu(weld::Window* pParent, const 
tools::Rectangle& rCellRect, bool bLayoutRTL)
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 7071bd384f4b..4e497e80d664 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -343,6 +343,7 @@ bool ScGridWindow::DPTestFieldPopupArrow(
 const MouseEvent& rMEvt, const ScAddress& rPos, const ScAddress& rDimPos, 
ScDPObject* pDPObj)
 {
 bool bLayoutRTL = mrViewData.GetDocument().IsLayoutRTL( 
mrViewData.GetTabNo() );
+bool bLOK = comphelper::LibreOfficeKit::isActive();
 
 // Get the geometry of the cell.
 Point aScrPos = mrViewData.GetScrPos(rPos.Col(), rPos.Row(), eWhich);
@@ -361,7 +362,7 @@ bool ScGridWindow::DPTestFieldPopupArrow(
 if (aRect.Contains(rMEvt.GetPosPixel()))
 {
 // Mouse cursor inside the popup arrow box.  Launch the field menu.
-DPLaunchFieldPopupMenu(OutputToScreenPixel(aScrPos), aScrSize, 
rDimPos, pDPObj);
+DPLaunchFieldPopupMenu(bLOK ? aScrPos : OutputToScreenPixel(aScrPos), 
aScrSize, rDimPos, pDPObj);
 return true;
 }
 
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index c2cd024fecac..3d9d0e3996be 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2618,7 +2618,9 @@ void ScTabView::DoDPFieldPopup(std::u16string_view 
rPivotTableName, sal_Int32 nD
 
 pDPObject->BuildAllDimensionMembers();
 
-Point aScreenPoint = pWin->OutputToScreenPixel(pWin->LogicToPixel(aPoint));
+Point aPos = pWin->LogicToPixel(aPoint);
+bool bLOK = comphelper::LibreOfficeKit::isActive();
+Point aScreenPoint = bLOK ? aPos : pWin->OutputToScreenPixel(aPos);
 Size aScreenSize = pWin->LogicToPixel(aSize);
 
 pWin->DPLaunchFieldPopupMenu(aScreenPoint, aScreenSize, nDimensionIndex, 
pDPObject);
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index 99c4f1bba398..f94a04cbb1d8 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -923,7 +924,9 @@ Point DockingWindow::GetFloatingPos() const
 aData.SetMask( WindowStateMask::Pos );
 pWrapper->mpFloatWin->GetWindowStateData( aData );
 Point aPos( aData.GetX(), aData.GetY() );
-aPos =