diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-29 08:50:34 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-30 12:44:01 +0200 |
commit | 6548361109deeb3be2e2c65b27eca04e59fa1f6f (patch) | |
tree | 2e5dcdd61ec9ca11dc692ee0f1a8ff1cdaa522ca /desktop | |
parent | 5fe0711dbe8568f6ec5fe7c2edeb122519ac68a7 (diff) |
LOK: Add getPartName.
By default (i.e. for writer) we can just return an empty string,
and we only actually need to implement ITiledRenderable's
getPartName for components that actually support it (i.e. calc/impress).
Change-Id: I8b381e5d7a8000638b02f763b4bea8ef0226f8e0
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 6c4d5cc3587c..6772694a64b8 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -184,6 +184,7 @@ static LibreOfficeKitDocumentType doc_getDocumentType(LibreOfficeKitDocument* pT static int doc_getParts(LibreOfficeKitDocument* pThis); static int doc_getPart(LibreOfficeKitDocument* pThis); static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart); +static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart); void doc_paintTile(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, const int nCanvasWidth, const int nCanvasHeight, @@ -214,6 +215,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument m_pDocumentClass->getParts = doc_getParts; m_pDocumentClass->getPart = doc_getPart; m_pDocumentClass->setPart = doc_setPart; + m_pDocumentClass->getPartName = doc_getPartName; m_pDocumentClass->paintTile = doc_paintTile; m_pDocumentClass->getDocumentSize = doc_getDocumentSize; @@ -469,6 +471,25 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart) Application::ReleaseSolarMutex(); } +static char* doc_getPartName(LibreOfficeKitDocument* pThis, int 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 0; + } + + OUString sName = pDoc->getPartName( nPart ); + OString aString = OUStringToOString(sName, RTL_TEXTENCODING_UTF8); + char* pMemory = (char*) malloc(aString.getLength() + 1); + strcpy(pMemory, aString.getStr()); + return pMemory; + +} + void doc_paintTile (LibreOfficeKitDocument* pThis, unsigned char* pBuffer, const int nCanvasWidth, const int nCanvasHeight, |