diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-11-21 17:53:35 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-11-21 22:03:04 +0100 |
commit | 1e64d9ebaa231caef5fb062009b8f76465e415f4 (patch) | |
tree | 041a9f5ff51384203fca791fe52c4fb4b05c9f8b /oox/source | |
parent | 122e2e0296d5060a2631867527817893f41384c4 (diff) |
oox: add PPTX import/export for semi-transparent shape text
And start a drawingml test suite in oox, so the test and the tested code
is close to each other (just like how it's done in chart2/ already).
Change-Id: I9a2810691f12604d240e4394e6a5ff4e7f52f1c1
Reviewed-on: https://gerrit.libreoffice.org/83412
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/drawingml/textcharacterproperties.cxx | 10 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 12 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 1 |
3 files changed, 21 insertions, 2 deletions
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index e2f5cc63c0a2..de47058e60ca 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -109,7 +109,15 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil } if ( maFillProperties.moFillType.has() ) - rPropMap.setProperty( PROP_CharColor, maFillProperties.getBestSolidColor().getColor( rFilter.getGraphicHelper() )); + { + Color aColor = maFillProperties.getBestSolidColor(); + rPropMap.setProperty(PROP_CharColor, aColor.getColor(rFilter.getGraphicHelper())); + + if (aColor.hasTransparency()) + { + rPropMap.setProperty(PROP_CharTransparence, aColor.getTransparency()); + } + } if( moLang.has() && !moLang.get().isEmpty() ) { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 2cc160d05b57..5dc696259649 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1883,13 +1883,23 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool ::Color color( *o3tl::doAccess<sal_uInt32>(mAny) ); SAL_INFO("oox.shape", "run color: " << sal_uInt32(color) << " auto: " << sal_uInt32(COL_AUTO)); + // WriteSolidFill() handles MAX_PERCENT as "no transparency". + sal_Int32 nTransparency = MAX_PERCENT; + if (rXPropSet->getPropertySetInfo()->hasPropertyByName("CharTransparence")) + { + rXPropSet->getPropertyValue("CharTransparence") >>= nTransparency; + // UNO scale is 0..100, OOXML scale is 0..100000; also UNO tracks transparency, OOXML + // tracks opacity. + nTransparency = MAX_PERCENT - (nTransparency * PER_PERCENT); + } + // 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 ) { color.SetTransparency(0); // TODO: special handle embossed/engraved - WriteSolidFill( color ); + WriteSolidFill(color, nTransparency); } } diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index db44e176ef33..a319b2bd42a9 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -82,6 +82,7 @@ CharPostureComplex CharShadowed CharStrikeout CharStyleName +CharTransparence CharUnderline CharUnderlineColor CharUnderlineHasColor |