23#include <com/sun/star/frame/XDispatchProvider.hpp>
24#include <com/sun/star/frame/XDispatch.hpp>
25#include <com/sun/star/util/URLTransformer.hpp>
26#include <com/sun/star/util/XURLTransformer.hpp>
37 const css::uno::Reference< css::frame::XFrame >& xFrame)
40 , m_xWindow (
xFrame->getContainerWindow())
53 std::unique_lock aReadLock(
m_mutex);
54 css::uno::Reference< css::awt::XWindow > xWindow(
m_xWindow.get(), css::uno::UNO_QUERY );
73 std::unique_lock aReadLock(
m_mutex);
74 css::uno::Reference< css::awt::XWindow > xWindow(
m_xWindow.get(), css::uno::UNO_QUERY );
95 if (rEvent.GetId() == VclEventId::ObjectDying)
100 if (rEvent.GetId() != VclEventId::WindowCommand)
104 if (pCommand->
GetCommand() != CommandEventId::ShowDialog)
116 case ShowDialogId::Preferences :
117 sCommand =
".uno:OptionsTreeDialog";
120 case ShowDialogId::About :
121 sCommand =
".uno:About";
133 std::unique_lock aReadLock(
m_mutex);
134 css::uno::Reference< css::frame::XDispatchProvider > xProvider(
m_xFrame.get(), css::uno::UNO_QUERY_THROW);
135 css::uno::Reference< css::uno::XComponentContext > xContext =
m_xContext;
140 if ( ! xProvider.is())
143 css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(xContext));
150 xDispatch->dispatch(
aCommand, css::uno::Sequence< css::beans::PropertyValue >());
152 catch(
const css::uno::Exception&)
css::uno::Reference< css::lang::XComponent > m_xFrame
CommandEventId GetCommand() const
const CommandDialogData * GetDialogData() const
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
internal helper to bind e.g.
~WindowCommandDispatch()
used to free internal resources.
css::uno::WeakReference< css::awt::XWindow > m_xWindow
knows the VCL window (where the hard coded commands occurred) as weak XWindow reference
void impl_startListening()
establish all listener connections we need.
css::uno::Reference< css::uno::XComponentContext > m_xContext
can be used to create own needed services on demand.
void impl_stopListening()
drop all listener connections we need.
WindowCommandDispatch(css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::frame::XFrame > &xFrame)
creates a new instance and initialize it with all necessary parameters.
Reference< XDispatch > xDispatch
css::uno::Reference< css::uno::XComponentContext > m_xContext
#define LINK(Instance, Class, Member)
std::unique_ptr< sal_Int32[]> pData
IMPL_LINK(WindowCommandDispatch, impl_notifyCommand, VclWindowEvent &, rEvent, void)
constexpr OUStringLiteral SPECIALTARGET_SELF
Reference< XFrame > xFrame