Kaydet (Commit) 8c52b5dd authored tarafından Miklos Vajna's avatar Miklos Vajna

oox: fix DOCX strict import of SmartArt

Change-Id: Ied8283e17ec4379f218dc60912e1c41ca28a8ac9
üst d145f49b
......@@ -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
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment