[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - include/sfx2 include/svx officecfg/registry sd/sdi sd/uiconfig sd/UIConfig_sdraw.mk sfx2/sdi sfx2/source
Muhammet Kara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 27 20:44:28 UTC 2019
include/sfx2/sfxsids.hrc | 3
include/svx/svxids.hrc | 4
officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 14 ++
officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu | 30 +++++
officecfg/registry/data/org/openoffice/Office/UI/DrawWindowState.xcu | 14 ++
sd/UIConfig_sdraw.mk | 1
sd/sdi/_drvwsh.sdi | 5
sd/sdi/sdraw.sdi | 18 +++
sd/uiconfig/sdraw/toolbar/redactedexportbar.xml | 23 +++
sd/uiconfig/sdraw/toolbar/redactionbar.xml | 3
sfx2/sdi/sfx.sdi | 2
sfx2/source/appl/appuno.cxx | 1
sfx2/source/doc/objserv.cxx | 60 ++++++++--
13 files changed, 167 insertions(+), 11 deletions(-)
New commits:
commit ddcc4c817380f013ed312367c17c8603e96c2237
Author: Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Wed Feb 20 14:36:12 2019 +0300
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Mar 27 21:43:59 2019 +0100
Add style options to redaction export
* Add 2 new uno command aliases to handle 2 different
styles of redaction export/sanitization:
* .uno:RedactedExportBlack & .uno:RedactedExportWhite
* Replace the single export button with the 2 new buttons
* Add a new toolbox names .uno:RedactedExportToolbox which
consists of the new 2 commands. It will be added to the Redaction
toolbar after we solve the icon issue.
* Now new redaction shapes are named as RectangleRedactionShape
or FreeformRedactionShape based on their type.
* While exporting to PDF, a seamless step of "Sanitization"
takes place, in which, all shapes in the Draw doc are traversed
and turned into opaq black or white (with black border) shapes,
then the whole doc is converted into bitmap (page by page).
* After the export operation is completed. All shapes are converted
back to the usual redaction style (gray and transparent).
* Icon issue:
* We need 2 new icons for our new commands, one for black redaction
shapes without border, and one for white redaction shapes with black
border.
* I tried adding links to a current icon, but it didn't work, so they
are iconless for now.
* Next to do: Handle icon issue, and take the redaction implementation
into a separate helper class because it is growing fast.
Change-Id: I9b2b7716289b800cdbe7bf3ffa4a442fe5afc474
Reviewed-on: https://gerrit.libreoffice.org/68072
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/69836
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index e275ba953a69..c725951cf118 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -247,8 +247,9 @@
#define SID_NO_FILE_SYNC (SID_SFX_START + 1729)
#define SID_IS_REDACT_MODE (SID_SFX_START + 1731)
+#define SID_REDACTION_STYLE (SID_SFX_START + 1732)
-// SID_SFX_free_START (SID_SFX_START + 1732)
+// SID_SFX_free_START (SID_SFX_START + 1733)
// SID_SFX_free_END (SID_SFX_START + 3999)
#define SID_OPEN_NEW_VIEW (SID_SFX_START + 520)
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 8649f2ba2317..b3ed3911ac36 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -471,6 +471,8 @@
// CAUTION! Range <413 .. 413> used by EditEngine (!)
+#define SID_DRAWTBX_REDACTED_EXPORT ( SID_SVX_START + 606 )
+
#define SID_ATTR_3D_START ( SID_SVX_START + 415 )
#define SID_RULER_PROTECT SID_ATTR_3D_START
#define SID_COLOR_CONTROL ( SID_SVX_START + 417 )
@@ -552,7 +554,7 @@
#define SID_FM_DBGRID ( SID_SVX_START + 603 )
#define SID_FM_IMAGEBUTTON ( SID_SVX_START + 604 )
#define SID_FM_FILECONTROL ( SID_SVX_START + 605 )
-//FREE
+//( SID_SVX_START + 606 ) is used by SID_DRAWTBX_REDACTED_EXPORT
#define SID_FM_NAVIGATIONBAR ( SID_SVX_START + 607 )
//FREE
//FREE
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 12d7ccd3de91..8c6daa310c36 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -600,6 +600,20 @@
<value>ellipsesbar;.uno:Ellipse</value>
</prop>
</node>
+ <node oor:name="RedactedExportToolbox" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:RedactedExportToolbox</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.framework.SubToolBarController</value>
+ </prop>
+ <prop oor:name="Value">
+ <value>redactedexportbar;.uno:ExportDirectToPDF?IsRedactMode:bool=true</value>
+ </prop>
+ </node>
<node oor:name="LineToolBox" oor:op="replace">
<prop oor:name="Command">
<value>.uno:LineToolbox</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 761d2d465449..26bf9cbaa103 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -1246,6 +1246,14 @@
<value>1</value>
</prop>
</node>
+ <node oor:name=".uno:RedactedExportToolbox" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Redacted Export</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
<node oor:name=".uno:ConnectorLineArrowEnd" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Straight Connector ends with Arrow</value>
@@ -2344,6 +2352,28 @@
<value>1</value>
</prop>
</node>
+ <node oor:name=".uno:RedactedExportBlack" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Redacted Export (Black)</value>
+ </prop>
+ <prop oor:name="TargetURL" oor:type="xs:string">
+ <value>.uno:ExportDirectToPDF?IsRedactMode:bool=true&RedactionStyle:string=Black</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
+ <node oor:name=".uno:RedactedExportWhite" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Redacted Export (White)</value>
+ </prop>
+ <prop oor:name="TargetURL" oor:type="xs:string">
+ <value>.uno:ExportDirectToPDF?IsRedactMode:bool=true&RedactionStyle:string=White</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
</node>
</node>
</oor:component-data>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawWindowState.xcu
index 53f3d1adb244..9f33993748a6 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawWindowState.xcu
@@ -371,6 +371,20 @@
<value>true</value>
</prop>
</node>
+ <node oor:name="private:resource/toolbar/redactedexportbar" oor:op="replace">
+ <prop oor:name="Docked" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ <prop oor:name="UIName" oor:type="xs:string">
+ <value xml:lang="en-US">Redacted Export</value>
+ </prop>
+ <prop oor:name="Visible" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ <prop oor:name="HideFromToolbarMenu" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
<node oor:name="private:resource/toolbar/ellipsesbar" oor:op="replace">
<prop oor:name="Docked" oor:type="xs:boolean">
<value>false</value>
diff --git a/sd/UIConfig_sdraw.mk b/sd/UIConfig_sdraw.mk
index 93056ddec9b6..5a982f7b1aa2 100644
--- a/sd/UIConfig_sdraw.mk
+++ b/sd/UIConfig_sdraw.mk
@@ -86,6 +86,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/sdraw,\
sd/uiconfig/sdraw/toolbar/optionsbar \
sd/uiconfig/sdraw/toolbar/positionbar \
sd/uiconfig/sdraw/toolbar/rectanglesbar \
+ sd/uiconfig/sdraw/toolbar/redactedexportbar \
sd/uiconfig/sdraw/toolbar/redactionbar \
sd/uiconfig/sdraw/toolbar/standardbar \
sd/uiconfig/sdraw/toolbar/starshapes \
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index a18924f36a13..4e1b9d2abfab 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -1265,6 +1265,11 @@ interface DrawView
ExecMethod = FuSupport ;
StateMethod = GetMenuState ;
]
+ SID_DRAWTBX_REDACTED_EXPORT // ole : no, status : ?
+ [
+ ExecMethod = FuSupport ;
+ StateMethod = GetMenuState ;
+ ]
SID_DRAWTBX_LINES // ole : no, status : ?
[
ExecMethod = FuSupport ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index f5d86d97aaa3..cdccfd94df91 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -1372,6 +1372,24 @@ SfxVoidItem EllipseToolbox SID_DRAWTBX_ELLIPSES
GroupId = SfxGroupId::Drawing;
]
+SfxVoidItem RedactedExportToolbox SID_DRAWTBX_REDACTED_EXPORT
+
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Drawing;
+]
+
SfxVoidItem ExpandPage SID_EXPAND_PAGE
()
[
diff --git a/sd/uiconfig/sdraw/toolbar/redactedexportbar.xml b/sd/uiconfig/sdraw/toolbar/redactedexportbar.xml
new file mode 100644
index 000000000000..06468d459409
--- /dev/null
+++ b/sd/uiconfig/sdraw/toolbar/redactedexportbar.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF?IsRedactMode:bool=true"/>
+ <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>
+</toolbar:toolbar>
diff --git a/sd/uiconfig/sdraw/toolbar/redactionbar.xml b/sd/uiconfig/sdraw/toolbar/redactionbar.xml
index 43ce5e856f7a..bb27cd01acb4 100644
--- a/sd/uiconfig/sdraw/toolbar/redactionbar.xml
+++ b/sd/uiconfig/sdraw/toolbar/redactionbar.xml
@@ -21,5 +21,6 @@
<toolbar:toolbaritem xlink:href=".uno:Rect?FillTransparence:short=50&FillColor:string=COL_GRAY7&LineStyle:short=0&IsSticky:bool=true&ShapeName:string=RectangleRedactionShape"/>
<toolbar:toolbaritem xlink:href=".uno:Freeline_Unfilled?Transparence:short=50&Color:string=COL_GRAY7&Width:short=500&IsSticky:bool=true&ShapeName:string=FreeformRedactionShape"/>
<toolbar:toolbarseparator/>
- <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF?IsRedactMode:bool=true"/>
+ <toolbar:toolbaritem xlink:href=".uno:RedactedExportBlack"/>
+ <toolbar:toolbaritem xlink:href=".uno:RedactedExportWhite"/>
</toolbar:toolbar>
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 47586b60e464..ecda87bb06be 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -4728,7 +4728,7 @@ SfxVoidItem ExportToPDF SID_EXPORTDOCASPDF
SfxVoidItem ExportDirectToPDF SID_DIRECTEXPORTDOCASPDF
(SfxStringItem URL SID_FILE_NAME, SfxStringItem FilterName SID_FILTER_NAME,
- SfxBoolItem IsRedactMode SID_IS_REDACT_MODE)
+ SfxBoolItem IsRedactMode SID_IS_REDACT_MODE, SfxStringItem RedactionStyle SID_REDACTION_STYLE)
[
AutoUpdate = FALSE,
FastCall = FALSE,
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 16dc5ed207c6..e60eaf0d1066 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -107,6 +107,7 @@ SfxFormalArgument const aFormalArgs[] = {
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "SaveACopy", SID_SAVEACOPYITEM },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "NoFileSync", SID_NO_FILE_SYNC },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "IsRedactMode", SID_IS_REDACT_MODE },
+ { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "RedactionStyle", SID_REDACTION_STYLE },
};
static sal_uInt16 nMediaArgsCount = SAL_N_ELEMENTS(aFormalArgs);
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index b0a3b933d8bc..8145177f900a 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -416,6 +416,24 @@ bool isRedactMode(SfxRequest& rReq)
return false;
}
+/// Returns the value of the given string param as an OUString
+/// Returns empty OUString if no param
+OUString getStringParam(const SfxRequest& rReq, const sal_uInt16& nParamId)
+{
+ OUString sStringParam;
+
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ if (!pArgs)
+ return sStringParam;
+
+ const SfxStringItem* pStringArg = rReq.GetArg<SfxStringItem>(nParamId);
+ if (!pStringArg)
+ return sStringParam;
+
+ sStringParam = pStringArg->GetValue();
+ return sStringParam;
+}
+
}
void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
@@ -691,6 +709,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
if ( xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.drawing.DrawingDocument")
&& isRedactMode(rReq) )
{
+ OUString sRedactionStyle(getStringParam(rReq, SID_REDACTION_STYLE));
+
// Access the draw pages
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPages> xDrawPages = xDrawPagesSupplier->getDrawPages();
@@ -733,14 +753,32 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
&& xInfo->hasPropertyByName("FillTransparence") && xInfo->hasPropertyByName("FillColor"))
{
xPropSet->setPropertyValue("FillTransparence", css::uno::makeAny(static_cast<sal_Int16>(0)));
- xPropSet->setPropertyValue("FillColor", css::uno::makeAny(COL_BLACK));
+ if (sRedactionStyle == "White")
+ {
+ xPropSet->setPropertyValue("FillColor", css::uno::makeAny(COL_WHITE));
+ xPropSet->setPropertyValue("LineStyle", css::uno::makeAny(css::drawing::LineStyle::LineStyle_SOLID));
+ xPropSet->setPropertyValue("LineColor", css::uno::makeAny(COL_BLACK));
+ }
+ else
+ {
+ xPropSet->setPropertyValue("FillColor", css::uno::makeAny(COL_BLACK));
+ xPropSet->setPropertyValue("LineStyle", css::uno::makeAny(css::drawing::LineStyle::LineStyle_NONE));
+ }
}
// Freeform redaction
else if (sShapeName == "FreeformRedactionShape"
&& xInfo->hasPropertyByName("LineTransparence") && xInfo->hasPropertyByName("LineColor"))
{
- xPropSet->setPropertyValue("LineTransparence", css::uno::makeAny(static_cast<sal_Int16>(0)));
+ xPropSet->setPropertyValue("LineTransparence", css::uno::makeAny(static_cast<sal_Int16>(0)));
+
+ if (sRedactionStyle == "White")
+ {
+ xPropSet->setPropertyValue("LineColor", css::uno::makeAny(COL_WHITE));
+ }
+ else
+ {
xPropSet->setPropertyValue("LineColor", css::uno::makeAny(COL_BLACK));
+ }
}
}
}
@@ -981,18 +1019,26 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
if (!xInfo->hasPropertyByName("Name"))
continue;
- OUString sName;
- uno::Any aAnyName = xPropSet->getPropertyValue("Name");
- aAnyName >>= sName;
+ OUString sShapeName;
+ if (xInfo->hasPropertyByName("Name"))
+ {
+ uno::Any aAnyShapeName = xPropSet->getPropertyValue("Name");
+ aAnyShapeName >>= sShapeName;
+ }
+ else
+ continue;
// Rectangle redaction
- if (!sName.isEmpty() && sName == "RectangleRedactionShape")
+ if (sShapeName == "RectangleRedactionShape"
+ && xInfo->hasPropertyByName("FillTransparence") && xInfo->hasPropertyByName("FillColor"))
{
xPropSet->setPropertyValue("FillTransparence", css::uno::makeAny(static_cast<sal_Int16>(50)));
xPropSet->setPropertyValue("FillColor", css::uno::makeAny(COL_GRAY7));
+ xPropSet->setPropertyValue("LineStyle", css::uno::makeAny(css::drawing::LineStyle::LineStyle_NONE));
+
}
// Freeform redaction
- else if (!sName.isEmpty() && sName == "FreeformRedactionShape")
+ else if (sShapeName == "FreeformRedactionShape")
{
xPropSet->setPropertyValue("LineTransparence", css::uno::makeAny(static_cast<sal_Int16>(50)));
xPropSet->setPropertyValue("LineColor", css::uno::makeAny(COL_GRAY7));
More information about the Libreoffice-commits
mailing list