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

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>

Inheritance diagram for framework::DispatchProvider:
[legend]
Collaboration diagram for framework::DispatchProvider:
[legend]

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
 

Detailed Description

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

Attention: \n Use this class as member only! Never use it as baseclass.
XInterface will be ambiguous and we hold a weakreference to our OWNER - not to our SUPERCLASS!

@base OWeakObject provides ref count and weak mechanism

@devstatus ready to use @threadsafe yes

Definition at line 67 of file dispatchprovider.hxx.

Constructor & Destructor Documentation

◆ DispatchProvider()

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

Parameters
rxContextreference to servicemanager to create new services.
xFramereference to our owner frame.

Definition at line 59 of file dispatchprovider.cxx.

References m_xFrame, and xFrame.

◆ ~DispatchProvider()

framework::DispatchProvider::~DispatchProvider ( )
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.

Member Function Documentation

◆ ClearProtocolHandlers()

void framework::DispatchProvider::ClearProtocolHandlers ( )
inline

Definition at line 91 of file dispatchprovider.hxx.

References m_aProtocolHandlers.

◆ implts_getOrCreateDispatchHelper()

css::uno::Reference< css::frame::XDispatch > framework::DispatchProvider::implts_getOrCreateDispatchHelper ( EDispatchHelper  eHelper,
const css::uno::Reference< css::frame::XFrame > &  xOwner,
const OUString &  sTarget = OUString(),
sal_Int32  nSearchFlags = 0 
)
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.

Attention: \n The parameter sTarget and nSearchFlags are defaulted to "" and 0!
Mostly it depends from the parameter eHelper is they are required or not.
Parameters
eHelperspecify the requested dispatch helper
xOwnerthe target of possible dispatch() call on created dispatch helper
sTargetthe target parameter of the original queryDispatch() request
nSearchFlagsthe flags parameter of the original queryDispatch() request
Returns
A reference to a dispatch helper.

@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().

◆ implts_isLoadableContent()

bool framework::DispatchProvider::implts_isLoadableContent ( const css::util::URL &  aURL)
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!

Parameters
aURLURL which should be "detected"
Returns
<TRUE> if somewhere could handle that - <FALSE> otherwise.

@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().

◆ implts_queryDesktopDispatch()

css::uno::Reference< css::frame::XDispatch > framework::DispatchProvider::implts_queryDesktopDispatch ( const css::uno::Reference< css::frame::XFrame > &  xDesktop,
const css::util::URL &  aURL,
const OUString &  sTargetFrameName,
sal_Int32  nSearchFlags 
)
private

◆ implts_queryFrameDispatch()

css::uno::Reference< css::frame::XDispatch > framework::DispatchProvider::implts_queryFrameDispatch ( const css::uno::Reference< css::frame::XFrame > &  xFrame,
const css::util::URL &  aURL,
const OUString &  sTargetFrameName,
sal_Int32  nSearchFlags 
)
private

◆ implts_searchProtocolHandler()

css::uno::Reference< css::frame::XDispatch > framework::DispatchProvider::implts_searchProtocolHandler ( const css::util::URL &  aURL)
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.

Parameters
aURLthe dispatch URL for which may a handler is registered
Returns
A dispatch object if a handler was found and agree with the given URL or <NULL> otherwise.

@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().

◆ queryDispatch()

css::uno::Reference< css::frame::XDispatch > SAL_CALL framework::DispatchProvider::queryDispatch ( const css::util::URL &  aURL,
const OUString &  sTargetFrameName,
sal_Int32  nSearchFlags 
)
overridevirtual

◆ queryDispatches()

css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL framework::DispatchProvider::queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor > &  lDescriptions)
overridevirtual

Definition at line 126 of file dispatchprovider.cxx.

References i, nCount, and queryDispatch().

Member Data Documentation

◆ m_aProtocolHandlerCache

HandlerCache framework::DispatchProvider::m_aProtocolHandlerCache
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().

◆ m_aProtocolHandlers

std::unordered_map<OUString, css::uno::Reference<css::frame::XDispatchProvider> > framework::DispatchProvider::m_aProtocolHandlers
private

Definition at line 78 of file dispatchprovider.hxx.

Referenced by ClearProtocolHandlers(), and implts_searchProtocolHandler().

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext > framework::DispatchProvider::m_xContext
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().

◆ m_xFrame

css::uno::WeakReference< css::frame::XFrame > framework::DispatchProvider::m_xFrame
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().


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