diff options
author | Muhammet Kara <muhammet.kara@collabora.com> | 2019-02-19 23:41:57 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2019-03-27 21:43:37 +0100 |
commit | 6f5466e19e7a645ad0a8215c29a2a3a0213e6dd6 (patch) | |
tree | 5ea824f0618e45950277a01d40edd0f11a109abc /sfx2 | |
parent | b93a50c4acae93bff3596663361bb26753241c34 (diff) |
Use named shapes for redaction
Change-Id: Ibb55bd503d264b618c3fbebfdbcf3fe9958c6783
Reviewed-on: https://gerrit.libreoffice.org/68031
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/69835
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 46 |
1 files changed, 14 insertions, 32 deletions
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<sal_Int32>()); - - - if (nTransp == 50 && aColor == COL_GRAY7) - { - xPropSet->setPropertyValue("FillTransparence", css::uno::makeAny(static_cast<sal_Int16>(0))); - xPropSet->setPropertyValue("FillColor", css::uno::makeAny(COL_BLACK)); - xPropSet->setPropertyValue("Name", css::uno::makeAny(sRectangleName)); - } + xPropSet->setPropertyValue("FillTransparence", css::uno::makeAny(static_cast<sal_Int16>(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<sal_Int32>()); - - if (nTransp == 50 && aColor == COL_GRAY7) - { xPropSet->setPropertyValue("LineTransparence", css::uno::makeAny(static_cast<sal_Int16>(0))); xPropSet->setPropertyValue("LineColor", css::uno::makeAny(COL_BLACK)); - xPropSet->setPropertyValue("Name", css::uno::makeAny(sFreeformName)); - } } } } |