diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-17 18:00:01 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-17 18:21:09 +0200 |
commit | cfc4375158ee174e8dcb4df319b82c0bdd6f31cc (patch) | |
tree | 41ae8a093c7cd1bd6f3f2e0045c41649ed894935 /desktop | |
parent | This patch is upstream, too (diff) | |
download | core-cfc4375158ee174e8dcb4df319b82c0bdd6f31cc.tar.gz core-cfc4375158ee174e8dcb4df319b82c0bdd6f31cc.zip |
LOK: add lok::Document::getTextSelection()
I.e. the copy part of copy&paste. Only the Writer bits for now.
Change-Id: Ia003e76e3b234735f472cdef125514f9771d8640
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 89e85af6a6fa..23c52bc38a3e 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -215,6 +215,8 @@ static void doc_setTextSelection (LibreOfficeKitDocument* pThis, int nType, int nX, int nY); +static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, + const char* pMimeType); static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis, int nType, int nX, @@ -251,6 +253,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument m_pDocumentClass->postMouseEvent = doc_postMouseEvent; m_pDocumentClass->postUnoCommand = doc_postUnoCommand; m_pDocumentClass->setTextSelection = doc_setTextSelection; + m_pDocumentClass->getTextSelection = doc_getTextSelection; m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection; m_pDocumentClass->resetSelection = doc_resetSelection; @@ -788,6 +791,22 @@ static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int n pDoc->setTextSelection(nType, nX, nY); } +static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMimeType) +{ + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return 0; + } + + OString aRet = pDoc->getTextSelection(pMimeType); + + char* pMemory = static_cast<char*>(malloc(aRet.getLength() + 1)); + strcpy(pMemory, aRet.getStr()); + return pMemory; +} + static void doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) { ITiledRenderable* pDoc = getTiledRenderable(pThis); |