summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-05-08 23:25:17 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-05-11 00:12:33 +0200
commit5952331844450dad93e21d2e329d51841ae1700e (patch)
treeee95ae8c96b27928ba6ae30620e9e524c1982d3e
parentce0933c0d8cc0d51774d0168a8be4e9bb3153463 (diff)
tdf#49247: implement soft edges document model and import/export
... for ODF and OOXML. Two object properties added: SoftEdge (boolean, effect enabled/disabled) SoftEdgeRad (sal_Int32, effect radius in 100ths of mm) Two corresponding ODF attributes added: loext:softedge ("visible"/"hidden") loext:softedge-radius (metric) Change-Id: I0dc4d7fc3e5b0c2c36092d430568ebcfd3a68c9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93833 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--include/oox/export/drawingml.hxx1
-rw-r--r--include/svx/strings.hrc2
-rw-r--r--include/svx/svddef.hxx7
-rw-r--r--include/svx/svxids.hrc2
-rw-r--r--include/svx/unoshprp.hxx4
-rw-r--r--include/xmloff/xmltoken.hxx2
-rw-r--r--oox/source/drawingml/effectproperties.cxx6
-rw-r--r--oox/source/drawingml/effectproperties.hxx8
-rw-r--r--oox/source/drawingml/effectpropertiescontext.cxx8
-rw-r--r--oox/source/drawingml/shape.cxx9
-rw-r--r--oox/source/export/drawingml.cxx32
-rw-r--r--schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng14
-rw-r--r--sd/qa/unit/data/odg/softedges.odgbin0 -> 10130 bytes
-rw-r--r--sd/qa/unit/data/pptx/shape-soft-edges.pptxbin0 -> 32995 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx16
-rw-r--r--sd/qa/unit/export-tests.cxx36
-rw-r--r--svx/source/sdr/properties/customshapeproperties.cxx2
-rw-r--r--svx/source/sdr/properties/graphicproperties.cxx2
-rw-r--r--svx/source/svdraw/svdattr.cxx9
-rw-r--r--svx/source/unodraw/unoprov.cxx11
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport7.cxx35
-rw-r--r--xmloff/inc/xmlsdtypes.hxx3
-rw-r--r--xmloff/source/core/xmltoken.cxx2
-rw-r--r--xmloff/source/draw/sdpropls.cxx17
-rw-r--r--xmloff/source/token/tokens.txt2
25 files changed, 197 insertions, 33 deletions
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 27735af4cbd9..439d817d0449 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -168,6 +168,7 @@ protected:
static bool EqualGradients( css::awt::Gradient aGradient1, css::awt::Gradient aGradient2 );
void WriteGlowEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
+ void WriteSoftEdgeEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
public:
DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = nullptr )
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index 472a35a487e8..e6ff4f7cc25b 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -516,6 +516,8 @@
#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")
// drawing layer table strings
diff --git a/include/svx/svddef.hxx b/include/svx/svddef.hxx
index d6bbccf57654..2b8fb1e74fbb 100644
--- a/include/svx/svddef.hxx
+++ b/include/svx/svddef.hxx
@@ -422,7 +422,12 @@ constexpr TypedWhichId<XColorItem> SDRATTR_GLOW_COLOR (SDRATTR_GLOW_FIRST+2);
constexpr TypedWhichId<SdrPercentItem> SDRATTR_GLOW_TRANSPARENCY(SDRATTR_GLOW_FIRST + 3);
constexpr sal_uInt16 SDRATTR_GLOW_LAST (SDRATTR_GLOW_TRANSPARENCY);
-constexpr sal_uInt16 SDRATTR_END (SDRATTR_GLOW_LAST); /* 1357 */ /* 1333 V4+++*/ /* 1243 V4+++*/ /*1213*/ /*1085*/ /*1040*/ /*Pool V2: 1123,V1: 1065 */
+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 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 */
#endif // INCLUDED_SVX_SVDDEF_HXX
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 5c18856d0713..ab6fce14082c 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -418,6 +418,8 @@ 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_SCAN ( SID_SVX_START + 330 )
#define SID_TWAIN_SELECT ( SID_SVX_START + 331 )
#define SID_TWAIN_TRANSFER ( SID_SVX_START + 332 )
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index b8c0990fa2f7..12188840cfe4 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -215,6 +215,10 @@
{ OUString{"GlowEffectColor"}, SDRATTR_GLOW_COLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
{ 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 \
{ OUString(UNO_NAME_SHADOW), SDRATTR_SHADOW, cppu::UnoType<bool>::get(), 0, 0}, \
{ OUString(UNO_NAME_SHADOWCOLOR), SDRATTR_SHADOWCOLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 0f646baa40ca..d04776be3265 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1693,6 +1693,8 @@ namespace xmloff::token {
XML_SLANT_Y,
XML_SLIDE,
XML_SLOW,
+ XML_SOFTEDGE,
+ XML_SOFTEDGE_RADIUS,
XML_SOLID,
XML_SOLID_TYPE,
XML_SORT,
diff --git a/oox/source/drawingml/effectproperties.cxx b/oox/source/drawingml/effectproperties.cxx
index dd5fdd0693f9..4d0c7c334ab5 100644
--- a/oox/source/drawingml/effectproperties.cxx
+++ b/oox/source/drawingml/effectproperties.cxx
@@ -22,6 +22,11 @@ void EffectGlowProperties ::assignUsed(const EffectGlowProperties& rSourceProps)
moGlowColor.assignIfUsed( rSourceProps.moGlowColor );
}
+void EffectSoftEdgeProperties::assignUsed(const EffectSoftEdgeProperties& rSourceProps)
+{
+ moRad.assignIfUsed(rSourceProps.moRad);
+}
+
void EffectShadowProperties::assignUsed(const EffectShadowProperties& rSourceProps)
{
moShadowDist.assignIfUsed( rSourceProps.moShadowDist );
@@ -35,6 +40,7 @@ void EffectProperties::assignUsed( const EffectProperties& rSourceProps )
{
maShadow.assignUsed(rSourceProps.maShadow);
maGlow.assignUsed(rSourceProps.maGlow);
+ maSoftEdge.assignUsed(rSourceProps.maSoftEdge);
if (!rSourceProps.m_Effects.empty())
{
m_Effects.clear();
diff --git a/oox/source/drawingml/effectproperties.hxx b/oox/source/drawingml/effectproperties.hxx
index e1e42d485789..2d2b20e2e8e5 100644
--- a/oox/source/drawingml/effectproperties.hxx
+++ b/oox/source/drawingml/effectproperties.hxx
@@ -29,6 +29,13 @@ struct EffectGlowProperties
void assignUsed( const EffectGlowProperties& rSourceProps );
};
+struct EffectSoftEdgeProperties
+{
+ OptValue<sal_Int64> moRad; // size of effect
+
+ void assignUsed(const EffectSoftEdgeProperties& rSourceProps);
+};
+
struct EffectShadowProperties
{
OptValue< sal_Int64 > moShadowDist;
@@ -54,6 +61,7 @@ struct EffectProperties
{
EffectShadowProperties maShadow;
EffectGlowProperties maGlow;
+ EffectSoftEdgeProperties maSoftEdge;
/** Stores all effect properties, including those not supported by core yet */
std::vector<std::unique_ptr<Effect>> m_Effects;
diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx
index 28fdd8ea4fcf..afd00d2dd097 100644
--- a/oox/source/drawingml/effectpropertiescontext.cxx
+++ b/oox/source/drawingml/effectpropertiescontext.cxx
@@ -106,12 +106,14 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
}
case A_TOKEN( softEdge ):
+ {
+ mrEffectProperties.maSoftEdge.moRad = rAttribs.getInteger(XML_rad, 0);
+ return this; // no inner elements
+ }
case A_TOKEN( reflection ):
case A_TOKEN( blur ):
{
- if( nElement == A_TOKEN( softEdge ) )
- mrEffectProperties.m_Effects[nPos]->msName = "softEdge";
- else if( nElement == A_TOKEN( reflection ) )
+ if (nElement == A_TOKEN(reflection))
mrEffectProperties.m_Effects[nPos]->msName = "reflection";
else if( nElement == A_TOKEN( blur ) )
mrEffectProperties.m_Effects[nPos]->msName = "blur";
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 92629b2419b5..92e145fbe1da 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1474,6 +1474,15 @@ Reference< XShape > const & Shape::createAndInsert(
propertySet->setPropertyValue("GlowEffectColor", makeAny(aEffectProperties.maGlow.moGlowColor.getColor(rGraphicHelper)));
propertySet->setPropertyValue("GlowEffectTransparency", makeAny(aEffectProperties.maGlow.moGlowColor.getTransparency()));
}
+
+ // Set soft edge effect properties
+ 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())));
+ }
}
if( mxShape.is() )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e2149b648f84..134fa648aff6 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3750,12 +3750,13 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
bool bHasShadow = false;
if( GetProperty( rXPropSet, "Shadow" ) )
mAny >>= bHasShadow;
- bool bHasGlow = false;
- if( GetProperty( rXPropSet, "GlowEffect") )
- mAny >>= bHasGlow;
- //rXPropSet->getPropertyValue("GlowEffect") >>= bHasGlow;
+ bool bHasEffects = bHasShadow;
+ if (!bHasEffects && GetProperty(rXPropSet, "GlowEffect"))
+ mAny >>= bHasEffects;
+ if (!bHasEffects && GetProperty(rXPropSet, "SoftEdge"))
+ mAny >>= bHasEffects;
- if( bHasShadow || bHasGlow )
+ if (bHasEffects)
{
mpFS->startElementNS(XML_a, XML_effectLst);
WriteGlowEffect(rXPropSet);
@@ -3782,6 +3783,7 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
WriteShapeEffect( "outerShdw", aShadowGrabBag );
}
+ WriteSoftEdgeEffect(rXPropSet);
mpFS->endElementNS(XML_a, XML_effectLst);
}
}
@@ -3848,6 +3850,7 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
}
if (!bGlowWritten)
WriteGlowEffect(rXPropSet);
+ WriteSoftEdgeEffect(rXPropSet); // the last
mpFS->endElementNS(XML_a, XML_effectLst);
}
@@ -3877,6 +3880,25 @@ void DrawingML::WriteGlowEffect(const Reference< XPropertySet >& rXPropSet)
WriteShapeEffect("glow", aGlowProps);
}
+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;
+ css::uno::Sequence<css::beans::PropertyValue> aAttribs(1);
+ aAttribs[0].Name = "rad";
+ aAttribs[0].Value <<= oox::drawingml::convertHmmToEmu(nRad);
+ css::uno::Sequence<css::beans::PropertyValue> aProps(1);
+ aProps[0].Name = "Attribs";
+ aProps[0].Value <<= aAttribs;
+
+ WriteShapeEffect("softEdge", aProps);
+}
+
void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet )
{
// check existence of the grab bag
diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index 5e1a587fda74..7cb6eaabafef 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -944,6 +944,20 @@ 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>
+ <rng:optional>
+ <rng:attribute name="loext:softedge-radius">
+ <rng:ref name="length"/>
+ </rng:attribute>
+ </rng:optional>
</rng:interleave>
</rng:define>
diff --git a/sd/qa/unit/data/odg/softedges.odg b/sd/qa/unit/data/odg/softedges.odg
new file mode 100644
index 000000000000..a1fcab90e9ad
--- /dev/null
+++ b/sd/qa/unit/data/odg/softedges.odg
Binary files differ
diff --git a/sd/qa/unit/data/pptx/shape-soft-edges.pptx b/sd/qa/unit/data/pptx/shape-soft-edges.pptx
new file mode 100644
index 000000000000..cafb8cf4ca59
--- /dev/null
+++ b/sd/qa/unit/data/pptx/shape-soft-edges.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 645c3cb4f388..72e1110fe693 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -196,6 +196,7 @@ public:
void testTdf131554();
void testTdf132282();
void testTdf132201EffectOrder();
+ void testShapeSoftEdgeEffect();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -309,6 +310,7 @@ public:
CPPUNIT_TEST(testTdf131554);
CPPUNIT_TEST(testTdf132282);
CPPUNIT_TEST(testTdf132201EffectOrder);
+ CPPUNIT_TEST(testShapeSoftEdgeEffect);
CPPUNIT_TEST_SUITE_END();
@@ -2915,6 +2917,20 @@ void SdOOXMLExportTest2::testTdf132201EffectOrder()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest2::testShapeSoftEdgeEffect()
+{
+ auto xDocShRef
+ = 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
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 516eaf6df3c9..eeac217a3b83 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -75,6 +75,7 @@ public:
void testTdf113822();
void testTdf126761();
void testGlow();
+ void testSoftEdges();
CPPUNIT_TEST_SUITE(SdExportTest);
@@ -110,6 +111,7 @@ public:
CPPUNIT_TEST(testTdf113822);
CPPUNIT_TEST(testTdf126761);
CPPUNIT_TEST(testGlow);
+ CPPUNIT_TEST(testSoftEdges);
CPPUNIT_TEST_SUITE_END();
@@ -1307,6 +1309,40 @@ void SdExportTest::testGlow()
xDocShRef->DoClose();
}
+void SdExportTest::testSoftEdges()
+{
+ auto xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odg/softedges.odg"), ODG);
+ utl::TempFile tempFile;
+ 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);
+ sal_Int32 nRad = 0;
+ CPPUNIT_ASSERT(xShapeProps->getPropertyValue("SoftEdgeRad") >>= nRad);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRad); // 18 pt
+
+ // Test ODF element
+ xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml");
+
+ // 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");
+ assertXPath(
+ pXmlDoc,
+ "/office:document-content/office:automatic-styles/style:style[2]/style:graphic-properties",
+ "softedge-radius", "0.635cm");
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx
index f9da077101ee..0d1443081910 100644
--- a/svx/source/sdr/properties/customshapeproperties.cxx
+++ b/svx/source/sdr/properties/customshapeproperties.cxx
@@ -73,7 +73,7 @@ namespace sdr::properties
// Graphic attributes, 3D properties, CustomShape
// properties:
SDRATTR_GRAF_FIRST, SDRATTR_CUSTOMSHAPE_LAST,
- SDRATTR_GLOW_FIRST, SDRATTR_GLOW_LAST,
+ SDRATTR_GLOW_FIRST, SDRATTR_SOFTEDGE_LAST,
// Range from SdrTextObj:
EE_ITEMS_START, EE_ITEMS_END>{});
}
diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx
index 35d8e832679a..2819826caad5 100644
--- a/svx/source/sdr/properties/graphicproperties.cxx
+++ b/svx/source/sdr/properties/graphicproperties.cxx
@@ -67,7 +67,7 @@ namespace sdr::properties
// range from SdrGrafObj
SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
- SDRATTR_GLOW_FIRST, SDRATTR_GLOW_LAST,
+ SDRATTR_GLOW_FIRST, SDRATTR_SOFTEDGE_LAST,
// range from SdrTextObj
EE_ITEMS_START, EE_ITEMS_END>{});
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 1b89cab1da13..ed96682bc6f7 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -333,6 +333,9 @@ 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
mpLocalItemInfos[SDRATTR_SHADOW-SDRATTR_START]._nSID=SID_ATTR_FILL_SHADOW;
mpLocalItemInfos[SDRATTR_SHADOWCOLOR-SDRATTR_START]._nSID=SID_ATTR_SHADOW_COLOR;
@@ -352,6 +355,9 @@ 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
SetDefaults(mpLocalPoolDefaults);
SetItemInfos(mpLocalItemInfos.get());
@@ -463,6 +469,9 @@ 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;
case SDRATTR_CAPTIONFIXEDANGLE: pResId = SIP_SA_CAPTIONFIXEDANGLE;break;
case SDRATTR_CAPTIONANGLE : pResId = SIP_SA_CAPTIONANGLE;break;
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 92399dee20c3..8d2849512856 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -62,6 +62,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxShapePropertyMap()
MISC_OBJ_PROPERTIES
LINKTARGET_PROPERTIES
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
TEXT_PROPERTIES
// #FontWork#
@@ -86,6 +87,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxTextShapePropertyMap()
MISC_OBJ_PROPERTIES_NO_SHEAR
LINKTARGET_PROPERTIES
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
TEXT_PROPERTIES
// #FontWork#
@@ -111,6 +113,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxConnectorPropertyMap()
MISC_OBJ_PROPERTIES
LINKTARGET_PROPERTIES
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
TEXT_PROPERTIES
// #FontWork#
@@ -136,6 +139,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxDimensioningPropertyMap()
MISC_OBJ_PROPERTIES
LINKTARGET_PROPERTIES
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
TEXT_PROPERTIES
// #FontWork#
@@ -161,6 +165,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxCirclePropertyMap()
MISC_OBJ_PROPERTIES
LINKTARGET_PROPERTIES
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
TEXT_PROPERTIES
// #FontWork#
@@ -188,6 +193,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxPolyPolygonPropertyMap()
MISC_OBJ_PROPERTIES
LINKTARGET_PROPERTIES
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
TEXT_PROPERTIES
// #FontWork#
@@ -218,6 +224,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxGraphicObjectPropertyMap()
LINKTARGET_PROPERTIES
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
TEXT_PROPERTIES
// #FontWork#
@@ -369,6 +376,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxAllPropertyMap()
static SfxItemPropertyMapEntry const aAllPropertyMap_Impl[] =
{
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
LINE_PROPERTIES
LINE_PROPERTIES_START_END
@@ -432,6 +440,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxOle2PropertyMap()
MISC_OBJ_PROPERTIES
LINKTARGET_PROPERTIES
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
TEXT_PROPERTIES
FONTWORK_PROPERTIES
@@ -684,6 +693,7 @@ static SfxItemPropertyMapEntry const * ImplGetSvxCustomShapePropertyMap()
MISC_OBJ_PROPERTIES
LINKTARGET_PROPERTIES
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
TEXT_PROPERTIES
{OUString("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
@@ -763,6 +773,7 @@ static comphelper::PropertyMapEntry const * ImplGetSvxDrawingDefaultsPropertyMap
static comphelper::PropertyMapEntry const aSvxDrawingDefaultsPropertyMap_Impl[] =
{
GLOW_PROPERTIES
+ SOFTEDGE_PROPERTIES
SHADOW_PROPERTIES
LINE_PROPERTIES_DEFAULTS
FILL_PROPERTIES_BMP
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
index 32dfd9b1c925..572f19026653 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
@@ -32,6 +32,18 @@ protected:
// If the testcase is stored in some other format, it's pointless to test.
return OString(filename).endsWith(".docx");
}
+
+ // We import OOXML's EMUs into integral mm100 internal representation, then export back into
+ // EMUs. This results in inaccuracies.
+ void assertXPathHasApproxEMU(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath,
+ const OString& rAttribute, sal_Int64 nAttributeVal)
+ {
+ OUString val = getXPath(pXmlDoc, rXPath, rAttribute);
+ // Use precision of 1/2 of 100th of mm, which is 180 EMU
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
+ OString("XPath: " + rXPath + "\nAttribute: " + rAttribute).getStr(), nAttributeVal,
+ val.toInt64(), 180);
+ }
};
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST( testChildNodesOfCubicBezierTo, "FDO74774.docx")
@@ -216,9 +228,11 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testShapeEffectPreservation, "shape-effect-p
"val", "50000");
// 4th shape with soft edge
- assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
- "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:softEdge",
- "rad", "127000");
+ assertXPathHasApproxEMU(
+ pXmlDoc,
+ "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+ "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:softEdge",
+ "rad", 127000); // actually, it returns 127080
assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:softEdge/*",
0 ); // should not be present
@@ -246,13 +260,10 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testShapeEffectPreservation, "shape-effect-p
0 ); // should not be present
// 7th shape with several effects: glow, inner shadow and reflection
- // We import glow radius (in EMU in OOXML) into integral mm100 internal representation, then
- // export back into EMUs. This results in inaccuracies.
- OUString rad = getXPath(pXmlDoc,
+ assertXPathHasApproxEMU(pXmlDoc,
"/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow",
- "rad");
- CPPUNIT_ASSERT_DOUBLES_EQUAL(63500, rad.toInt64(), 150); // actually, it returns 63360
+ "rad", 63500); // actually, it returns 63360
assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:srgbClr",
"val", "eb2722");
@@ -433,9 +444,11 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPictureEffectPreservation, "picture-effe
0 ); // should not be present
// third picture: soft edge effect
- assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
- "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:softEdge",
- "rad", "63500");
+ assertXPathHasApproxEMU(
+ pXmlDoc,
+ "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+ "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:softEdge",
+ "rad", 63500); // actually, it returns 63360
}
DECLARE_OOXMLEXPORT_TEST(testPictureArtisticEffectPreservation, "picture-artistic-effects-preservation.docx")
diff --git a/xmloff/inc/xmlsdtypes.hxx b/xmloff/inc/xmlsdtypes.hxx
index 6b060d322f7c..01849d004f4f 100644
--- a/xmloff/inc/xmlsdtypes.hxx
+++ b/xmloff/inc/xmlsdtypes.hxx
@@ -43,7 +43,7 @@
#define XML_SD_TYPE_FILLSTYLE (XML_SD_TYPES_START + 9 )
#define XML_SD_TYPE_GRADIENT (XML_SD_TYPES_START + 10 )
#define XML_SD_TYPE_GRADIENT_STEPCOUNT (XML_SD_TYPES_START + 11 )
-#define XML_SD_TYPE_SHADOW (XML_SD_TYPES_START + 12 )
+#define XML_SD_TYPE_VISIBLE_HIDDEN (XML_SD_TYPES_START + 12 )
#define XML_SD_TYPE_TEXT_CROSSEDOUT (XML_SD_TYPES_START + 13 )
#define XML_SD_TYPE_NUMBULLET (XML_SD_TYPES_START + 14 )
#define XML_SD_TYPE_WRITINGMODE (XML_SD_TYPES_START + 15 )
@@ -68,7 +68,6 @@
#define XML_SD_TYPE_IMAGE_SCALE_MODE (XML_SD_TYPES_START + 34 )
#define XML_SD_TYPE_LINECAP (XML_SD_TYPES_START + 35 )
#define XML_SD_TYPE_FITTOSIZE_AUTOFIT (XML_SD_TYPES_START + 36 )
-#define XML_SD_TYPE_GLOW (XML_SD_TYPES_START + 37 )
//////////////////////////////////////////////////////////////////////////////
// 3D property types
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 9fab6ca983ef..4f7428dc431f 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1698,6 +1698,8 @@ 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 ),
TOKEN( "sort", XML_SORT ),
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index 8011d423d319..bb2a504e4d8b 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -146,18 +146,22 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
GMAP( "TextChainNextName", XML_NAMESPACE_DRAW, XML_CHAIN_NEXT_NAME, XML_TYPE_STRING, 0 ),
// shadow attributes
- GMAP( "Shadow", XML_NAMESPACE_DRAW, XML_SHADOW, XML_SD_TYPE_SHADOW, 0 ),
+ GMAP( "Shadow", XML_NAMESPACE_DRAW, XML_SHADOW, XML_SD_TYPE_VISIBLE_HIDDEN, 0 ),
GMAP( "ShadowXDistance", XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_X, XML_TYPE_MEASURE, 0 ),
GMAP( "ShadowYDistance", XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_Y, XML_TYPE_MEASURE, 0 ),
GMAP( "ShadowColor", XML_NAMESPACE_DRAW, XML_SHADOW_COLOR, XML_TYPE_COLOR, 0 ),
GMAP( "ShadowTransparence", XML_NAMESPACE_DRAW, XML_SHADOW_OPACITY, XML_TYPE_NEG_PERCENT, 0 ),
// glow attributes
- GMAPV( "GlowEffect", XML_NAMESPACE_LO_EXT, XML_GLOW, XML_SD_TYPE_GLOW , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+ GMAPV( "GlowEffect", XML_NAMESPACE_LO_EXT, XML_GLOW, XML_SD_TYPE_VISIBLE_HIDDEN, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
GMAPV( "GlowEffectRad", XML_NAMESPACE_LO_EXT, XML_GLOW_RADIUS, XML_TYPE_MEASURE , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
GMAPV( "GlowEffectColor", XML_NAMESPACE_LO_EXT, XML_GLOW_COLOR, XML_TYPE_COLOR , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
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
GMAP( "GraphicColorMode", XML_NAMESPACE_DRAW, XML_COLOR_MODE, XML_TYPE_COLOR_MODE, 0 ), // exists in SW, too, with same property name
GMAP( "AdjustLuminance", XML_NAMESPACE_DRAW, XML_LUMINANCE, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
@@ -232,7 +236,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
GMAP( "D3DMaterialSpecularIntensity", XML_NAMESPACE_DR3D, XML_SHININESS, XML_TYPE_PERCENT, 0 ),
// 3D shadow attributes
- GMAP( "D3DShadow3D", XML_NAMESPACE_DR3D, XML_SHADOW, XML_SD_TYPE_SHADOW, 0 ),
+ GMAP( "D3DShadow3D", XML_NAMESPACE_DR3D, XML_SHADOW, XML_SD_TYPE_VISIBLE_HIDDEN, 0 ),
// #FontWork# attributes
GMAP( "FontWorkStyle", XML_NAMESPACE_DRAW, XML_FONTWORK_STYLE, XML_SD_TYPE_FONTWORK_STYLE| MID_FLAG_ELEMENT_ITEM_EXPORT, CTF_FONTWORK_STYLE ),
@@ -1020,12 +1024,7 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy
pHdl = new XMLEnumPropertyHdl( aXML_PresChange_EnumMap );
break;
}
- case XML_SD_TYPE_SHADOW :
- {
- pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_VISIBLE), GetXMLToken(XML_HIDDEN) );
- break;
- }
- case XML_SD_TYPE_GLOW :
+ case XML_SD_TYPE_VISIBLE_HIDDEN:
{
pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_VISIBLE), GetXMLToken(XML_HIDDEN) );
break;
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 5737c639b50a..9a2c343d44c6 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -1611,6 +1611,8 @@ slant-x
slant-y
slide
slow
+softedge
+softedge-radius
solid
solid-type
sort