LCOV - code coverage report
Current view: top level - desktop/inc - app.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 6 11 54.5 %
Date: 2014-04-11 Functions: 4 5 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_DESKTOP_INC_APP_HXX
      21             : #define INCLUDED_DESKTOP_INC_APP_HXX
      22             : 
      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>
      35             : 
      36             : namespace com { namespace sun { namespace star { namespace uno {
      37             :     class XComponentContext;
      38             : } } } }
      39             : 
      40             : namespace desktop
      41             : {
      42             : 
      43             : /*--------------------------------------------------------------------
      44             :     Description:    Application-class
      45             :  --------------------------------------------------------------------*/
      46             : class CommandLineArgs;
      47             : class Lockfile;
      48         160 : class AcceptorMap : public std::map< OUString, css::uno::Reference<css::lang::XInitialization> > {};
      49             : struct ConvertData;
      50             : class Desktop : public Application
      51             : {
      52             :     int doShutdown();
      53             : 
      54             :     public:
      55             :         enum BootstrapError
      56             :         {
      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
      66             :         };
      67             :         enum BootstrapStatus
      68             :         {
      69             :             BS_OK,
      70             :             BS_TERMINATE
      71             :         };
      72             : 
      73             :                                 Desktop();
      74             :                                 virtual ~Desktop();
      75             :         virtual int             Main( ) SAL_OVERRIDE;
      76             :         virtual void            Init() SAL_OVERRIDE;
      77             :         virtual void            InitFinished() SAL_OVERRIDE;
      78             :         virtual void            DeInit() SAL_OVERRIDE;
      79             :         virtual bool        QueryExit() SAL_OVERRIDE;
      80             :         virtual sal_uInt16      Exception(sal_uInt16 nError) SAL_OVERRIDE;
      81             :         virtual void            OverrideSystemSettings( AllSettings& rSettings ) SAL_OVERRIDE;
      82             :         virtual void            AppEvent( const ApplicationEvent& rAppEvent ) SAL_OVERRIDE;
      83             : 
      84             :         DECL_LINK( OpenClients_Impl, void* );
      85             : 
      86             :         static void             OpenClients();
      87             :         static void             OpenDefault();
      88             : 
      89             :         DECL_LINK( EnableAcceptors_Impl, void*);
      90             : 
      91             :         static void             HandleAppEvent( const ApplicationEvent& rAppEvent );
      92             :         static ResMgr*          GetDesktopResManager();
      93             :         static CommandLineArgs& GetCommandLineArgs();
      94             : 
      95             :         void                    HandleBootstrapErrors(
      96             :                                     BootstrapError nError, OUString const & aMessage );
      97           0 :         void                    SetBootstrapError(
      98             :                                     BootstrapError nError, OUString const & aMessage )
      99             :         {
     100           0 :             if ( m_aBootstrapError == BE_OK )
     101             :             {
     102           0 :                 m_aBootstrapError = nError;
     103           0 :                 m_aBootstrapErrorMessage = aMessage;
     104             :             }
     105           0 :         }
     106             : 
     107          80 :         void                    SetBootstrapStatus( BootstrapStatus nStatus )
     108             :         {
     109          80 :             m_aBootstrapStatus = nStatus;
     110          80 :         }
     111          80 :         BootstrapStatus          GetBootstrapStatus() const
     112             :         {
     113          80 :             return m_aBootstrapStatus;
     114             :         }
     115             : 
     116             :         static sal_Bool         isCrashReporterEnabled();
     117             : 
     118             :         // first-start (ever) related methods
     119             :         static sal_Bool         CheckExtensionDependencies();
     120             : 
     121             :         void                    SynchronizeExtensionRepositories();
     122             :         void                    SetSplashScreenText( const OUString& rText );
     123             :         void                    SetSplashScreenProgress( sal_Int32 );
     124             : 
     125             :         // Bootstrap methods
     126             :         static void             InitApplicationServiceManager();
     127             :             // throws an exception upon failure
     128             : 
     129             :     private:
     130             :         void                    RegisterServices(
     131             :                                     css::uno::Reference< css::uno::XComponentContext > const & context);
     132             :         void                    DeregisterServices();
     133             : 
     134             :         void                    CreateTemporaryDirectory();
     135             :         void                    RemoveTemporaryDirectory();
     136             : 
     137             :         sal_Bool                InitializeInstallation( const OUString& rAppFilename );
     138             :         bool                    InitializeConfiguration();
     139             :         void                    FlushConfiguration();
     140             :         sal_Bool                InitializeQuickstartMode( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
     141             : 
     142             :         void                    HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const OUString& aMsg );
     143             :         void                    StartSetup( const OUString& aParameters );
     144             : 
     145             :         // Create a error message depending on bootstrap failure code and an optional file url
     146             :         OUString                CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode,
     147             :                                                       const OUString& aFileURL );
     148             : 
     149             :         static void             PreloadModuleData( const CommandLineArgs& );
     150             :         static void             PreloadConfigurationData();
     151             : 
     152             :         css::uno::Reference<css::task::XStatusIndicator> m_rSplashScreen;
     153             :         void                    OpenSplashScreen();
     154             :         void                    CloseSplashScreen();
     155             : 
     156             :         void                    EnableOleAutomation();
     157             :                                 DECL_LINK( ImplInitFilterHdl, ConvertData* );
     158             :         DECL_LINK( AsyncInitFirstRun, void* );
     159             :         /** checks if the office is run the first time
     160             :             <p>If so, <method>DoFirstRunInitializations</method> is called (asynchronously and delayed) and the
     161             :             respective flag in the configuration is reset.</p>
     162             :         */
     163             :         void                    CheckFirstRun( );
     164             : 
     165             :         /// does initializations which are necessary for the first run of the office
     166             :         void                    DoFirstRunInitializations();
     167             : 
     168             :         static void             ShowBackingComponent(Desktop * progress);
     169             : 
     170             :         static sal_Bool         SaveTasks();
     171             : 
     172             :         static sal_Bool         isUIOnSessionShutdownAllowed();
     173             : 
     174             :         // on-demand acceptors
     175             :         static void             createAcceptor(const OUString& aDescription);
     176             :         static void             enableAcceptors();
     177             :         static void             destroyAcceptor(const OUString& aDescription);
     178             : 
     179             :         bool                    m_bCleanedExtensionCache;
     180             :         bool                    m_bServicesRegistered;
     181             :         BootstrapError          m_aBootstrapError;
     182             :         OUString                m_aBootstrapErrorMessage;
     183             :         BootstrapStatus         m_aBootstrapStatus;
     184             : 
     185             :         boost::scoped_ptr<Lockfile> m_xLockfile;
     186             :         Timer                   m_firstRunTimer;
     187             : 
     188             :         static ResMgr*          pResMgr;
     189             : };
     190             : 
     191             : }
     192             : 
     193             : #endif // INCLUDED_DESKTOP_INC_APP_HXX
     194             : 
     195             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10