diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2019-07-19 23:44:20 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-08-02 11:41:47 -0400 |
commit | 3dbf6e43ebd6a52b665fab906711f173f0e5ba82 (patch) | |
tree | fd6c4db33a2653871d5298bdb0a6775790d63308 /include | |
parent | a85b62cb8cbbbd25316f77b49055c1fb817c60e3 (diff) |
Add more powerful selection fetch & clipboard set methods.
Change-Id: I6633356d13480377a83a006588ec69ebcb56a93f
Diffstat (limited to 'include')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 16 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 40 |
2 files changed, 56 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index dedb75995930..14b7bb995b10 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -389,6 +389,22 @@ struct _LibreOfficeKitDocumentClass void (*resizeWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId, const int width, const int height); + /// Pass a nullptr terminated array of mime-type strings + /// @see lok::Document::getSelection for more details + int (*getSelection) (LibreOfficeKitDocument* pThis, + const char **pMimeTypes, + size_t *pOutCount, + char ***pOutMimeTypes, + size_t **pOutSizes, + char ***pOutStreams); + + /// @see lok::Document::setClipboard + int (*setClipboard) (LibreOfficeKitDocument* pThis, + const size_t nInCount, + const char **pInMimeTypes, + const size_t *pInSizes, + const char **pInStreams); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index c6f90dc1ae24..cb1ca1e4c2d3 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -352,6 +352,46 @@ public: } /** + * Gets the selected content for the current view as a series of binary streams. + * + * NB. returns a complete set of possible selection types if nullptr is passed for pMimeTypes. + * + * @param pMimeTypes passes in a nullptr terminated list of mime types to fetch + * @param pOutCount returns the size of the other @pOut arrays + * @param pOutMimeTypes returns an array of mime types + * @param pOutSizes returns the size of each pOutStream + * @param pOutStreams the content of each mime-type, of length in @pOutSizes + * + * @returns: true on success, false on error. + */ + bool getSelection(const char **pMimeTypes, + size_t *pOutCount, + char ***pOutMimeTypes, + size_t **pOutSizes, + char ***pOutStreams) + { + return mpDoc->pClass->getSelection(mpDoc, pMimeTypes, pOutCount, pOutMimeTypes, pOutSizes, pOutStreams); + } + + /** + * Populates the clipboard for this view with multiple types of content. + * + * @param nInCount the number of types to paste + * @param pInMimeTypes array of mime type strings + * @param pInSizes array of sizes of the data to paste + * @param pInStreams array containing the data of the various types + * + * @return if the supplied data was populated successfully. + */ + bool setClipboard(const size_t nInCount, + const char **pInMimeTypes, + const size_t *pInSizes, + const char **pInStreams) + { + return mpDoc->pClass->setClipboard(mpDoc, nInCount, pInMimeTypes, pInSizes, pInStreams); + } + + /** * Pastes content at the current cursor position. * * @param pMimeType format of pData, for example text/plain;charset=utf-8. |