fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / framework / inc / jobs / helponstartup.hxx
blob45a8f97973e37f4a5c3b7d98e901889ff143e60b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_FRAMEWORK_INC_JOBS_HELPONSTARTUP_HXX
21 #define INCLUDED_FRAMEWORK_INC_JOBS_HELPONSTARTUP_HXX
23 #include <macros/xinterface.hxx>
24 #include <macros/xtypeprovider.hxx>
25 #include <macros/xserviceinfo.hxx>
27 #include <cppuhelper/implbase3.hxx>
29 #include <com/sun/star/frame/XFrame.hpp>
30 #include <com/sun/star/task/XJob.hpp>
31 #include <com/sun/star/lang/XEventListener.hpp>
32 #include <com/sun/star/container/XNameAccess.hpp>
33 #include <com/sun/star/frame/XDesktop2.hpp>
34 #include <com/sun/star/frame/XModuleManager2.hpp>
36 namespace framework{
38 /** @short implements a job component, which handle the special
39 feature to show a suitable help page for every (visible!)
40 loaded document.
42 @author as96863
44 class HelpOnStartup : public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::lang::XEventListener,::com::sun::star::task::XJob >
47 // member
48 private:
49 osl::Mutex m_mutex;
51 /** @short reference to an uno service manager. */
52 css::uno::Reference< css::uno::XComponentContext > m_xContext;
54 /** @short such module manager is used to classify new opened documents. */
55 css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager;
57 /** @short is needed to locate a might open help frame. */
58 css::uno::Reference< css::frame::XDesktop2 > m_xDesktop;
60 /** @short provides read access to the underlying configuration. */
61 css::uno::Reference< css::container::XNameAccess > m_xConfig;
63 /** @short knows the current locale of this office session,
64 which is needed to build complete help URLs.
66 OUString m_sLocale;
68 /** @short knows the current operating system of this office session,
69 which is needed to build complete help URLs.
71 OUString m_sSystem;
73 // native interface
74 public:
76 /** @short create new instance of this class.
78 @param xContext
79 reference to the uno service manager, which created this instance.
80 Can be used later to create own needed uno resources on demand.
82 HelpOnStartup(const css::uno::Reference< css::uno::XComponentContext >& xContext);
84 /** @short does nothing real ...
86 @descr But it should exists as virtual function,
87 so this class can't make trouble
88 related to inline/symbols etcpp.!
90 virtual ~HelpOnStartup();
92 // uno interface
93 public:
95 // css.lang.XServiceInfo
96 DECLARE_XSERVICEINFO
98 // css.task.XJob
99 virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments)
100 throw(css::lang::IllegalArgumentException,
101 css::uno::Exception ,
102 css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
104 // css.lang.XEventListener
105 virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
106 throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
108 // helper
109 private:
111 /** @short analyze the given job arguments, try to locate a model reference
112 and try to classify this model.
114 @descr As a result of this operation a module identifier will be returned.
115 It can be used against the module configuration then to retrieve further information.
117 @param lArguments
118 the list of job arguments which is given on our interface method execute().
120 @return [string]
121 a module identifier ... or an empty value if no model could be located ...
122 or if it could not be classified successfully.
124 OUString its_getModuleIdFromEnv(const css::uno::Sequence< css::beans::NamedValue >& lArguments);
126 /** @short tries to locate the open help module and return
127 the url of the currently shown help content.
129 @descr It returns an empty string, if the help isn't still
130 open at calling time.
132 @return The URL of the current shown help content;
133 or an empty value if the help isn't still open.
135 OUString its_getCurrentHelpURL();
137 /** @short checks if the given help url match to a default help url
138 of any office module.
140 @param sHelpURL
141 the help url for checking.
143 @return [bool]
144 sal_True if the given URL is any default one ...
145 sal_False otherwise.
147 bool its_isHelpUrlADefaultOne(const OUString& sHelpURL);
149 /** @short checks, if the help module should be shown automatically for the
150 currently opened office module.
152 @descr This value is readed from the module configuration.
153 In case the help should be shown, this method returns
154 a help URL, which can be used to show the right help content.
156 @param sModule
157 identifies the used office module.
159 @return [string]
160 A valid help URL in case the help content should be shown;
161 an empty value if such automatism was disabled for the specified office module.
163 OUString its_checkIfHelpEnabledAndGetURL(const OUString& sModule);
165 /** @short create a help URL for the given parameters.
167 @param sBaseURL
168 must be the base URL for a requested help content
169 e.g. "vnd.sun.star.help://swriter/"
170 or "vnd.sun.star.help://swriter/67351"
172 @param sLocale
173 the current office locale
174 e.g. "en-US"
176 @param sSystem
177 the current operating system
178 e.g. "WIN"
180 @return The URL which was generated.
181 e.g.
182 e.g. "vnd.sun.star.help://swriter/?Language=en-US&System=WIN"
183 or "vnd.sun.star.help://swriter/67351?Language=en-US&System=WIN"
185 static OUString ist_createHelpURL(const OUString& sBaseURL,
186 const OUString& sLocale ,
187 const OUString& sSystem );
190 } // namespace framework
192 #endif // INCLUDED_FRAMEWORK_INC_JOBS_HELPONSTARTUP_HXX
194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */