From 50131f31f093c32d7f4a3c85fc77637ba0513f2c Mon Sep 17 00:00:00 2001 From: Balazs Varga <balazs.varga.extern@allotropia.de> Date: Mon, 16 Dec 2024 13:35:38 +0100 Subject: tdf#135320 sd fix soft edges are not shown on text frames Allow soft edge and glow effect on text frames objects. Change-Id: If08da1cfeae515aa50ded5689b7fe3a963a98cd9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178656 Tested-by: Jenkins Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de> (cherry picked from commit 8b7900dc3dfc6e3284442dc106799c44dc8961de) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178739 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> --- .../data/org/openoffice/Office/UI/Sidebar.xcu | 6 ++++-- sd/qa/unit/data/odg/softedges.odg | Bin 10130 -> 14473 bytes sd/qa/unit/data/pptx/shape-soft-edges.pptx | Bin 32995 -> 50092 bytes sd/qa/unit/export-tests-ooxml4.cxx | 4 ++++ sd/qa/unit/export-tests.cxx | 14 ++++++++++++++ .../sdr/primitive2d/sdrrectangleprimitive2d.cxx | 14 ++++++++++++++ svx/source/sdr/properties/textproperties.cxx | 2 +- 7 files changed, 37 insertions(+), 3 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu index 543d13edf274..b4a826bcf680 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu @@ -765,10 +765,12 @@ Calc, Draw, hidden ; DrawImpress, Draw, hidden ; DrawImpress, Graphic, hidden ; + DrawImpress, TextObject, hidden ; WriterVariants, Draw, hidden ; - Calc, DrawFontwork, visible ; + Calc, TextObject, hidden ; + Calc, DrawFontwork, visible ; DrawImpress, DrawFontwork, visible ; - WriterVariants, DrawFontwork, visible ; + WriterVariants, DrawFontwork, visible ; </value> </prop> <prop oor:name="ImplementationURL" oor:type="xs:string"> diff --git a/sd/qa/unit/data/odg/softedges.odg b/sd/qa/unit/data/odg/softedges.odg index a1fcab90e9ad..f1604b5d851e 100644 Binary files a/sd/qa/unit/data/odg/softedges.odg and b/sd/qa/unit/data/odg/softedges.odg differ diff --git a/sd/qa/unit/data/pptx/shape-soft-edges.pptx b/sd/qa/unit/data/pptx/shape-soft-edges.pptx index cafb8cf4ca59..e735070f0364 100644 Binary files a/sd/qa/unit/data/pptx/shape-soft-edges.pptx and b/sd/qa/unit/data/pptx/shape-soft-edges.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index 55f1b5d5de2d..5c8085911303 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -579,6 +579,10 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testShapeSoftEdgeEffect) sal_Int32 nRadius = -1; xShapeProps->getPropertyValue(u"SoftEdgeRadius"_ustr) >>= nRadius; CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRadius); // 18 pt + + xShapeProps.set(getShapeFromPage(1, 0)); + xShapeProps->getPropertyValue(u"SoftEdgeRadius"_ustr) >>= nRadius; + CPPUNIT_ASSERT_EQUAL(sal_Int32(353), nRadius); // 10 pt } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testShapeShadowBlurEffect) diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index b20064eb1006..a57dc111b0d2 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -1581,6 +1581,20 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testSoftEdges) pXmlDoc, "/office:document-content/office:automatic-styles/style:style[2]/style:graphic-properties", "softedge-radius", u"0.635cm"); + + // Text frame object + xShapeProps.set(getShapeFromPage(1, 0)); + CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"SoftEdgeRadius"_ustr) >>= nRad); + CPPUNIT_ASSERT_EQUAL(sal_Int32(353), nRad); // 10 pt + + // Test ODF element + pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[3]", + "family", u"graphic"); + assertXPath( + pXmlDoc, + "/office:document-content/office:automatic-styles/style:style[3]/style:graphic-properties", + "softedge-radius", u"0.353cm"); } CPPUNIT_TEST_FIXTURE(SdExportTest, testShadowBlur) diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index e66285e6bb6e..60cfa24bd8db 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -89,6 +89,20 @@ namespace drawinglayer::primitive2d getTransform())); } + // Soft edges should be before text, since text is not affected by soft edges + if (!aRetval.empty() && getSdrLFSTAttribute().getSoftEdgeRadius()) + { + aRetval = createEmbeddedSoftEdgePrimitive(std::move(aRetval), + getSdrLFSTAttribute().getSoftEdgeRadius()); + } + + // tdf#132199: put glow before shadow, to have shadow of the glow, not the opposite + if (!aRetval.empty() && !getSdrLFSTAttribute().getGlow().isDefault()) + { + // glow + aRetval = createEmbeddedGlowPrimitive(std::move(aRetval), getSdrLFSTAttribute().getGlow()); + } + // add text if(!getSdrLFSTAttribute().getText().isDefault()) { diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index cabe52ab68b7..3a2990846621 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -54,7 +54,7 @@ namespace sdr::properties svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, - SDRATTR_GLOW_TEXT_FIRST, SDRATTR_GLOW_TEXT_LAST, + SDRATTR_GLOW_FIRST, SDRATTR_GLOW_TEXT_LAST, SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST, // range from SdrTextObj -- cgit