summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2020-06-03 17:27:28 +0530
committerDennis Francis <dennis.francis@collabora.com>2020-07-06 17:44:21 +0200
commit18d8297fe2ae9a312473a0fc4e450fc6dcfa6450 (patch)
tree3b1ebc39cc8cc236c529abc746bfcf2fa572b9c3 /sc/source/ui
parent849d7d8c09120d842ea1a75dd266ee375cb25c78 (diff)
lokit: Avoid sending wrong edit-cursor/selection messages when...
the EditView's output-area needs to be tweaked temporarily to render it to a tile which is meant for another view. Change-Id: I2b8fc1986c247ce65c18ea64e3b43d25625c7e9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98065 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/view/gridwin4.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 4d122af6d269..2a1ac2439b65 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -571,6 +571,32 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
rDoc.PrepareFormulaCalc();
}
+namespace {
+
+class SupressEditViewMessagesGuard
+{
+public:
+ SupressEditViewMessagesGuard(EditView& rEditView) :
+ mrEditView(rEditView),
+ mbOrigSupressFlag(rEditView.IsSupressLOKMessages())
+ {
+ if (!mbOrigSupressFlag)
+ mrEditView.SupressLOKMessages(true);
+ }
+
+ ~SupressEditViewMessagesGuard()
+ {
+ if (mrEditView.IsSupressLOKMessages() != mbOrigSupressFlag)
+ mrEditView.SupressLOKMessages(mbOrigSupressFlag);
+ }
+
+private:
+ EditView& mrEditView;
+ const bool mbOrigSupressFlag;
+};
+
+}
+
void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData,
bool bLogicText)
{
@@ -1019,6 +1045,11 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
const tools::Rectangle aOrigOutputArea(pOtherEditView->GetOutputArea()); // Not in pixels.
const MapMode aOrigMapMode = pOtherWin->GetMapMode();
pOtherWin->SetMapMode(rDevice.GetMapMode());
+
+ // Avoid sending wrong cursor/selection messages by the 'other' view, as the output-area is going
+ // to be tweaked temporarily to match the current view's zoom.
+ SupressEditViewMessagesGuard aGuard(*pOtherEditView);
+
pOtherEditView->SetOutputArea(rDevice.PixelToLogic(aEditRect));
pOtherEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
@@ -1117,6 +1148,12 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
const tools::Rectangle aOrigOutputArea(pEditView->GetOutputArea()); // Not in pixels.
const MapMode aOrigMapMode = GetMapMode();
SetMapMode(rDevice.GetMapMode());
+
+ // Avoid sending wrong cursor/selection messages by the current view, as the output-area is going
+ // to be tweaked temporarily to match other view's zoom. (This does not affect the manual
+ // cursor-messaging done in the non print-twips mode)
+ SupressEditViewMessagesGuard aGuard(*pEditView);
+
pEditView->SetOutputArea(rDevice.PixelToLogic(aEditRect));
pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);