summaryrefslogtreecommitdiff
path: root/sc
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 00:08:54 +0100
commitdf6871286d7b769bc47554955213a2d727c47875 (patch)
tree16fcc172a087807ba291c250d38ecb3420258bb6 /sc
parentd3c108d744a354bd3ed82d2001b76a7f8c20c5a5 (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/85437 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sc')
-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 638c8b645aa6..b591b974dabf 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5902,7 +5902,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;
@@ -5955,7 +5958,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
@@ -5975,13 +5982,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