diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2023-12-04 09:31:23 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-16 11:58:52 +0100 |
commit | 78f230713e1e1fd94f9fb1087bdba500fcf9231a (patch) | |
tree | c31d7a5ec158d7329c96142bf45d069636df4694 /sc/source/ui/view/gridwin4.cxx | |
parent | dd8dad09097225726cbcd878d95d5bd0aacdf042 (diff) |
calc: on editing invalidation of view with different zoom is wrong
This patch fixes the following invalidation issue:
There are 2 views with different zoom levels.
In a view text editing for a cell occurs.
The other view is not invalidated properly: the computed invalidation
rectangle is misplaced.
Change-Id: I72db61486647640ee68e6cb2db96b2902de5b997
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160303
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162161
Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/view/gridwin4.cxx')
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 301082c5754c..aa2fcea54ae0 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -670,6 +670,11 @@ int lcl_GetMultiLineHeight(EditEngine* pEditEngine) return nHeight; } + +tools::Rectangle lcl_negateRectX(const tools::Rectangle& rRect) +{ + return tools::Rectangle(-rRect.Right(), rRect.Top(), -rRect.Left(), rRect.Bottom()); +} } void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData, @@ -1766,6 +1771,27 @@ void ScGridWindow::LogicInvalidate(const tools::Rectangle* pRectangle) LogicInvalidatePart(pRectangle, pViewShell->getPart()); } +bool ScGridWindow::InvalidateByForeignEditView(EditView* pEditView) +{ + if (!pEditView) + return false; + + auto* pGridWin = dynamic_cast<ScGridWindow*>(pEditView->GetWindow()); + if (!pGridWin) + return false; + + const ScViewData& rViewData = pGridWin->getViewData(); + tools::Long nRefTabNo = rViewData.GetRefTabNo(); + tools::Long nX = rViewData.GetCurXForTab(nRefTabNo); + tools::Long nY = rViewData.GetCurYForTab(nRefTabNo); + + tools::Rectangle aPixRect = getViewData().GetEditArea(eWhich, nX, nY, this, nullptr, true); + tools::Rectangle aLogicRect = PixelToLogic(aPixRect, getViewData().GetLogicMode()); + Invalidate(pEditView->IsNegativeX() ? lcl_negateRectX(aLogicRect) : aLogicRect); + + return true; +} + void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) { ScTabView* pTabView = mrViewData.GetView(); |