devtools: inspect selected object when DevTools are started
When DevTools window is started, we check if there is a selected object and inspect that one automatically, else use the root document object. Change-Id: I1b8b5031c4ac67300bcc15d176b86bac0a4c5d4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110732 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
committed by
Tomaž Vajngerl
parent
6f7e48c00f
commit
9afdfc80a3
@@ -18,6 +18,7 @@
|
||||
#include <com/sun/star/uno/XInterface.hpp>
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <com/sun/star/view/XSelectionChangeListener.hpp>
|
||||
#include <com/sun/star/frame/XController.hpp>
|
||||
|
||||
#include <svx/devtools/DocumentModelTreeHandler.hxx>
|
||||
|
||||
@@ -44,6 +45,7 @@ private:
|
||||
|
||||
void inspectDocument();
|
||||
void updateSelection();
|
||||
void inspectSelectionOrRoot(css::uno::Reference<css::frame::XController> const& xController);
|
||||
|
||||
void clearObjectInspectorChildren(weld::TreeIter const& rParent);
|
||||
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <com/sun/star/script/XInvocation.hpp>
|
||||
#include <com/sun/star/script/Invocation.hpp>
|
||||
|
||||
#include <com/sun/star/view/XSelectionSupplier.hpp>
|
||||
|
||||
#include <comphelper/processfactory.hxx>
|
||||
|
||||
#include <sfx2/dispatch.hxx>
|
||||
@@ -40,8 +42,6 @@
|
||||
|
||||
#include <sfx2/viewfrm.hxx>
|
||||
|
||||
#include <com/sun/star/frame/XController.hpp>
|
||||
|
||||
#include <cppuhelper/compbase.hxx>
|
||||
#include <cppuhelper/basemutex.hxx>
|
||||
|
||||
@@ -465,9 +465,32 @@ DevelopmentToolDockingWindow::DevelopmentToolDockingWindow(SfxBindings* pInputBi
|
||||
|
||||
mxRoot = pInputBindings->GetDispatcher()->GetFrame()->GetObjectShell()->GetBaseModel();
|
||||
|
||||
introspect(mxRoot);
|
||||
maDocumentModelTreeHandler.inspectDocument();
|
||||
mxSelectionListener.set(new SelectionChangeHandler(xController, this));
|
||||
|
||||
inspectSelectionOrRoot(xController);
|
||||
}
|
||||
|
||||
void DevelopmentToolDockingWindow::inspectSelectionOrRoot(
|
||||
uno::Reference<frame::XController> const& xController)
|
||||
{
|
||||
css::uno::Reference<css::view::XSelectionSupplier> xSupplier(xController, css::uno::UNO_QUERY);
|
||||
if (xSupplier.is())
|
||||
{
|
||||
css::uno::Any aAny = xSupplier->getSelection();
|
||||
if (aAny.hasValue())
|
||||
{
|
||||
auto xInterface = aAny.get<css::uno::Reference<css::uno::XInterface>>();
|
||||
if (xInterface.is())
|
||||
{
|
||||
introspect(xInterface);
|
||||
mpSelectionToggle->set_state(TRISTATE_TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
mpSelectionToggle->set_state(TRISTATE_FALSE);
|
||||
introspect(mxRoot);
|
||||
}
|
||||
|
||||
IMPL_LINK(DevelopmentToolDockingWindow, DocumentModelTreeViewSelectionHandler, weld::TreeView&,
|
||||
|
Reference in New Issue
Block a user