diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-02-02 14:10:02 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-02-04 15:21:04 +0100 |
commit | f0497af409a51f0949a0b19082923ba5f9ad6d82 (patch) | |
tree | 70d5f046534e749ff8bfb230580146ee563a079c /xmloff | |
parent | ad116f4d0048473887708900af41c7b15afb16b5 (diff) |
xmloff: tdf#96147: ODF export: fix duplicate fo:background-color
... attributes that happen if both CharHighlight and CharBackColor
properties are used, because the CharBackTransparent property wasn't
taken into account, and combining the CharBackColor and
CharBackTransparent properties happens *after*
XMLTextExportPropertySetMapper::ContextFilter() runs.
Also, it looks like a transparent highlight wouldn't export properly but
apparently DomainMapper::getColorFromId() won't create such.
(regression from f880962f5bf26bfaef06bd3f9e67e2d901a2e74c)
(cherry picked from commit 8dadefc35f8b33648fb6adbdaca75ea52b2705db)
Change-Id: Ib628ef8bb377482f74fadb97c81afb95fbbf7184
Reviewed-on: https://gerrit.libreoffice.org/22046
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit e92dcab1407fa26fc5ee68d0b626b87bc04f1b3b)
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/text/txtprmap.cxx | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index bd0ed88978a1..cb728682ec25 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -669,6 +669,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( // character background and highlight XMLPropertyState* pCharBackground = NULL; + XMLPropertyState* pCharBackgroundTransparency = NULL; XMLPropertyState* pCharHighlight = NULL; bool bNeedsAnchor = false; @@ -831,6 +832,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( break; case CTF_CHAR_BACKGROUND: pCharBackground = propertyState; break; + case CTF_CHAR_BACKGROUND_TRANSPARENCY: pCharBackgroundTransparency = propertyState; break; case CTF_CHAR_HIGHLIGHT: pCharHighlight = propertyState; break; } } @@ -1137,12 +1139,20 @@ void XMLTextExportPropertySetMapper::ContextFilter( // When both background attributes are available export the visible one if( pCharHighlight && pCharBackground ) { + assert(pCharBackgroundTransparency); // always together sal_uInt32 nColor = COL_TRANSPARENT; pCharHighlight->maValue >>= nColor; if( nColor == COL_TRANSPARENT ) + { + // actually this would not be exported as transparent anyway + // and we'd need another property CharHighlightTransparent for that pCharHighlight->mnIndex = -1; + } else + { pCharBackground->mnIndex = -1; + pCharBackgroundTransparency->mnIndex = -1; + } } SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet); diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 7f892f483e65..17d3622e1b78 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -192,7 +192,7 @@ XMLPropertyMapEntry aXMLParaPropMap[] = // TODO: not used? // RES_CHRATR_BACKGROUND MT_E( "CharBackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, CTF_CHAR_BACKGROUND ), - MT_E( "CharBackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), + MT_E( "CharBackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, CTF_CHAR_BACKGROUND_TRANSPARENCY), MT_E( "CharBackColor", FO, TEXT_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ), // RES_CHRATR_CJK_FONT MT_ED( "CharFontNameAsian", STYLE, FONT_NAME_ASIAN, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CJK ), @@ -535,7 +535,7 @@ XMLPropertyMapEntry aXMLTextPropMap[] = // TODO: not used? // RES_CHRATR_BACKGROUND MT_E( "CharBackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, CTF_CHAR_BACKGROUND ), - MT_E( "CharBackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), + MT_E( "CharBackTransparent", FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, CTF_CHAR_BACKGROUND_TRANSPARENCY), { "CharShadingValue", sizeof("CharShadingValue")-1, XML_NAMESPACE_LO_EXT, XML_CHAR_SHADING_VALUE, XML_TYPE_NUMBER|XML_TYPE_PROP_TEXT, 0, SvtSaveOptions::ODFVER_012_EXT_COMPAT, false }, MT_E( "CharBackColor", FO, TEXT_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ), // RES_CHRATR_CJK_FONT |