summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-12-18 22:32:07 +0100
committerMichael Meeks <michael.meeks@collabora.com>2019-12-19 03:04:06 +0100
commit7fb88645d20c1b1ec4aca41d0d96c457333282a7 (patch)
tree0d0d8bd5424b74d471e3f70187abf5b9f9d93dcd /sc/source
parent42a1a1c6b91907f81e15066ffab219411f18c4db (diff)
lok: send "EMPTY" if the rect is empty for cell selection or fill
It can happen that the selection or auto-fill rectangles are empty and if that's the case then we need to send "EMPTY" string and not the content of an empty rectangle (0, 0, -32768, -32768). This can happen for CELL_SELECTION_AREA or CELL_AUTO_FILL_AREA in calc. Change-Id: I9a60e3907a2ab8b0e0fd1a2ff81137fba6c8e9a3 Reviewed-on: https://gerrit.libreoffice.org/85441 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/view/gridwin.cxx26
1 files changed, 19 insertions, 7 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 28fbef5fb1f7..c6833d7fe2aa 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5930,7 +5930,10 @@ void ScGridWindow::UpdateKitSelection(const std::vector<tools::Rectangle>& rRect
}
ScTabViewShell* pViewShell = pViewData->GetViewShell();
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, aBoundingBox.toString().getStr());
+ OString sBoundingBoxString = "EMPTY";
+ if (!aBoundingBox.IsEmpty())
+ sBoundingBoxString = aBoundingBox.toString();
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, sBoundingBoxString.getStr());
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, rectanglesToString(aLogicRects).getStr());
for (SfxViewShell* it = SfxViewShell::GetFirst(); it;
@@ -5980,7 +5983,11 @@ void ScGridWindow::updateOtherKitSelections() const
OString aRectsString = rectanglesToString(aOtherLogicRects);
if (it == pViewShell)
{
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, aBoundingBox.toString().getStr());
+ OString sBoundingBoxString = "EMPTY";
+ if (!aBoundingBox.IsEmpty())
+ sBoundingBoxString = aBoundingBox.toString();
+
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, sBoundingBoxString.getStr());
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aRectsString.getStr());
}
else
@@ -6000,13 +6007,18 @@ void updateLibreOfficeKitAutoFill(const ScViewData* pViewData, tools::Rectangle
double nPPTX = pViewData->GetPPTX();
double nPPTY = pViewData->GetPPTY();
- // selection start handle
- tools::Rectangle aLogicRectangle(
- rRectangle.Left() / nPPTX, rRectangle.Top() / nPPTY,
- rRectangle.Right() / nPPTX, rRectangle.Bottom() / nPPTY);
+ OString sRectangleString = "EMPTY";
+ if (!rRectangle.IsEmpty())
+ {
+ // selection start handle
+ tools::Rectangle aLogicRectangle(
+ rRectangle.Left() / nPPTX, rRectangle.Top() / nPPTY,
+ rRectangle.Right() / nPPTX, rRectangle.Bottom() / nPPTY);
+ sRectangleString = aLogicRectangle.toString();
+ }
ScTabViewShell* pViewShell = pViewData->GetViewShell();
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_AUTO_FILL_AREA, aLogicRectangle.toString().getStr());
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_AUTO_FILL_AREA, sRectangleString.getStr());
}
} //end anonymous namespace