diff options
author | Pranav Kant <pranavk@libreoffice.org> | 2015-12-09 21:45:21 +0530 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2015-12-09 16:36:22 +0000 |
commit | 7d7fad258dfde500c5ee99b5f1691172724383bd (patch) | |
tree | 2688915c6cf6534d80922f881a712c5a83881492 /libreofficekit/source | |
parent | dbc830aecc722d34971d773470da478ef4c38714 (diff) |
tdf#96317: Add API for copy/paste from/to the widget
Change-Id: Iac869ddb65cbdd2227f96d047d83159ca7819f11
Reviewed-on: https://gerrit.libreoffice.org/20534
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'libreofficekit/source')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 3bf4d44c2835..741760214be4 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -343,7 +343,7 @@ doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highligh cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect); x = pixelToTwip (cairoVisRect.x, priv->m_fZoom); y = pixelToTwip (cairoVisRect.y, priv->m_fZoom); - + aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/type", '/'), "string"); aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value", '/'), pText); aTree.put(boost::property_tree::ptree::path_type("SearchItem.Backward/type", '/'), "boolean"); @@ -2668,6 +2668,37 @@ lok_doc_view_highlight_all (LOKDocView* pDocView, doSearch(pDocView, pText, false, true); } +SAL_DLLPUBLIC_EXPORT gchar* +lok_doc_view_copy_selection (LOKDocView* pDocView, + const gchar* pMimeType, + gchar** pUsedMimeType) +{ + LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(pDocView); + return pDocument->pClass->getTextSelection(pDocument, pMimeType, pUsedMimeType); +} + +SAL_DLLPUBLIC_EXPORT gboolean +lok_doc_view_paste (LOKDocView* pDocView, + const gchar* pMimeType, + const gchar* pData, + gsize nSize) +{ + LOKDocViewPrivate& priv = getPrivate(pDocView); + LibreOfficeKitDocument* pDocument = priv->m_pDocument; + gboolean ret = 0; + + if (!priv->m_bEdit) + { + g_info ("ignoring paste in view-only mode"); + return ret; + } + + if (pData) + ret = pDocument->pClass->paste(pDocument, pMimeType, pData, nSize); + + return ret; +} + SAL_DLLPUBLIC_EXPORT float lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput) { |