summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2021-12-16 15:10:33 +0100
committerLászló Németh <nemeth@numbertext.org>2022-01-03 14:40:09 +0100
commit678790f292b63c9def1f0427df20028a1f734c15 (patch)
treeb9d25d13c2ff874fc6a8fd52413160b9532aa8d0 /oox
parentf6fefed87a3ffac4a8d236e6a96a6405bfbb31f0 (diff)
tdf#127696 PPTX export: fix lost outline character formatting
Now outline font property export is supported partially in PPTX export and in text shape export in other OOXML formats. Note: OOXML/MSO has customizable Text Fill and Text Outline in Format Text Effects, while LO has only simple and buggy outline character formatting property, showing only white or completely transparent outline fill color. Transparency issues and the buggy outline font handling of LO (e.g. 1% font color (line) transparency results 100% fill transparency of the outline text) haven't been handled yet. Change-Id: Ic34bce4efd4a544d799b1d89af1107c4918061d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126996 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/textcharacterproperties.cxx8
-rw-r--r--oox/source/export/drawingml.cxx24
2 files changed, 30 insertions, 2 deletions
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 7ffeaeba8da2..9d568cd5cabb 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -111,6 +111,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
if ( maFillProperties.moFillType.has() )
{
Color aColor = maFillProperties.getBestSolidColor();
+ bool bContoured = false;
// noFill doesn't exist for characters. Map noFill to 99% transparency
if (maFillProperties.moFillType.get() == XML_noFill)
@@ -124,7 +125,11 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
{
Color aLineColor = moTextOutlineProperties.get().maLineFill.getBestSolidColor();
sal_Int16 nLineTransparency = aLineColor.getTransparency();
- if (nLineTransparency < aColor.getTransparency())
+
+ // tdf#127696 If the text color is white (and the outline color doesn't dominate),
+ // then this is contoured text in LO.
+ if (nLineTransparency < aColor.getTransparency()
+ || (bContoured = aColor.getColor(rFilter.getGraphicHelper()) == COL_WHITE))
aColor = aLineColor;
}
rPropMap.setProperty(PROP_CharColor, aColor.getColor(rFilter.getGraphicHelper()));
@@ -133,6 +138,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
rPropMap.setProperty(PROP_CharColorTintOrShade, aColor.getTintOrShade());
rPropMap.setProperty(PROP_CharColorLumMod, aColor.getLumMod());
rPropMap.setProperty(PROP_CharColorLumOff, aColor.getLumOff());
+ rPropMap.setProperty(PROP_CharContoured, bContoured);
if (aColor.hasTransparency())
{
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8581535357a0..d87c6cccddee 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2201,9 +2201,31 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
nTransparency = MAX_PERCENT - (nTransparency * PER_PERCENT);
}
+ bool bContoured = false;
+ if (GetProperty(rXPropSet, "CharContoured"))
+ bContoured = *o3tl::doAccess<bool>(mAny);
+
+ // tdf#127696 If the CharContoured is true, then the text color is white and the outline color is the CharColor.
+ if (bContoured)
+ {
+ mpFS->startElementNS(XML_a, XML_ln);
+ if (color == COL_AUTO)
+ {
+ mbIsBackgroundDark ? WriteSolidFill(COL_WHITE) : WriteSolidFill(COL_BLACK);
+ }
+ else
+ {
+ color.SetAlpha(255);
+ if (!WriteCharColor(rXPropSet))
+ WriteSolidFill(color, nTransparency);
+ }
+ mpFS->endElementNS(XML_a, XML_ln);
+
+ WriteSolidFill(COL_WHITE);
+ }
// tdf#104219 In LibreOffice and MS Office, there are two types of colors:
// Automatic and Fixed. OOXML is setting automatic color, by not providing color.
- if( color != COL_AUTO )
+ else if( color != COL_AUTO )
{
color.SetAlpha(255);
// TODO: special handle embossed/engraved