fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / desktop / inc / app.hxx
blob5c6b708270dfc611a8e9ed5cd95acfcbc6cb983d
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_DESKTOP_INC_APP_HXX
21 #define INCLUDED_DESKTOP_INC_APP_HXX
23 #include <boost/optional.hpp>
24 #include <boost/scoped_ptr.hpp>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <sal/log.hxx>
27 #include <vcl/svapp.hxx>
28 #include <vcl/timer.hxx>
29 #include <tools/resmgr.hxx>
30 #include <unotools/bootstrap.hxx>
31 #include <com/sun/star/task/XStatusIndicator.hpp>
32 #include <com/sun/star/uno/Reference.h>
33 #include <osl/mutex.hxx>
35 namespace com { namespace sun { namespace star { namespace uno {
36 class XComponentContext;
37 } } } }
39 namespace desktop
42 /*--------------------------------------------------------------------
43 Description: Application-class
44 --------------------------------------------------------------------*/
45 class CommandLineArgs;
46 class Lockfile;
47 struct ConvertData;
48 class Desktop : public Application
50 int doShutdown();
52 public:
53 enum BootstrapError
55 BE_OK,
56 BE_UNO_SERVICEMANAGER,
57 BE_UNO_SERVICE_CONFIG_MISSING,
58 BE_PATHINFO_MISSING,
59 BE_USERINSTALL_FAILED,
60 BE_LANGUAGE_MISSING,
61 BE_USERINSTALL_NOTENOUGHDISKSPACE,
62 BE_USERINSTALL_NOWRITEACCESS,
63 BE_OFFICECONFIG_BROKEN
65 enum BootstrapStatus
67 BS_OK,
68 BS_TERMINATE
71 Desktop();
72 virtual ~Desktop();
73 virtual int Main( ) SAL_OVERRIDE;
74 virtual void Init() SAL_OVERRIDE;
75 virtual void InitFinished() SAL_OVERRIDE;
76 virtual void DeInit() SAL_OVERRIDE;
77 virtual bool QueryExit() SAL_OVERRIDE;
78 virtual sal_uInt16 Exception(sal_uInt16 nError) SAL_OVERRIDE;
79 virtual void OverrideSystemSettings( AllSettings& rSettings ) SAL_OVERRIDE;
80 virtual void AppEvent( const ApplicationEvent& rAppEvent ) SAL_OVERRIDE;
82 DECL_LINK( OpenClients_Impl, void* );
84 static void OpenClients();
85 static void OpenDefault();
87 DECL_STATIC_LINK( Desktop, EnableAcceptors_Impl, void*);
89 static void HandleAppEvent( const ApplicationEvent& rAppEvent );
90 static ResMgr* GetDesktopResManager();
91 static CommandLineArgs& GetCommandLineArgs();
93 static void HandleBootstrapErrors(
94 BootstrapError nError, OUString const & aMessage );
95 void SetBootstrapError(
96 BootstrapError nError, OUString const & aMessage )
98 if ( m_aBootstrapError == BE_OK )
100 SAL_INFO("desktop.app", "SetBootstrapError: " << nError << " '" << aMessage << "'");
101 m_aBootstrapError = nError;
102 m_aBootstrapErrorMessage = aMessage;
106 void SetBootstrapStatus( BootstrapStatus nStatus )
108 m_aBootstrapStatus = nStatus;
110 BootstrapStatus GetBootstrapStatus() const
112 return m_aBootstrapStatus;
115 static bool isCrashReporterEnabled();
117 // first-start (ever) related methods
118 static bool CheckExtensionDependencies();
120 void SynchronizeExtensionRepositories();
121 void SetSplashScreenText( const OUString& rText );
122 void SetSplashScreenProgress( sal_Int32 );
124 // Bootstrap methods
125 static void InitApplicationServiceManager();
126 // throws an exception upon failure
128 private:
129 void RegisterServices(
130 css::uno::Reference< css::uno::XComponentContext > const & context);
131 static void DeregisterServices();
133 static void CreateTemporaryDirectory();
134 static void RemoveTemporaryDirectory();
136 bool InitializeInstallation( const OUString& rAppFilename );
137 static bool InitializeConfiguration();
138 static void FlushConfiguration();
139 static bool InitializeQuickstartMode( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
141 static void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const OUString& aMsg );
142 void StartSetup( const OUString& aParameters );
144 // Create a error message depending on bootstrap failure code and an optional file url
145 static OUString CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode,
146 const OUString& aFileURL );
148 static void PreloadModuleData( const CommandLineArgs& );
149 static void PreloadConfigurationData();
151 css::uno::Reference<css::task::XStatusIndicator> m_rSplashScreen;
152 void OpenSplashScreen();
153 void CloseSplashScreen();
155 static void EnableOleAutomation();
156 DECL_STATIC_LINK( Desktop, ImplInitFilterHdl, ConvertData* );
157 DECL_STATIC_LINK_TYPED( Desktop, AsyncInitFirstRun, Timer*, void );
158 /** checks if the office is run the first time
159 <p>If so, <method>DoFirstRunInitializations</method> is called (asynchronously and delayed) and the
160 respective flag in the configuration is reset.</p>
162 void CheckFirstRun( );
164 /// does initializations which are necessary for the first run of the office
165 static void DoFirstRunInitializations();
167 static void ShowBackingComponent(Desktop * progress);
169 static bool SaveTasks();
171 static bool isUIOnSessionShutdownAllowed();
173 // on-demand acceptors
174 static void createAcceptor(const OUString& aDescription);
175 static void enableAcceptors();
176 static void destroyAcceptor(const OUString& aDescription);
178 bool m_bCleanedExtensionCache;
179 bool m_bServicesRegistered;
180 BootstrapError m_aBootstrapError;
181 OUString m_aBootstrapErrorMessage;
182 BootstrapStatus m_aBootstrapStatus;
184 boost::scoped_ptr<Lockfile> m_xLockfile;
185 Timer m_firstRunTimer;
187 static ResMgr* pResMgr;
190 OUString GetURL_Impl(
191 const OUString& rName, boost::optional< OUString > const & cwdUrl );
193 OUString ReplaceStringHookProc(const OUString& rStr);
197 #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined LIBO_HEADLESS
198 bool fire_glxtest_process();
199 #endif
201 #endif // INCLUDED_DESKTOP_INC_APP_HXX
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */