summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-02-19 23:41:57 +0300
committerMuhammet Kara <muhammet.kara@collabora.com>2019-02-20 06:20:21 +0100
commit98384e98e59506d08c48b41b70a660655a8f83d7 (patch)
tree6a3385071edaaa3a979e3f29187c85a7ea10189a /sfx2
parent12a59a1f2948274c6a845ab4a0963bab8aff45b8 (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>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/objserv.cxx48
1 files changed, 15 insertions, 33 deletions
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index f333eaa35f42..175f7b22f8ee 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -734,46 +734,28 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
if (!xInfo.is())
continue;
- // Rectangle redaction
- if (xInfo->hasPropertyByName("FillTransparence") && xInfo->hasPropertyByName("FillColor"))
+ OUString sShapeName;
+ if (xInfo->hasPropertyByName("Name"))
{
- uno::Any aAnyTransp = xPropSet->getPropertyValue("FillTransparence");
- uno::Any aAnyColor = xPropSet->getPropertyValue("FillColor");
-
- sal_Int16 nTransp = 0;
- Color aColor;
- const OUString sRectangleName("RectangleRedactionShape");
-
- aAnyTransp >>= nTransp;
- aAnyColor >>= aColor;
+ uno::Any aAnyShapeName = xPropSet->getPropertyValue("Name");
+ aAnyShapeName >>= sShapeName;
+ }
+ else
+ continue;
- 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));
- }
+ // Rectangle redaction
+ if (sShapeName == "RectangleRedactionShape"
+ && 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));
}
- //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;
- Color aColor;
- const OUString sFreeformName("FreeformRedactionShape");
-
- aAnyTransp >>= nTransp;
- aAnyColor >>= aColor;
-
- 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));
- }
}
}
}