Kaydet (Commit) 6872ecdb authored tarafından Andrzej Hunt's avatar Andrzej Hunt

LOK: add setPartMode.

This API seems to be simplest in the long run where we'll want to be
able to select between rendering slides/notes/both/embedded objects,
and maybe even adding the option of switching between continuous
and single page mode in writer (although I have no idea how hard
getting a single page mode out of writer would be).

Change-Id: I5bdfdb61854c37281c6992c8f3ed1c50c8aa0919
üst 65483611
...@@ -185,6 +185,7 @@ static int doc_getParts(LibreOfficeKitDocument* pThis); ...@@ -185,6 +185,7 @@ static int doc_getParts(LibreOfficeKitDocument* pThis);
static int doc_getPart(LibreOfficeKitDocument* pThis); static int doc_getPart(LibreOfficeKitDocument* pThis);
static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart); static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart);
static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart); static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart);
static void doc_setPartMode(LibreOfficeKitDocument* pThis, LibreOfficeKitPartMode ePartMode);
void doc_paintTile(LibreOfficeKitDocument* pThis, void doc_paintTile(LibreOfficeKitDocument* pThis,
unsigned char* pBuffer, unsigned char* pBuffer,
const int nCanvasWidth, const int nCanvasHeight, const int nCanvasWidth, const int nCanvasHeight,
...@@ -216,6 +217,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument ...@@ -216,6 +217,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
m_pDocumentClass->getPart = doc_getPart; m_pDocumentClass->getPart = doc_getPart;
m_pDocumentClass->setPart = doc_setPart; m_pDocumentClass->setPart = doc_setPart;
m_pDocumentClass->getPartName = doc_getPartName; m_pDocumentClass->getPartName = doc_getPartName;
m_pDocumentClass->setPartMode = doc_setPartMode;
m_pDocumentClass->paintTile = doc_paintTile; m_pDocumentClass->paintTile = doc_paintTile;
m_pDocumentClass->getDocumentSize = doc_getDocumentSize; m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
...@@ -490,6 +492,21 @@ static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart) ...@@ -490,6 +492,21 @@ static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart)
} }
static void doc_setPartMode(LibreOfficeKitDocument* pThis,
LibreOfficeKitPartMode ePartMode)
{
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() );
if (!pDoc)
{
gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
return;
}
pDoc->setPartMode(ePartMode);
}
void doc_paintTile (LibreOfficeKitDocument* pThis, void doc_paintTile (LibreOfficeKitDocument* pThis,
unsigned char* pBuffer, unsigned char* pBuffer,
const int nCanvasWidth, const int nCanvasHeight, const int nCanvasWidth, const int nCanvasHeight,
......
...@@ -40,6 +40,16 @@ typedef enum ...@@ -40,6 +40,16 @@ typedef enum
LOK_DOCTYPE_OTHER LOK_DOCTYPE_OTHER
} }
LibreOfficeKitDocumentType; LibreOfficeKitDocumentType;
typedef enum
{
LOK_PARTMODE_DEFAULT,
LOK_PARTMODE_SLIDE,
LOK_PARTMODE_NOTES,
LOK_PARTMODE_SLIDENOTES,
LOK_PARTMODE_EMBEDDEDOBJ
}
LibreOfficeKitPartMode;
#endif // LOK_USE_UNSTABLE_API #endif // LOK_USE_UNSTABLE_API
struct _LibreOfficeKit struct _LibreOfficeKit
...@@ -86,6 +96,9 @@ struct _LibreOfficeKitDocumentClass ...@@ -86,6 +96,9 @@ struct _LibreOfficeKitDocumentClass
char* (*getPartName) (LibreOfficeKitDocument* pThis, char* (*getPartName) (LibreOfficeKitDocument* pThis,
int nPart); int nPart);
void (*setPartMode) (LibreOfficeKitDocument* pThis,
LibreOfficeKitPartMode eMode);
// Get a pointer to a raw array, of size 3*nCanvasWidth*nCanvasHeight // Get a pointer to a raw array, of size 3*nCanvasWidth*nCanvasHeight
// Basebmp's bitmap device seems to round the width up if needed // Basebmp's bitmap device seems to round the width up if needed
// for its internal buffer, i.e. the rowstride for the buffer may be larger // for its internal buffer, i.e. the rowstride for the buffer may be larger
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#ifndef INCLUDED_VCL_ITILEDRENDERABLE_HXX #ifndef INCLUDED_VCL_ITILEDRENDERABLE_HXX
#define INCLUDED_VCL_ITILEDRENDERABLE_HXX #define INCLUDED_VCL_ITILEDRENDERABLE_HXX
#define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit/LibreOfficeKit.h>
#include <tools/gen.hxx> #include <tools/gen.hxx>
#include <vcl/virdev.hxx> #include <vcl/virdev.hxx>
...@@ -67,6 +69,11 @@ public: ...@@ -67,6 +69,11 @@ public:
(void) nPart; (void) nPart;
return ""; return "";
} }
virtual void setPartMode(LibreOfficeKitPartMode ePartMode)
{
(void) ePartMode;
}
}; };
} // namespace vcl } // namespace vcl
......
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