[Libreoffice-bugs] [Bug 139633] Direct editing of tree nodes in the Navigator to rename objects

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Fri Jan 22 08:26:37 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=139633

--- Comment #9 from Jim Raykowski <raykowj at gmail.com> ---
code pointers:

class NavigatorTree
svx/source/inc/fmexpl.hxx
svx/source/form/navigatortree.cxx

IsEditingActive()
DECL_LINK(EditingEntryHdl...
DECL_LINK(EditedEntryHdl...
m_xTreeView->connect_editing(...
IMPL_LINK(NavigatorTree, EditingEntryHdl, const weld::TreeIter&, rIter, bool)
IMPL_LINK(NavigatorTree, EditedEntryHdl, const IterString&, rIterString, bool)

include/vcl/weld.hxx
class TreeView
connect_editing

class SwContentTree
sw/source/uibase/inc/conttree.hxx
sw/source/uibase/utlui/content.cxx

Add the above declarations and handlers as in the NavigatorTree to the
SwContentTree.
In the EditingEntryHdl set m_bEditing according to boolean value return by
lcl_IsContent

When in Editing mode always return false from
SwContentTree::HasContentChanged()

void SwContentTree::ExecuteContextMenuAction(const OString&
rSelectedPopupEntry)
        case 502 : // handling of popup menu entry Rename...
            EditEntry(*xFirst, EditEntryMode::RENAME);
return immediatly after calling EditEntry so UpdateListbox isn't called after
breaking out of the switch

Study SwContentTree::EditEntry function, in particular the nMode ==
EditEntryMode::RENAME handling for the various content types.

Move rename handling out of SwContentTree::EditEntry into the newly added
SwContentTree::EditedEntryHdl
This will eliminate need for CreateSwRenameXNamedDlg in
SwContentTree::EditEntry

Do this by moving:
uno::Reference< container::XNameAccess >  xNameAccess;
uno::Reference< frame::XModel > xModel =
m_pActiveShell->GetView().GetDocShell()->GetBaseModel();
and each X...Supplier to get xNameAccess as done in SwContentTree::EditEntry

To start in place editing use the following at each nMode ==
EditEntryMode::RENAME in SwContentTree::EditEntry

        m_xTreeView->start_editing(rEntry);
        return;

Renaming ContentTypeId::DRAWOBJECT is different, see: 
sw/source/uibase/shells/drwbassh.cxx
void SwDrawBaseShell::Execute
case FN_NAME_SHAPE 

To check drawing object name uniqueness see:
sw/source/uibase/shells/drwbassh.cxx
IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl,
AbstractSvxObjectNameDialog&, rNameDialog, bool )

Take care to do forbidden character checking for bookmark renaming and table
renaming.

Rename the context menu item Rename... to Rename
sw/uiconfig/swriter/ui/navigatorcontextmenu.ui

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210122/927d3776/attachment.htm>


More information about the Libreoffice-bugs mailing list