From 57667603c52e7d6bb82f5040151c8b7defcc6f8a Mon Sep 17 00:00:00 2001 From: Muhammet Kara Date: Fri, 1 Mar 2019 21:56:31 +0300 Subject: Auto-redact - First stab Add a SfxRedactionHelper::autoRedactPage method which searches for the given term through the gdimetafile which has the whole content of an xPage (a Draw page), and draws redaction rectangles at proper positions with proper sizes. The search is case sensitive, and finds only the first occurences on a line. Will switch to a proper search provider via a follow-up patch. Change-Id: If3db62e50994670143785b6727fdcf1ccd4c6f8e Reviewed-on: https://gerrit.libreoffice.org/68597 Tested-by: Jenkins Reviewed-by: Muhammet Kara --- sfx2/inc/SfxRedactionHelper.hxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sfx2/inc/SfxRedactionHelper.hxx') diff --git a/sfx2/inc/SfxRedactionHelper.hxx b/sfx2/inc/SfxRedactionHelper.hxx index ac15bb790fe9..44a78ab9b877 100644 --- a/sfx2/inc/SfxRedactionHelper.hxx +++ b/sfx2/inc/SfxRedactionHelper.hxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -87,6 +88,25 @@ public: * pages inserted into Draw for redaction. * */ static PageMargins getPageMarginsForCalc(css::uno::Reference& xModel); + + static void searchInMetaFile(const OUString& sSearchTerm, const GDIMetaFile& rMtf, + std::vector& aRedactionRectangles, + uno::Reference& xComponent); + + /* + * Draws a redaction rectangle on the draw page referenced with its page number (0-based) + * */ + static void addRedactionRectToPage(uno::Reference& xComponent, + uno::Reference& xPage, + const std::vector& aNewRectangles); + + /* + * Search for the given term through the gdimetafile, which has the whole content of a draw page, + * and draw redaction rectangles to the appropriate positions with suitable sizes. + * */ + static void autoRedactPage(const OUString& sRedactionTerm, const GDIMetaFile& rGDIMetaFile, + uno::Reference& xPage, + uno::Reference& xComponent); }; #endif // INCLUDED_CUI_SOURCE_INC_SFXREDACTIONHELPER_HXX -- cgit v1.2.3