diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-08-21 17:34:23 +0200 |
---|---|---|
committer | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-08-29 19:59:24 +0200 |
commit | 3eac847927a0cdfa40c3fea38c473ed2ad7faecc (patch) | |
tree | d1e26675fb6aca7d8751426c010b0b9e33d5c7e3 /oox/source/drawingml | |
parent | 786aed3a35a50c0e147e15d29c88987aaf523775 (diff) |
tdf#161826 - Add uniform Glow effect for texts in shapes
- Add new text Glow effect properties for shapes
- Using TextGlowPrimitive for rendering uniform text glow in shapes
- Add/allow new UI Glow Effect for texts in shapes on sidebar
(Only for Impress/Draw and Calc)
- Import/Export ooxml files with Glow effect on texts in shapes
(Only PPTX/XLSX)
- Import/Export odf files with Glow effect on texts in shapes
- Add unit test for glow text attributes in ODF
- Add uni tests for OOXML import/export
Note: Also this patch effects on
tdf#144061 - Effects: Allow GLOW to apply to Text (as we have for shapes)
Change-Id: I16586c01654f197f532129e4e06aa2ef9f214395
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172216
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r-- | oox/source/drawingml/effectproperties.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/effectpropertiescontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 46 | ||||
-rw-r--r-- | oox/source/drawingml/textcharacterproperties.cxx | 1 | ||||
-rw-r--r-- | oox/source/drawingml/textcharacterpropertiescontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/themeelementscontext.cxx | 2 |
6 files changed, 51 insertions, 4 deletions
diff --git a/oox/source/drawingml/effectproperties.cxx b/oox/source/drawingml/effectproperties.cxx index 83df8d59c57f..b1850b17c6d6 100644 --- a/oox/source/drawingml/effectproperties.cxx +++ b/oox/source/drawingml/effectproperties.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "effectproperties.hxx" +#include <oox/drawingml/effectproperties.hxx> #include <oox/drawingml/drawingmltypes.hxx> #include <oox/helper/graphichelper.hxx> #include <oox/token/properties.hxx> diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx index 9e5fbd983689..ea949017cae2 100644 --- a/oox/source/drawingml/effectpropertiescontext.cxx +++ b/oox/source/drawingml/effectpropertiescontext.cxx @@ -8,7 +8,7 @@ */ #include <drawingml/effectpropertiescontext.hxx> -#include "effectproperties.hxx" +#include <oox/drawingml/effectproperties.hxx> #include <drawingml/colorchoicecontext.hxx> #include <oox/helper/attributelist.hxx> #include <oox/token/namespaces.hxx> diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index e3c08581f624..56e04caadbf1 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -29,7 +29,7 @@ #include <drawingml/presetgeometrynames.hxx> #include <drawingml/shape3dproperties.hxx> #include <drawingml/scene3dhelper.hxx> -#include "effectproperties.hxx" +#include <oox/drawingml/effectproperties.hxx> #include <oox/drawingml/shapepropertymap.hxx> #include <drawingml/textbody.hxx> #include <drawingml/textparagraph.hxx> @@ -2162,6 +2162,50 @@ Reference< XShape > const & Shape::createAndInsert( u"SoftEdgeRadius"_ustr, Any(convertEmuToHmm(aEffectProperties.maSoftEdge.moRad.value()))); } + // Set text glow effect for shapes + if (mpTextBody && (!bDoNotInsertEmptyTextBody || !mpTextBody->isEmpty())) + { + const TextParagraphVector& rParagraphs = mpTextBody->getParagraphs(); + if (!rParagraphs.empty()) + { + EffectProperties aTextEffectProperties; + for (TextParagraphVector::const_iterator aPIt = rParagraphs.begin(), aPEnd = rParagraphs.end(); aPIt != aPEnd; ++aPIt) + { + const TextParagraph& rTextPara = **aPIt; + const TextCharacterProperties & rParaProps = rTextPara.getProperties().getTextCharacterProperties(); + if (rParaProps.getEffectProperties().maGlow.moGlowRad.has_value()) + { + aTextEffectProperties.assignUsed(rParaProps.getEffectProperties()); + goto found; + } + else + { + for (TextRunVector::const_iterator aRIt = rTextPara.getRuns().begin(), aREnd = rTextPara.getRuns().end(); aRIt != aREnd; ++aRIt) + { + const TextRun& rTextRun = **aRIt; + const TextCharacterProperties& rRunrops = rTextRun.getTextCharacterProperties(); + if (rRunrops.getEffectProperties().maGlow.moGlowRad.has_value()) + { + aTextEffectProperties.assignUsed(rRunrops.getEffectProperties()); + goto found; + } + } + } + } + + found: + if (aTextEffectProperties.maGlow.moGlowRad.has_value()) + { + xSet->setPropertyValue(u"GlowTextEffectRadius"_ustr, + uno::Any(convertEmuToHmm(aTextEffectProperties.maGlow.moGlowRad.value()))); + xSet->setPropertyValue(u"GlowTextEffectColor"_ustr, + uno::Any(aTextEffectProperties.maGlow.moGlowColor.getColor(rGraphicHelper))); + xSet->setPropertyValue(u"GlowTextEffectTransparency"_ustr, + uno::Any(aTextEffectProperties.maGlow.moGlowColor.getTransparency())); + } + } + } + // Set the stroke and fill-color properties of the OLE shape if (aServiceName == "com.sun.star.drawing.OLE2Shape" && mxOleObjectInfo && !mxOleObjectInfo->maShapeId.isEmpty()) diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index eafa93bf2c46..a32512743085 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -70,6 +70,7 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource assignIfUsed( moTextOutlineProperties, rSourceProps.moTextOutlineProperties); maTextEffectsProperties = rSourceProps.maTextEffectsProperties; + mpEffectPropertiesPtr->assignUsed(*rSourceProps.mpEffectPropertiesPtr); maFillProperties.assignUsed( rSourceProps.maFillProperties ); } diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index 9bee9c88106a..711fa153b697 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -21,6 +21,7 @@ #include <oox/helper/attributelist.hxx> #include <drawingml/colorchoicecontext.hxx> +#include <drawingml/effectpropertiescontext.hxx> #include <drawingml/linepropertiescontext.hxx> #include <drawingml/misccontexts.hxx> #include <drawingml/textcharacterproperties.hxx> @@ -129,6 +130,7 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl // EG_EffectProperties case A_TOKEN( effectDag ): // CT_EffectContainer 5.1.10.25 case A_TOKEN( effectLst ): // CT_EffectList 5.1.10.26 + return new EffectPropertiesContext(*this, mrTextCharacterProperties.getEffectProperties()); break; case A_TOKEN( highlight ): // CT_Color return new ColorContext(*this, mrTextCharacterProperties.maHighlightColor); diff --git a/oox/source/drawingml/themeelementscontext.cxx b/oox/source/drawingml/themeelementscontext.cxx index 921841b6a307..537a24441a85 100644 --- a/oox/source/drawingml/themeelementscontext.cxx +++ b/oox/source/drawingml/themeelementscontext.cxx @@ -26,7 +26,7 @@ #include <drawingml/textcharacterproperties.hxx> #include <oox/drawingml/theme.hxx> #include <oox/helper/attributelist.hxx> -#include "effectproperties.hxx" +#include <oox/drawingml/effectproperties.hxx> #include <drawingml/effectpropertiescontext.hxx> #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> |