diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-19 18:13:27 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-19 18:00:53 +0000 |
commit | af7cbebd8eed82b81e00e6c2e0dc6c2c467ad8e2 (patch) | |
tree | 2172475e22afce046cb1e9b1fb6528574bc16cf4 /desktop | |
parent | rendercontext: Fix painting of double-buffered listbox. (diff) | |
download | core-af7cbebd8eed82b81e00e6c2e0dc6c2c467ad8e2.tar.gz core-af7cbebd8eed82b81e00e6c2e0dc6c2c467ad8e2.zip |
LOK: return used format in Document::getTextSelection()
This allows requesting text/html, with falling back to plain text if
necessary.
Change-Id: Ie6d4e0e173311ba018553043b6a869abf193bf6f
Reviewed-on: https://gerrit.libreoffice.org/16377
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 23c52bc38a3e..c043e04a22a0 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -216,7 +216,8 @@ static void doc_setTextSelection (LibreOfficeKitDocument* pThis, int nX, int nY); static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, - const char* pMimeType); + const char* pMimeType, + char** pUsedMimeType); static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, int nType, int nX, @@ -791,7 +792,7 @@ static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int n pDoc->setTextSelection(nType, nX, nY); } -static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMimeType) +static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMimeType, char** pUsedMimeType) { ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -800,10 +801,20 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMi return 0; } - OString aRet = pDoc->getTextSelection(pMimeType); + OString aUsedMimeType; + OString aRet = pDoc->getTextSelection(pMimeType, aUsedMimeType); + if (aUsedMimeType.isEmpty()) + aRet = pDoc->getTextSelection("text/plain;charset=utf-8", aUsedMimeType); char* pMemory = static_cast<char*>(malloc(aRet.getLength() + 1)); strcpy(pMemory, aRet.getStr()); + + if (pUsedMimeType) + { + *pUsedMimeType = static_cast<char*>(malloc(aUsedMimeType.getLength() + 1)); + strcpy(*pUsedMimeType, aUsedMimeType.getStr()); + } + return pMemory; } |