summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-06-17 18:00:01 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-06-22 11:14:37 +0200
commit7160685d541605bda21fbb434e975c4452799abd (patch)
treeba64e13a79d18b133bd039a6b8b8afca123bebba /desktop
parent161e39a6d2eb7038e0d7a40b13f5e290680be6f8 (diff)
LOK: add lok::Document::getTextSelection()
I.e. the copy part of copy&paste. Only the Writer bits for now. Change-Id: Ia003e76e3b234735f472cdef125514f9771d8640 (cherry picked from commit cfc4375158ee174e8dcb4df319b82c0bdd6f31cc)
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 71e943185744..89fe2dbd366e 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);