GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / desktop / inc / app.hxx
blob31d0daee9589bb1f22b25b393822c31a36221c91
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 // 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 int doShutdown();
54 public:
55 enum BootstrapError
57 BE_OK,
58 BE_UNO_SERVICEMANAGER,
59 BE_UNO_SERVICE_CONFIG_MISSING,
60 BE_PATHINFO_MISSING,
61 BE_USERINSTALL_FAILED,
62 BE_LANGUAGE_MISSING,
63 BE_USERINSTALL_NOTENOUGHDISKSPACE,
64 BE_USERINSTALL_NOWRITEACCESS,
65 BE_OFFICECONFIG_BROKEN
67 enum BootstrapStatus
69 BS_OK,
70 BS_TERMINATE
73 Desktop();
74 ~Desktop();
75 virtual int Main( );
76 virtual void Init();
77 virtual void InitFinished();
78 virtual void DeInit();
79 virtual sal_Bool QueryExit();
80 virtual sal_uInt16 Exception(sal_uInt16 nError);
81 virtual void SystemSettingsChanging( AllSettings& rSettings, Window* pFrame );
82 virtual void AppEvent( const ApplicationEvent& rAppEvent );
84 DECL_LINK( OpenClients_Impl, void* );
86 static void OpenClients();
87 static void OpenDefault();
89 DECL_LINK( EnableAcceptors_Impl, void*);
91 static void HandleAppEvent( const ApplicationEvent& rAppEvent );
92 static ResMgr* GetDesktopResManager();
93 static CommandLineArgs& GetCommandLineArgs();
95 void HandleBootstrapErrors(
96 BootstrapError nError, OUString const & aMessage );
97 void SetBootstrapError(
98 BootstrapError nError, OUString const & aMessage )
100 if ( m_aBootstrapError == BE_OK )
102 m_aBootstrapError = nError;
103 m_aBootstrapErrorMessage = aMessage;
107 void SetBootstrapStatus( BootstrapStatus nStatus )
109 m_aBootstrapStatus = nStatus;
111 BootstrapStatus GetBootstrapStatus() const
113 return m_aBootstrapStatus;
116 static sal_Bool isCrashReporterEnabled();
118 // first-start (ever) related methods
119 static sal_Bool CheckExtensionDependencies();
121 void SynchronizeExtensionRepositories();
122 void SetSplashScreenText( const OUString& rText );
123 void SetSplashScreenProgress( sal_Int32 );
125 // Bootstrap methods
126 static void InitApplicationServiceManager();
127 // throws an exception upon failure
129 private:
130 void RegisterServices(
131 css::uno::Reference<
132 css::uno::XComponentContext > const & context);
133 void DeregisterServices();
135 void CreateTemporaryDirectory();
136 void RemoveTemporaryDirectory();
138 sal_Bool InitializeInstallation( const OUString& rAppFilename );
139 bool InitializeConfiguration();
140 void FlushConfiguration();
141 sal_Bool InitializeQuickstartMode( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
143 void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const OUString& aMsg );
144 void StartSetup( const OUString& aParameters );
146 // Create a error message depending on bootstrap failure code and an optional file url
147 OUString CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode,
148 const OUString& aFileURL );
150 static void PreloadModuleData( const CommandLineArgs& );
151 static void PreloadConfigurationData();
153 css::uno::Reference<css::task::XStatusIndicator> m_rSplashScreen;
154 void OpenSplashScreen();
155 void CloseSplashScreen();
157 void EnableOleAutomation();
158 DECL_LINK( ImplInitFilterHdl, ConvertData* );
159 DECL_LINK( AsyncInitFirstRun, void* );
160 /** checks if the office is run the first time
161 <p>If so, <method>DoFirstRunInitializations</method> is called (asynchronously and delayed) and the
162 respective flag in the configuration is reset.</p>
164 void CheckFirstRun( );
166 /// does initializations which are necessary for the first run of the office
167 void DoFirstRunInitializations();
169 static void ShowBackingComponent(Desktop * progress);
171 static sal_Bool SaveTasks();
173 static void retrieveCrashReporterState();
174 static sal_Bool isUIOnSessionShutdownAllowed();
176 // on-demand acceptors
177 static void createAcceptor(const OUString& aDescription);
178 static void enableAcceptors();
179 static void destroyAcceptor(const OUString& aDescription);
181 bool m_bCleanedExtensionCache;
182 bool m_bServicesRegistered;
183 BootstrapError m_aBootstrapError;
184 OUString m_aBootstrapErrorMessage;
185 BootstrapStatus m_aBootstrapStatus;
187 boost::scoped_ptr<Lockfile> m_xLockfile;
188 Timer m_firstRunTimer;
190 static ResMgr* pResMgr;
195 #endif // INCLUDED_DESKTOP_INC_APP_HXX
197 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */