summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-09-02 11:35:42 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2022-11-10 10:16:52 +0100
commitff9b9944401a594ec4a67bca953b312f3a54e3f8 (patch)
tree890a82d22932d381ded25a9f249c81cc23478c4e /desktop
parent3f4e11bd40f60510272df7a285d8a78181af0ccb (diff)
lok: Introudce getDataArea for Calc
It will share information about real size of a data inside spreadsheet so we can easily check where data ends in online side. Change-Id: I376187a33c5c82d409f559d5cc826a4f36d4252e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139472 Reviewed-by: Gökay ŞATIR <gokaysatir@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142503 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx3
-rw-r--r--desktop/source/lib/init.cxx28
2 files changed, 30 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index d7089d9243f0..dd84323f6c9b 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -3623,10 +3623,11 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(documentClassOffset(64),
offsetof(struct _LibreOfficeKitDocumentClass, sendContentControlEvent));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(65), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionTypeAndText));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(66), offsetof(struct _LibreOfficeKitDocumentClass, getDataArea));
// Extending is fine, update this, and add new assert for the offsetof the
// new method
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(66), sizeof(struct _LibreOfficeKitDocumentClass));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(67), sizeof(struct _LibreOfficeKitDocumentClass));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d4332d5c2926..f4aeaf2760cf 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1020,6 +1020,10 @@ static int doc_getTileMode(LibreOfficeKitDocument* pThis);
static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
long* pWidth,
long* pHeight);
+static void doc_getDataArea(LibreOfficeKitDocument* pThis,
+ long nTab,
+ long* pCol,
+ long* pRow);
static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
const char* pArguments);
@@ -1272,6 +1276,7 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference <css::lang::XComponent> xC
m_pDocumentClass->paintPartTile = doc_paintPartTile;
m_pDocumentClass->getTileMode = doc_getTileMode;
m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
+ m_pDocumentClass->getDataArea = doc_getDataArea;
m_pDocumentClass->initializeForRendering = doc_initializeForRendering;
m_pDocumentClass->registerCallback = doc_registerCallback;
m_pDocumentClass->postKeyEvent = doc_postKeyEvent;
@@ -3919,6 +3924,29 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
}
}
+static void doc_getDataArea(LibreOfficeKitDocument* pThis,
+ long nTab,
+ long* pCol,
+ long* pRow)
+{
+ comphelper::ProfileZone aZone("doc_getDataArea");
+
+ SolarMutexGuard aGuard;
+ SetLastExceptionMsg();
+
+ ITiledRenderable* pDoc = getTiledRenderable(pThis);
+ if (pDoc)
+ {
+ Size aDocumentSize = pDoc->getDataArea(nTab);
+ *pCol = aDocumentSize.Width();
+ *pRow = aDocumentSize.Height();
+ }
+ else
+ {
+ SetLastExceptionMsg("Document doesn't support tiled rendering");
+ }
+}
+
static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
const char* pArguments)
{