diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-07-26 12:12:49 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-08-19 18:57:04 +0200 |
commit | 7f394b9b2002282068d06b750c236732e4e0e4f5 (patch) | |
tree | 726e57e7a6d579c2b58b80e96accb75e0ed96354 /vcl | |
parent | d03efc010b6017bf13b2d0a8d9bb9e3c1730dd45 (diff) |
tdf#150017 vcl,sw: add UITest
Unfortunately i couldn't figure out how to send keyboard input to the
Edit widget in the SvTreeListBox; it's created by
SvTreeListBox::EditText() and shows up when calling dumpHierarchy()
on the DialogUIObject as a child of the
SvTreeListBox/"19LclHeaderTabListBox" but the execute() doesn't send it
events, neither when called on DialogUIObject nor on TreeListUIObject.
So forward explicitly in TreeListUIObject::execute() - probably not the
best way to do this?
When using the UI, events arrive like this:
0 SvInplaceEdit2::KeyInput(KeyEvent const&) at vcl/source/treelist/treelistbox.cxx:202
1 (anonymous namespace)::MyEdit_Impl::KeyInput(KeyEvent const&) at vcl/source/treelist/treelistbox.cxx:117
2 ImplHandleKey(vcl::Window*, MouseNotifyEvent, sal_uInt16, sal_uInt16, sal_uInt16, bool) (pWindow=0x6dc4bc0, nSVEvent=MouseNotifyEvent::KEYINPUT, nKeyCode=1026, nCharCode=0, nRepeat=0, bForward=true) at vcl/source/window/winproc.cxx:1209
3 ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) at vcl/source/window/winproc.cxx:2672
4 SalFrame::CallCallback(SalEvent, void const*) const (this=0x8a19fb0, nEvent=SalEvent::KeyInput, pEvent=0x7ffc7f3639a0) at vcl/inc/salframe.hxx:306
5 X11SalFrame::HandleKeyEvent(XKeyEvent*) at vcl/unx/generic/window/salframe.cxx:3190
Change-Id: I0be42330aeef98ef09e21297acef6cf616b7f2d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137459
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit a89b221afe2d2d8aa670236fce6e95022ffa1cd9)
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/treelist/treelistbox.cxx | 7 | ||||
-rw-r--r-- | vcl/source/treelist/uiobject.cxx | 13 |
2 files changed, 20 insertions, 0 deletions
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index aa56db5b718f..26d7d44dc6aa 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -889,6 +889,13 @@ void SvTreeListBox::EnableSelectionAsDropTarget( bool bEnable ) // InplaceEditing // ****************************************************************** +VclPtr<Edit> SvInplaceEdit2::GetEditWidget() const { return pEdit; }; + +VclPtr<Edit> SvTreeListBox::GetEditWidget() const +{ + return pEdCtrl ? pEdCtrl->GetEditWidget() : nullptr; +} + void SvTreeListBox::EditText( const OUString& rStr, const tools::Rectangle& rRect, const Selection& rSel ) { diff --git a/vcl/source/treelist/uiobject.cxx b/vcl/source/treelist/uiobject.cxx index 6c4a4e15bda2..65dbecbc4fb8 100644 --- a/vcl/source/treelist/uiobject.cxx +++ b/vcl/source/treelist/uiobject.cxx @@ -8,6 +8,8 @@ */ #include <memory> + +#include <vcl/edit.hxx> #include <vcl/svlbitm.hxx> #include <vcl/uitest/uiobject.hxx> #include <vcl/treelistbox.hxx> @@ -49,6 +51,10 @@ void TreeListUIObject::execute(const OUString& rAction, if (rAction.isEmpty()) { } + else if (auto const pEdit = mxTreeList->GetEditWidget()) + { + std::unique_ptr<UIObject>(new EditUIObject(pEdit))->execute(rAction, rParameters); + } else WindowUIObject::execute(rAction, rParameters); } @@ -64,6 +70,13 @@ std::unique_ptr<UIObject> TreeListUIObject::get_child(const OUString& rID) return std::unique_ptr<UIObject>(new TreeListEntryUIObject(mxTreeList, pEntry)); } + else if (nID == -1) // FIXME hack? + { + if (auto const pEdit = mxTreeList->GetEditWidget()) + { + return std::unique_ptr<UIObject>(new EditUIObject(pEdit)); + } + } return nullptr; } |