summaryrefslogtreecommitdiffstats
path: root/include/LibreOfficeKit
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-07-09 14:41:21 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-07-30 08:22:19 +0200
commite1511ce551f27a5560600029193f076fd65ece17 (patch)
tree3f104ccdda4a63bbaf4d7745f56944ff4d0ad4b3 /include/LibreOfficeKit
parenttools: use upper case GetWidth/GetHeight for Rect for repr. string (diff)
downloadcore-e1511ce551f27a5560600029193f076fd65ece17.tar.gz
core-e1511ce551f27a5560600029193f076fd65ece17.zip
indexing: add LOKit API to render the search result into a bitmap
This adds a new LOKit API to render the search result into a bitmap buffer. It combines the SearchResultLocator to get the location inside the document of the search result (a series of rectangles) and the existing LOKit paintTile API to render the result into a bitmap (byte) buffer. It also adds a LOKit test to show how the API is used and to render a search result of a example document. Change-Id: I4284d90188777fd28158d029daa04151e71022bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118670 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/LibreOfficeKit')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h6
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx16
2 files changed, 22 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 82738d65ff93..8c9e0012552e 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -458,6 +458,12 @@ struct _LibreOfficeKitDocumentClass
void (*sendFormFieldEvent) (LibreOfficeKitDocument* pThis,
const char* pArguments);
+ /// @see lok::Document::renderSearchResult
+ bool (*renderSearchResult) (LibreOfficeKitDocument* pThis,
+ const char* pSearchResult,
+ unsigned char** pBitmapBuffer,
+ int* pWidth, int* pHeight, size_t* pByteSize);
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 06fe5abc19e2..b1d579849cbd 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -787,6 +787,22 @@ public:
mpDoc->pClass->sendFormFieldEvent(mpDoc, pArguments);
}
+ /**
+ * Render input search result to a bitmap buffer.
+ *
+ * @param pSearchResult payload containing the search result data
+ * @param pBitmapBuffer contains the bitmap; use free to deallocate.
+ * @param nWidth output bitmap width
+ * @param nHeight output bitmap height
+ * @param nByteSize output bitmap byte size
+ * @return true if successful
+ */
+ bool renderSearchResult(const char* pSearchResult, unsigned char** pBitmapBuffer,
+ int* pWidth, int* pHeight, size_t* pByteSize)
+ {
+ return mpDoc->pClass->renderSearchResult(mpDoc, pSearchResult, pBitmapBuffer, pWidth, pHeight, pByteSize);
+ }
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};