tdf#139331 Option to redact images in "Auto-Redact"
Add images as target in 'Automatic Redaction' Dialog Tools -> Auto-Redact -> Add Target -> Type(All Images) This redacts the images with black rectangles. Change-Id: I0b5253df72199a286e268fedfc3db220bee6b5ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183248 Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Tested-by: Jenkins
This commit is contained in:
@@ -482,6 +482,7 @@ class SvxZoomItem;
|
||||
#define SID_ASYNCHRON (SID_SFX_START + 813)
|
||||
#define SID_ACCESSIBILITY_CHECK_ONLINE (SID_SFX_START + 814)
|
||||
#define SID_THEME_DIALOG (SID_SFX_START + 815)
|
||||
#define SID_REDACT_IMAGE (SID_SFX_START + 816)
|
||||
|
||||
// default-ids for configuration
|
||||
#define SID_CONFIG TypedWhichId<SfxStringItem>(SID_SFX_START + 904)
|
||||
|
||||
@@ -189,6 +189,7 @@
|
||||
#define STR_REDACTION_TARGET_TYPE_TEXT NC_("STR_REDACTION_TARGET_TYPE_TEXT", "Text")
|
||||
#define STR_REDACTION_TARGET_TYPE_REGEX NC_("STR_REDACTION_TARGET_TYPE_REGEX", "Regular expression")
|
||||
#define STR_REDACTION_TARGET_TYPE_PREDEF NC_("STR_REDACTION_TARGET_TYPE_PREDEF", "Predefined")
|
||||
#define STR_REDACTION_TARGET_TYPE_IMAGE NC_("STR_REDACTION_TARGET_TYPE_IMAGE", "Image")
|
||||
#define STR_REDACTION_TARGET_TYPE_UNKNOWN NC_("STR_REDACTION_TARGET_TYPE_UNKNOWN", "Unknown")
|
||||
|
||||
// Translators: Values for the Case Sensitive and the Whole Words columns in Auto-redaction dialog
|
||||
@@ -207,6 +208,7 @@
|
||||
#define STR_REDACTION_EDIT_TARGET NC_("STR_REDACTION_EDIT_TARGET", "Edit Target")
|
||||
#define STR_REDACTION_TARGET_ADD_ERROR NC_("STR_REDACTION_TARGET_ADD_ERROR", "An error occurred while adding new target. Please report this incident.")
|
||||
#define STR_REDACTION_NO_DRAW_WARNING NC_("STR_REDACTION_NO_DRAW_WARNING", "Draw module is needed for redaction. Please make sure you have %PRODUCTNAME Draw installed and working correctly.")
|
||||
#define STR_REDACTION_MULTI_IMAGE_TARGETS NC_("STR_REDACTION_MULTI_IMAGE_TARGETS", "An 'Image' target already exists, which redacts all the images in the document.")
|
||||
|
||||
#define STR_SFX_FILEDLG_ACTUALVERSION NC_("STR_SFX_FILEDLG_ACTUALVERSION", "Current version")
|
||||
#define STR_SFX_EXPLORERFILE_EXPORT NC_("STR_SFX_EXPLORERFILE_EXPORT", "Export")
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#*************************************************************************
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
#*************************************************************************
|
||||
|
||||
$(eval $(call gb_CppunitTest_CppunitTest,sfx2_autoredaction))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_externals,sfx2_autoredaction,\
|
||||
boost_headers \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,sfx2_autoredaction, \
|
||||
sfx2/qa/cppunit/autoredaction \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_libraries,sfx2_autoredaction, \
|
||||
comphelper \
|
||||
cppu \
|
||||
cppuhelper \
|
||||
sal \
|
||||
subsequenttest \
|
||||
test \
|
||||
unotest \
|
||||
sfx \
|
||||
svl \
|
||||
utl \
|
||||
tl \
|
||||
svx \
|
||||
vcl \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_sdk_api,sfx2_autoredaction))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_ure,sfx2_autoredaction))
|
||||
$(eval $(call gb_CppunitTest_use_vcl,sfx2_autoredaction))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_rdb,sfx2_autoredaction,services))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_configuration,sfx2_autoredaction))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
@@ -37,6 +37,7 @@ $(eval $(call gb_Module_add_check_targets,sfx2,\
|
||||
CppunitTest_sfx2_classification \
|
||||
CppunitTest_sfx2_view \
|
||||
CppunitTest_sfx2_doc \
|
||||
CppunitTest_sfx2_autoredaction \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Module_add_subsequentcheck_targets,sfx2,\
|
||||
|
||||
@@ -105,12 +105,21 @@ public:
|
||||
std::vector<tools::Rectangle>& aRedactionRectangles,
|
||||
const uno::Reference<XComponent>& xComponent);
|
||||
|
||||
/*
|
||||
* Used to find images to be redacted. Returns a list of rectangles to cover those
|
||||
* areas to be redacted.
|
||||
* */
|
||||
static void searchImagesInMetaFile(const GDIMetaFile& rMtf,
|
||||
std::vector<tools::Rectangle>& aRedactionRectangles,
|
||||
const uno::Reference<XComponent>& xComponent);
|
||||
|
||||
/*
|
||||
* Draws a redaction rectangle on the draw page referenced with its page number (0-based)
|
||||
* */
|
||||
static void addRedactionRectToPage(const uno::Reference<XComponent>& xComponent,
|
||||
const uno::Reference<drawing::XDrawPage>& xPage,
|
||||
const std::vector<tools::Rectangle>& aNewRectangles);
|
||||
const std::vector<tools::Rectangle>& aNewRectangles,
|
||||
bool isImage);
|
||||
|
||||
/*
|
||||
* Search for the given term through the gdimetafile, which has the whole content of a draw page,
|
||||
|
||||
@@ -20,6 +20,7 @@ enum RedactionTargetType
|
||||
REDACTION_TARGET_TEXT,
|
||||
REDACTION_TARGET_REGEX,
|
||||
REDACTION_TARGET_PREDEFINED,
|
||||
REDACTION_TARGET_IMAGE,
|
||||
REDACTION_TARGET_UNKNOWN
|
||||
};
|
||||
|
||||
@@ -43,6 +44,7 @@ class TargetsTable
|
||||
public:
|
||||
TargetsTable(std::unique_ptr<weld::TreeView> xControl);
|
||||
void InsertTarget(RedactionTarget* pTarget);
|
||||
bool HasTargetType(RedactionTargetType aTargetType);
|
||||
RedactionTarget* GetTargetByName(std::u16string_view sName);
|
||||
OUString GetNameProposal() const;
|
||||
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <test/unoapi_test.hxx>
|
||||
|
||||
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
|
||||
|
||||
#include <sfx2/objsh.hxx>
|
||||
#include <vcl/scheduler.hxx>
|
||||
#include <comphelper/propertyvalue.hxx>
|
||||
|
||||
using namespace com::sun::star;
|
||||
|
||||
class AutoRedactionTest : public UnoApiTest
|
||||
{
|
||||
public:
|
||||
AutoRedactionTest()
|
||||
: UnoApiTest(u"/sfx2/qa/cppunit/data/"_ustr)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(AutoRedactionTest, testImageRedaction)
|
||||
{
|
||||
// Get the images size and postion from the writer
|
||||
loadFromFile(u"autoredact_img.fodt");
|
||||
CPPUNIT_ASSERT_MESSAGE("Failed to load autoredact_img.odt", mxComponent.is());
|
||||
|
||||
uno::Reference<text::XTextGraphicObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT(xSupplier.is());
|
||||
uno::Reference<container::XIndexAccess> xGraphics(xSupplier->getGraphicObjects(),
|
||||
uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT(xGraphics.is());
|
||||
|
||||
sal_Int32 nImageCount = 0, nTotalCount = 3;
|
||||
std::vector<tools::Rectangle> aImageRectangles;
|
||||
|
||||
for (sal_Int32 i = 0; i < xGraphics->getCount(); i++)
|
||||
{
|
||||
uno::Reference<beans::XPropertySet> xProps;
|
||||
xGraphics->getByIndex(i) >>= xProps;
|
||||
if (!xProps.is())
|
||||
continue;
|
||||
|
||||
awt::Point aPos;
|
||||
awt::Size aSize;
|
||||
|
||||
xProps->getPropertyValue(u"HoriOrientPosition"_ustr) >>= aPos.X;
|
||||
xProps->getPropertyValue(u"VertOrientPosition"_ustr) >>= aPos.Y;
|
||||
xProps->getPropertyValue(u"Width"_ustr) >>= aSize.Width;
|
||||
xProps->getPropertyValue(u"Height"_ustr) >>= aSize.Height;
|
||||
|
||||
aImageRectangles.push_back(
|
||||
tools::Rectangle(aPos.X, aPos.Y, aPos.X + aSize.Width, aPos.Y + aSize.Height));
|
||||
nImageCount++;
|
||||
}
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(nTotalCount, nImageCount);
|
||||
|
||||
uno::Sequence<beans::PropertyValue> aArgs
|
||||
= { comphelper::makePropertyValue(u"RedactImages"_ustr, true) };
|
||||
dispatchCommand(mxComponent, u".uno:AutoRedactDoc"_ustr, aArgs);
|
||||
|
||||
Scheduler::ProcessEventsToIdle();
|
||||
|
||||
SfxObjectShell* pDocSh = SfxObjectShell::Current();
|
||||
CPPUNIT_ASSERT(pDocSh);
|
||||
|
||||
uno::Reference<frame::XModel> xDrawingDoc = pDocSh->GetModel();
|
||||
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xDrawingDoc, uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT(xDrawPagesSupplier.is());
|
||||
uno::Reference<container::XIndexAccess> xDrawPages = xDrawPagesSupplier->getDrawPages();
|
||||
CPPUNIT_ASSERT(xDrawPages.is());
|
||||
|
||||
sal_Int32 nRedactRect = 0;
|
||||
for (sal_Int32 i = 0; i < xDrawPages->getCount(); i++)
|
||||
{
|
||||
uno::Reference<drawing::XDrawPage> xDrawPage;
|
||||
xDrawPages->getByIndex(i) >>= xDrawPage;
|
||||
CPPUNIT_ASSERT(xDrawPage.is());
|
||||
|
||||
// Iterate through all shapes on this page
|
||||
for (sal_Int32 j = 0; j < xDrawPage->getCount(); j++)
|
||||
{
|
||||
uno::Reference<drawing::XShape> xShape;
|
||||
xDrawPage->getByIndex(j) >>= xShape;
|
||||
CPPUNIT_ASSERT(xShape.is());
|
||||
|
||||
uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
|
||||
if (!xShapeProps.is())
|
||||
continue;
|
||||
|
||||
if (xShapeProps->getPropertyValue(u"Name"_ustr) == u"ImageRedactionShape"_ustr)
|
||||
{
|
||||
nRedactRect++;
|
||||
awt::Point aPos = xShape->getPosition();
|
||||
awt::Size aSize = xShape->getSize();
|
||||
|
||||
tools::Rectangle aRect(aPos.X, aPos.Y, aPos.X + aSize.Width, aPos.Y + aSize.Height);
|
||||
|
||||
bool bMatchesImage = false;
|
||||
for (const auto& aImageRect : aImageRectangles)
|
||||
{
|
||||
if (aRect.Overlaps(aImageRect))
|
||||
{
|
||||
bMatchesImage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CPPUNIT_ASSERT_MESSAGE("No proper redaction rectangle for a image", bMatchesImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of redaction rectangles should match number of images",
|
||||
nImageCount, nRedactRect);
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -0,0 +1,183 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
|
||||
<office:meta><meta:creation-date>2025-05-01T10:30:58.674105757</meta:creation-date><dc:date>2025-05-13T14:11:14.256050000</dc:date><meta:editing-duration>PT20M49S</meta:editing-duration><meta:editing-cycles>7</meta:editing-cycles><meta:generator>LibreOffice/24.8.3.2$MacOSX_AARCH64 LibreOffice_project/48a6bac9e7e268aeb4c3483fcf825c94556d9f92</meta:generator><meta:document-statistic meta:table-count="0" meta:image-count="3" meta:object-count="0" meta:page-count="1" meta:paragraph-count="0" meta:word-count="0" meta:character-count="0" meta:non-whitespace-character-count="0"/></office:meta>
|
||||
<office:font-face-decls>
|
||||
<style:font-face style:name="Arial Unicode MS1" svg:font-family="'Arial Unicode MS'" style:font-family-generic="system" style:font-pitch="variable"/>
|
||||
<style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
|
||||
<style:font-face style:name="Songti SC" svg:font-family="'Songti SC'" style:font-family-generic="system" style:font-pitch="variable"/>
|
||||
</office:font-face-decls>
|
||||
<office:styles>
|
||||
<style:default-style style:family="graphic">
|
||||
<style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:writing-mode="lr-tb" style:flow-with-text="false"/>
|
||||
<style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" loext:tab-stop-distance="0in" style:font-independent-line-spacing="false">
|
||||
<style:tab-stops/>
|
||||
</style:paragraph-properties>
|
||||
<style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Songti SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Arial Unicode MS1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
|
||||
</style:default-style>
|
||||
<style:default-style style:family="paragraph">
|
||||
<style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" loext:hyphenation-keep-type="column" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="page"/>
|
||||
<style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Songti SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Arial Unicode MS1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
|
||||
</style:default-style>
|
||||
<style:default-style style:family="table">
|
||||
<style:table-properties table:border-model="collapsing"/>
|
||||
</style:default-style>
|
||||
<style:default-style style:family="table-row">
|
||||
<style:table-row-properties fo:keep-together="auto"/>
|
||||
</style:default-style>
|
||||
<style:style style:name="Standard" style:family="paragraph" style:class="text"/>
|
||||
<style:style style:name="Graphics" style:family="graphic">
|
||||
<style:graphic-properties text:anchor-type="paragraph" svg:x="0in" svg:y="0in" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph" fo:background-color="transparent" draw:fill="none" draw:fill-color="#729fcf"/>
|
||||
</style:style>
|
||||
<text:outline-style style:name="Outline">
|
||||
<text:outline-level-style text:level="1" loext:num-list-format="%1%" style:num-format="">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
<style:list-level-label-alignment text:label-followed-by="listtab"/>
|
||||
</style:list-level-properties>
|
||||
</text:outline-level-style>
|
||||
<text:outline-level-style text:level="2" loext:num-list-format="%2%" style:num-format="">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
<style:list-level-label-alignment text:label-followed-by="listtab"/>
|
||||
</style:list-level-properties>
|
||||
</text:outline-level-style>
|
||||
<text:outline-level-style text:level="3" loext:num-list-format="%3%" style:num-format="">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
<style:list-level-label-alignment text:label-followed-by="listtab"/>
|
||||
</style:list-level-properties>
|
||||
</text:outline-level-style>
|
||||
<text:outline-level-style text:level="4" loext:num-list-format="%4%" style:num-format="">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
<style:list-level-label-alignment text:label-followed-by="listtab"/>
|
||||
</style:list-level-properties>
|
||||
</text:outline-level-style>
|
||||
<text:outline-level-style text:level="5" loext:num-list-format="%5%" style:num-format="">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
<style:list-level-label-alignment text:label-followed-by="listtab"/>
|
||||
</style:list-level-properties>
|
||||
</text:outline-level-style>
|
||||
<text:outline-level-style text:level="6" loext:num-list-format="%6%" style:num-format="">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
<style:list-level-label-alignment text:label-followed-by="listtab"/>
|
||||
</style:list-level-properties>
|
||||
</text:outline-level-style>
|
||||
<text:outline-level-style text:level="7" loext:num-list-format="%7%" style:num-format="">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
<style:list-level-label-alignment text:label-followed-by="listtab"/>
|
||||
</style:list-level-properties>
|
||||
</text:outline-level-style>
|
||||
<text:outline-level-style text:level="8" loext:num-list-format="%8%" style:num-format="">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
<style:list-level-label-alignment text:label-followed-by="listtab"/>
|
||||
</style:list-level-properties>
|
||||
</text:outline-level-style>
|
||||
<text:outline-level-style text:level="9" loext:num-list-format="%9%" style:num-format="">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
<style:list-level-label-alignment text:label-followed-by="listtab"/>
|
||||
</style:list-level-properties>
|
||||
</text:outline-level-style>
|
||||
<text:outline-level-style text:level="10" loext:num-list-format="%10%" style:num-format="">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
<style:list-level-label-alignment text:label-followed-by="listtab"/>
|
||||
</style:list-level-properties>
|
||||
</text:outline-level-style>
|
||||
</text:outline-style>
|
||||
<text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
|
||||
<text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
|
||||
<text:linenumbering-configuration text:number-lines="false" text:offset="0.1965in" style:num-format="1" text:number-position="left" text:increment="5"/>
|
||||
</office:styles>
|
||||
<office:automatic-styles>
|
||||
<style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics">
|
||||
<style:graphic-properties style:vertical-pos="from-top" style:vertical-rel="paragraph" style:horizontal-pos="from-left" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0in, 0in, 0in, 0in)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/>
|
||||
</style:style>
|
||||
<style:page-layout style:name="pm1">
|
||||
<style:page-layout-properties fo:page-width="8.5in" fo:page-height="11in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.278in" style:layout-grid-ruby-height="0.139in" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0in" loext:margin-gutter="0in">
|
||||
<style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
|
||||
</style:page-layout-properties>
|
||||
<style:header-style/>
|
||||
<style:footer-style/>
|
||||
</style:page-layout>
|
||||
<style:style style:name="dp1" style:family="drawing-page">
|
||||
<style:drawing-page-properties draw:background-size="full"/>
|
||||
</style:style>
|
||||
</office:automatic-styles>
|
||||
<office:master-styles>
|
||||
<style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/>
|
||||
</office:master-styles>
|
||||
<office:body>
|
||||
<office:text>
|
||||
<text:sequence-decls>
|
||||
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
|
||||
<text:sequence-decl text:display-outline-level="0" text:name="Table"/>
|
||||
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
|
||||
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
|
||||
<text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
|
||||
</text:sequence-decls>
|
||||
<text:p text:style-name="Standard"><draw:frame draw:style-name="fr1" draw:name="Image2" text:anchor-type="char" svg:x="-0.0189in" svg:y="0.148in" svg:width="1.3335in" svg:height="1.3335in" draw:z-index="0"><draw:image draw:mime-type="image/png">
|
||||
<office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4b
|
||||
AAADf0lEQVR42u3byU4UQQCH8f+YMYp6NfII3rxw8gE8uBFFcF8QtxBiNKO4xd0YFDKKEgPu
|
||||
r+BRUdxiojcTD148eOAw6gMIKo2HGRMPTFc1dHV39Xxf0iemhkrVj+qQ6ZGiV5I0LimQNO3R
|
||||
9WcW1xdJu2exRr0Jr1Eg6aukbjmux7NNj2txj0X8A0lzvl0uAXxqQAD/EJQs1+hzynP9GGVD
|
||||
ixEBLFVjVpDUX1vgsuG181Oea7PLN6806Anw/0lw1LBGfSnPsQIA9wiOhKzRAklPfQFQjAnG
|
||||
gKR3OTryWySdrh39M90OyrXFHpzh55OSWiU9kbQqb/fCeidARw7v+8cN/8YFkg6HjF+Y0klQ
|
||||
AUB89Vog6AkZ3yTpGQD87oRnCADgoJMWCLoNCEYB4HenPEEAAIedMSCYknTIgOA5APKP4GCK
|
||||
CACQQGcNmzAl6UBKCACQUOcsEOw3IHgBAL87b4FgX8j4RQ4QACDhLlgg6DIgGAOA312yQLA3
|
||||
IQQASKnLFgg6DQheAsDvrsj8XOIexwgAkHJXLRCEPWi6eI4IAOAJgl2OEAAgI/VZINhpQPAK
|
||||
AH53zQLBjpgRACBjXbdAsN2A4DUA/K7fAsG2mBAAIKMNGDbut6StIeOXSHoDAL8rWyDYMkcE
|
||||
AMh4NywQbJ4DAgB40E0LBB0GBG/rjP0AAD8aNCD4Jak9IoJAUhsA/OmWBYJNIeObJF2U9F7V
|
||||
B05bXU8YAPF32wJBW1YmCwA3DVkg2AiA/FaQdMcCwQYANDaCybQRAMA9gmELBK0AyDeCkawi
|
||||
AEByCO5aIFgPgHwjuGdAMCFpHQDyjeC+BYK1AMhv8yQ9sECwBgD5RvDQAsFqAOQbwSMDgp+S
|
||||
VgIg3wgeGxCMRXnDImvqVYGq3zEsqP73CpYDIP8IOlX9KLi9zikBgAZAMKrwB0YAQAAgABAA
|
||||
CAAEAAIAAYAAQAAgABAACAAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgA
|
||||
BAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAA
|
||||
IAAQAAgABAACAAGAAEAAIAAQACijAFokTbCcibYijjcpRHx9RdIy1j7TfZPUzC2AAEDxA/jB
|
||||
LSDzfXcJYFjSEGuc6UZc/4KSpHFJgaRprkxcQW1PSlE38y88X1uXlq9JtgAAAABJRU5ErkJg
|
||||
gg==
|
||||
</office:binary-data>
|
||||
</draw:image>
|
||||
</draw:frame><draw:frame draw:style-name="fr1" draw:name="Image2 Copy 1" text:anchor-type="char" svg:x="2.0547in" svg:y="1.0618in" svg:width="5.3591in" svg:height="4.5827in" draw:z-index="1"><draw:image draw:mime-type="image/png">
|
||||
<office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4b
|
||||
AAADf0lEQVR42u3byU4UQQCH8f+YMYp6NfII3rxw8gE8uBFFcF8QtxBiNKO4xd0YFDKKEgPu
|
||||
r+BRUdxiojcTD148eOAw6gMIKo2HGRMPTFc1dHV39Xxf0iemhkrVj+qQ6ZGiV5I0LimQNO3R
|
||||
9WcW1xdJu2exRr0Jr1Eg6aukbjmux7NNj2txj0X8A0lzvl0uAXxqQAD/EJQs1+hzynP9GGVD
|
||||
ixEBLFVjVpDUX1vgsuG181Oea7PLN6806Anw/0lw1LBGfSnPsQIA9wiOhKzRAklPfQFQjAnG
|
||||
gKR3OTryWySdrh39M90OyrXFHpzh55OSWiU9kbQqb/fCeidARw7v+8cN/8YFkg6HjF+Y0klQ
|
||||
AUB89Vog6AkZ3yTpGQD87oRnCADgoJMWCLoNCEYB4HenPEEAAIedMSCYknTIgOA5APKP4GCK
|
||||
CACQQGcNmzAl6UBKCACQUOcsEOw3IHgBAL87b4FgX8j4RQ4QACDhLlgg6DIgGAOA312yQLA3
|
||||
IQQASKnLFgg6DQheAsDvrsj8XOIexwgAkHJXLRCEPWi6eI4IAOAJgl2OEAAgI/VZINhpQPAK
|
||||
AH53zQLBjpgRACBjXbdAsN2A4DUA/K7fAsG2mBAAIKMNGDbut6StIeOXSHoDAL8rWyDYMkcE
|
||||
AMh4NywQbJ4DAgB40E0LBB0GBG/rjP0AAD8aNCD4Jak9IoJAUhsA/OmWBYJNIeObJF2U9F7V
|
||||
B05bXU8YAPF32wJBW1YmCwA3DVkg2AiA/FaQdMcCwQYANDaCybQRAMA9gmELBK0AyDeCkawi
|
||||
AEByCO5aIFgPgHwjuGdAMCFpHQDyjeC+BYK1AMhv8yQ9sECwBgD5RvDQAsFqAOQbwSMDgp+S
|
||||
VgIg3wgeGxCMRXnDImvqVYGq3zEsqP73CpYDIP8IOlX9KLi9zikBgAZAMKrwB0YAQAAgABAA
|
||||
CAAEAAIAAYAAQAAgABAACAAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgA
|
||||
BAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAA
|
||||
IAAQAAgABAACAAGAAEAAIAAQACijAFokTbCcibYijjcpRHx9RdIy1j7TfZPUzC2AAEDxA/jB
|
||||
LSDzfXcJYFjSEGuc6UZc/4KSpHFJgaRprkxcQW1PSlE38y88X1uXlq9JtgAAAABJRU5ErkJg
|
||||
gg==
|
||||
</office:binary-data>
|
||||
</draw:image>
|
||||
</draw:frame><draw:frame draw:style-name="fr1" draw:name="Image2 Copy 1 Copy 1" text:anchor-type="char" svg:x="0.4508in" svg:y="6.8925in" svg:width="2.8646in" svg:height="2.6917in" draw:z-index="2"><draw:image draw:mime-type="image/png">
|
||||
<office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4b
|
||||
AAADf0lEQVR42u3byU4UQQCH8f+YMYp6NfII3rxw8gE8uBFFcF8QtxBiNKO4xd0YFDKKEgPu
|
||||
r+BRUdxiojcTD148eOAw6gMIKo2HGRMPTFc1dHV39Xxf0iemhkrVj+qQ6ZGiV5I0LimQNO3R
|
||||
9WcW1xdJu2exRr0Jr1Eg6aukbjmux7NNj2txj0X8A0lzvl0uAXxqQAD/EJQs1+hzynP9GGVD
|
||||
ixEBLFVjVpDUX1vgsuG181Oea7PLN6806Anw/0lw1LBGfSnPsQIA9wiOhKzRAklPfQFQjAnG
|
||||
gKR3OTryWySdrh39M90OyrXFHpzh55OSWiU9kbQqb/fCeidARw7v+8cN/8YFkg6HjF+Y0klQ
|
||||
AUB89Vog6AkZ3yTpGQD87oRnCADgoJMWCLoNCEYB4HenPEEAAIedMSCYknTIgOA5APKP4GCK
|
||||
CACQQGcNmzAl6UBKCACQUOcsEOw3IHgBAL87b4FgX8j4RQ4QACDhLlgg6DIgGAOA312yQLA3
|
||||
IQQASKnLFgg6DQheAsDvrsj8XOIexwgAkHJXLRCEPWi6eI4IAOAJgl2OEAAgI/VZINhpQPAK
|
||||
AH53zQLBjpgRACBjXbdAsN2A4DUA/K7fAsG2mBAAIKMNGDbut6StIeOXSHoDAL8rWyDYMkcE
|
||||
AMh4NywQbJ4DAgB40E0LBB0GBG/rjP0AAD8aNCD4Jak9IoJAUhsA/OmWBYJNIeObJF2U9F7V
|
||||
B05bXU8YAPF32wJBW1YmCwA3DVkg2AiA/FaQdMcCwQYANDaCybQRAMA9gmELBK0AyDeCkawi
|
||||
AEByCO5aIFgPgHwjuGdAMCFpHQDyjeC+BYK1AMhv8yQ9sECwBgD5RvDQAsFqAOQbwSMDgp+S
|
||||
VgIg3wgeGxCMRXnDImvqVYGq3zEsqP73CpYDIP8IOlX9KLi9zikBgAZAMKrwB0YAQAAgABAA
|
||||
CAAEAAIAAYAAQAAgABAACAAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgA
|
||||
BAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAA
|
||||
IAAQAAgABAACAAGAAEAAIAAQACijAFokTbCcibYijjcpRHx9RdIy1j7TfZPUzC2AAEDxA/jB
|
||||
LSDzfXcJYFjSEGuc6UZc/4KSpHFJgaRprkxcQW1PSlE38y88X1uXlq9JtgAAAABJRU5ErkJg
|
||||
gg==
|
||||
</office:binary-data>
|
||||
</draw:image>
|
||||
</draw:frame></text:p>
|
||||
</office:text>
|
||||
</office:body>
|
||||
</office:document>
|
||||
+1
-1
@@ -5066,7 +5066,7 @@ SfxVoidItem RedactDoc SID_REDACTDOC
|
||||
]
|
||||
|
||||
SfxVoidItem AutoRedactDoc SID_AUTOREDACTDOC
|
||||
(SfxStringItem URL SID_FILE_NAME, SfxStringItem FilterName SID_FILTER_NAME)
|
||||
(SfxStringItem URL SID_FILE_NAME, SfxStringItem FilterName SID_FILTER_NAME, SfxBoolItem RedactImages SID_REDACT_IMAGE)
|
||||
[
|
||||
AutoUpdate = FALSE,
|
||||
FastCall = FALSE,
|
||||
|
||||
@@ -91,6 +91,7 @@ SfxFormalArgument const aFormalArgs[] = {
|
||||
{ static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"IsRedactMode"_ustr, SID_IS_REDACT_MODE },
|
||||
{ static_cast<const SfxType*>(&aSfxStringItem_Impl), u"RedactionStyle"_ustr, SID_REDACTION_STYLE },
|
||||
{ static_cast<const SfxType*>(&aSfxStringItem_Impl), u"AdditionsTag"_ustr, FN_PARAM_ADDITIONS_TAG },
|
||||
{ static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"RedactImages"_ustr, SID_REDACT_IMAGE},
|
||||
};
|
||||
|
||||
constexpr sal_uInt16 nMediaArgsCount = std::size(aFormalArgs);
|
||||
|
||||
@@ -417,6 +417,12 @@ void SfxRedactionHelper::searchInMetaFile(const RedactionTarget& rRedactionTarge
|
||||
std::vector<::tools::Rectangle>& aRedactionRectangles,
|
||||
const uno::Reference<XComponent>& xComponent)
|
||||
{
|
||||
if (rRedactionTarget.sType == RedactionTargetType::REDACTION_TARGET_IMAGE)
|
||||
{
|
||||
searchImagesInMetaFile(rMtf, aRedactionRectangles, xComponent);
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize search
|
||||
i18nutil::SearchOptions2 aSearchOptions;
|
||||
fillSearchOptions(aSearchOptions, rRedactionTarget);
|
||||
@@ -478,9 +484,91 @@ void SfxRedactionHelper::searchInMetaFile(const RedactionTarget& rRedactionTarge
|
||||
pOutputDevice->Pop();
|
||||
}
|
||||
|
||||
void SfxRedactionHelper::searchImagesInMetaFile(
|
||||
const GDIMetaFile& rMtf, std::vector<::tools::Rectangle>& aRedactionRectangles,
|
||||
const uno::Reference<XComponent>& xComponent)
|
||||
{
|
||||
OutputDevice* pOutputDevice
|
||||
= SfxObjectShell::GetShellFromComponent(xComponent)->GetDocumentRefDev();
|
||||
pOutputDevice->Push(::vcl::PushFlags::ALL);
|
||||
|
||||
MetaAction* pCurrAct;
|
||||
|
||||
for (pCurrAct = const_cast<GDIMetaFile&>(rMtf).FirstAction(); pCurrAct;
|
||||
pCurrAct = const_cast<GDIMetaFile&>(rMtf).NextAction())
|
||||
{
|
||||
tools::Rectangle aImageRect;
|
||||
Point aDestPt;
|
||||
Size aDestSz;
|
||||
bool bIsImage = true;
|
||||
|
||||
switch (pCurrAct->GetType())
|
||||
{
|
||||
case MetaActionType::BMP:
|
||||
{
|
||||
MetaBmpAction* pAction = static_cast<MetaBmpAction*>(pCurrAct);
|
||||
aDestPt = pAction->GetPoint();
|
||||
aDestSz = pAction->GetBitmap().GetSizePixel();
|
||||
break;
|
||||
}
|
||||
|
||||
case MetaActionType::BMPSCALE:
|
||||
{
|
||||
MetaBmpScaleAction* pAction = static_cast<MetaBmpScaleAction*>(pCurrAct);
|
||||
aDestPt = pAction->GetPoint();
|
||||
aDestSz = pAction->GetSize();
|
||||
break;
|
||||
}
|
||||
|
||||
case MetaActionType::BMPSCALEPART:
|
||||
{
|
||||
MetaBmpScalePartAction* pAction = static_cast<MetaBmpScalePartAction*>(pCurrAct);
|
||||
aDestPt = pAction->GetDestPoint();
|
||||
aDestSz = pAction->GetDestSize();
|
||||
break;
|
||||
}
|
||||
|
||||
case MetaActionType::BMPEX:
|
||||
{
|
||||
MetaBmpExAction* pAction = static_cast<MetaBmpExAction*>(pCurrAct);
|
||||
aDestPt = pAction->GetPoint();
|
||||
aDestSz = pAction->GetBitmapEx().GetSizePixel();
|
||||
break;
|
||||
}
|
||||
|
||||
case MetaActionType::BMPEXSCALE:
|
||||
{
|
||||
MetaBmpExScaleAction* pAction = static_cast<MetaBmpExScaleAction*>(pCurrAct);
|
||||
aDestPt = pAction->GetPoint();
|
||||
aDestSz = pAction->GetSize();
|
||||
break;
|
||||
}
|
||||
|
||||
case MetaActionType::BMPEXSCALEPART:
|
||||
{
|
||||
MetaBmpExScalePartAction* pAction
|
||||
= static_cast<MetaBmpExScalePartAction*>(pCurrAct);
|
||||
aDestPt = pAction->GetDestPoint();
|
||||
aDestSz = pAction->GetDestSize();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
bIsImage = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bIsImage)
|
||||
{
|
||||
aImageRect = tools::Rectangle(aDestPt, aDestSz);
|
||||
aRedactionRectangles.push_back(aImageRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SfxRedactionHelper::addRedactionRectToPage(
|
||||
const uno::Reference<XComponent>& xComponent, const uno::Reference<drawing::XDrawPage>& xPage,
|
||||
const std::vector<::tools::Rectangle>& aNewRectangles)
|
||||
const std::vector<::tools::Rectangle>& aNewRectangles, bool isImage)
|
||||
{
|
||||
if (!xComponent.is() || !xPage.is())
|
||||
return;
|
||||
@@ -496,11 +584,22 @@ void SfxRedactionHelper::addRedactionRectToPage(
|
||||
xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY);
|
||||
uno::Reference<beans::XPropertySet> xRectShapeProperySet(xRectShape, uno::UNO_QUERY);
|
||||
|
||||
xRectShapeProperySet->setPropertyValue(u"Name"_ustr,
|
||||
uno::Any(u"RectangleRedactionShape"_ustr));
|
||||
xRectShapeProperySet->setPropertyValue(u"FillTransparence"_ustr,
|
||||
css::uno::Any(static_cast<sal_Int16>(50)));
|
||||
xRectShapeProperySet->setPropertyValue(u"FillColor"_ustr, css::uno::Any(COL_GRAY7));
|
||||
if (isImage)
|
||||
{
|
||||
xRectShapeProperySet->setPropertyValue(u"Name"_ustr,
|
||||
uno::Any(u"ImageRedactionShape"_ustr));
|
||||
xRectShapeProperySet->setPropertyValue(u"FillTransparence"_ustr,
|
||||
css::uno::Any(static_cast<sal_Int16>(0)));
|
||||
xRectShapeProperySet->setPropertyValue(u"FillColor"_ustr, css::uno::Any(COL_BLACK));
|
||||
}
|
||||
else
|
||||
{
|
||||
xRectShapeProperySet->setPropertyValue(u"Name"_ustr,
|
||||
uno::Any(u"RectangleRedactionShape"_ustr));
|
||||
xRectShapeProperySet->setPropertyValue(u"FillTransparence"_ustr,
|
||||
css::uno::Any(static_cast<sal_Int16>(50)));
|
||||
xRectShapeProperySet->setPropertyValue(u"FillColor"_ustr, css::uno::Any(COL_GRAY7));
|
||||
}
|
||||
xRectShapeProperySet->setPropertyValue(
|
||||
u"LineStyle"_ustr, css::uno::Any(css::drawing::LineStyle::LineStyle_NONE));
|
||||
|
||||
@@ -524,7 +623,8 @@ void SfxRedactionHelper::autoRedactPage(const RedactionTarget& rRedactionTarget,
|
||||
searchInMetaFile(rRedactionTarget, rGDIMetaFile, aRedactionRectangles, xComponent);
|
||||
|
||||
// Add the redaction rectangles to the page
|
||||
addRedactionRectToPage(xComponent, xPage, aRedactionRectangles);
|
||||
addRedactionRectToPage(xComponent, xPage, aRedactionRectangles,
|
||||
rRedactionTarget.sType == RedactionTargetType::REDACTION_TARGET_IMAGE);
|
||||
}
|
||||
|
||||
namespace
|
||||
|
||||
@@ -39,6 +39,19 @@ int TargetsTable::GetRowByTargetName(std::u16string_view sName)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool TargetsTable::HasTargetType(RedactionTargetType aTargetType)
|
||||
{
|
||||
for (int i = 0, nCount = m_xControl->n_children(); i < nCount; ++i)
|
||||
{
|
||||
RedactionTarget* pTarget = weld::fromId<RedactionTarget*>(m_xControl->get_id(i));
|
||||
if (pTarget->sType == aTargetType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
TargetsTable::TargetsTable(std::unique_ptr<weld::TreeView> xControl)
|
||||
: m_xControl(std::move(xControl))
|
||||
{
|
||||
@@ -65,6 +78,9 @@ OUString getTypeName(RedactionTargetType nType)
|
||||
case RedactionTargetType::REDACTION_TARGET_PREDEFINED:
|
||||
sTypeName = SfxResId(STR_REDACTION_TARGET_TYPE_PREDEF);
|
||||
break;
|
||||
case RedactionTargetType::REDACTION_TARGET_IMAGE:
|
||||
sTypeName = SfxResId(STR_REDACTION_TARGET_TYPE_IMAGE);
|
||||
break;
|
||||
case RedactionTargetType::REDACTION_TARGET_UNKNOWN:
|
||||
sTypeName = SfxResId(STR_REDACTION_TARGET_TYPE_UNKNOWN);
|
||||
break;
|
||||
@@ -89,6 +105,9 @@ OUString getTypeID(RedactionTargetType nType)
|
||||
case RedactionTargetType::REDACTION_TARGET_PREDEFINED:
|
||||
sTypeID = "predefined";
|
||||
break;
|
||||
case RedactionTargetType::REDACTION_TARGET_IMAGE:
|
||||
sTypeID = "image";
|
||||
break;
|
||||
case RedactionTargetType::REDACTION_TARGET_UNKNOWN:
|
||||
sTypeID = "unknown";
|
||||
break;
|
||||
@@ -224,6 +243,15 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, AddHdl, weld::Button&, void)
|
||||
SfxResId(STR_REDACTION_TARGET_NAME_CLASH)));
|
||||
xBox->run();
|
||||
}
|
||||
else if (aAddTargetDialog.getType() == REDACTION_TARGET_IMAGE
|
||||
&& m_aTargetsBox.HasTargetType(REDACTION_TARGET_IMAGE))
|
||||
{
|
||||
bIncomplete = true;
|
||||
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
|
||||
getDialog(), VclMessageType::Warning, VclButtonsType::Ok,
|
||||
SfxResId(STR_REDACTION_MULTI_IMAGE_TARGETS)));
|
||||
xBox->run();
|
||||
}
|
||||
|
||||
} while (bIncomplete);
|
||||
|
||||
@@ -302,6 +330,16 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, weld::Button&, void)
|
||||
SfxResId(STR_REDACTION_TARGET_NAME_CLASH)));
|
||||
xBox->run();
|
||||
}
|
||||
else if (pTarget->sType != REDACTION_TARGET_IMAGE
|
||||
&& aEditTargetDialog.getType() == REDACTION_TARGET_IMAGE
|
||||
&& m_aTargetsBox.HasTargetType(REDACTION_TARGET_IMAGE))
|
||||
{
|
||||
bIncomplete = true;
|
||||
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
|
||||
getDialog(), VclMessageType::Warning, VclButtonsType::Ok,
|
||||
SfxResId(STR_REDACTION_MULTI_IMAGE_TARGETS)));
|
||||
xBox->run();
|
||||
}
|
||||
|
||||
} while (bIncomplete);
|
||||
|
||||
@@ -309,8 +347,16 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, weld::Button&, void)
|
||||
pTarget->sName = aEditTargetDialog.getName();
|
||||
pTarget->sType = aEditTargetDialog.getType();
|
||||
pTarget->sContent = aEditTargetDialog.getContent();
|
||||
pTarget->bCaseSensitive = aEditTargetDialog.isCaseSensitive();
|
||||
pTarget->bWholeWords = aEditTargetDialog.isWholeWords();
|
||||
if (pTarget->sType == REDACTION_TARGET_IMAGE)
|
||||
{
|
||||
pTarget->bCaseSensitive = false;
|
||||
pTarget->bWholeWords = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
pTarget->bCaseSensitive = aEditTargetDialog.isCaseSensitive();
|
||||
pTarget->bWholeWords = aEditTargetDialog.isWholeWords();
|
||||
}
|
||||
|
||||
// And sync the targets box row with the actual target data
|
||||
m_aTargetsBox.setRowData(nSelectedRow, pTarget);
|
||||
@@ -667,6 +713,22 @@ IMPL_LINK_NOARG(SfxAddTargetDialog, SelectTypeHdl, weld::ComboBox&, void)
|
||||
m_xPredefContent->set_sensitive(true);
|
||||
m_xPredefContent->set_visible(true);
|
||||
}
|
||||
else if (m_xType->get_active_id() == "image")
|
||||
{
|
||||
m_xLabelContent->set_sensitive(false);
|
||||
m_xLabelContent->set_visible(false);
|
||||
m_xContent->set_sensitive(false);
|
||||
m_xContent->set_visible(false);
|
||||
m_xWholeWords->set_sensitive(false);
|
||||
m_xWholeWords->set_visible(false);
|
||||
m_xCaseSensitive->set_sensitive(false);
|
||||
m_xCaseSensitive->set_visible(false);
|
||||
|
||||
m_xLabelPredefContent->set_sensitive(false);
|
||||
m_xLabelPredefContent->set_visible(false);
|
||||
m_xPredefContent->set_sensitive(false);
|
||||
m_xPredefContent->set_visible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xLabelPredefContent->set_sensitive(false);
|
||||
@@ -727,6 +789,13 @@ SfxAddTargetDialog::SfxAddTargetDialog(weld::Window* pParent, const OUString& sN
|
||||
SelectTypeHdl(*m_xPredefContent);
|
||||
m_xPredefContent->set_active(o3tl::toInt32(o3tl::getToken(sContent, 0, ';')));
|
||||
}
|
||||
else if (eTargetType == RedactionTargetType::REDACTION_TARGET_IMAGE)
|
||||
{
|
||||
m_xContent->set_visible(false);
|
||||
m_xLabelContent->set_visible(false);
|
||||
m_xCaseSensitive->set_visible(false);
|
||||
m_xWholeWords->set_visible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xContent->set_text(sContent);
|
||||
@@ -748,6 +817,8 @@ RedactionTargetType SfxAddTargetDialog::getType() const
|
||||
return RedactionTargetType::REDACTION_TARGET_REGEX;
|
||||
else if (sTypeID == "predefined")
|
||||
return RedactionTargetType::REDACTION_TARGET_PREDEFINED;
|
||||
else if (sTypeID == "image")
|
||||
return RedactionTargetType::REDACTION_TARGET_IMAGE;
|
||||
else
|
||||
return RedactionTargetType::REDACTION_TARGET_UNKNOWN;
|
||||
}
|
||||
@@ -759,6 +830,8 @@ OUString SfxAddTargetDialog::getContent() const
|
||||
return OUString(OUString::number(m_xPredefContent->get_active()) + ";"
|
||||
+ m_xPredefContent->get_active_text());
|
||||
}
|
||||
else if (m_xType->get_active_id() == "image")
|
||||
return "All Images";
|
||||
|
||||
return m_xContent->get_text();
|
||||
}
|
||||
|
||||
@@ -809,7 +809,16 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
|
||||
SfxAutoRedactDialog aDlg(pDialogParent);
|
||||
sal_Int16 nResult = aDlg.run();
|
||||
|
||||
if (nResult != RET_OK || !aDlg.hasTargets() || !aDlg.isValidState())
|
||||
const SfxBoolItem* redactImage = rReq.GetArg<SfxBoolItem>(SID_REDACT_IMAGE);
|
||||
|
||||
if (redactImage && redactImage->GetValue())
|
||||
{
|
||||
RedactionTarget* redactiontarget
|
||||
= new RedactionTarget({ "Images", RedactionTargetType::REDACTION_TARGET_IMAGE,
|
||||
"All Images", false, false, 0 });
|
||||
aRedactionTargets.push_back({*redactiontarget, redactiontarget->sName});
|
||||
}
|
||||
else if (nResult != RET_OK || !aDlg.hasTargets() || !aDlg.isValidState())
|
||||
{
|
||||
//Do nothing
|
||||
return;
|
||||
|
||||
@@ -166,6 +166,7 @@
|
||||
<item id="text" translatable="yes" context="addtargetdialog|type">Text</item>
|
||||
<item id="regex" translatable="yes" context="addtargetdialog|type">Regular expression</item>
|
||||
<item id="predefined" translatable="yes" context="addtargetdialog|type">Predefined</item>
|
||||
<item id="image" translatable="yes" context="addtargetdialog|type">All Images</item>
|
||||
</items>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_type"/>
|
||||
|
||||
Reference in New Issue
Block a user