From b74163742ff1288ad9ea1ec8e83ac08faf686893 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Thu, 21 Apr 2016 19:04:58 +0200 Subject: 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 --- desktop/source/lib/init.cxx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'desktop/source') diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d74ae31332ba..ceb7f9063309 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -367,6 +367,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 &xComponent) : mxComponent(xComponent) @@ -388,7 +389,6 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 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; @@ -412,6 +412,9 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 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(); @@ -905,6 +908,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(malloc(aString.getLength() + 1)); + strcpy(pMemory, aString.getStr()); + return pMemory; + +} + static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode) { -- cgit