summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-16 12:04:57 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-16 12:48:05 +0200
commit7389393284c06fb235bdf9f2fc130d0b61b21ec3 (patch)
tree208d9ad09bbd66a90f191def8dd5a565442eee5c
parent76fe2776afea5d2b02aeef1052e84a9d9f7fbbb1 (diff)
SwModelTestBase: add a getShapeByName() method
Change-Id: Ie3b7099aea1d473cca88c4904683234408920100
-rw-r--r--sw/qa/extras/inc/swmodeltestbase.hxx19
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx6
2 files changed, 22 insertions, 3 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index b55a8eb4f2a0..682647206cc4 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -486,6 +486,25 @@ protected:
return xShape;
}
+ /// Get shape by name
+ uno::Reference<drawing::XShape> getShapeByName(const OUString& aName)
+ {
+ uno::Reference<drawing::XShape> xRet;
+
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ for (sal_Int32 i = 0; i < xDrawPage->getCount(); ++i)
+ {
+ uno::Reference<container::XNamed> xShape(xDrawPage->getByIndex(i), uno::UNO_QUERY);
+ if (xShape->getName() == aName)
+ {
+ xRet.set(xShape, uno::UNO_QUERY);
+ break;
+ }
+ }
+
+ return xRet;
+ }
/// Get TextFrame by name
uno::Reference<drawing::XShape> getTextFrameByName(const OUString& aName)
{
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index bff87a921cbe..888373a1d99d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -215,13 +215,13 @@ DECLARE_OOXMLEXPORT_TEST(testDMLTextFrameVertAdjust, "dml-textframe-vertadjust.d
// TextVerticalAdjust attribute so far.
// 1st frame's context is adjusted to the top
- uno::Reference<beans::XPropertySet> xFrame(getTextFrameByName("Rectangle 1"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xFrame(getShapeByName("Rectangle 1"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
// 2nd frame's context is adjusted to the center
- xFrame.set(getTextFrameByName("Rectangle 2"), uno::UNO_QUERY);
+ xFrame.set(getShapeByName("Rectangle 2"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_CENTER, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
// 3rd frame's context is adjusted to the bottom
- xFrame.set(getTextFrameByName("Rectangle 3"), uno::UNO_QUERY);
+ xFrame.set(getShapeByName("Rectangle 3"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
}