diff options
author | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2015-03-18 10:25:05 +0100 |
---|---|---|
committer | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2015-03-21 16:19:08 +0100 |
commit | f880962f5bf26bfaef06bd3f9e67e2d901a2e74c (patch) | |
tree | 21791df62dd1dd2c149f1dcc6462dddd2dc143c5 /xmloff | |
parent | dba637ad230d132be0c8f69a630d0dfdfafc105f (diff) |
Char highlight: ODT filters
Export merges the two background attribute.
Change-Id: I882321fbd5a7d24991fb01b8dc9d2cc0bd294051
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 19 | ||||
-rw-r--r-- | xmloff/source/text/txtprmap.cxx | 8 |
2 files changed, 25 insertions, 2 deletions
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 7e3cfc48d3de..1300c3b3f0e8 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/text/XChapterNumberingSupplier.hpp> #include <tools/debug.hxx> +#include <tools/color.hxx> #include <xmloff/txtprmap.hxx> #include <xmloff/xmlexp.hxx> #include <xmloff/maptype.hxx> @@ -658,6 +659,10 @@ void XMLTextExportPropertySetMapper::ContextFilter( XMLPropertyState* pRepeatOffsetX = NULL; XMLPropertyState* pRepeatOffsetY = NULL; + // character background and highlight + XMLPropertyState* pCharBackground = NULL; + XMLPropertyState* pCharHighlight = NULL; + bool bNeedsAnchor = false; for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); @@ -816,6 +821,9 @@ void XMLTextExportPropertySetMapper::ContextFilter( propertyState->mnIndex = -1; } break; + + case CTF_CHAR_BACKGROUND: pCharBackground = propertyState; break; + case CTF_CHAR_HIGHLIGHT: pCharHighlight = propertyState; break; } } @@ -1118,6 +1126,17 @@ void XMLTextExportPropertySetMapper::ContextFilter( if( pClipState != NULL && pClip11State != NULL ) pClip11State->mnIndex = -1; + // When both background attributes are available export the visible one + if( pCharHighlight && pCharBackground ) + { + sal_uInt32 nColor = COL_TRANSPARENT; + pCharHighlight->maValue >>= nColor; + if( nColor == COL_TRANSPARENT ) + pCharHighlight->mnIndex = -1; + else + pCharBackground->mnIndex = -1; + } + SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet); } diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 3806625b83e1..19979c9f23ee 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -191,7 +191,7 @@ XMLPropertyMapEntry aXMLParaPropMap[] = // RES_CHRATR_NOLINEBREAK // TODO: not used? // RES_CHRATR_BACKGROUND - MT_E( "CharBackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), + 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( "CharBackColor", FO, TEXT_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ), // RES_CHRATR_CJK_FONT @@ -291,6 +291,8 @@ XMLPropertyMapEntry aXMLParaPropMap[] = // RES_CHRATR_SHADOW MAP_EXT( "CharShadowFormat", XML_NAMESPACE_LO_EXT, XML_SHADOW, XML_TYPE_TEXT_SHADOW|XML_TYPE_PROP_TEXT, 0 ), MAP_EXT_I( "CharShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW|XML_TYPE_PROP_TEXT, 0 ), + // RES_CHRATR_HIGHLIGHT + MT_E( "CharHighlight", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY| MID_FLAG_NO_PROPERTY_IMPORT, CTF_CHAR_HIGHLIGHT ), // RES_TXTATR_INETFMT // TODO // RES_TXTATR_REFMARK @@ -531,7 +533,7 @@ XMLPropertyMapEntry aXMLTextPropMap[] = // RES_CHRATR_NOLINEBREAK // TODO: not used? // RES_CHRATR_BACKGROUND - MT_E( "CharBackColor", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), + 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 ), { "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 ), @@ -634,6 +636,8 @@ XMLPropertyMapEntry aXMLTextPropMap[] = // RES_CHRATR_SHADOW MAP_EXT( "CharShadowFormat", XML_NAMESPACE_LO_EXT, XML_SHADOW, XML_TYPE_TEXT_SHADOW|XML_TYPE_PROP_TEXT, 0 ), MAP_EXT_I( "CharShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW|XML_TYPE_PROP_TEXT, 0 ), + // RES_CHRATR_HIGHLIGHT + MT_E( "CharHighlight", FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_NO_PROPERTY_IMPORT, CTF_CHAR_HIGHLIGHT ), // RES_TXTATR_INETFMT MT_E( "HyperLinkURL", TEXT, XMLNS, XML_TYPE_STRING|MID_FLAG_NO_PROPERTY_IMPORT, CTF_HYPERLINK_URL ), // RES_TXTATR_REFMARK |