summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorAndres Gomez <agomez@igalia.com>2013-09-03 11:13:22 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-09-11 07:35:59 +0000
commitab0998c77cc5b1f15c4d584185e7c401ef6fe62b (patch)
tree2602d208420e976b8feeb9282c42d79c13a9ee49 /sw
parentfca4b8d48b07d522dadc86757423b93d1829621b (diff)
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 <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx47
1 files changed, 47 insertions, 0 deletions
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 <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/table/TableBorder2.hpp>
#include <com/sun/star/text/SizeType.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
#include <vcl/svapp.hxx>
@@ -542,6 +543,52 @@ void Test::testSmartart()
uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xGroup->getCount()); // 3 rectangles and an arrow in the group
+ uno::Reference<beans::XPropertySet> xGroupPropertySet(getShape(1), uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> 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<xml::dom::XDocument> 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<xml::dom::XDocument> 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<xml::dom::XDocument> 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<xml::dom::XDocument> 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<xml::dom::XDocument> 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<beans::XPropertySet> xPropertySet(xGroup->getByIndex(1), uno::UNO_QUERY);
sal_Int32 nValue(0);
xPropertySet->getPropertyValue("FillColor") >>= nValue;