[Libreoffice-commits] core.git: 3 commits - include/oox oox/source sd/qa svx/source

Muthu Subramanian sumuthu at collabora.com
Thu Mar 6 02:28:27 PST 2014


 include/oox/drawingml/shapepropertymap.hxx |    3 +++
 oox/source/drawingml/fillproperties.cxx    |    4 +++-
 oox/source/drawingml/shapepropertymap.cxx  |   14 ++++++++++++++
 sd/qa/unit/data/pptx/n821567.pptx          |binary
 sd/qa/unit/import-tests.cxx                |   29 +++++++++++++++++++++++++++++
 svx/source/xoutdev/xattrbmp.cxx            |    4 +++-
 6 files changed, 52 insertions(+), 2 deletions(-)

New commits:
commit e8c00c409123e1d99f71c8e6cf8d672e96fb0c91
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Thu Mar 6 15:57:43 2014 +0530

    n#821567: Add unit test case.

diff --git a/sd/qa/unit/data/pptx/n821567.pptx b/sd/qa/unit/data/pptx/n821567.pptx
new file mode 100644
index 0000000..9f365ad
Binary files /dev/null and b/sd/qa/unit/data/pptx/n821567.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 486f7f3..0f5732c 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -57,6 +57,7 @@ public:
     void testN828390_3();
     void testN828390_4();
     void testN828390_5();
+    void testN821567();
     void testFdo68594();
     void testFdo72998();
 
@@ -72,6 +73,7 @@ public:
     CPPUNIT_TEST(testN828390_3);
     CPPUNIT_TEST(testN828390_4);
     CPPUNIT_TEST(testN828390_5);
+    CPPUNIT_TEST(testN821567);
     CPPUNIT_TEST(testFdo68594);
     CPPUNIT_TEST(testFdo72998);
 
@@ -204,6 +206,33 @@ void SdFiltersTest::testN759180()
     }
 }
 
+void SdFiltersTest::testN821567()
+{
+    OUString bgImage;
+    ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n821567.pptx") );
+    CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
+
+    xDocShRef = saveAndReload( xDocShRef, ODP );
+    CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
+    CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() );
+    uno::Reference< drawing::XDrawPagesSupplier > xDoc(
+        xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
+    CPPUNIT_ASSERT_MESSAGE( "not exactly one page", xDoc->getDrawPages()->getCount() == 1 );
+    uno::Reference< drawing::XDrawPage > xPage(
+        xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
+
+    uno::Reference< beans::XPropertySet > xPropSet( xPage, uno::UNO_QUERY );
+    uno::Any aAny = xPropSet->getPropertyValue( OUString("Background") );
+    if(aAny.hasValue())
+    {
+        uno::Reference< beans::XPropertySet > aXBackgroundPropSet;
+        aAny >>= aXBackgroundPropSet;
+        aAny = aXBackgroundPropSet->getPropertyValue( OUString("FillBitmapName"));
+        aAny >>= bgImage;
+    }
+    CPPUNIT_ASSERT_MESSAGE("Slide Background is not exported properly", !bgImage.isEmpty());
+}
+
 void SdFiltersTest::testN828390()
 {
     bool bPassed = false;
commit bf2ff0468e06770f9320c652a2332f7ec137d061
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Thu Mar 6 15:53:07 2014 +0530

    n#821567: Use BitmapURL only if its valid.

diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 797e089..674f8f6 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())
commit 2ec4d410de5bd98527336a9dc49abb76656373df
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Thu Mar 6 15:52:24 2014 +0530

    n#821567: Import PPTX background images with table-name.
    
    Seems like using the URL directly causes ODP export
    to ignore the background image.
    Probaby ODP Export requires updation as well?

diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
index 29b0ba2..f451cc0 100644
--- a/include/oox/drawingml/shapepropertymap.hxx
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -65,6 +65,7 @@ enum ShapePropertyId
     SHAPEPROP_FillBitmapRectanglePoint,
     SHAPEPROP_FillHatch,
     SHAPEPROP_ShadowXDistance,
+    SHAPEPROP_FillBitmapNameFromUrl,
     SHAPEPROP_END
 };
 
@@ -129,6 +130,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 c9ec724..4eedd35 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 f14b653..5a90875 100644
--- a/oox/source/drawingml/shapepropertymap.cxx
+++ b/oox/source/drawingml/shapepropertymap.cxx
@@ -48,6 +48,7 @@ static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END + 1 ] = // one for the
     PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
     PROP_FillHatch,
     PROP_ShadowXDistance,
+    PROP_FillBitmapName,
     PROP_END_LIST
 };
 
@@ -115,6 +116,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
     }
 
@@ -202,6 +206,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


More information about the Libreoffice-commits mailing list