diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-12-07 18:02:07 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-12-07 19:20:44 +0000 |
commit | 5d2c189aee5057d1533165c368227c9c4c49d330 (patch) | |
tree | 797dbb4ad8628bff73d055fccd69a94ca0cfc0dd /sw | |
parent | 2b5305d3020435c57d75d19f332acea10049ef69 (diff) |
sw: fix keyboard-based iteration on draw shapes wrt. textboxes
Pressing <tab> resulted in no action, as we jumped to the textbox of the
shape, which was correct to jump to the shape, so we never arrived to
the next draw shape.
Change-Id: I8c6458994ce985fc420999042a1d8e69b6e6712b
Reviewed-on: https://gerrit.libreoffice.org/31733
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf84695-tab.odt | bin | 0 -> 9833 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 27 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 4 |
3 files changed, 31 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf84695-tab.odt b/sw/qa/extras/uiwriter/data/tdf84695-tab.odt Binary files differnew file mode 100644 index 000000000000..aa438bdf9b34 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf84695-tab.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 44dd39e410a9..13e2fa4c10a3 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -207,6 +207,7 @@ public: void testTdf99004(); void testTdf84695(); void testTdf84695NormalChar(); + void testTdf84695Tab(); void testTableStyleUndo(); void testRedlineParam(); void testRedlineViewAuthor(); @@ -320,6 +321,7 @@ public: CPPUNIT_TEST(testTdf99004); CPPUNIT_TEST(testTdf84695); CPPUNIT_TEST(testTdf84695NormalChar); + CPPUNIT_TEST(testTdf84695Tab); CPPUNIT_TEST(testTableStyleUndo); CPPUNIT_TEST(testRedlineParam); CPPUNIT_TEST(testRedlineViewAuthor); @@ -3818,6 +3820,31 @@ void SwUiWriterTest::testTdf84695NormalChar() CPPUNIT_ASSERT_EQUAL(OUString("a"), xShape->getString()); } +void SwUiWriterTest::testTdf84695Tab() +{ + SwDoc* pDoc = createDoc("tdf84695-tab.odt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + SdrObject* pObject = pPage->GetObj(0); + SwContact* pShape = static_cast<SwContact*>(pObject->GetUserCall()); + // First, make sure that pShape is a draw shape. + CPPUNIT_ASSERT_EQUAL(RES_DRAWFRMFMT, static_cast<RES_FMT>(pShape->GetFormat()->Which())); + + // Then select it. + pWrtShell->SelectObj(Point(), 0, pObject); + + // Now pressing 'tab' should jump to the other shape. + SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_TAB); + + // And finally make sure the selection has changed. + const SdrMarkList& rMarkList = pWrtShell->GetDrawView()->GetMarkedObjectList(); + SwContact* pOtherShape = static_cast<SwContact*>(rMarkList.GetMark(0)->GetMarkedSdrObj()->GetUserCall()); + // This failed, 'tab' didn't do anything -> the selected shape was the same. + CPPUNIT_ASSERT(pOtherShape != pShape); +} + void SwUiWriterTest::testTableStyleUndo() { SwDoc* pDoc = createDoc(); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index de6fcc5afc23..06f1a4bd7e59 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1509,6 +1509,10 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool bool bFlyFrame = dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr; if( ( bNoFly && bFlyFrame ) || ( bNoDraw && !bFlyFrame ) || + // Ignore TextBoxes of draw shapes here, so that + // SwFEShell::SelectObj() won't jump back on this list, meaning + // we never jump to the next draw shape. + SwTextBoxHelper::isTextBox(pObj) || ( eType == GotoObjFlags::DrawSimple && lcl_IsControlGroup( pObj ) ) || ( eType == GotoObjFlags::DrawControl && !lcl_IsControlGroup( pObj ) ) || ( pFilter && !pFilter->includeObject( *pObj ) ) ) |