diff options
author | Jan Holesovsky <kendy@collabora.com> | 2016-04-21 19:04:58 +0200 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2016-04-23 11:33:24 -0400 |
commit | 41a5531afb740f7af01309ac061838c37c6c3fb1 (patch) | |
tree | 126ab9c91c4d0a2e740881a4b1a6ab572c70e496 | |
parent | 756e208be95b455d3d817610d931a742d1b04389 (diff) |
lok: getPartHash should be at the end, it is a new API call.
Also add it to the init.cxx so that it is actually used.
Change-Id: I255411158d0822718116ac05aad1ee925a9a7a9a
-rw-r--r-- | desktop/source/lib/init.cxx | 22 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 8 |
2 files changed, 25 insertions, 5 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index bada69fd2bb5..f1cb9f05ff0d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -381,6 +381,7 @@ static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis, const char *pFontName, int* pFontWidth, int* pFontHeight); +static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart); LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) : mxComponent(xComponent) @@ -400,7 +401,6 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->setPart = doc_setPart; m_pDocumentClass->getPartName = doc_getPartName; m_pDocumentClass->setPartMode = doc_setPartMode; - m_pDocumentClass->renderFont = doc_renderFont; m_pDocumentClass->paintTile = doc_paintTile; m_pDocumentClass->getTileMode = doc_getTileMode; m_pDocumentClass->getDocumentSize = doc_getDocumentSize; @@ -424,6 +424,9 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->getView = doc_getView; m_pDocumentClass->getViews = doc_getViews; + m_pDocumentClass->renderFont = doc_renderFont; + m_pDocumentClass->getPartHash = doc_getPartHash; + gDocumentClass = m_pDocumentClass; } pClass = m_pDocumentClass.get(); @@ -913,6 +916,23 @@ static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart) } +static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart) +{ + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return nullptr; + } + + OUString sHash = pDoc->getPartHash(nPart); + OString aString = OUStringToOString(sHash, RTL_TEXTENCODING_UTF8); + char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1)); + strcpy(pMemory, aString.getStr()); + return pMemory; + +} + static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode) { diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index d66028a4b18d..be833dbaf1d9 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -116,10 +116,6 @@ struct _LibreOfficeKitDocumentClass char* (*getPartName) (LibreOfficeKitDocument* pThis, int nPart); - /// @see lok::Document::getPartHash(). - char* (*getPartHash) (LibreOfficeKitDocument* pThis, - int nPart); - /// @see lok::Document::setPartMode(). void (*setPartMode) (LibreOfficeKitDocument* pThis, int nMode); @@ -226,6 +222,10 @@ struct _LibreOfficeKitDocumentClass const char* pFontName, int* pFontWidth, int* pFontHeight); + + /// @see lok::Document::getPartHash(). + char* (*getPartHash) (LibreOfficeKitDocument* pThis, + int nPart); #endif // LOK_USE_UNSTABLE_API }; |