diff options
author | Jim Raykowski <raykowj@gmail.com> | 2023-08-12 21:54:57 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2023-08-16 08:01:37 +0200 |
commit | b363a689bf5b434113648373f98ee46aa00c09d7 (patch) | |
tree | c1f4debdc8fee46549e7e2023a0f6954d34c0a90 /sd/source | |
parent | 717fa28e88f382ad86b2be2fdbc24f4f60bc524d (diff) |
tdf#156610 tdf#139633 SDNavigator: Fix object naming/renaming
implementation
This patch makes the Rename... menu item open the Name dialog and
makes name editing start in the tree when a selected entry is left-
clicked on and released without moving the mouse pointer to begin a
drag operation.
Change-Id: I8d8b93895b797d7e1be860a17a5c1fe6d82e474e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155647
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/dlg/navigatr.cxx | 14 | ||||
-rw-r--r-- | sd/source/ui/dlg/sdtreelb.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/inc/sdtreelb.hxx | 1 |
3 files changed, 18 insertions, 3 deletions
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index ca6bc100cad9..f1a4a66c1e5f 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -264,8 +264,18 @@ IMPL_LINK(SdNavigatorWin, CommandHdl, const CommandEvent&, rCEvt, bool) void SdNavigatorWin::ExecuteContextMenuAction(std::u16string_view rSelectedPopupEntry) { - if (rSelectedPopupEntry == u"rename") - GetObjects().start_editing(); + if (rSelectedPopupEntry == u"rename" && mpBindings) + { + weld::TreeView& rTreeView = GetObjects().get_treeview(); + std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator()); + if (rTreeView.get_selected(xIter.get())) + { + if (rTreeView.get_iter_depth(*xIter) > 0) + mpBindings->Execute(SID_NAME_GROUP); + else + mpBindings->Execute(SID_RENAMEPAGE); + } + } } IMPL_LINK(SdNavigatorWin, SelectToolboxHdl, const OUString&, rCommand, void) diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 56e93bd7dfe0..e6e72c8884e0 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -354,6 +354,7 @@ IMPL_LINK(SdPageObjsTLV, KeyInputHdl, const KeyEvent&, rKEvt, bool) IMPL_LINK(SdPageObjsTLV, MousePressHdl, const MouseEvent&, rMEvt, bool) { + m_bMouseReleased = false; m_bEditing = false; m_bSelectionHandlerNavigates = rMEvt.GetClicks() == 1; m_bNavigationGrabsFocus = rMEvt.GetClicks() != 1; @@ -362,6 +363,7 @@ IMPL_LINK(SdPageObjsTLV, MousePressHdl, const MouseEvent&, rMEvt, bool) IMPL_LINK_NOARG(SdPageObjsTLV, MouseReleaseHdl, const MouseEvent&, bool) { + m_bMouseReleased = true; if (m_aMouseReleaseHdl.IsSet() && m_aMouseReleaseHdl.Call(MouseEvent())) return false; @@ -758,6 +760,7 @@ SdPageObjsTLV::SdPageObjsTLV(std::unique_ptr<weld::TreeView> xTreeView) m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 28, m_xTreeView->get_text_height() * 8); + m_xTreeView->set_column_editables({true}); } IMPL_LINK(SdPageObjsTLV, EditEntryAgain, void*, p, void) @@ -839,7 +842,8 @@ void SdPageObjsTLV::Select() { m_nSelectEventId = nullptr; - if (IsEditingActive()) + // hack to make inplace editing work for x11 + if (m_bMouseReleased) return; m_bLinkableSelected = true; diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index 38255a66e16f..712a6ebf3860 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -102,6 +102,7 @@ private: */ bool m_bNavigationGrabsFocus; + bool m_bMouseReleased = true; // hack for x11 inplace editing bool m_bEditing = false; SelectionMode m_eSelectionMode; |