oox/source/core/xmlfilterbase.cxx                  |   15 ++++++++++++++-
 sw/qa/extras/ooxmlimport/data/strict-smartart.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx           |   11 +++++++++--
 3 files changed, 23 insertions(+), 3 deletions(-)

New commits:
commit 8c52b5dd1c6457131b2c2c6b85222400fce3f246
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Tue Mar 18 11:26:41 2014 +0100

    oox: fix DOCX strict import of SmartArt
    
    Change-Id: Ied8283e17ec4379f218dc60912e1c41ca28a8ac9

diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 5b054f8..130ae9e 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -90,8 +90,11 @@ struct NamespaceIds: public rtl::StaticWithInit<
             "http://www.w3.org/XML/1998/namespace";,
             "http://schemas.openxmlformats.org/package/2006/relationships";,
             
"http://schemas.openxmlformats.org/officeDocument/2006/relationships";,
+            "http://purl.oclc.org/ooxml/officeDocument/relationships";,
             "http://schemas.openxmlformats.org/drawingml/2006/main";,
+            "http://purl.oclc.org/ooxml/drawingml/main";,
             "http://schemas.openxmlformats.org/drawingml/2006/diagram";,
+            "http://purl.oclc.org/ooxml/drawingml/diagram";,
             "http://schemas.openxmlformats.org/drawingml/2006/chart";,
             "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing";,
             "urn:schemas-microsoft-com:vml",
@@ -114,8 +117,11 @@ struct NamespaceIds: public rtl::StaticWithInit<
             NMSP_xml,
             NMSP_packageRel,
             NMSP_officeRel,
+            NMSP_officeRel,
+            NMSP_dml,
             NMSP_dml,
             NMSP_dmlDiagram,
+            NMSP_dmlDiagram,
             NMSP_dmlChart,
             NMSP_dmlChartDr,
             NMSP_vml,
@@ -146,8 +152,15 @@ struct NamespaceIds: public rtl::StaticWithInit<
 void registerNamespaces( FastParser& rParser )
 {
     const Sequence< beans::Pair<OUString, sal_Int32> > ids = 
NamespaceIds::get();
+
+    // Filter out duplicates: a namespace can have multiple URL's, think of
+    // strict vs trasitional.
+    std::set<sal_Int32> aSet;
     for (sal_Int32 i = 0; i < ids.getLength(); ++i)
-        rParser.registerNamespace(ids[i].Second);
+        aSet.insert(ids[i].Second);
+
+    for (std::set<sal_Int32>::iterator it = aSet.begin(); it != aSet.end(); 
++it)
+        rParser.registerNamespace(*it);
 }
 
 } // namespace
diff --git a/sw/qa/extras/ooxmlimport/data/strict-smartart.docx 
b/sw/qa/extras/ooxmlimport/data/strict-smartart.docx
new file mode 100644
index 0000000..bab7c16
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/strict-smartart.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 535ebf8..1492cd9 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -70,13 +70,13 @@ public:
 
     virtual void preTest(const char* filename) SAL_OVERRIDE
     {
-        if (OString(filename) == "smartart.docx")
+        if (OString(filename) == "smartart.docx" || OString(filename) == 
"strict-smartart.docx")
             SvtFilterOptions::Get().SetSmartArt2Shape(true);
     }
 
     virtual void postTest(const char* filename) SAL_OVERRIDE
     {
-        if (OString(filename) == "smartart.docx")
+        if (OString(filename) == "smartart.docx" || OString(filename) == 
"strict-smartart.docx")
             SvtFilterOptions::Get().SetSmartArt2Shape(false);
     }
 };
@@ -1969,6 +1969,13 @@ DECLARE_OOXMLIMPORT_TEST(testStrictLockedcanvas, 
"strict-lockedcanvas.docx")
     getShape(1);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testSmartartStrict, "strict-smartart.docx")
+{
+    uno::Reference<container::XIndexAccess> xGroup(getShape(1), 
uno::UNO_QUERY);
+    // This was 0, SmartArt was visually missing.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xGroup->getCount()); // 3 ellipses + 3 
arrows
+}
+
 DECLARE_OOXMLIMPORT_TEST(testI124106, "i124106.docx")
 {
     // This was 2.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to