LibreOffice Module framework (master) 1
|
implement a helper for XDispatchProvider interface @descr The result of a queryDispatch() call depends from the owner, which use an instance of this class. More...
#include <dispatchprovider.hxx>
Public Member Functions | |
DispatchProvider (css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::frame::XFrame > &xFrame) | |
standard ctor/dtor @descr These initialize a new instance of this class with needed information for work. More... | |
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL | queryDispatch (const css::util::URL &aURL, const OUString &sTargetFrameName, sal_Int32 nSearchFlags) override |
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL | queryDispatches (const css::uno::Sequence< css::frame::DispatchDescriptor > &lDescriptions) override |
void | ClearProtocolHandlers () |
Private Member Functions | |
virtual | ~DispatchProvider () override |
protected(!) dtor for deinitializing @descr We made it protected to prevent using of us as base class instead as a member. More... | |
css::uno::Reference< css::frame::XDispatch > | implts_getOrCreateDispatchHelper (EDispatchHelper eHelper, const css::uno::Reference< css::frame::XFrame > &xOwner, const OUString &sTarget=OUString(), sal_Int32 nSearchFlags=0) |
get or create new dispatch helper @descr Sometimes we need some helper implementations to support dispatching of special URLs or commands. More... | |
bool | implts_isLoadableContent (const css::util::URL &aURL) |
check URL for support by our used loader or handler @descr If we must return our own dispatch helper implementations (self, blank, create dispatcher!) we should be sure, that URL describe any loadable content. More... | |
css::uno::Reference< css::frame::XDispatch > | implts_queryDesktopDispatch (const css::uno::Reference< css::frame::XFrame > &xDesktop, const css::util::URL &aURL, const OUString &sTargetFrameName, sal_Int32 nSearchFlags) |
helper for queryDispatch() @descr Every member of the frame tree (frame, desktop) must handle such request in another way. More... | |
css::uno::Reference< css::frame::XDispatch > | implts_queryFrameDispatch (const css::uno::Reference< css::frame::XFrame > &xFrame, const css::util::URL &aURL, const OUString &sTargetFrameName, sal_Int32 nSearchFlags) |
css::uno::Reference< css::frame::XDispatch > | implts_searchProtocolHandler (const css::util::URL &aURL) |
search for a registered protocol handler and ask him for a dispatch object @descr We search a suitable handler inside our cfg package org.openoffice.Office.ProtocolHandler. More... | |
Private Attributes | |
css::uno::Reference< css::uno::XComponentContext > | m_xContext |
reference to global service manager to create new services More... | |
css::uno::WeakReference< css::frame::XFrame > | m_xFrame |
weakreference to owner frame (Don't use a hard reference. Owner can't delete us then!) More... | |
HandlerCache | m_aProtocolHandlerCache |
cache of some other dispatch provider which are registered inside configuration to handle special URL protocols More... | |
std::unordered_map< OUString, css::uno::Reference< css::frame::XDispatchProvider > > | m_aProtocolHandlers |
implement a helper for XDispatchProvider interface @descr The result of a queryDispatch() call depends from the owner, which use an instance of this class.
(frame, desktop) All of them must provides different functionality. E.g: - task can be created by the desktop only
@base OWeakObject provides ref count and weak mechanism
@devstatus ready to use @threadsafe yes
Definition at line 67 of file dispatchprovider.hxx.
framework::DispatchProvider::DispatchProvider | ( | css::uno::Reference< css::uno::XComponentContext > | xContext, |
const css::uno::Reference< css::frame::XFrame > & | xFrame | ||
) |
standard ctor/dtor @descr These initialize a new instance of this class with needed information for work.
We hold a weakreference to our owner frame which start dispatches at us. We can't use a normal reference because he hold a reference of us too ... nobody can die so ...!
@seealso using at owner
rxContext | reference to servicemanager to create new services. |
xFrame | reference to our owner frame. |
Definition at line 59 of file dispatchprovider.cxx.
|
overrideprivatevirtual |
protected(!) dtor for deinitializing @descr We made it protected to prevent using of us as base class instead as a member.
Definition at line 70 of file dispatchprovider.cxx.
|
inline |
Definition at line 91 of file dispatchprovider.hxx.
References m_aProtocolHandlers.
|
private |
get or create new dispatch helper @descr Sometimes we need some helper implementations to support dispatching of special URLs or commands.
But it's not a good idea to hold these services for the whole life time of this provider instance. We should create it on demand... That's why we implement this method. It return an already existing helper or create a new one otherwise.
eHelper | specify the requested dispatch helper |
xOwner | the target of possible dispatch() call on created dispatch helper |
sTarget | the target parameter of the original queryDispatch() request |
nSearchFlags | the flags parameter of the original queryDispatch() request |
@threadsafe yes
Definition at line 522 of file dispatchprovider.cxx.
References framework::E_BLANKDISPATCHER, framework::E_CLOSEDISPATCHER, framework::E_CREATEDISPATCHER, framework::E_DEFAULTDISPATCHER, framework::E_SELFDISPATCHER, framework::E_STARTMODULEDISPATCHER, m_xContext, framework::SPECIALTARGET_BLANK, framework::SPECIALTARGET_DEFAULT, and framework::SPECIALTARGET_SELF.
Referenced by implts_queryDesktopDispatch(), and implts_queryFrameDispatch().
|
private |
check URL for support by our used loader or handler @descr If we must return our own dispatch helper implementations (self, blank, create dispatcher!) we should be sure, that URL describe any loadable content.
Otherwise slot/uno URLs will be detected... but there exist nothing for real loading into a target frame!
aURL | URL which should be "detected" |
@threadsafe yes
Definition at line 577 of file dispatchprovider.cxx.
References aURL, framework::LoadEnv::classifyContent(), framework::LoadEnv::E_CAN_BE_LOADED, and eType.
Referenced by implts_queryDesktopDispatch(), and implts_queryFrameDispatch().
|
private |
helper for queryDispatch() @descr Every member of the frame tree (frame, desktop) must handle such request in another way.
So we implement different specialized methods for everyone.
@threadsafe yes
Definition at line 151 of file dispatchprovider.cxx.
References aURL, framework::E_BLANKDISPATCHER, framework::E_CREATEDISPATCHER, framework::E_DEFAULTDISPATCHER, framework::E_STARTMODULEDISPATCHER, implts_getOrCreateDispatchHelper(), implts_isLoadableContent(), implts_searchProtocolHandler(), framework::isStartModuleDispatch(), framework::SPECIALTARGET_BEAMER, framework::SPECIALTARGET_BLANK, framework::SPECIALTARGET_DEFAULT, SPECIALTARGET_PARENT, framework::SPECIALTARGET_SELF, and framework::SPECIALTARGET_TOP.
Referenced by queryDispatch().
|
private |
Definition at line 233 of file dispatchprovider.cxx.
References aURL, framework::E_CLOSEDISPATCHER, framework::E_SELFDISPATCHER, VCLUnoHelper::GetWindow(), implts_getOrCreateDispatchHelper(), implts_isLoadableContent(), implts_searchProtocolHandler(), vcl::Window::IsSystemWindow(), framework::WindowHelper::isTopWindow(), queryDispatch(), framework::SPECIALTARGET_BEAMER, framework::SPECIALTARGET_BLANK, framework::SPECIALTARGET_DEFAULT, SPECIALTARGET_PARENT, framework::SPECIALTARGET_SELF, framework::SPECIALTARGET_TOP, xController, and xFrame.
Referenced by queryDispatch().
|
private |
search for a registered protocol handler and ask him for a dispatch object @descr We search a suitable handler inside our cfg package org.openoffice.Office.ProtocolHandler.
If we found anyone, we create and initialize it. Initialize means: we set our owner frame on it as context information. He can use it or leave it. Of course - we are aware of handler implementations, which doesn't support initialization. It's an optional feature.
aURL | the dispatch URL for which may a handler is registered |
@threadsafe yes
Definition at line 433 of file dispatchprovider.cxx.
References aURL, m_aProtocolHandlerCache, m_aProtocolHandlers, framework::ProtocolHandler::m_sUNOName, m_xContext, m_xFrame, SAL_WARN_IF, framework::HandlerCache::search(), and framework::SPECIALTARGET_SELF.
Referenced by implts_queryDesktopDispatch(), and implts_queryFrameDispatch().
|
overridevirtual |
Definition at line 93 of file dispatchprovider.cxx.
References aURL, implts_queryDesktopDispatch(), implts_queryFrameDispatch(), and m_xFrame.
Referenced by implts_queryFrameDispatch(), and queryDispatches().
|
overridevirtual |
Definition at line 126 of file dispatchprovider.cxx.
References i, nCount, and queryDispatch().
|
private |
cache of some other dispatch provider which are registered inside configuration to handle special URL protocols
Definition at line 76 of file dispatchprovider.hxx.
Referenced by implts_searchProtocolHandler().
|
private |
Definition at line 78 of file dispatchprovider.hxx.
Referenced by ClearProtocolHandlers(), and implts_searchProtocolHandler().
|
private |
reference to global service manager to create new services
Definition at line 72 of file dispatchprovider.hxx.
Referenced by implts_getOrCreateDispatchHelper(), and implts_searchProtocolHandler().
|
private |
weakreference to owner frame (Don't use a hard reference. Owner can't delete us then!)
Definition at line 74 of file dispatchprovider.hxx.
Referenced by implts_searchProtocolHandler(), and queryDispatch().