summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2017-05-24 01:13:26 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2017-06-01 14:08:42 +0200
commit0b0cc6a3306a03798fdbe766976480160d0d5c22 (patch)
treeb963fbcaba1ebda43986b9c48697ae7ac647c449 /oox
parentbd8b8ccd3110a9f6fa7fb4f2aec3275f7b650052 (diff)
tdf#104219 Don't export color information when color is automatic
In LibreOffice and MS Office, there are two types of colors: - Automatic (which is taken from settings) and Fixed (which is set by RGB value). OOXML is setting automatic color by default, by not providing any RGB color. To preserve automatic color we need to not export RGB color during OOXML export. Change-Id: I8895230c4fffc9d8741f3eff37e64c4823d71da8 Reviewed-on: https://gerrit.libreoffice.org/37970 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> (cherry picked from commit 8129ad7b22dceeb2fef13741aa509c2229cf03de) Reviewed-on: https://gerrit.libreoffice.org/38285 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/textcharacterproperties.cxx1
-rw-r--r--oox/source/export/drawingml.cxx30
2 files changed, 19 insertions, 12 deletions
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index d45e59ddc9c7..71046841c60c 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -152,6 +152,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
rPropMap.setProperty( PROP_CharUnderlineHasColor, true);
rPropMap.setProperty( PROP_CharUnderlineColor, maUnderlineColor.getColor( rFilter.getGraphicHelper() ));
}
+ // TODO If bUnderlineFillFollowText uFillTx (CT_TextUnderlineFillFollowText) is set, fill color of the underline should be the same color as the text
}
void pushToGrabBag( PropertySet& rPropSet, const std::vector<PropertyValue>& aVectorOfProperyValues )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 94c70ffdb642..1b05c1d8fb2a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1410,24 +1410,30 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
sal_uInt32 color = *o3tl::doAccess<sal_uInt32>(mAny);
SAL_INFO("oox.shape", "run color: " << color << " auto: " << COL_AUTO);
- if( color == COL_AUTO ) // nCharColor depends to the background color
+ // 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 = mbIsBackgroundDark ? 0xffffff : 0x000000;
+ color &= 0xffffff;
+ // TODO: special handle embossed/engraved
+ WriteSolidFill( color );
}
- color &= 0xffffff;
-
- // TODO: special handle embossed/engraved
-
- WriteSolidFill( color );
}
- if( CGETAD( CharUnderlineColor ) )
+ if( ( underline != nullptr ) && CGETAD( CharUnderlineColor ) )
{
sal_uInt32 color = *o3tl::doAccess<sal_uInt32>(mAny);
-
- mpFS->startElementNS( XML_a, XML_uFill,FSEND);
- WriteSolidFill( color );
- mpFS->endElementNS( XML_a, XML_uFill );
+ // if color is automatic, then we shouldn't write information about color but to take color from character
+ if( color != COL_AUTO )
+ {
+ mpFS->startElementNS( XML_a, XML_uFill, FSEND);
+ WriteSolidFill( color );
+ mpFS->endElementNS( XML_a, XML_uFill );
+ }
+ else
+ {
+ mpFS->singleElementNS( XML_a, XML_uFillTx, FSEND );
+ }
}
if( GETA( CharFontName ) )