From ab0998c77cc5b1f15c4d584185e7c401ef6fe62b Mon Sep 17 00:00:00 2001 From: Andres Gomez Date: Tue, 3 Sep 2013 11:13:22 +0300 Subject: oox: Smart-Art DOMs stored in the InteropGrabBag The XDocuments representing the DOM documents of a DrawingML diagram (Smart-Art) are now stored as the PropertyValues "OOXData", "OOXLayout", "OOXStyle", "OOXColor" and "OOXDrawing" into the "InteropGraBag" property of the parent SvxGroupShape created from such diagram. Modified the oox::drawingml::dgm::Diagram class to be able to hold the map storing the XDocuments and its names. Added the getDomMap() method to obtain the map directly and the getDomsAsPropertyValues method to get the map as a sequence of Property Values. Modified the methods for importing and loading the Smart-Art into the Diagram so they add automatically the DOM documents to it. Modified the oox::drawingml::Shape class to be able to hold the sequence of PropertyValues storing the XDocuments and its names coming from the oox::drawingml::dgm::Diagram class. Added the getDiagramDoms() and setDiagramDoms() methods. Enhanced the oox::shape::ShapeContextHandler::getShape() method to add the extended drawing document to the oox::drawingml::Shape class. Modified the oox::drawingml::Shape::createAndInsert() method to store the sequence of XDocuments in the "InteropGrabBag" property of the GroupShape service SvxGroupShape implementation representing a Smart-Art. Change-Id: I7d0b9dfbfc9d5299ddd25fab394e5e9a422d1dd1 Reviewed-on: https://gerrit.libreoffice.org/5849 Reviewed-by: Miklos Vajna Tested-by: Miklos Vajna --- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'sw') diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index b933e856b58d..06a3ae242739 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -542,6 +543,52 @@ void Test::testSmartart() uno::Reference xGroup(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xGroup->getCount()); // 3 rectangles and an arrow in the group + uno::Reference xGroupPropertySet(getShape(1), uno::UNO_QUERY); + uno::Sequence aGrabBag(0); + xGroupPropertySet->getPropertyValue(OUString::createFromAscii("InteropGrabBag")) >>= aGrabBag; + CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty + + sal_Bool bData, bLayout, bQStyle, bColor, bDrawing = sal_False; + for(int i = 0; i < aGrabBag.getLength(); ++i) + { + if (aGrabBag[i].Name == OUString::createFromAscii("OOXData")) + { + bData = sal_True; + uno::Reference aDataDom; + CPPUNIT_ASSERT(aGrabBag[i].Value >>= aDataDom); // PropertyValue of proper type + CPPUNIT_ASSERT(aDataDom.get()); // Reference not empty + } + else if (aGrabBag[i].Name == OUString::createFromAscii("OOXLayout")) + { + bLayout = sal_True; + uno::Reference aLayoutDom; + CPPUNIT_ASSERT(aGrabBag[i].Value >>= aLayoutDom); // PropertyValue of proper type + CPPUNIT_ASSERT(aLayoutDom.get()); // Reference not empty + } + else if (aGrabBag[i].Name == OUString::createFromAscii("OOXStyle")) + { + bQStyle = sal_True; + uno::Reference aStyleDom; + CPPUNIT_ASSERT(aGrabBag[i].Value >>= aStyleDom); // PropertyValue of proper type + CPPUNIT_ASSERT(aStyleDom.get()); // Reference not empty + } + else if (aGrabBag[i].Name == OUString::createFromAscii("OOXColor")) + { + bColor = sal_True; + uno::Reference aColorDom; + CPPUNIT_ASSERT(aGrabBag[i].Value >>= aColorDom); // PropertyValue of proper type + CPPUNIT_ASSERT(aColorDom.get()); // Reference not empty + } + else if (aGrabBag[i].Name == OUString::createFromAscii("OOXDrawing")) + { + bDrawing = sal_True; + uno::Reference aDrawingDom; + CPPUNIT_ASSERT(aGrabBag[i].Value >>= aDrawingDom); // PropertyValue of proper type + CPPUNIT_ASSERT(aDrawingDom.get()); // Reference not empty + } + } + CPPUNIT_ASSERT(bData && bLayout && bQStyle && bColor && bDrawing); // Grab Bag has all the expected elements + uno::Reference xPropertySet(xGroup->getByIndex(1), uno::UNO_QUERY); sal_Int32 nValue(0); xPropertySet->getPropertyValue("FillColor") >>= nValue; -- cgit