summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/devtools/DevelopmentToolDockingWindow.hxx5
-rw-r--r--svx/source/devtools/DevelopmentToolDockingWindow.cxx89
2 files changed, 91 insertions, 3 deletions
diff --git a/include/svx/devtools/DevelopmentToolDockingWindow.hxx b/include/svx/devtools/DevelopmentToolDockingWindow.hxx
index 89030c0652e1..30499379f32e 100644
--- a/include/svx/devtools/DevelopmentToolDockingWindow.hxx
+++ b/include/svx/devtools/DevelopmentToolDockingWindow.hxx
@@ -15,13 +15,15 @@
#include <vcl/customweld.hxx>
#include <vcl/weld.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
class SAL_WARN_UNUSED SVX_DLLPUBLIC DevelopmentToolChildWindow final : public SfxChildWindow
{
SFX_DECL_CHILDWINDOW_WITHID(DevelopmentToolChildWindow);
DevelopmentToolChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId, SfxBindings* pBindings,
SfxChildWinInfo* pInfo);
- virtual ~DevelopmentToolChildWindow() override;
};
class SAL_WARN_UNUSED SVX_DLLPUBLIC DevelopmentToolDockingWindow final : public SfxDockingWindow
@@ -29,6 +31,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC DevelopmentToolDockingWindow final : public
public:
DevelopmentToolDockingWindow(SfxBindings* pBindings, SfxChildWindow* pChildWindow,
vcl::Window* pParent);
+
virtual ~DevelopmentToolDockingWindow() override;
virtual void ToggleFloatingMode() override;
diff --git a/svx/source/devtools/DevelopmentToolDockingWindow.cxx b/svx/source/devtools/DevelopmentToolDockingWindow.cxx
index a435cd9b9c04..7d2626ae7978 100644
--- a/svx/source/devtools/DevelopmentToolDockingWindow.cxx
+++ b/svx/source/devtools/DevelopmentToolDockingWindow.cxx
@@ -12,10 +12,85 @@
#include <svx/devtools/DevelopmentToolDockingWindow.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <com/sun/star/beans/theIntrospection.hpp>
+#include <com/sun/star/beans/XIntrospection.hpp>
+#include <com/sun/star/beans/XIntrospectionAccess.hpp>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/PropertyConcept.hpp>
+#include <com/sun/star/beans/MethodConcept.hpp>
+#include <com/sun/star/reflection/XIdlMethod.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <comphelper/processfactory.hxx>
+
#include <sfx2/dispatch.hxx>
#include <sfx2/sfxmodelfactory.hxx>
#include <svx/svxids.hrc>
+#include <sfx2/objsh.hxx>
+
+#include <sfx2/viewfrm.hxx>
+
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+using namespace css;
+
+namespace
+{
+void introspect(uno::Reference<uno::XInterface> const& xInterface)
+{
+ if (!xInterface.is())
+ return;
+
+ uno::Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
+ if (!xContext.is())
+ return;
+}
+
+typedef cppu::WeakComponentImplHelper<css::view::XSelectionChangeListener>
+ SelectionChangeHandlerInterfaceBase;
+
+class SelectionChangeHandler final : private ::cppu::BaseMutex,
+ public SelectionChangeHandlerInterfaceBase
+{
+private:
+ css::uno::Reference<css::frame::XController> mxController;
+
+public:
+ SelectionChangeHandler(const css::uno::Reference<css::frame::XController>& rxController)
+ : SelectionChangeHandlerInterfaceBase(m_aMutex)
+ , mxController(rxController)
+ {
+ }
+
+ virtual void SAL_CALL selectionChanged(const css::lang::EventObject& /*rEvent*/) override
+ {
+ uno::Reference<view::XSelectionSupplier> xSupplier(mxController, uno::UNO_QUERY);
+ if (xSupplier.is())
+ {
+ uno::Any aAny = xSupplier->getSelection();
+ auto aRef = aAny.get<uno::Reference<uno::XInterface>>();
+ introspect(aRef);
+ }
+ }
+ virtual void SAL_CALL disposing(const css::lang::EventObject& /*rEvent*/) override {}
+ virtual void SAL_CALL disposing() override {}
+
+private:
+ SelectionChangeHandler(const SelectionChangeHandler&) = delete;
+ SelectionChangeHandler& operator=(const SelectionChangeHandler&) = delete;
+};
+
+} // end anonymous namespace
+
SFX_IMPL_DOCKINGWINDOW_WITHID(DevelopmentToolChildWindow, SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW);
DevelopmentToolChildWindow::DevelopmentToolChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId,
@@ -30,14 +105,24 @@ DevelopmentToolChildWindow::DevelopmentToolChildWindow(vcl::Window* pParentWindo
pWin->Initialize(pInfo);
}
-DevelopmentToolChildWindow::~DevelopmentToolChildWindow() {}
-
DevelopmentToolDockingWindow::DevelopmentToolDockingWindow(SfxBindings* pInputBindings,
SfxChildWindow* pChildWindow,
vcl::Window* pParent)
: SfxDockingWindow(pInputBindings, pChildWindow, pParent, "DevelopmentTool",
"svx/ui/developmenttool.ui")
{
+ auto* pViewFrame = pInputBindings->GetDispatcher()->GetFrame();
+
+ uno::Reference<frame::XController> xCtrl = pViewFrame->GetFrame().GetController();
+
+ uno::Reference<view::XSelectionSupplier> xSupplier(xCtrl, uno::UNO_QUERY);
+ if (xSupplier.is())
+ {
+ uno::Reference<view::XSelectionChangeListener> xChangeListener(
+ new SelectionChangeHandler(xCtrl));
+ xSupplier->addSelectionChangeListener(xChangeListener);
+ introspect(pInputBindings->GetDispatcher()->GetFrame()->GetObjectShell()->GetBaseModel());
+ }
}
DevelopmentToolDockingWindow::~DevelopmentToolDockingWindow() { disposeOnce(); }