diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-02-25 21:11:39 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-02-28 01:13:47 +0100 |
commit | 129deefc1f4ab9b3bc5005d6646ed07064a6aec1 (patch) | |
tree | abe6a1a50f0a30e0f762a6b4512835c1606e6f2c /sfx2/source/devtools | |
parent | eb3789bd35e9dc62e92008467bfaa0650cd8d6be (diff) |
devtools: on demand create the content of tab pages
Until now all the tree views in each tab page were populated at
once when the object was inspected.
With this change, the tree views are filled on demand when the
user enters a tab page, and is cleaned when the user leaves a
tab page.
Change-Id: I7f2ff89ab4c09412563b71e6524d4529318dee85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111533
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sfx2/source/devtools')
-rw-r--r-- | sfx2/source/devtools/DevelopmentToolDockingWindow.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/devtools/ObjectInspectorTreeHandler.cxx | 97 |
2 files changed, 79 insertions, 22 deletions
diff --git a/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx b/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx index d7d02198d331..a6b34091fcca 100644 --- a/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx +++ b/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx @@ -35,11 +35,13 @@ DevelopmentToolDockingWindow::DevelopmentToolDockingWindow(SfxBindings* pInputBi , mpDocumentModelTreeView(m_xBuilder->weld_tree_view("leftside_treeview_id")) , mpSelectionToggle(m_xBuilder->weld_toggle_button("selection_toggle")) , mpObjectInspectorToolbar(m_xBuilder->weld_toolbar("object_inspector_toolbar")) + , mpObjectInspectorNotebook(m_xBuilder->weld_notebook("object_inspector_notebookbar")) , maDocumentModelTreeHandler( mpDocumentModelTreeView, pInputBindings->GetDispatcher()->GetFrame()->GetObjectShell()->GetBaseModel()) , maObjectInspectorTreeHandler(mpInterfacesTreeView, mpServicesTreeView, mpPropertiesTreeView, - mpMethodsTreeView, mpClassNameLabel, mpObjectInspectorToolbar) + mpMethodsTreeView, mpClassNameLabel, mpObjectInspectorToolbar, + mpObjectInspectorNotebook) { mpDocumentModelTreeView->connect_changed( LINK(this, DevelopmentToolDockingWindow, DocumentModelTreeViewSelectionHandler)); diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx index c100ed5fff31..c00ddc645a10 100644 --- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx +++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx @@ -629,13 +629,15 @@ ObjectInspectorTreeHandler::ObjectInspectorTreeHandler( std::unique_ptr<weld::TreeView>& pPropertiesTreeView, std::unique_ptr<weld::TreeView>& pMethodsTreeView, std::unique_ptr<weld::Label>& pClassNameLabel, - std::unique_ptr<weld::Toolbar>& pObjectInspectorToolbar) + std::unique_ptr<weld::Toolbar>& pObjectInspectorToolbar, + std::unique_ptr<weld::Notebook>& pObjectInspectorNotebook) : mpInterfacesTreeView(pInterfacesTreeView) , mpServicesTreeView(pServicesTreeView) , mpPropertiesTreeView(pPropertiesTreeView) , mpMethodsTreeView(pMethodsTreeView) , mpClassNameLabel(pClassNameLabel) , mpObjectInspectorToolbar(pObjectInspectorToolbar) + , mpObjectInspectorNotebook(pObjectInspectorNotebook) { mpInterfacesTreeView->connect_expanding( LINK(this, ObjectInspectorTreeHandler, ExpandingHandlerInterfaces)); @@ -658,6 +660,11 @@ ObjectInspectorTreeHandler::ObjectInspectorTreeHandler( LINK(this, ObjectInspectorTreeHandler, ToolbarButtonClicked)); mpObjectInspectorToolbar->set_item_sensitive("inspect", false); mpObjectInspectorToolbar->set_item_sensitive("back", false); + + mpObjectInspectorNotebook->connect_leave_page( + LINK(this, ObjectInspectorTreeHandler, NotebookLeavePage)); + mpObjectInspectorNotebook->connect_enter_page( + LINK(this, ObjectInspectorTreeHandler, NotebookEnterPage)); } void ObjectInspectorTreeHandler::handleExpanding(std::unique_ptr<weld::TreeView>& pTreeView, @@ -764,6 +771,72 @@ IMPL_LINK(ObjectInspectorTreeHandler, ToolbarButtonClicked, const OString&, rSel } } +IMPL_LINK(ObjectInspectorTreeHandler, NotebookEnterPage, const OString&, rPageId, void) +{ + uno::Any aAny = maInspectionStack.back(); + if (aAny.hasValue()) + { + uno::Reference<uno::XInterface> xInterface(aAny, uno::UNO_QUERY); + if (rPageId == "object_inspector_interfaces_tab") + { + mpInterfacesTreeView->freeze(); + clearAll(mpInterfacesTreeView); + appendInterfaces(xInterface); + mpInterfacesTreeView->thaw(); + } + else if (rPageId == "object_inspector_services_tab") + { + mpServicesTreeView->freeze(); + clearAll(mpServicesTreeView); + appendServices(xInterface); + mpServicesTreeView->thaw(); + } + else if (rPageId == "object_inspector_properties_tab") + { + mpPropertiesTreeView->freeze(); + clearAll(mpPropertiesTreeView); + appendProperties(xInterface); + mpPropertiesTreeView->thaw(); + } + else if (rPageId == "object_inspector_methods_tab") + { + mpMethodsTreeView->freeze(); + clearAll(mpMethodsTreeView); + appendMethods(xInterface); + mpMethodsTreeView->thaw(); + } + } +} + +IMPL_LINK(ObjectInspectorTreeHandler, NotebookLeavePage, const OString&, rPageId, bool) +{ + if (rPageId == "object_inspector_interfaces_tab") + { + mpInterfacesTreeView->freeze(); + clearAll(mpInterfacesTreeView); + mpInterfacesTreeView->thaw(); + } + else if (rPageId == "object_inspector_services_tab") + { + mpServicesTreeView->freeze(); + clearAll(mpServicesTreeView); + mpServicesTreeView->thaw(); + } + else if (rPageId == "object_inspector_properties_tab") + { + mpPropertiesTreeView->freeze(); + clearAll(mpPropertiesTreeView); + mpPropertiesTreeView->thaw(); + } + else if (rPageId == "object_inspector_methods_tab") + { + mpMethodsTreeView->freeze(); + clearAll(mpMethodsTreeView); + mpMethodsTreeView->thaw(); + } + return true; +} + void ObjectInspectorTreeHandler::clearObjectInspectorChildren( std::unique_ptr<weld::TreeView>& pTreeView, weld::TreeIter const& rParent) { @@ -891,26 +964,8 @@ void ObjectInspectorTreeHandler::inspectObject(uno::Reference<uno::XInterface> c OUString aImplementationName = xServiceInfo->getImplementationName(); mpClassNameLabel->set_label(aImplementationName); - // fill object inspector - mpInterfacesTreeView->freeze(); - clearAll(mpInterfacesTreeView); - appendInterfaces(xInterface); - mpInterfacesTreeView->thaw(); - - mpServicesTreeView->freeze(); - clearAll(mpServicesTreeView); - appendServices(xInterface); - mpServicesTreeView->thaw(); - - mpPropertiesTreeView->freeze(); - clearAll(mpPropertiesTreeView); - appendProperties(xInterface); - mpPropertiesTreeView->thaw(); - - mpMethodsTreeView->freeze(); - clearAll(mpMethodsTreeView); - appendMethods(xInterface); - mpMethodsTreeView->thaw(); + auto rPageId = mpObjectInspectorNotebook->get_current_page_ident(); + NotebookEnterPage(rPageId); } void ObjectInspectorTreeHandler::introspect(uno::Reference<uno::XInterface> const& xInterface) |