[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - include/oox oox/source svx/source

Muthu Subramanian sumuthu at collabora.com
Mon Mar 17 03:42:00 PDT 2014


 include/oox/drawingml/shapepropertymap.hxx |    3 +++
 oox/source/drawingml/fillproperties.cxx    |    4 +++-
 oox/source/drawingml/shapepropertymap.cxx  |   16 +++++++++++++++-
 svx/source/xoutdev/xattrbmp.cxx            |    4 +++-
 4 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 43dae523edd6aede5009d72be73e3627726903f9
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Wed Mar 12 16:29:56 2014 +0530

    n#821567: Import PPTX background images with table-name.
    
    Ported from 2ec4d410de5bd98527336a9dc49abb76656373df
    
    Change-Id: I19cefa3097d8a7c2da057089efb52ec8fd45b2b0
    Reviewed-on: https://gerrit.libreoffice.org/8544
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
index 6a6628b..f2dc8ec 100644
--- a/include/oox/drawingml/shapepropertymap.hxx
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -63,6 +63,7 @@ enum ShapePropertyId
     SHAPEPROP_FillBitmapRectanglePoint,
     SHAPEPROP_FillHatch,
     SHAPEPROP_ShadowXDistance,
+    SHAPEPROP_FillBitmapNameFromUrl,
     SHAPEPROP_END
 };
 
@@ -128,6 +129,8 @@ private:
     bool                setGradientTrans( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
     /** Sets an explicit fill bitmap URL, or creates a named fill bitmap URL. */
     bool                setFillBitmapUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+    /** Sets an explicit fill bitmap URL and pushes the name to FillBitmapName */
+    bool                setFillBitmapNameFromUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
 
     // not implemented, to prevent implicit conversion from enum to int
     ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId );
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 4e6d8e1..c96c77a 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -421,7 +421,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
 
                     OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic );
                     // push bitmap or named bitmap to property map
-                    if( !aGraphicUrl.isEmpty() && rPropMap.setProperty( SHAPEPROP_FillBitmapUrl, aGraphicUrl ) )
+                    if( !aGraphicUrl.isEmpty() && rPropMap.supportsProperty( SHAPEPROP_FillBitmapNameFromUrl ) && rPropMap.setProperty( SHAPEPROP_FillBitmapNameFromUrl, aGraphicUrl ) )
+                        eFillStyle = FillStyle_BITMAP;
+                    else if( !aGraphicUrl.isEmpty() && rPropMap.setProperty( SHAPEPROP_FillBitmapUrl, aGraphicUrl ) )
                         eFillStyle = FillStyle_BITMAP;
 
                     // set other bitmap properties, if bitmap has been inserted into the map
diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx
index ff02dd5..fe985db 100644
--- a/oox/source/drawingml/shapepropertymap.cxx
+++ b/oox/source/drawingml/shapepropertymap.cxx
@@ -47,7 +47,8 @@ static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END ] =
     PROP_FillBitmapURL, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
     PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
     PROP_FillHatch,
-    PROP_ShadowXDistance
+    PROP_ShadowXDistance,
+    PROP_FillBitmapName
 };
 
 } // namespace
@@ -108,6 +109,9 @@ bool ShapePropertyMap::setAnyProperty( ShapePropertyId ePropId, const Any& rValu
         case SHAPEPROP_FillBitmapUrl:
             return setFillBitmapUrl( nPropId, rValue );
 
+        case SHAPEPROP_FillBitmapNameFromUrl:
+            return setFillBitmapNameFromUrl( nPropId, rValue );
+
         default:;   // suppress compiler warnings
     }
 
@@ -195,6 +199,16 @@ bool ShapePropertyMap::setFillBitmapUrl( sal_Int32 nPropId, const Any& rValue )
     return false;
 }
 
+bool ShapePropertyMap::setFillBitmapNameFromUrl( sal_Int32 /*nPropId*/, const Any& rValue )
+{
+    if( rValue.has< OUString >() )
+    {
+        OUString aBitmapUrlName = mrModelObjHelper.insertFillBitmapUrl( rValue.get< OUString >() );
+        return !aBitmapUrlName.isEmpty() && setProperty( PROP_FillBitmapName, aBitmapUrlName );
+    }
+    return false;
+}
+
 // ============================================================================
 
 } // namespace drawingml
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index f8c53d7..cbd49df 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -513,7 +513,9 @@ bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt
     }
     if( bSetURL )
     {
-        maGraphicObject  = GraphicObject::CreateGraphicObjectFromURL(aURL);
+        GraphicObject aGraphicObject  = GraphicObject::CreateGraphicObjectFromURL(aURL);
+        if( aGraphicObject.GetType() != GRAPHIC_NONE )
+            maGraphicObject = aGraphicObject;
 
         // #121194# Prefer GraphicObject over bitmap object if both are provided
         if(bSetBitmap && GRAPHIC_NONE != maGraphicObject.GetType())


More information about the Libreoffice-commits mailing list