desktop/qa/desktop_lib/test_desktop_lib.cxx |    3 ++-
 desktop/source/lib/init.cxx                 |    8 ++++++++
 include/LibreOfficeKit/LibreOfficeKit.h     |    3 +++
 include/LibreOfficeKit/LibreOfficeKit.hxx   |    6 ++++++
 4 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 8dcb86a4a724f143f7d5cfcc3d1231a7f924cbd9
Author:     Michael Meeks <[email protected]>
AuthorDate: Mon Nov 18 13:36:32 2024 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Nov 18 17:41:02 2024 +0100

    cool#4250 - add API to set per view options.
    
    Change-Id: I5e3b3b3548ba93b96b33fe682405a2b0b53bbdee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176715
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 9a5c8c65a3cf..849b79a72e07 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -3754,9 +3754,10 @@ void DesktopLOKTest::testABI()
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(75), offsetof(struct 
_LibreOfficeKitDocumentClass, createSlideRenderer));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(76), offsetof(struct 
_LibreOfficeKitDocumentClass, postSlideshowCleanup));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(77), offsetof(struct 
_LibreOfficeKitDocumentClass, renderNextSlideLayer));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(78), offsetof(struct 
_LibreOfficeKitDocumentClass, setViewOption));
 
     // As above
-    CPPUNIT_ASSERT_EQUAL(documentClassOffset(78), sizeof(struct 
_LibreOfficeKitDocumentClass));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(79), sizeof(struct 
_LibreOfficeKitDocumentClass));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7ba3ebf9e977..b045f15fdd2a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1350,6 +1350,8 @@ static void 
doc_postSlideshowCleanup(LibreOfficeKitDocument* pThis);
 static bool doc_renderNextSlideLayer(
     LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* 
bIsBitmapLayer, char** pJsonMsg);
 
+static void doc_setViewOption(LibreOfficeKitDocument* pDoc, const char* 
pOption, const char* pValue);
+
 } // extern "C"
 
 namespace {
@@ -1551,6 +1553,7 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference 
<css::lang::XComponent> xC
         m_pDocumentClass->createSlideRenderer = doc_createSlideRenderer;
         m_pDocumentClass->postSlideshowCleanup = doc_postSlideshowCleanup;
         m_pDocumentClass->renderNextSlideLayer = doc_renderNextSlideLayer;
+        m_pDocumentClass->setViewOption = doc_setViewOption;
 
         gDocumentClass = m_pDocumentClass;
     }
@@ -5825,6 +5828,11 @@ static bool doc_renderNextSlideLayer(
     return bDone;
 }
 
+static void doc_setViewOption(LibreOfficeKitDocument* /*pDoc*/, const char* 
/*pOption*/, const char* /*pValue*/)
+{
+    // placeholder for now
+}
+
 static bool getFromTransferable(
     const css::uno::Reference<css::datatransfer::XTransferable> &xTransferable,
     const OString &aInMimeType, OString &aRet);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index bf7f0fd8c1b3..bd4e4b2533a2 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -552,6 +552,9 @@ struct _LibreOfficeKitDocumentClass
     bool (*renderNextSlideLayer)(
         LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* 
bIsBitmapLayer, char** pJsonMessage);
 
+    /// @see lok::Document::setViewOption
+    void (*setViewOption)(LibreOfficeKitDocument* pThis, const char* pOption, 
const char* pValue);
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index ece999cbd6d7..49fdf03bf233 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -937,6 +937,12 @@ public:
         return mpDoc->pClass->renderNextSlideLayer(mpDoc, pBuffer, 
bIsBitmapLayer, pJsonMessage);
     }
 
+    /// Set named view options
+    void setViewOption(const char* pOption, const char* pValue)
+    {
+        mpDoc->pClass->setViewOption(mpDoc, pOption, pValue);
+    }
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 

Reply via email to