[Libreoffice-commits] core.git: desktop/qa include/LibreOfficeKit sc/source
Marco Cecchetti
marco.cecchetti at collabora.com
Sat Dec 16 13:17:53 UTC 2017
desktop/qa/desktop_lib/test_desktop_lib.cxx | 3 ++-
include/LibreOfficeKit/LibreOfficeKitEnums.h | 5 +++++
sc/source/ui/view/gridwin.cxx | 14 +++++++++-----
3 files changed, 16 insertions(+), 6 deletions(-)
New commits:
commit 7a5efaa02cbe4140c017d8777993479369c2f10a
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Wed Dec 13 18:02:01 2017 +0100
lok: sc: append the col, row position to the cell cursor message
The payload changes from: "x, y, width, height"
to: "x, y, width, height, column, row".
This feature is exploited by online starting from the 3.0 release.
This change is compatible with older online release:
the column, row coordinates are just ignored.
Change-Id: I7f8c0e3685c57ff20520ee068b215037f6137389
Reviewed-on: https://gerrit.libreoffice.org/46528
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 71bd1af0adaf..ba76a8ca532d 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -774,7 +774,8 @@ void DesktopLOKTest::testCellCursor()
boost::property_tree::read_json(aStream, aTree);
OString aRectangle(aTree.get<std::string>("commandValues").c_str());
- CPPUNIT_ASSERT_EQUAL(OString("0, 0, 1279, 255"), aRectangle);
+ // cell cursor geometry + col + row
+ CPPUNIT_ASSERT_EQUAL(OString("0, 0, 1279, 255, 0, 0"), aRectangle);
comphelper::LibreOfficeKit::setActive(false);
}
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index f14ce4d36a7a..9cf635bb4c40 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -267,6 +267,11 @@ typedef enum
/**
* The size and/or the position of the cell cursor changed.
*
+ * Payload format: "x, y, width, height, column, row", where the first
+ * 4 numbers are document coordinates, in twips, and the last 2 are table
+ * coordinates starting from 0.
+ * When the cursor is not shown the payload format is the "EMPTY" string.
+ *
* Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
*/
LOK_CALLBACK_CELL_CURSOR = 17,
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index a1416600d9d2..0e0f668adf7a 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5568,11 +5568,15 @@ OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoo
if (nSizeYPix == 0)
nSizeYPix = 1;
- long nSizeXTw = rtl::math::round(nSizeXPix / fPPTX);
- long nSizeYTw = rtl::math::round(nSizeYPix / fPPTY);
+ long nPosXTw = rtl::math::round(aScrPos.getX() / fPPTX);
+ long nPosYTw = rtl::math::round(aScrPos.getY() / fPPTY);
+ // look at Rectangle( const Point& rLT, const Size& rSize ) for the '- 1'
+ long nSizeXTw = rtl::math::round(nSizeXPix / fPPTX) - 1;
+ long nSizeYTw = rtl::math::round(nSizeYPix / fPPTY) - 1;
- tools::Rectangle aRect(Point(rtl::math::round(aScrPos.getX() / fPPTX), rtl::math::round(aScrPos.getY() / fPPTY)),
- Size(nSizeXTw, nSizeYTw));
+ std::stringstream ss;
+ ss << nPosXTw << ", " << nPosYTw << ", " << nSizeXTw << ", " << nSizeYTw << ", "
+ << nX << ", " << nY;
pViewData->SetZoom(defaultZoomX, defaultZoomY, true);
@@ -5583,7 +5587,7 @@ OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoo
pViewData->GetLOKHeightHelper().insert(nY - 1, aScrPos.getY());
pViewData->SetLOKOldCurY(nY);
- return aRect.toString();
+ return ss.str().c_str();
}
void ScGridWindow::updateLibreOfficeKitCellCursor(const SfxViewShell* pOtherShell) const
More information about the Libreoffice-commits
mailing list