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

implements a job component, which handle the special feature to show a suitable help page for every (visible!) loaded document. More...

#include <helponstartup.hxx>

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

Public Member Functions

 HelpOnStartup (css::uno::Reference< css::uno::XComponentContext > xContext)
 create new instance of this class. More...
 
virtual ~HelpOnStartup () override
 does nothing real ... More...
 
virtual OUString SAL_CALL getImplementationName () override
 
virtual sal_Bool SAL_CALL supportsService (const OUString &sServiceName) override
 
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override
 
virtual css::uno::Any SAL_CALL execute (const css::uno::Sequence< css::beans::NamedValue > &lArguments) override
 
virtual void SAL_CALL disposing (const css::lang::EventObject &aEvent) override
 

Private Member Functions

OUString its_getModuleIdFromEnv (const css::uno::Sequence< css::beans::NamedValue > &lArguments)
 analyze the given job arguments, try to locate a model reference and try to classify this model. More...
 
OUString its_getCurrentHelpURL ()
 tries to locate the open help module and return the url of the currently shown help content. More...
 
bool its_isHelpUrlADefaultOne (std::u16string_view sHelpURL)
 checks if the given help url match to a default help url of any office module. More...
 
OUString its_checkIfHelpEnabledAndGetURL (const OUString &sModule)
 checks, if the help module should be shown automatically for the currently opened office module. More...
 

Static Private Member Functions

static OUString ist_createHelpURL (std::u16string_view sBaseURL, std::u16string_view sLocale, std::u16string_view sSystem)
 create a help URL for the given parameters. More...
 

Private Attributes

std::mutex m_mutex
 
css::uno::Reference< css::uno::XComponentContext > m_xContext
 reference to a uno service manager. More...
 
css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager
 such module manager is used to classify new opened documents. More...
 
css::uno::Reference< css::frame::XDesktop2 > m_xDesktop
 is needed to locate a might open help frame. More...
 
css::uno::Reference< css::container::XNameAccess > m_xConfig
 provides read access to the underlying configuration. More...
 
OUString m_sLocale
 knows the current locale of this office session, which is needed to build complete help URLs. More...
 
OUString m_sSystem
 knows the current operating system of this office session, which is needed to build complete help URLs. More...
 

Detailed Description

implements a job component, which handle the special feature to show a suitable help page for every (visible!) loaded document.

Definition at line 43 of file helponstartup.hxx.

Constructor & Destructor Documentation

◆ HelpOnStartup()

framework::HelpOnStartup::HelpOnStartup ( css::uno::Reference< css::uno::XComponentContext >  xContext)

create new instance of this class.

Parameters
xContextreference to the uno service manager, which created this instance. Can be used later to create own needed uno resources on demand.

Definition at line 60 of file helponstartup.cxx.

References m_sLocale, m_sSystem, m_xConfig, m_xContext, m_xDesktop, and m_xModuleManager.

◆ ~HelpOnStartup()

framework::HelpOnStartup::~HelpOnStartup ( )
overridevirtual

does nothing real ...

@descr But it should exists as virtual function, so this class can't make trouble related to inline/symbols etcpp.!

Definition at line 87 of file helponstartup.cxx.

Member Function Documentation

◆ disposing()

void SAL_CALL framework::HelpOnStartup::disposing ( const css::lang::EventObject &  aEvent)
overridevirtual

Definition at line 135 of file helponstartup.cxx.

References aEvent, m_mutex, m_xConfig, m_xDesktop, and m_xModuleManager.

◆ execute()

css::uno::Any SAL_CALL framework::HelpOnStartup::execute ( const css::uno::Sequence< css::beans::NamedValue > &  lArguments)
overridevirtual

◆ getImplementationName()

OUString SAL_CALL framework::HelpOnStartup::getImplementationName ( )
overridevirtual

Definition at line 45 of file helponstartup.cxx.

◆ getSupportedServiceNames()

css::uno::Sequence< OUString > SAL_CALL framework::HelpOnStartup::getSupportedServiceNames ( )
overridevirtual

Definition at line 55 of file helponstartup.cxx.

References framework::SERVICENAME_JOB.

◆ ist_createHelpURL()

OUString framework::HelpOnStartup::ist_createHelpURL ( std::u16string_view  sBaseURL,
std::u16string_view  sLocale,
std::u16string_view  sSystem 
)
staticprivate

create a help URL for the given parameters.

Parameters
sBaseURLmust be the base URL for a requested help content e.g. "vnd.sun.star.help://swriter/" or "vnd.sun.star.help://swriter/67351"
sLocalethe current office locale e.g. "en-US"
sSystemthe current operating system e.g. "WIN"
Returns
The URL which was generated. e.g. e.g. "vnd.sun.star.help://swriter/?Language=en-US&System=WIN" or "vnd.sun.star.help://swriter/67351?Language=en-US&System=WIN"

Definition at line 320 of file helponstartup.cxx.

Referenced by its_checkIfHelpEnabledAndGetURL(), and its_isHelpUrlADefaultOne().

◆ its_checkIfHelpEnabledAndGetURL()

OUString framework::HelpOnStartup::its_checkIfHelpEnabledAndGetURL ( const OUString &  sModule)
private

checks, if the help module should be shown automatically for the currently opened office module.

@descr This value is read from the module configuration. In case the help should be shown, this method returns a help URL, which can be used to show the right help content.

Parameters
sModuleidentifies the used office module.
Returns
[string] A valid help URL in case the help content should be shown; an empty value if such automatism was disabled for the specified office module.

Definition at line 283 of file helponstartup.cxx.

References ist_createHelpURL(), m_mutex, m_sLocale, m_sSystem, and m_xConfig.

Referenced by execute().

◆ its_getCurrentHelpURL()

OUString framework::HelpOnStartup::its_getCurrentHelpURL ( )
private

tries to locate the open help module and return the url of the currently shown help content.

@descr It returns an empty string, if the help isn't still open at calling time.

Returns
The URL of the current shown help content; or an empty value if the help isn't still open.

Definition at line 196 of file helponstartup.cxx.

References m_mutex, m_xDesktop, and framework::SPECIALTARGET_HELPTASK.

Referenced by execute().

◆ its_getModuleIdFromEnv()

OUString framework::HelpOnStartup::its_getModuleIdFromEnv ( const css::uno::Sequence< css::beans::NamedValue > &  lArguments)
private

analyze the given job arguments, try to locate a model reference and try to classify this model.

@descr As a result of this operation a module identifier will be returned. It can be used against the module configuration then to retrieve further information.

Parameters
lArgumentsthe list of job arguments which is given on our interface method execute().
Returns
[string] a module identifier ... or an empty value if no model could be located ... or if it could not be classified successfully.

Definition at line 146 of file helponstartup.cxx.

References comphelper::SequenceAsHashMap::getUnpackedValueOrDefault(), m_mutex, m_xModuleManager, xController, and xFrame.

Referenced by execute().

◆ its_isHelpUrlADefaultOne()

bool framework::HelpOnStartup::its_isHelpUrlADefaultOne ( std::u16string_view  sHelpURL)
private

checks if the given help url match to a default help url of any office module.

Parameters
sHelpURLthe help url for checking.
Returns
[bool] sal_True if the given URL is any default one ... sal_False otherwise.

Definition at line 237 of file helponstartup.cxx.

References i, ist_createHelpURL(), m_mutex, m_sLocale, m_sSystem, and m_xConfig.

Referenced by execute().

◆ supportsService()

sal_Bool SAL_CALL framework::HelpOnStartup::supportsService ( const OUString &  sServiceName)
overridevirtual

Definition at line 50 of file helponstartup.cxx.

References sServiceName, and cppu::supportsService().

Member Data Documentation

◆ m_mutex

std::mutex framework::HelpOnStartup::m_mutex
private

◆ m_sLocale

OUString framework::HelpOnStartup::m_sLocale
private

knows the current locale of this office session, which is needed to build complete help URLs.

Definition at line 65 of file helponstartup.hxx.

Referenced by HelpOnStartup(), its_checkIfHelpEnabledAndGetURL(), and its_isHelpUrlADefaultOne().

◆ m_sSystem

OUString framework::HelpOnStartup::m_sSystem
private

knows the current operating system of this office session, which is needed to build complete help URLs.

Definition at line 70 of file helponstartup.hxx.

Referenced by HelpOnStartup(), its_checkIfHelpEnabledAndGetURL(), and its_isHelpUrlADefaultOne().

◆ m_xConfig

css::uno::Reference< css::container::XNameAccess > framework::HelpOnStartup::m_xConfig
private

provides read access to the underlying configuration.

Definition at line 60 of file helponstartup.hxx.

Referenced by disposing(), HelpOnStartup(), its_checkIfHelpEnabledAndGetURL(), and its_isHelpUrlADefaultOne().

◆ m_xContext

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

reference to a uno service manager.

Definition at line 51 of file helponstartup.hxx.

Referenced by HelpOnStartup().

◆ m_xDesktop

css::uno::Reference< css::frame::XDesktop2 > framework::HelpOnStartup::m_xDesktop
private

is needed to locate a might open help frame.

Definition at line 57 of file helponstartup.hxx.

Referenced by disposing(), HelpOnStartup(), and its_getCurrentHelpURL().

◆ m_xModuleManager

css::uno::Reference< css::frame::XModuleManager2 > framework::HelpOnStartup::m_xModuleManager
private

such module manager is used to classify new opened documents.

Definition at line 54 of file helponstartup.hxx.

Referenced by disposing(), HelpOnStartup(), and its_getModuleIdFromEnv().


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