LibreOffice Module framework (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
framework::WindowCommandDispatch Class Referencefinal

internal helper to bind e.g. More...

#include <windowcommanddispatch.hxx>

Public Member Functions

 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. More...
 
 ~WindowCommandDispatch ()
 used to free internal resources. More...
 

Private Member Functions

void impl_startListening ()
 establish all listener connections we need. More...
 
void impl_stopListening ()
 drop all listener connections we need. More...
 
 DECL_LINK (impl_notifyCommand, VclWindowEvent &, void)
 callback from VCL to notify new commands More...
 

Private Attributes

std::mutex m_mutex
 
css::uno::Reference< css::uno::XComponentContext > m_xContext
 can be used to create own needed services on demand. More...
 
css::uno::WeakReference< css::frame::XFrame > m_xFrame
 knows the frame, where we dispatch our commands as weak reference More...
 
css::uno::WeakReference< css::awt::XWindow > m_xWindow
 knows the VCL window (where the hard coded commands occurred) as weak XWindow reference More...
 

Detailed Description

internal helper to bind e.g.

MAC-Menu events to our internal dispatch API.

@descr On e.g. MAC platform system menus are merged together with some fix entries as e.g. "Pereferences" or "About". These menu entries trigger hard coded commands. Here we map these commands to the right URLs and dispatch them.

This helper knows a frame and its container window (where VCL provide the hard coded commands). We hold those objects weak so there is no need to react for complex UNO dispose/ing() scenarios. On the other side VCL does not hold us alive (because it doesn't know our UNO reference). So we register at the VCL level as an event listener and

Definition at line 47 of file windowcommanddispatch.hxx.

Constructor & Destructor Documentation

◆ WindowCommandDispatch()

framework::WindowCommandDispatch::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.

@descr Every instance of such MACDispatch can be used for the specified context only. Means: 1 MACDispatch object is bound to 1 Frame/Window pair in which context the detected commands will be executed.

Parameters
xContextwill be used to create own needed services on demand.
xFrameused as for new detected commands.

Definition at line 36 of file windowcommanddispatch.cxx.

References impl_startListening(), m_xFrame, and xFrame.

◆ ~WindowCommandDispatch()

framework::WindowCommandDispatch::~WindowCommandDispatch ( )

used to free internal resources.

Definition at line 45 of file windowcommanddispatch.cxx.

References impl_stopListening(), and m_xContext.

Member Function Documentation

◆ DECL_LINK()

framework::WindowCommandDispatch::DECL_LINK ( impl_notifyCommand  ,
VclWindowEvent ,
void   
)
private

callback from VCL to notify new commands

◆ impl_startListening()

void framework::WindowCommandDispatch::impl_startListening ( )
private

establish all listener connections we need.

@descr Those listener connections will be created one times only (see ctor). Afterwards we listen for incoming events till our referred frame/window pair will be closed.

Definition at line 51 of file windowcommanddispatch.cxx.

References VCLUnoHelper::GetWindow(), LINK, m_mutex, and m_xWindow.

Referenced by WindowCommandDispatch().

◆ impl_stopListening()

void framework::WindowCommandDispatch::impl_stopListening ( )
private

drop all listener connections we need.

Definition at line 71 of file windowcommanddispatch.cxx.

References VCLUnoHelper::GetWindow(), LINK, m_mutex, and m_xWindow.

Referenced by ~WindowCommandDispatch().

Member Data Documentation

◆ m_mutex

std::mutex framework::WindowCommandDispatch::m_mutex
private

Definition at line 50 of file windowcommanddispatch.hxx.

Referenced by impl_startListening(), and impl_stopListening().

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext > framework::WindowCommandDispatch::m_xContext
private

can be used to create own needed services on demand.

Definition at line 53 of file windowcommanddispatch.hxx.

Referenced by ~WindowCommandDispatch().

◆ m_xFrame

css::uno::WeakReference< css::frame::XFrame > framework::WindowCommandDispatch::m_xFrame
private

knows the frame, where we dispatch our commands as weak reference

Definition at line 56 of file windowcommanddispatch.hxx.

◆ m_xWindow

css::uno::WeakReference< css::awt::XWindow > framework::WindowCommandDispatch::m_xWindow
private

knows the VCL window (where the hard coded commands occurred) as weak XWindow reference

Definition at line 59 of file windowcommanddispatch.hxx.

Referenced by impl_startListening(), and impl_stopListening().


The documentation for this class was generated from the following files: