From 6f5466e19e7a645ad0a8215c29a2a3a0213e6dd6 Mon Sep 17 00:00:00 2001 From: Muhammet Kara Date: Tue, 19 Feb 2019 23:41:57 +0300 Subject: Use named shapes for redaction Change-Id: Ibb55bd503d264b618c3fbebfdbcf3fe9958c6783 Reviewed-on: https://gerrit.libreoffice.org/68031 Tested-by: Jenkins Reviewed-by: Muhammet Kara Reviewed-on: https://gerrit.libreoffice.org/69835 Reviewed-by: Andras Timar Tested-by: Andras Timar --- sfx2/source/doc/objserv.cxx | 46 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 1cc2a0f4f8fc..b0a3b933d8bc 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -720,45 +720,27 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if (!xInfo.is()) continue; + OUString sShapeName; + if (xInfo->hasPropertyByName("Name")) + { + uno::Any aAnyShapeName = xPropSet->getPropertyValue("Name"); + aAnyShapeName >>= sShapeName; + } + else + continue; // Rectangle redaction - if (xInfo->hasPropertyByName("FillTransparence") && xInfo->hasPropertyByName("FillColor")) + if (sShapeName == "RectangleRedactionShape" + && xInfo->hasPropertyByName("FillTransparence") && xInfo->hasPropertyByName("FillColor")) { - uno::Any aAnyTransp = xPropSet->getPropertyValue("FillTransparence"); - uno::Any aAnyColor = xPropSet->getPropertyValue("FillColor"); - - sal_Int16 nTransp = 0; - const OUString sRectangleName("RectangleRedactionShape"); - - aAnyTransp >>= nTransp; - Color aColor(aAnyColor.get()); - - - if (nTransp == 50 && aColor == COL_GRAY7) - { - xPropSet->setPropertyValue("FillTransparence", css::uno::makeAny(static_cast(0))); - xPropSet->setPropertyValue("FillColor", css::uno::makeAny(COL_BLACK)); - xPropSet->setPropertyValue("Name", css::uno::makeAny(sRectangleName)); - } + xPropSet->setPropertyValue("FillTransparence", css::uno::makeAny(static_cast(0))); + xPropSet->setPropertyValue("FillColor", css::uno::makeAny(COL_BLACK)); } - //FIXME: Turn this into an else-if when we have the name-check // Freeform redaction - if (xInfo->hasPropertyByName("LineTransparence") && xInfo->hasPropertyByName("LineColor")) + else if (sShapeName == "FreeformRedactionShape" + && xInfo->hasPropertyByName("LineTransparence") && xInfo->hasPropertyByName("LineColor")) { - uno::Any aAnyTransp = xPropSet->getPropertyValue("LineTransparence"); - uno::Any aAnyColor = xPropSet->getPropertyValue("LineColor"); - - sal_Int16 nTransp = 0; - const OUString sFreeformName("FreeformRedactionShape"); - - aAnyTransp >>= nTransp; - Color aColor(aAnyColor.get()); - - if (nTransp == 50 && aColor == COL_GRAY7) - { xPropSet->setPropertyValue("LineTransparence", css::uno::makeAny(static_cast(0))); xPropSet->setPropertyValue("LineColor", css::uno::makeAny(COL_BLACK)); - xPropSet->setPropertyValue("Name", css::uno::makeAny(sFreeformName)); - } } } } -- cgit