n#870234: Import gradfill for text colors.

Uses the first color from the gradfill list.
(Which is better than plain black!)

Change-Id: I4c1c0c4b031f3681c95b75b3c0683eb4de95bffb
This commit is contained in:
Muthu Subramanian
2014-03-28 17:24:45 +05:30
parent 06db1edf61
commit cfc76de83e
3 changed files with 9 additions and 0 deletions

View File

@@ -24,6 +24,7 @@
#include <oox/helper/propertymap.hxx>
#include <oox/drawingml/color.hxx>
#include <oox/drawingml/textfont.hxx>
#include <oox/drawingml/fillproperties.hxx>
namespace oox { class PropertySet; }
@@ -56,6 +57,7 @@ struct TextCharacterProperties
OptValue< bool > moItalic;
OptValue< bool > moUnderlineLineFollowText;
OptValue< bool > moUnderlineFillFollowText;
GradientFillProperties maGradientProps; /// Properties for gradient text colors
std::vector<css::beans::PropertyValue> maTextEffectsProperties;

View File

@@ -65,6 +65,7 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource
moUnderlineFillFollowText.assignIfUsed( rSourceProps.moUnderlineFillFollowText );
maTextEffectsProperties = rSourceProps.maTextEffectsProperties;
maGradientProps.assignUsed( rSourceProps.maGradientProps );
}
void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFilterBase& rFilter, bool bUseOptional ) const
@@ -108,6 +109,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
if( maCharColor.isUsed() )
rPropMap.setProperty( PROP_CharColor, maCharColor.getColor( rFilter.getGraphicHelper() ));
if( maGradientProps.maGradientStops.size() > 0 )
rPropMap[ PROP_CharColor ] <<= maGradientProps.maGradientStops.begin()->second.getColor( rFilter.getGraphicHelper() );
if( moLang.has() && !moLang.get().isEmpty() )
{

View File

@@ -132,6 +132,10 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
case A_TOKEN( hlinkClick ): // CT_Hyperlink
case A_TOKEN( hlinkMouseOver ): // CT_Hyperlink
return new HyperLinkContext( *this, rAttribs, mrTextCharacterProperties.maHyperlinkPropertyMap );
case A_TOKEN( gradFill ):
return new GradientFillContext( *this, rAttribs, mrTextCharacterProperties.maGradientProps );
case OOX_TOKEN( doc, rFonts ):
if( rAttribs.hasAttribute(OOX_TOKEN(doc, ascii)) )
{