summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@suse.com>2013-07-19 14:07:34 +0530
committerMuthu Subramanian <sumuthu@collabora.com>2013-10-18 19:05:12 +0530
commit9bc72622631b7a1f2ad1cee7101157b3584cc4b2 (patch)
tree9f0b84512001041b43395c85e1fc2d02bae3facc /oox
parent6fc72c01366dc48f3e9f3233d85d3eccbe5247f3 (diff)
n#820077: Use duotone with GraphicProperties as well.
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/fillproperties.cxx36
1 files changed, 21 insertions, 15 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 92b4b0a89ca2..bb2eb573b8ea 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -52,6 +52,25 @@ namespace drawingml {
namespace {
+Reference< XGraphic > lclCheckAndApplyDuotoneTransform( BlipFillProperties aBlipProps, Reference< XGraphic > xGraphic,
+ const GraphicHelper& rGraphicHelper, const sal_Int32 nPhClr )
+{
+ if( aBlipProps.maDuotoneColors[0].isUsed() && aBlipProps.maDuotoneColors[1].isUsed() )
+ {
+ sal_Int32 nColor1 = aBlipProps.maDuotoneColors[0].getColor( rGraphicHelper, nPhClr );
+ sal_Int32 nColor2 = aBlipProps.maDuotoneColors[1].getColor( rGraphicHelper, nPhClr );
+ try
+ {
+ Reference< XGraphicTransformer > xTransformer( aBlipProps.mxGraphic, UNO_QUERY_THROW );
+ xGraphic = xTransformer->applyDuotone( xGraphic, nColor1, nColor2 );
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ return xGraphic;
+}
+
BitmapMode lclGetBitmapMode( sal_Int32 nToken )
{
OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
@@ -374,20 +393,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
// do not start complex graphic transformation if property is not supported...
if( maBlipProps.mxGraphic.is() && rPropMap.supportsProperty( SHAPEPROP_FillBitmapUrl ) )
{
- Reference< XGraphic > xGraphic = maBlipProps.mxGraphic;
- if( maBlipProps.maDuotoneColors[0].isUsed() && maBlipProps.maDuotoneColors[1].isUsed() )
- {
- sal_Int32 nColor1 = maBlipProps.maDuotoneColors[0].getColor( rGraphicHelper, nPhClr );
- sal_Int32 nColor2 = maBlipProps.maDuotoneColors[1].getColor( rGraphicHelper, nPhClr );
- try
- {
- Reference< XGraphicTransformer > xTransformer( maBlipProps.mxGraphic, UNO_QUERY_THROW );
- xGraphic = xTransformer->applyDuotone( maBlipProps.mxGraphic, nColor1, nColor2 );
- }
- catch( Exception& )
- {
- }
- }
+ Reference< XGraphic > xGraphic = lclCheckAndApplyDuotoneTransform( maBlipProps, maBlipProps.mxGraphic, rGraphicHelper, nPhClr );
// TODO: "rotate with shape" is not possible with our current core
OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic );
@@ -473,7 +479,7 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe
if( maBlipProps.mxGraphic.is() )
{
// created transformed graphic
- Reference< XGraphic > xGraphic = maBlipProps.mxGraphic;
+ Reference< XGraphic > xGraphic = lclCheckAndApplyDuotoneTransform( maBlipProps, maBlipProps.mxGraphic, rGraphicHelper, nPhClr );
if( maBlipProps.maColorChangeFrom.isUsed() && maBlipProps.maColorChangeTo.isUsed() )
{
sal_Int32 nFromColor = maBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr );