tdf#49247: no need in extra boolean property, radius is enough

When soft edge has radius 0, the effect is disabled.

Change-Id: I7d66ea7b87e0ed59129a83885d52906b8edf75f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93971
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2020-05-11 18:24:23 +02:00
parent 14514042f7
commit d8d31f7423
14 changed files with 14 additions and 42 deletions
-1
View File
@@ -516,7 +516,6 @@
#define SIP_SA_GLOW_RAD NC_("SIP_SA_GLOW_RAD", "Radius of glow effect")
#define SIP_SA_GLOW_COLOR NC_("SIP_SA_GLOW_COLOR", "Color of glow effect")
#define SIP_SA_GLOW_TRANSPARENCY NC_("SIP_SA_GLOW_TRANSPARENCY", "Transparency of glow effect")
#define SIP_SA_SOFTEDGE NC_("SIP_SA_SOFTEDGE", "Soft edge effect")
#define SIP_SA_SOFTEDGE_RAD NC_("SIP_SA_SOFTEDGE_RAD", "Radius of soft edge effect")
#define STR_ObjNameSingulMEDIA NC_("STR_ObjNameSingulMEDIA", "Media object")
#define STR_ObjNamePluralMEDIA NC_("STR_ObjNamePluralMEDIA", "Media objects")
+1 -2
View File
@@ -423,8 +423,7 @@ constexpr TypedWhichId<SdrPercentItem> SDRATTR_GLOW_TRANSPARENCY(SDRATTR_GLOW_FI
constexpr sal_uInt16 SDRATTR_GLOW_LAST (SDRATTR_GLOW_TRANSPARENCY);
constexpr sal_uInt16 SDRATTR_SOFTEDGE_FIRST(SDRATTR_GLOW_LAST + 1);
constexpr TypedWhichId<SdrOnOffItem> SDRATTR_SOFTEDGE(SDRATTR_SOFTEDGE_FIRST + 0);
constexpr TypedWhichId<SdrMetricItem> SDRATTR_SOFTEDGE_RAD(SDRATTR_SOFTEDGE_FIRST + 1);
constexpr TypedWhichId<SdrMetricItem> SDRATTR_SOFTEDGE_RAD(SDRATTR_SOFTEDGE_FIRST + 0);
constexpr sal_uInt16 SDRATTR_SOFTEDGE_LAST(SDRATTR_SOFTEDGE_RAD);
constexpr sal_uInt16 SDRATTR_END (SDRATTR_SOFTEDGE_LAST); /* 1357 */ /* 1333 V4+++*/ /* 1243 V4+++*/ /*1213*/ /*1085*/ /*1040*/ /*Pool V2: 1123,V1: 1065 */
+1 -2
View File
@@ -418,8 +418,7 @@ class SvxSetItem;
#define SID_ATTR_GLOW_COLOR ( SID_SVX_START + 321 )
#define SID_ATTR_GLOW_RADIUS ( SID_SVX_START + 322 )
#define SID_ATTR_GLOW_TRANSPARENCY ( SID_SVX_START + 323 )
#define SID_ATTR_SOFTEDGE ( SID_SVX_START + 324 )
#define SID_ATTR_SOFTEDGE_RADIUS ( SID_SVX_START + 325 )
#define SID_ATTR_SOFTEDGE_RADIUS ( SID_SVX_START + 324 )
#define SID_SCAN ( SID_SVX_START + 330 )
#define SID_TWAIN_SELECT ( SID_SVX_START + 331 )
#define SID_TWAIN_TRANSFER ( SID_SVX_START + 332 )
-1
View File
@@ -216,7 +216,6 @@
{ OUString{"GlowEffectTransparency"}, SDRATTR_GLOW_TRANSPARENCY,::cppu::UnoType<sal_Int16>::get(), 0, 0 },
#define SOFTEDGE_PROPERTIES \
{ OUString("SoftEdge"), SDRATTR_SOFTEDGE, cppu::UnoType<bool>::get(), 0, 0}, \
{ OUString{"SoftEdgeRad"}, SDRATTR_SOFTEDGE_RAD, cppu::UnoType<sal_Int32>::get(), 0, 0, PropertyMoreFlags::METRIC_ITEM},
#define SHADOW_PROPERTIES \
-1
View File
@@ -1695,7 +1695,6 @@ namespace xmloff::token {
XML_SLANT_Y,
XML_SLIDE,
XML_SLOW,
XML_SOFTEDGE,
XML_SOFTEDGE_RADIUS,
XML_SOLID,
XML_SOLID_TYPE,
-1
View File
@@ -1479,7 +1479,6 @@ Reference< XShape > const & Shape::createAndInsert(
if (aEffectProperties.maSoftEdge.moRad.has())
{
uno::Reference<beans::XPropertySet> propertySet(mxShape, uno::UNO_QUERY);
propertySet->setPropertyValue("SoftEdge", makeAny(true));
propertySet->setPropertyValue(
"SoftEdgeRad", makeAny(convertEmuToHmm(aEffectProperties.maSoftEdge.moRad.get())));
}
+9 -7
View File
@@ -3753,8 +3753,12 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
bool bHasEffects = bHasShadow;
if (!bHasEffects && GetProperty(rXPropSet, "GlowEffect"))
mAny >>= bHasEffects;
if (!bHasEffects && GetProperty(rXPropSet, "SoftEdge"))
mAny >>= bHasEffects;
if (!bHasEffects && GetProperty(rXPropSet, "SoftEdgeRad"))
{
sal_Int32 rad = 0;
mAny >>= rad;
bHasEffects = rad > 0;
}
if (bHasEffects)
{
@@ -3882,13 +3886,11 @@ void DrawingML::WriteGlowEffect(const Reference< XPropertySet >& rXPropSet)
void DrawingML::WriteSoftEdgeEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet)
{
bool hasEffect = false;
rXPropSet->getPropertyValue("SoftEdge") >>= hasEffect;
if (!hasEffect)
return;
sal_Int32 nRad = 0;
rXPropSet->getPropertyValue("SoftEdgeRad") >>= nRad;
if (!nRad)
return;
css::uno::Sequence<css::beans::PropertyValue> aAttribs(1);
aAttribs[0].Name = "rad";
aAttribs[0].Value <<= oox::drawingml::convertHmmToEmu(nRad);
@@ -944,15 +944,7 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
<rng:ref name="zeroToHundredPercent"/>
</rng:attribute>
</rng:optional>
<!-- TODO: no proposal for loext:softedge* -->
<rng:optional>
<rng:attribute name="loext:softedge">
<rng:choice>
<rng:value>visible</rng:value>
<rng:value>hidden</rng:value>
</rng:choice>
</rng:attribute>
</rng:optional>
<!-- TODO: no proposal for loext:softedge-radius -->
<rng:optional>
<rng:attribute name="loext:softedge-radius">
<rng:ref name="length"/>
-3
View File
@@ -2923,9 +2923,6 @@ void SdOOXMLExportTest2::testShapeSoftEdgeEffect()
= loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/shape-soft-edges.pptx"), PPTX);
xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
auto xShapeProps(getShapeFromPage(0, 0, xDocShRef));
bool bHasSoftEdges = false;
xShapeProps->getPropertyValue("SoftEdge") >>= bHasSoftEdges;
CPPUNIT_ASSERT(bHasSoftEdges);
sal_Int32 nRadius = -1;
xShapeProps->getPropertyValue("SoftEdgeRad") >>= nRadius;
CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRadius); // 18 pt
+2 -9
View File
@@ -1316,10 +1316,7 @@ void SdExportTest::testSoftEdges()
xDocShRef = saveAndReload(xDocShRef.get(), ODG, &tempFile);
auto xShapeProps(getShapeFromPage(0, 0, xDocShRef));
// Check glow properties
bool bEffect = false;
CPPUNIT_ASSERT(xShapeProps->getPropertyValue("SoftEdge") >>= bEffect);
CPPUNIT_ASSERT(bEffect);
// Check property
sal_Int32 nRad = 0;
CPPUNIT_ASSERT(xShapeProps->getPropertyValue("SoftEdgeRad") >>= nRad);
CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRad); // 18 pt
@@ -1330,11 +1327,7 @@ void SdExportTest::testSoftEdges()
// check that we actually test graphic style
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[2]",
"family", "graphic");
// check loext graphic attributes
assertXPath(
pXmlDoc,
"/office:document-content/office:automatic-styles/style:style[2]/style:graphic-properties",
"softedge", "visible");
// check loext graphic attribute
assertXPath(
pXmlDoc,
"/office:document-content/office:automatic-styles/style:style[2]/style:graphic-properties",
-3
View File
@@ -333,7 +333,6 @@ SdrItemPool::SdrItemPool(
rPoolDefaults[ SDRATTR_GLOW_COLOR - SDRATTR_START ] = new XColorItem(SDRATTR_GLOW_COLOR, aNullCol);
rPoolDefaults[ SDRATTR_GLOW_TRANSPARENCY - SDRATTR_START ] = new SdrPercentItem(SDRATTR_GLOW_TRANSPARENCY, 0);
rPoolDefaults[SDRATTR_SOFTEDGE - SDRATTR_START] = new SdrOnOffItem(SDRATTR_SOFTEDGE, false);
rPoolDefaults[SDRATTR_SOFTEDGE_RAD - SDRATTR_START] = new SdrMetricItem(SDRATTR_SOFTEDGE_RAD, 0);
// set own ItemInfos
@@ -355,7 +354,6 @@ SdrItemPool::SdrItemPool(
mpLocalItemInfos[SDRATTR_GLOW_COLOR - SDRATTR_START]._nSID = SID_ATTR_GLOW_COLOR;
mpLocalItemInfos[SDRATTR_GLOW_TRANSPARENCY - SDRATTR_START]._nSID = SID_ATTR_GLOW_TRANSPARENCY;
mpLocalItemInfos[SDRATTR_SOFTEDGE - SDRATTR_START]._nSID = SID_ATTR_SOFTEDGE;
mpLocalItemInfos[SDRATTR_SOFTEDGE_RAD - SDRATTR_START]._nSID = SID_ATTR_SOFTEDGE_RADIUS;
// it's my own creation level, set Defaults and ItemInfos
@@ -469,7 +467,6 @@ OUString SdrItemPool::GetItemName(sal_uInt16 nWhich)
case SDRATTR_GLOW_COLOR : pResId = SIP_SA_GLOW_COLOR;break;
case SDRATTR_GLOW_TRANSPARENCY : pResId = SIP_SA_GLOW_TRANSPARENCY;break;
case SDRATTR_SOFTEDGE : pResId = SIP_SA_SOFTEDGE; break;
case SDRATTR_SOFTEDGE_RAD : pResId = SIP_SA_SOFTEDGE_RAD; break;
case SDRATTR_CAPTIONTYPE : pResId = SIP_SA_CAPTIONTYPE;break;
-1
View File
@@ -1701,7 +1701,6 @@ namespace xmloff::token {
TOKEN( "slant-y", XML_SLANT_Y ),
TOKEN( "slide", XML_SLIDE ),
TOKEN( "slow", XML_SLOW ),
TOKEN( "softedge", XML_SOFTEDGE ),
TOKEN( "softedge-radius", XML_SOFTEDGE_RADIUS ),
TOKEN( "solid", XML_SOLID ),
TOKEN( "solid-type", XML_SOLID_TYPE ),
-1
View File
@@ -159,7 +159,6 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
GMAPV( "GlowEffectTransparency", XML_NAMESPACE_LO_EXT, XML_GLOW_TRANSPARENCY, XML_TYPE_PERCENT16, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
// soft edge attributes
GMAPV( "SoftEdge", XML_NAMESPACE_LO_EXT, XML_SOFTEDGE, XML_SD_TYPE_VISIBLE_HIDDEN, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
GMAPV( "SoftEdgeRad", XML_NAMESPACE_LO_EXT, XML_SOFTEDGE_RADIUS, XML_TYPE_MEASURE , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
// graphic attributes
-1
View File
@@ -1611,7 +1611,6 @@ slant-x
slant-y
slide
slow
softedge
softedge-radius
solid
solid-type