Kaydet (Commit) 7a5efaa0 authored tarafından Marco Cecchetti's avatar Marco Cecchetti Kaydeden (comit) Marco Cecchetti

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/46528Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarco Cecchetti <mrcekets@gmail.com>
üst 0f173b3f
......@@ -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);
}
......
......@@ -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,
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment