summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx6
-rw-r--r--desktop/source/lib/init.cxx97
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h16
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx27
4 files changed, 145 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index ec40760861e7..85cd7e47e4f2 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -3674,9 +3674,13 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(documentClassOffset(71), offsetof(struct _LibreOfficeKitDocumentClass, getA11yCaretPosition));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(72), offsetof(struct _LibreOfficeKitDocumentClass, setViewReadOnly));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(73), offsetof(struct _LibreOfficeKitDocumentClass, setAllowChangeComments));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(74), offsetof(struct _LibreOfficeKitDocumentClass, getPresentationInfo));
+ 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));
// As above
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(74), sizeof(struct _LibreOfficeKitDocumentClass));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(78), sizeof(struct _LibreOfficeKitDocumentClass));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 03a5457edcc8..365947a43b9f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1274,6 +1274,19 @@ static void doc_setAccessibilityState(LibreOfficeKitDocument* pThis, int nId, bo
static char* doc_getA11yFocusedParagraph(LibreOfficeKitDocument* pThis);
static int doc_getA11yCaretPosition(LibreOfficeKitDocument* pThis);
+
+static char* doc_getPresentationInfo(LibreOfficeKitDocument* pThis);
+
+static bool doc_createSlideRenderer(
+ LibreOfficeKitDocument* pThis,
+ int nSlideNumber, unsigned* nViewWidth, unsigned* nViewHeight,
+ bool bRenderBackground, bool bRenderMasterPage);
+
+static void doc_postSlideshowCleanup(LibreOfficeKitDocument* pThis);
+
+static bool doc_renderNextSlideLayer(
+ LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* bIsBitmapLayer, char** pJsonMsg);
+
} // extern "C"
namespace {
@@ -1471,6 +1484,11 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference <css::lang::XComponent> xC
m_pDocumentClass->setAllowChangeComments = doc_setAllowChangeComments;
+ m_pDocumentClass->getPresentationInfo = doc_getPresentationInfo;
+ m_pDocumentClass->createSlideRenderer = doc_createSlideRenderer;
+ m_pDocumentClass->postSlideshowCleanup = doc_postSlideshowCleanup;
+ m_pDocumentClass->renderNextSlideLayer = doc_renderNextSlideLayer;
+
gDocumentClass = m_pDocumentClass;
}
pClass = m_pDocumentClass.get();
@@ -5499,6 +5517,85 @@ static void doc_setWindowTextSelection(LibreOfficeKitDocument* /*pThis*/, unsign
Application::PostMouseEvent(VclEventId::WindowMouseButtonUp, pWindow, &aCursorEvent);
}
+static char* doc_getPresentationInfo(LibreOfficeKitDocument* pThis)
+{
+ SolarMutexGuard aGuard;
+ SetLastExceptionMsg();
+
+ ITiledRenderable* pDoc = getTiledRenderable(pThis);
+ if (!pDoc)
+ {
+ SetLastExceptionMsg(u"Document doesn't support tiled rendering"_ustr);
+ return nullptr;
+ }
+
+ return convertOString(pDoc->getPresentationInfo());
+}
+
+static bool doc_createSlideRenderer(
+ LibreOfficeKitDocument* pThis,
+ int nSlideNumber, unsigned* pViewWidth, unsigned* pViewHeight,
+ bool bRenderBackground, bool bRenderMasterPage)
+{
+ SolarMutexGuard aGuard;
+ SetLastExceptionMsg();
+
+ ITiledRenderable* pDoc = getTiledRenderable(pThis);
+ if (!pDoc)
+ {
+ SetLastExceptionMsg(u"Document doesn't support tiled rendering"_ustr);
+ return false;
+ }
+
+ sal_Int32 nViewWidth = 0;
+ sal_Int32 nViewHeight = 0;
+ bool bReturn = pDoc->createSlideRenderer(
+ nSlideNumber, nViewWidth, nViewHeight,
+ bRenderBackground, bRenderMasterPage);
+
+ *pViewWidth = nViewWidth;
+ *pViewHeight = nViewHeight;
+
+ return bReturn;
+}
+
+static void doc_postSlideshowCleanup(LibreOfficeKitDocument* pThis)
+{
+ SolarMutexGuard aGuard;
+ SetLastExceptionMsg();
+
+ ITiledRenderable* pDoc = getTiledRenderable(pThis);
+ if (!pDoc)
+ {
+ SetLastExceptionMsg(u"Document doesn't support tiled rendering"_ustr);
+ return;
+ }
+ pDoc->postSlideshowCleanup();
+}
+
+static bool doc_renderNextSlideLayer(
+ LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* pIsBitmapLayer, char** pJsonMessage)
+{
+ SolarMutexGuard aGuard;
+ SetLastExceptionMsg();
+
+ ITiledRenderable* pDoc = getTiledRenderable(pThis);
+ if (!pDoc)
+ {
+ SetLastExceptionMsg(u"Document doesn't support tiled rendering"_ustr);
+ return true;
+ }
+ OUString sJsonMesssage;
+ bool bIsBitmapLayer = false;
+ bool bDone = pDoc->renderNextSlideLayer(pBuffer, bIsBitmapLayer, sJsonMesssage);
+
+ if (pJsonMessage)
+ *pJsonMessage = convertOUString(sJsonMesssage);
+ *pIsBitmapLayer = bIsBitmapLayer;
+
+ return bDone;
+}
+
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 8db2848ef7c8..7589da304594 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -523,6 +523,22 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document::setAllowChangeComments().
void (*setAllowChangeComments) (LibreOfficeKitDocument* pThis, int nId, const bool allow);
+ /// @see lok::Document::getPresentationInfo
+ char* (*getPresentationInfo) (LibreOfficeKitDocument* pThis);
+
+ /// @see lok::Document::createSlideRenderer
+ bool (*createSlideRenderer) (
+ LibreOfficeKitDocument* pThis,
+ int nSlideNumber, unsigned* nViewWidth, unsigned* nViewHeight,
+ bool bRenderBackground, bool bRenderMasterPage);
+
+ /// @see lok::Document::postSlideshowCleanup
+ void (*postSlideshowCleanup)(LibreOfficeKitDocument* pThis);
+
+ /// @see lok::Document::renderNextSlideLayer
+ bool (*renderNextSlideLayer)(
+ LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* bIsBitmapLayer, char** pJsonMessage);
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 2d58fb0ce1e0..3678dd29a9ec 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -909,6 +909,33 @@ public:
return mpDoc->pClass->getA11yCaretPosition(mpDoc);
}
+ /// Get the information about the current presentation (Impress only).
+ char* getPresentationInfo()
+ {
+ return mpDoc->pClass->getPresentationInfo(mpDoc);
+ }
+
+ /// Create a slide renderer in core for the input slide.
+ bool createSlideRenderer(
+ int nSlideNumber, unsigned* nViewWidth, unsigned* nViewHeight,
+ bool bRenderBackground, bool bRenderMasterPage)
+ {
+ return mpDoc->pClass->createSlideRenderer(
+ mpDoc, nSlideNumber, nViewWidth, nViewHeight, bRenderBackground, bRenderMasterPage);
+ }
+
+ /// Clean-up the slideshow (slide renderer)
+ void postSlideshowCleanup()
+ {
+ mpDoc->pClass->postSlideshowCleanup(mpDoc);
+ }
+
+ /// Render the slide layer
+ bool renderNextSlideLayer(unsigned char* pBuffer, bool* bIsBitmapLayer, char** pJsonMessage)
+ {
+ return mpDoc->pClass->renderNextSlideLayer(mpDoc, pBuffer, bIsBitmapLayer, pJsonMessage);
+ }
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};