summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@collabora.com>2013-10-10 18:03:51 +0530
committerMuthu Subramanian <sumuthu@collabora.com>2013-10-10 18:05:36 +0530
commitefbf0b412bc76149b410d0cd17c7040513d4c203 (patch)
tree698daf422384bddf97e457abb44ac4ef822d3991 /oox
parent215269e3031e31fd64e3aa38167875a042b8c80c (diff)
n#812793: clrChange applying for EMFs
Also fixed alpha clrChanges.
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/colorchoicecontext.cxx3
-rw-r--r--oox/source/drawingml/fillproperties.cxx39
2 files changed, 27 insertions, 15 deletions
diff --git a/oox/source/drawingml/colorchoicecontext.cxx b/oox/source/drawingml/colorchoicecontext.cxx
index b33b6dd87b79..bec28b042fca 100644
--- a/oox/source/drawingml/colorchoicecontext.cxx
+++ b/oox/source/drawingml/colorchoicecontext.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/colorchoicecontext.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/drawingml/color.hxx"
@@ -83,6 +84,8 @@ void ColorValueContext::onStartElement( const AttributeList& rAttribs )
switch( nElement )
{
case A_TOKEN( alpha ):
+ mrColor.addTransformation( nElement, rAttribs.getInteger( XML_val, 0 )*PER_PERCENT );
+ break;
case A_TOKEN( alphaMod ):
case A_TOKEN( alphaOff ):
case A_TOKEN( blue ):
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index dcac76b88b6c..4e6d8e1ccf81 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -71,6 +71,29 @@ Reference< XGraphic > lclCheckAndApplyDuotoneTransform( const BlipFillProperties
return xGraphic;
}
+Reference< XGraphic > lclCheckAndApplyChangeColorTransform( const BlipFillProperties &aBlipProps, Reference< XGraphic > xGraphic,
+ const GraphicHelper& rGraphicHelper, const sal_Int32 nPhClr )
+{
+ if( aBlipProps.maColorChangeFrom.isUsed() && aBlipProps.maColorChangeTo.isUsed() )
+ {
+ sal_Int32 nFromColor = aBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr );
+ sal_Int32 nToColor = aBlipProps.maColorChangeTo.getColor( rGraphicHelper, nPhClr );
+ if ( (nFromColor != nToColor) || aBlipProps.maColorChangeTo.hasTransparency() ) try
+ {
+ sal_Int16 nToTransparence = aBlipProps.maColorChangeTo.getTransparency();
+ sal_Int8 nToAlpha = static_cast< sal_Int8 >( (100 - nToTransparence) * 2.55 );
+ Reference< XGraphicTransformer > xTransformer( aBlipProps.mxGraphic, UNO_QUERY_THROW );
+ xGraphic = xTransformer->colorChange( xGraphic, nFromColor, 9, nToColor, nToAlpha );
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ return xGraphic;
+}
+
+
+
BitmapMode lclGetBitmapMode( sal_Int32 nToken )
{
OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
@@ -480,21 +503,7 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe
{
// created transformed graphic
Reference< XGraphic > xGraphic = lclCheckAndApplyDuotoneTransform( maBlipProps, maBlipProps.mxGraphic, rGraphicHelper, nPhClr );
- if( maBlipProps.maColorChangeFrom.isUsed() && maBlipProps.maColorChangeTo.isUsed() )
- {
- sal_Int32 nFromColor = maBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr );
- sal_Int32 nToColor = maBlipProps.maColorChangeTo.getColor( rGraphicHelper, nPhClr );
- if ( (nFromColor != nToColor) || maBlipProps.maColorChangeTo.hasTransparency() ) try
- {
- sal_Int16 nToTransparence = maBlipProps.maColorChangeTo.getTransparency();
- sal_Int8 nToAlpha = static_cast< sal_Int8 >( (100 - nToTransparence) / 39.062 ); // ?!? correct ?!?
- Reference< XGraphicTransformer > xTransformer( maBlipProps.mxGraphic, UNO_QUERY_THROW );
- xGraphic = xTransformer->colorChange( maBlipProps.mxGraphic, nFromColor, 9, nToColor, nToAlpha );
- }
- catch( Exception& )
- {
- }
- }
+ xGraphic = lclCheckAndApplyChangeColorTransform( maBlipProps, xGraphic, rGraphicHelper, nPhClr );
rPropMap[ PROP_Graphic ] <<= xGraphic;