16#include <com/sun/star/frame/Desktop.hpp>
17#include <com/sun/star/frame/XStatusListener.hpp>
18#include <com/sun/star/frame/XDispatch.hpp>
19#include <com/sun/star/frame/XDispatchProvider.hpp>
20#include <com/sun/star/util/URL.hpp>
21#include <com/sun/star/util/URLTransformer.hpp>
23template <
class T>
class VclStatusListener final :
public cppu::WeakImplHelper < css::frame::XStatusListener>
34 css::uno::Reference<css::frame::XFrame>
mxFrame;
37 void SAL_CALL
statusChanged(
const css::frame::FeatureStateEvent& rEvent)
override;
39 void SAL_CALL
disposing(
const css::lang::EventObject& )
override;
51 css::uno::Reference<css::uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
53 css::uno::Reference<css::util::XURLTransformer> xParser = css::util::URLTransformer::create(xContext);
60 css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(mxFrame, css::uno::UNO_QUERY);
61 if (!xDispatchProvider.is())
64 mxDispatch = xDispatchProvider->queryDispatch(maCommandURL,
"", 0);
66 mxDispatch->addStatusListener(
this, maCommandURL);
72 mWidget->statusChanged(rEvent);
85 mxDispatch->removeStatusListener(
this, maCommandURL);
void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &rEvent) override
css::uno::Reference< css::frame::XDispatch > mxDispatch
The widget on which actions are performed.
void SAL_CALL disposing(const css::lang::EventObject &) override
VclStatusListener(T *widget, const css::uno::Reference< css::frame::XFrame > &rFrame, const OUString &aCommand)
css::util::URL maCommandURL
css::uno::Reference< css::frame::XFrame > mxFrame