LCOV - code coverage report
Current view: top level - libreoffice/desktop/inc - app.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 11 0.0 %
Date: 2012-12-27 Functions: 0 5 0.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 _DESKTOP_APP_HXX_
      21             : #define _DESKTOP_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             : using namespace com::sun::star::task;
      41             : using namespace com::sun::star::uno;
      42             : using namespace com::sun::star::lang;
      43             : 
      44             : namespace desktop
      45             : {
      46             : 
      47             : /*--------------------------------------------------------------------
      48             :     Description:    Application-class
      49             :  --------------------------------------------------------------------*/
      50             : class CommandLineArgs;
      51             : class Lockfile;
      52           0 : class AcceptorMap : public std::map< rtl::OUString, Reference<XInitialization> > {};
      53             : struct ConvertData;
      54             : class Desktop : public Application
      55             : {
      56             :     friend class UserInstall;
      57             : 
      58             :     int doShutdown();
      59             : 
      60             :     public:
      61             :         enum BootstrapError
      62             :         {
      63             :             BE_OK,
      64             :             BE_UNO_SERVICEMANAGER,
      65             :             BE_UNO_SERVICE_CONFIG_MISSING,
      66             :             BE_PATHINFO_MISSING,
      67             :             BE_USERINSTALL_FAILED,
      68             :             BE_LANGUAGE_MISSING,
      69             :             BE_USERINSTALL_NOTENOUGHDISKSPACE,
      70             :             BE_USERINSTALL_NOWRITEACCESS,
      71             :             BE_OFFICECONFIG_BROKEN
      72             :         };
      73             :         enum BootstrapStatus
      74             :         {
      75             :             BS_OK,
      76             :             BS_TERMINATE
      77             :         };
      78             : 
      79             :                                 Desktop();
      80             :                                 ~Desktop();
      81             :         virtual int         Main( );
      82             :         virtual void            Init();
      83             :         virtual void            InitFinished();
      84             :         virtual void            DeInit();
      85             :         virtual sal_Bool            QueryExit();
      86             :         virtual sal_uInt16          Exception(sal_uInt16 nError);
      87             :         virtual void            SystemSettingsChanging( AllSettings& rSettings, Window* pFrame );
      88             :         virtual void            AppEvent( const ApplicationEvent& rAppEvent );
      89             : 
      90             :         DECL_LINK(          OpenClients_Impl, void* );
      91             : 
      92             :         static void             OpenClients();
      93             :         static void             OpenDefault();
      94             : 
      95             :         DECL_LINK( EnableAcceptors_Impl, void*);
      96             : 
      97             :         static void             HandleAppEvent( const ApplicationEvent& rAppEvent );
      98             :         static ResMgr*          GetDesktopResManager();
      99             :         static CommandLineArgs& GetCommandLineArgs();
     100             : 
     101             :         void                    HandleBootstrapErrors(
     102             :             BootstrapError nError, OUString const & aMessage );
     103           0 :         void                    SetBootstrapError(
     104             :             BootstrapError nError, OUString const & aMessage )
     105             :         {
     106           0 :             if ( m_aBootstrapError == BE_OK )
     107             :             {
     108           0 :                 m_aBootstrapError = nError;
     109           0 :                 m_aBootstrapErrorMessage = aMessage;
     110             :             }
     111           0 :         }
     112             : 
     113           0 :         void                    SetBootstrapStatus( BootstrapStatus nStatus )
     114             :         {
     115           0 :             m_aBootstrapStatus = nStatus;
     116           0 :         }
     117           0 :         BootstrapStatus          GetBootstrapStatus() const
     118             :         {
     119           0 :             return m_aBootstrapStatus;
     120             :         }
     121             : 
     122             :         static sal_Bool         isCrashReporterEnabled();
     123             : 
     124             :         // first-start (ever) related methods
     125             :         static sal_Bool         CheckExtensionDependencies();
     126             : 
     127             :         static void             DoRestartActionsIfNecessary( sal_Bool bQuickStart );
     128             :         static void             SetRestartState();
     129             : 
     130             :         void                    SynchronizeExtensionRepositories();
     131             :         void                    SetSplashScreenText( const ::rtl::OUString& rText );
     132             :         void                    SetSplashScreenProgress( sal_Int32 );
     133             : 
     134             :         // Bootstrap methods
     135             :         static void             InitApplicationServiceManager();
     136             :             // throws an exception upon failure
     137             : 
     138             :     private:
     139             :         void RegisterServices(
     140             :             com::sun::star::uno::Reference<
     141             :                 com::sun::star::uno::XComponentContext > const & context);
     142             :         void                    DeregisterServices();
     143             : 
     144             :         void                    CreateTemporaryDirectory();
     145             :         void                    RemoveTemporaryDirectory();
     146             : 
     147             :         sal_Bool                InitializeInstallation( const rtl::OUString& rAppFilename );
     148             :         bool                    InitializeConfiguration();
     149             :         void                    FlushConfiguration();
     150             :         static sal_Bool         shouldLaunchQuickstart();
     151             :         sal_Bool                InitializeQuickstartMode( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr );
     152             : 
     153             :         void                    HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const ::rtl::OUString& aMsg );
     154             :         void                    StartSetup( const ::rtl::OUString& aParameters );
     155             : 
     156             :         // Create a error message depending on bootstrap failure code and an optional file url
     157             :         ::rtl::OUString         CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode,
     158             :                                                       const ::rtl::OUString& aFileURL );
     159             : 
     160             :         static void             PreloadModuleData( const CommandLineArgs& );
     161             :         static void             PreloadConfigurationData();
     162             : 
     163             :         Reference<XStatusIndicator> m_rSplashScreen;
     164             :         void                    OpenSplashScreen();
     165             :         void                    CloseSplashScreen();
     166             : 
     167             :         void                    EnableOleAutomation();
     168             :                                 DECL_LINK( ImplInitFilterHdl, ConvertData* );
     169             :         DECL_LINK(          AsyncInitFirstRun, void* );
     170             :         /** checks if the office is run the first time
     171             :             <p>If so, <method>DoFirstRunInitializations</method> is called (asynchronously and delayed) and the
     172             :             respective flag in the configuration is reset.</p>
     173             :         */
     174             :         void                    CheckFirstRun( );
     175             : 
     176             :         /// does initializations which are necessary for the first run of the office
     177             :         void                    DoFirstRunInitializations();
     178             : 
     179             :         static void             ShowBackingComponent(Desktop * progress);
     180             : 
     181             :         static sal_Bool         SaveTasks();
     182             : 
     183             :         static void             retrieveCrashReporterState();
     184             :         static sal_Bool         isUIOnSessionShutdownAllowed();
     185             : 
     186             :         // on-demand acceptors
     187             :         static void                         createAcceptor(const rtl::OUString& aDescription);
     188             :         static void                         enableAcceptors();
     189             :         static void                         destroyAcceptor(const rtl::OUString& aDescription);
     190             : 
     191             :         bool                            m_bCleanedExtensionCache;
     192             :         bool                            m_bServicesRegistered;
     193             :         BootstrapError                  m_aBootstrapError;
     194             :         OUString                        m_aBootstrapErrorMessage;
     195             :         BootstrapStatus                 m_aBootstrapStatus;
     196             : 
     197             :         boost::scoped_ptr<Lockfile> m_xLockfile;
     198             :         Timer    m_firstRunTimer;
     199             : 
     200             :         static ResMgr*                  pResMgr;
     201             : };
     202             : 
     203             : }
     204             : 
     205             : #endif // _DESKTOP_APP_HXX_
     206             : 
     207             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10