summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-07-28 10:04:58 +0900
committerTomaž Vajngerl <quikee@gmail.com>2019-07-28 12:35:39 +0200
commit23ed3a19cb0d53639d817af9b802a44977e89c65 (patch)
tree6afd7c4c0689292ae6170d2a5326428093ccdc51 /sc
parent86900bd5e24e64e2d517c9c4229554a76ec4470c (diff)
lok: send cell selection rectangle and cell area fill rectangle
Instead of text selection start/end for cell selection we send a cell selection rectangle event. This is needed so we're able to differentiate when to draw cell selection and text selection markers. In addition send cell fill area rectangle, which is the area where we need to hit to trigger area fill functionality in Calc. Change-Id: I54af958932815818a1a4d48364192ba43f1df7de Reviewed-on: https://gerrit.libreoffice.org/76491 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/gridwin.cxx50
1 files changed, 36 insertions, 14 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index d7c23d5696dc..cb5c6a3bab7f 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5912,23 +5912,41 @@ static void updateLibreOfficeKitSelection(const ScViewData* pViewData, const std
return;
// selection start handle
- tools::Rectangle aStart(aBoundingBox.Left() / nPPTX, aBoundingBox.Top() / nPPTY,
- aBoundingBox.Left() / nPPTX, (aBoundingBox.Top() / nPPTY) + 256);
-
- // selection end handle
- tools::Rectangle aEnd(aBoundingBox.Right() / nPPTX, (aBoundingBox.Bottom() / nPPTY) - 256,
+ tools::Rectangle aRectangle(
+ aBoundingBox.Left() / nPPTX, aBoundingBox.Top() / nPPTY,
aBoundingBox.Right() / nPPTX, aBoundingBox.Bottom() / nPPTY);
// the selection itself
OString aSelection = comphelper::string::join("; ", aRectangles).getStr();
ScTabViewShell* pViewShell = pViewData->GetViewShell();
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr());
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, aRectangle.toString().getStr());
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.getStr());
SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", aSelection.getStr());
}
+namespace
+{
+
+void updateLibreOfficeKitAutoFill(const ScViewData* pViewData, tools::Rectangle const & rRectangle)
+{
+ if (!comphelper::LibreOfficeKit::isActive())
+ return;
+
+ 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);
+
+ ScTabViewShell* pViewShell = pViewData->GetViewShell();
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_AUTO_FILL_AREA, aLogicRectangle.toString().getStr());
+}
+
+} //end anonymous namespace
+
void ScGridWindow::UpdateCursorOverlay()
{
ScDocument* pDoc = pViewData->GetDocument();
@@ -6169,6 +6187,7 @@ void ScGridWindow::UpdateSelectionOverlay()
{
ScTabViewShell* pViewShell = pViewData->GetViewShell();
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY");
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, "EMPTY");
SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "EMPTY");
}
@@ -6199,9 +6218,11 @@ void ScGridWindow::UpdateAutoFillOverlay()
SCCOL nX = aAutoMarkPos.Col();
SCROW nY = aAutoMarkPos.Row();
- if (!maVisibleRange.isInside(nX, nY))
+ if (!maVisibleRange.isInside(nX, nY) && !comphelper::LibreOfficeKit::isActive())
+ {
// Autofill mark is not visible. Bail out.
return;
+ }
SCTAB nTab = pViewData->GetTabNo();
ScDocument* pDoc = pViewData->GetDocument();
@@ -6227,15 +6248,16 @@ void ScGridWindow::UpdateAutoFillOverlay()
tools::Rectangle aFillRect(aFillPos, aFillHandleSize);
// expand rect to increase hit area
- mpAutoFillRect = tools::Rectangle(aFillRect.Left() - fScaleFactor,
- aFillRect.Top() - fScaleFactor,
- aFillRect.Right() + fScaleFactor,
- aFillRect.Bottom() + fScaleFactor);
+ mpAutoFillRect = aFillRect;
+ mpAutoFillRect->expand(fScaleFactor);
// #i70788# get the OverlayManager safely
rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager();
-
- if (xOverlayManager.is() && !comphelper::LibreOfficeKit::isActive())
+ if (comphelper::LibreOfficeKit::isActive()) // notify the LibreOfficeKit
+ {
+ updateLibreOfficeKitAutoFill(pViewData, aFillRect);
+ }
+ else if (xOverlayManager.is())
{
Color aHandleColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
if (pViewData->GetActivePart() != eWhich)