[Libreoffice-commits] core.git: oox/source

Muthu Subramanian sumuthu at suse.com
Fri Jul 19 01:29:33 PDT 2013


 oox/source/drawingml/fillproperties.cxx |   36 ++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 15 deletions(-)

New commits:
commit 6fd347855f461f4ec2f0c54d79a1b20f3095b858
Author: Muthu Subramanian <sumuthu at suse.com>
Date:   Fri Jul 19 14:07:34 2013 +0530

    n#820077: Use duotone with GraphicProperties as well.

diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 92b4b0a..bb2eb57 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 );


More information about the Libreoffice-commits mailing list