diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-25 14:31:11 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-26 17:08:42 +0100 |
commit | 8a2b065d2a414ca90b3412c803533c8fd0109b30 (patch) | |
tree | a986dd0e07eac9bc1abc844bfd770cd7149baa05 | |
parent | 7e698f51550e366e76fadd19eea5461a70140043 (diff) |
lok: The GridWindow can get reset to a smaller than wanted size
This is the same problem as described in:
commit 22a185a977f90d706c3e9d182adeaac310b6f348
Date: Thu Jan 11 15:08:21 2024 +0900
sc lok: set the GridWindow size to the client area size + test
except that the size of the GridWindow gets reset by UpdateFormulas
via UpdateHeaderWidth to the width of the "frame" which is remains
at the nominal 800x600 initial size throughout.
That only happens if there are enough rows in the document to trigger
a check against this, so add some extra content into the test document
to trigger the problem, and then guard against this reset for the kit
case.
Change-Id: Ibf80849929a4c987fd0fe977518336e5115ebdce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165288
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods | bin | 8096 -> 7906 bytes | |||
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 16 |
3 files changed, 16 insertions, 9 deletions
diff --git a/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods b/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods Binary files differindex 27fc3f45c543..9c03b5ae2f43 100644 --- a/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods +++ b/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 94892ca70c63..e623d2d679cd 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2672,9 +2672,6 @@ void lcl_ExtendTiledDimension(bool bColumn, const SCCOLROW nEnd, const SCCOLROW if (pModelObj) aNewSize = pModelObj->getDocumentSize(); - if (aOldSize == aNewSize) - return; - if (!pDocSh) return; @@ -2684,10 +2681,14 @@ void lcl_ExtendTiledDimension(bool bColumn, const SCCOLROW nEnd, const SCCOLROW if (pGridWindow) { Size aNewSizePx(aNewSize.Width() * rViewData.GetPPTX(), aNewSize.Height() * rViewData.GetPPTY()); - pGridWindow->SetOutputSizePixel(aNewSizePx); + if (aNewSizePx != pGridWindow->GetOutputSizePixel()) + pGridWindow->SetOutputSizePixel(aNewSizePx); } } + if (aOldSize == aNewSize) + return; + // New area extended to the right/bottom of the sheet after last col/row tools::Rectangle aNewArea(Point(0, 0), aNewSize); // excluding overlapping area with aNewArea diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 15e71a1ba751..8f5fe8ae13b8 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -419,9 +419,6 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) if (pModelObj) aNewSize = pModelObj->getDocumentSize(); - if (aOldSize == aNewSize) - return; - if (!pDocSh) return; @@ -431,10 +428,14 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) if (pGridWindow) { Size aNewSizePx(aNewSize.Width() * aViewData.GetPPTX(), aNewSize.Height() * aViewData.GetPPTY()); - pGridWindow->SetOutputSizePixel(aNewSizePx); + if (aNewSizePx != pGridWindow->GetOutputSizePixel()) + pGridWindow->SetOutputSizePixel(aNewSizePx); } } + if (aOldSize == aNewSize) + return; + // New area extended to the right of the sheet after last column // including overlapping area with aNewRowArea tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), aNewSize.getHeight()); @@ -2341,7 +2342,12 @@ void ScTabView::UpdateFormulas(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, if ( aViewData.IsPagebreakMode() ) UpdatePageBreakData(); //! asynchronous - UpdateHeaderWidth(); + bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive(); + // UpdateHeaderWidth can fit the GridWindow widths to the frame, something + // we don't want in kit-mode where we try and match the GridWindow width + // to the tiled area separately + if (!bIsTiledRendering) + UpdateHeaderWidth(); // if in edit mode, adjust edit view area because widths/heights may have changed if ( aViewData.HasEditView( aViewData.GetActivePart() ) ) |