[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/qa

Muthu Subramanian sumuthu at collabora.com
Thu Mar 6 07:53:43 PST 2014


 include/oox/helper/modelobjecthelper.hxx |    4 ++++
 oox/source/drawingml/shape.cxx           |    7 +++++++
 oox/source/helper/modelobjecthelper.cxx  |   15 +++++++++++++++
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |    2 +-
 4 files changed, 27 insertions(+), 1 deletion(-)

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

    n#821567: Fix TextFrame background import for sw.
    
    TextFrame in sw unfortunately doesn't seem to
    support nametable!

diff --git a/include/oox/helper/modelobjecthelper.hxx b/include/oox/helper/modelobjecthelper.hxx
index e57e014..2ced973 100644
--- a/include/oox/helper/modelobjecthelper.hxx
+++ b/include/oox/helper/modelobjecthelper.hxx
@@ -48,6 +48,8 @@ public:
     /** Returns true, if the object with the passed name exists in the container. */
     bool                hasObject( const OUString& rObjName ) const;
 
+    ::com::sun::star::uno::Any getObject( const OUString& rObjName ) const;
+
     /** Inserts the passed object into the container, returns its final name. */
     OUString     insertObject(
                             const OUString& rObjName,
@@ -104,6 +106,8 @@ public:
         an internal constant name with a new unused index appended. */
     OUString     insertFillBitmapUrl( const OUString& rGraphicUrl );
 
+    OUString     getFillBitmapUrl( const OUString& rGraphicName );
+
 private:
     ObjectContainer     maMarkerContainer;      ///< Contains all named line markers (line end polygons).
     ObjectContainer     maDashContainer;        ///< Contains all named line dsahes.
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 883d76f..7d3b0dc 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -35,6 +35,7 @@
 #include "oox/core/xmlfilterbase.hxx"
 #include "oox/helper/graphichelper.hxx"
 #include "oox/helper/propertyset.hxx"
+#include "oox/helper/modelobjecthelper.hxx"
 
 #include <tools/gen.hxx>
 #include <tools/mapunit.hxx>
@@ -691,6 +692,12 @@ Reference< XShape > Shape::createAndInsert(
                     aShapeProps.setProperty(PROP_BackGraphicURL, aShapeProps.getProperty(PROP_FillBitmapURL));
                     aShapeProps.erase(PROP_FillBitmapURL);
                 }
+                if (aShapeProps.hasProperty(PROP_FillBitmapName))
+                {
+                    uno::Any aAny = aShapeProps[PROP_FillBitmapName];
+                    aShapeProps.setProperty(PROP_BackGraphicURL, rFilterBase.getModelObjectHelper().getFillBitmapUrl( aAny.get<OUString>() ));
+                    // aShapeProps.erase(PROP_FillBitmapName);  // Maybe, leave the name as well
+                }
                 // And no LineColor property; individual borders can have colors
                 if (aShapeProps.hasProperty(PROP_LineColor))
                 {
diff --git a/oox/source/helper/modelobjecthelper.cxx b/oox/source/helper/modelobjecthelper.cxx
index 5a966fe..1ec45af 100644
--- a/oox/source/helper/modelobjecthelper.cxx
+++ b/oox/source/helper/modelobjecthelper.cxx
@@ -56,6 +56,13 @@ bool ObjectContainer::hasObject( const OUString& rObjName ) const
     return mxContainer.is() && mxContainer->hasByName( rObjName );
 }
 
+Any ObjectContainer::getObject( const OUString& rObjName ) const
+{
+    if( hasObject( rObjName ) )
+        return mxContainer->getByName( rObjName );
+    return Any();
+}
+
 OUString ObjectContainer::insertObject( const OUString& rObjName, const Any& rObj, bool bInsertByUnusedName )
 {
     createContainer();
@@ -132,6 +139,14 @@ OUString ModelObjectHelper::insertFillBitmapUrl( const OUString& rGraphicUrl )
     return OUString();
 }
 
+OUString ModelObjectHelper::getFillBitmapUrl( const OUString &rGraphicName )
+{
+    Any aAny = maBitmapUrlContainer.getObject( rGraphicName );
+    if( aAny.hasValue() )
+        return aAny.get<OUString>();
+    return OUString();
+}
+
 
 
 } // namespace oox
commit ad737e7ff4bf12d8b66ceb2001aebf54ff5badba
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Thu Mar 6 18:16:46 2014 +0530

    Re-enable the unit test (BackGraphicURL).

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 28a8bfd..c51b58a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2116,7 +2116,7 @@ DECLARE_OOXMLEXPORT_TEST(testTextBoxPictureFill, "textbox_picturefill.docx")
 {
     uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, getProperty<drawing::FillStyle>(xFrame, "FillStyle"));
-    //CPPUNIT_ASSERT(!(getProperty<OUString>(xFrame,"BackGraphicURL")).isEmpty());
+    CPPUNIT_ASSERT(!(getProperty<OUString>(xFrame,"BackGraphicURL")).isEmpty());
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFDO73034, "FDO73034.docx")


More information about the Libreoffice-commits mailing list