desktop/qa/desktop_lib/test_desktop_lib.cxx | 5 +++-- desktop/source/lib/init.cxx | 13 +++++++++++++ include/LibreOfficeKit/LibreOfficeKit.h | 2 ++ include/LibreOfficeKit/LibreOfficeKit.hxx | 5 +++++ 4 files changed, 23 insertions(+), 2 deletions(-)
New commits: commit ab897d8fa045878b5a58e64a2b6e0de90e38f73e Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Feb 20 17:07:28 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Feb 26 11:15:48 2024 +0100 add getViewRenderState to LibreOfficeKitDocument so we can get the initial render state as it is when created Change-Id: I1202cbbf478bc4f62f4d587e1f2766c61f172cb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163666 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit effe8f6e5cc5389b234a6e57540f935de4a6f201) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163843 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index c9f276a67eeb..2457771c384c 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3681,12 +3681,13 @@ void DesktopLOKTest::testABI() offsetof(struct _LibreOfficeKitDocumentClass, getA11yFocusedParagraph)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(71), offsetof(struct _LibreOfficeKitDocumentClass, getA11yCaretPosition)); - CPPUNIT_ASSERT_EQUAL(documentClassOffset(72), offsetof(struct _LibreOfficeKitDocumentClass, hyperlinkInfoAtPosition)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(73), + offsetof(struct _LibreOfficeKitDocumentClass, getViewRenderState)); // As above - CPPUNIT_ASSERT_EQUAL(documentClassOffset(73), sizeof(struct _LibreOfficeKitDocumentClass)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(74), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7d5bbc66d492..5bc92fdb2a5d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1298,6 +1298,8 @@ static void doc_setAccessibilityState(LibreOfficeKitDocument* pThis, int nId, bo static char* doc_getA11yFocusedParagraph(LibreOfficeKitDocument* pThis); static int doc_getA11yCaretPosition(LibreOfficeKitDocument* pThis); + +static char* doc_getViewRenderState(LibreOfficeKitDocument* pThis); } // extern "C" namespace { @@ -1492,6 +1494,8 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference <css::lang::XComponent> xC m_pDocumentClass->getA11yFocusedParagraph = doc_getA11yFocusedParagraph; m_pDocumentClass->getA11yCaretPosition = doc_getA11yCaretPosition; + m_pDocumentClass->getViewRenderState = doc_getViewRenderState; + gDocumentClass = m_pDocumentClass; } pClass = m_pDocumentClass.get(); @@ -4882,6 +4886,15 @@ static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu return 0; } +static char* doc_getViewRenderState(LibreOfficeKitDocument* pThis) +{ + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + return nullptr; + + return convertOString(pDoc->getViewRenderState()); +} + namespace { /** Class to react on finishing of a dispatched command. diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 78651128d3ac..f66083e2d301 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -517,6 +517,8 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::hyperlinkInfoAtPosition(). char* (*hyperlinkInfoAtPosition) (LibreOfficeKitDocument* pThis, int x,int y); + char* (*getViewRenderState) (LibreOfficeKitDocument* pThis); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index e94053378355..b6cc69e8c92c 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -894,6 +894,11 @@ public: return mpDoc->pClass->getA11yCaretPosition(mpDoc); } + char* getViewRenderState() + { + return mpDoc->pClass->getViewRenderState(mpDoc); + } + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY };