fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / desktop / inc / app.hxx
blobd94930441836ddc7d4fd5923e5d46cec7fe0e6b4
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 _DESKTOP_APP_HXX_
21 #define _DESKTOP_APP_HXX_
23 // stl includes first
24 #include <map>
25 #include <boost/scoped_ptr.hpp>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
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/lang/XInitialization.hpp>
32 #include <com/sun/star/task/XStatusIndicator.hpp>
33 #include <com/sun/star/uno/Reference.h>
34 #include <osl/mutex.hxx>
36 namespace com { namespace sun { namespace star { namespace uno {
37 class XComponentContext;
38 } } } }
40 namespace desktop
43 /*--------------------------------------------------------------------
44 Description: Application-class
45 --------------------------------------------------------------------*/
46 class CommandLineArgs;
47 class Lockfile;
48 class AcceptorMap : public std::map< OUString, css::uno::Reference<css::lang::XInitialization> > {};
49 struct ConvertData;
50 class Desktop : public Application
52 friend class UserInstall;
54 int doShutdown();
56 public:
57 enum BootstrapError
59 BE_OK,
60 BE_UNO_SERVICEMANAGER,
61 BE_UNO_SERVICE_CONFIG_MISSING,
62 BE_PATHINFO_MISSING,
63 BE_USERINSTALL_FAILED,
64 BE_LANGUAGE_MISSING,
65 BE_USERINSTALL_NOTENOUGHDISKSPACE,
66 BE_USERINSTALL_NOWRITEACCESS,
67 BE_OFFICECONFIG_BROKEN
69 enum BootstrapStatus
71 BS_OK,
72 BS_TERMINATE
75 Desktop();
76 ~Desktop();
77 virtual int Main( );
78 virtual void Init();
79 virtual void InitFinished();
80 virtual void DeInit();
81 virtual sal_Bool QueryExit();
82 virtual sal_uInt16 Exception(sal_uInt16 nError);
83 virtual void SystemSettingsChanging( AllSettings& rSettings, Window* pFrame );
84 virtual void AppEvent( const ApplicationEvent& rAppEvent );
86 DECL_LINK( OpenClients_Impl, void* );
88 static void OpenClients();
89 static void OpenDefault();
91 DECL_LINK( EnableAcceptors_Impl, void*);
93 static void HandleAppEvent( const ApplicationEvent& rAppEvent );
94 static ResMgr* GetDesktopResManager();
95 static CommandLineArgs& GetCommandLineArgs();
97 void HandleBootstrapErrors(
98 BootstrapError nError, OUString const & aMessage );
99 void SetBootstrapError(
100 BootstrapError nError, OUString const & aMessage )
102 if ( m_aBootstrapError == BE_OK )
104 m_aBootstrapError = nError;
105 m_aBootstrapErrorMessage = aMessage;
109 void SetBootstrapStatus( BootstrapStatus nStatus )
111 m_aBootstrapStatus = nStatus;
113 BootstrapStatus GetBootstrapStatus() const
115 return m_aBootstrapStatus;
118 static sal_Bool isCrashReporterEnabled();
120 // first-start (ever) related methods
121 static sal_Bool CheckExtensionDependencies();
123 static void DoRestartActionsIfNecessary( sal_Bool bQuickStart );
124 static void SetRestartState();
126 void SynchronizeExtensionRepositories();
127 void SetSplashScreenText( const OUString& rText );
128 void SetSplashScreenProgress( sal_Int32 );
130 // Bootstrap methods
131 static void InitApplicationServiceManager();
132 // throws an exception upon failure
134 private:
135 void RegisterServices(
136 css::uno::Reference<
137 css::uno::XComponentContext > const & context);
138 void DeregisterServices();
140 void CreateTemporaryDirectory();
141 void RemoveTemporaryDirectory();
143 sal_Bool InitializeInstallation( const OUString& rAppFilename );
144 bool InitializeConfiguration();
145 void FlushConfiguration();
146 static sal_Bool shouldLaunchQuickstart();
147 sal_Bool InitializeQuickstartMode( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
149 void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const OUString& aMsg );
150 void StartSetup( const OUString& aParameters );
152 // Create a error message depending on bootstrap failure code and an optional file url
153 OUString CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode,
154 const OUString& aFileURL );
156 static void PreloadModuleData( const CommandLineArgs& );
157 static void PreloadConfigurationData();
159 css::uno::Reference<css::task::XStatusIndicator> m_rSplashScreen;
160 void OpenSplashScreen();
161 void CloseSplashScreen();
163 void EnableOleAutomation();
164 DECL_LINK( ImplInitFilterHdl, ConvertData* );
165 DECL_LINK( AsyncInitFirstRun, void* );
166 /** checks if the office is run the first time
167 <p>If so, <method>DoFirstRunInitializations</method> is called (asynchronously and delayed) and the
168 respective flag in the configuration is reset.</p>
170 void CheckFirstRun( );
172 /// does initializations which are necessary for the first run of the office
173 void DoFirstRunInitializations();
175 static void ShowBackingComponent(Desktop * progress);
177 static sal_Bool SaveTasks();
179 static void retrieveCrashReporterState();
180 static sal_Bool isUIOnSessionShutdownAllowed();
182 // on-demand acceptors
183 static void createAcceptor(const OUString& aDescription);
184 static void enableAcceptors();
185 static void destroyAcceptor(const OUString& aDescription);
187 bool m_bCleanedExtensionCache;
188 bool m_bServicesRegistered;
189 BootstrapError m_aBootstrapError;
190 OUString m_aBootstrapErrorMessage;
191 BootstrapStatus m_aBootstrapStatus;
193 boost::scoped_ptr<Lockfile> m_xLockfile;
194 Timer m_firstRunTimer;
196 static ResMgr* pResMgr;
201 #endif // _DESKTOP_APP_HXX_
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */