Kaydet (Commit) 5d2c189a authored tarafından Miklos Vajna's avatar Miklos Vajna

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/31733Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 2b5305d3
......@@ -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();
......
......@@ -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 ) ) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment