From 7596e26fd259ce5445212949403e7cd32303b2bd Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 24 Jun 2014 17:11:25 +0200 Subject: Add SwTextBoxHelper::findShapes It builds a textbox -> shape map, so methods interested to pick the shape instead of a shape's textbox can call it and act accordingly if their textbox is in the map. Change-Id: I0f30d64a284eb461f462ed6c0a36c88271153f04 --- .../extras/uiwriter/data/shape-textbox-delete.odt | Bin 10723 -> 0 bytes sw/qa/extras/uiwriter/data/shape-textbox.odt | Bin 0 -> 10723 bytes sw/qa/extras/uiwriter/uiwriter.cxx | 24 ++++++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) delete mode 100644 sw/qa/extras/uiwriter/data/shape-textbox-delete.odt create mode 100644 sw/qa/extras/uiwriter/data/shape-textbox.odt (limited to 'sw/qa/extras') diff --git a/sw/qa/extras/uiwriter/data/shape-textbox-delete.odt b/sw/qa/extras/uiwriter/data/shape-textbox-delete.odt deleted file mode 100644 index 0fe0e9b9cb89..000000000000 Binary files a/sw/qa/extras/uiwriter/data/shape-textbox-delete.odt and /dev/null differ diff --git a/sw/qa/extras/uiwriter/data/shape-textbox.odt b/sw/qa/extras/uiwriter/data/shape-textbox.odt new file mode 100644 index 000000000000..0fe0e9b9cb89 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/shape-textbox.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 2bf8d5ac7598..9ec5a76d8022 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -17,8 +17,10 @@ #include #include #include +#include #include +#include #include "UndoManager.hxx" @@ -39,6 +41,7 @@ public: void testFdo75110(); void testFdo75898(); void testFdo74981(); + void testShapeTextboxSelect(); void testShapeTextboxDelete(); void testCp1000071(); @@ -52,6 +55,7 @@ public: CPPUNIT_TEST(testFdo75110); CPPUNIT_TEST(testFdo75898); CPPUNIT_TEST(testFdo74981); + CPPUNIT_TEST(testShapeTextboxSelect); CPPUNIT_TEST(testShapeTextboxDelete); CPPUNIT_TEST(testCp1000071); CPPUNIT_TEST_SUITE_END(); @@ -282,9 +286,27 @@ void SwUiWriterTest::testFdo74981() CPPUNIT_ASSERT(!pTxtNode->HasHints()); } +void SwUiWriterTest::testShapeTextboxSelect() +{ + SwDoc* pDoc = createDoc("shape-textbox.odt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + SdrObject* pObject = pPage->GetObj(1); + SwDrawContact* pTextBox = static_cast(pObject->GetUserCall()); + // First, make sure that pTextBox is a fly frame (textbox of a shape). + CPPUNIT_ASSERT_EQUAL(RES_FLYFRMFMT, static_cast(pTextBox->GetFmt()->Which())); + + // Then select it. + pWrtShell->SelectObj(Point(), 0, pObject); + const SdrMarkList& rMarkList = pWrtShell->GetDrawView()->GetMarkedObjectList(); + SwDrawContact* pShape = static_cast(rMarkList.GetMark(0)->GetMarkedSdrObj()->GetUserCall()); + // And finally make sure the shape got selected, not just the textbox itself. + CPPUNIT_ASSERT_EQUAL(RES_DRAWFRMFMT, static_cast(pShape->GetFmt()->Which())); +} + void SwUiWriterTest::testShapeTextboxDelete() { - SwDoc* pDoc = createDoc("shape-textbox-delete.odt"); + SwDoc* pDoc = createDoc("shape-textbox.odt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); -- cgit v1.2.3