diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-08 15:23:06 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-12 05:19:13 +0200 |
commit | 4d15212ef8de89a71387c00bdeb7d9a41409e467 (patch) | |
tree | 8607981865d3044ba662698cb615f8a04217da69 /desktop | |
parent | 312883ad755e76cee95735f9faca4a8354b068fd (diff) |
Add get/setPart to ITiledRenderable, and implement for sw/sc.
Change-Id: Iec3d6374f029149cadf8fb9c9b16fec90146c31e
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 273446f1f142..bde1c508ef6f 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -181,7 +181,8 @@ extern "C" static void doc_destroy(LibreOfficeKitDocument* pThis); static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* pUrl, const char* pFormat, const char* pFilterOptions); static LibreOfficeKitDocumentType doc_getDocumentType(LibreOfficeKitDocument* pThis); -static int doc_getNumberOfParts(LibreOfficeKitDocument* pThis); +static int doc_getParts(LibreOfficeKitDocument* pThis); +static int doc_getPart(LibreOfficeKitDocument* pThis); static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart); void doc_paintTile(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, @@ -210,7 +211,8 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument m_pDocumentClass->destroy = doc_destroy; m_pDocumentClass->saveAs = doc_saveAs; m_pDocumentClass->getDocumentType = doc_getDocumentType; - m_pDocumentClass->getNumberOfParts = doc_getNumberOfParts; + m_pDocumentClass->getParts = doc_getParts; + m_pDocumentClass->getPart = doc_getPart; m_pDocumentClass->setPart = doc_setPart; m_pDocumentClass->paintTile = doc_paintTile; m_pDocumentClass->getDocumentSize = doc_getDocumentSize; @@ -421,17 +423,46 @@ static LibreOfficeKitDocumentType doc_getDocumentType (LibreOfficeKitDocument* p return LOK_DOCTYPE_OTHER; } -static int doc_getNumberOfParts (LibreOfficeKitDocument* pThis) +static int doc_getParts (LibreOfficeKitDocument* pThis) { - (void) pThis; - // Assume writer document for now. - return 1; + 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 0; + } + + return pDoc->getParts(); +} + +static int doc_getPart (LibreOfficeKitDocument* pThis) +{ + 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 0; + } + + return pDoc->getPart(); } static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart) { - (void) pThis; - (void) nPart; + 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->setPart( nPart ); } void doc_paintTile (LibreOfficeKitDocument* pThis, |