LCOV - code coverage report
Current view: top level - desktop/source/app - sofficemain.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 15 66.7 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 16 36 44.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "sal/config.h"
      30                 :            : 
      31                 :            : #include "desktopdllapi.h"
      32                 :            : 
      33                 :            : #include "app.hxx"
      34                 :            : #include "cmdlineargs.hxx"
      35                 :            : #include "cmdlinehelp.hxx"
      36                 :            : 
      37                 :            : #include <rtl/logfile.hxx>
      38                 :            : #include <rtl/bootstrap.hxx>
      39                 :            : #include <tools/extendapplicationenvironment.hxx>
      40                 :            : 
      41                 :            : #if defined WNT
      42                 :            : #define WIN32_LEAN_AND_MEAN
      43                 :            : #include <windows.h>
      44                 :            : #endif
      45                 :            : 
      46                 :            : int SVMain();
      47                 :            : 
      48                 :            : // -=-= main() -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      49                 :            : 
      50                 :        158 : extern "C" int DESKTOP_DLLPUBLIC soffice_main()
      51                 :            : {
      52                 :            : #if defined ANDROID || defined WNT
      53                 :            :     try {
      54                 :            : #endif
      55                 :            : #if defined(ANDROID)
      56                 :            :         rtl::Bootstrap::setIniFilename(
      57                 :            :                 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///assets/program/lofficerc")));
      58                 :            : #endif
      59         [ +  - ]:        158 :     tools::extendApplicationEnvironment();
      60                 :            : 
      61         [ +  - ]:        158 :     RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Main()" );
      62                 :            : 
      63         [ +  - ]:        158 :     desktop::Desktop aDesktop;
      64                 :            :     // This string is used during initialization of the Gtk+ VCL module
      65 [ +  - ][ +  - ]:        158 :     aDesktop.SetAppName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("soffice")) );
         [ +  - ][ +  - ]
      66                 :            : #ifdef UNX
      67                 :            :     // handle --version and --help already here, otherwise they would be handled
      68                 :            :     // after VCL initialization that might fail if $DISPLAY is not set
      69         [ +  - ]:        158 :     const desktop::CommandLineArgs& rCmdLineArgs = aDesktop.GetCommandLineArgs();
      70 [ +  - ][ -  + ]:        158 :     if ( rCmdLineArgs.IsHelp() )
      71                 :            :     {
      72         [ #  # ]:          0 :         desktop::displayCmdlineHelp();
      73                 :          0 :         return EXIT_SUCCESS;
      74                 :            :     }
      75 [ +  - ][ -  + ]:        158 :     else if ( rCmdLineArgs.IsVersion() )
      76                 :            :     {
      77         [ #  # ]:          0 :         desktop::displayVersion();
      78                 :          0 :         return EXIT_SUCCESS;
      79                 :            :     }
      80 [ +  - ][ -  + ]:        158 :     else if ( rCmdLineArgs.HasUnknown() )
      81                 :            :     {
      82                 :          0 :         return EXIT_FAILURE;
      83                 :            :     }
      84                 :            : #endif
      85 [ +  - ][ +  - ]:        158 :     return SVMain();
      86                 :            : #if defined ANDROID || defined WNT
      87                 :            :     } catch (const ::com::sun::star::uno::Exception &e) {
      88                 :            : #if defined ANDROID
      89                 :            :         fprintf (stderr, "Not handled UNO exception at main: '%s'\n",
      90                 :            :                  rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
      91                 :            : #elif defined WNT
      92                 :            :         MessageBoxW(
      93                 :            :             0,
      94                 :            :             reinterpret_cast< LPCWSTR >(
      95                 :            :                 rtl::OUString("Unhandled exception:\n" + e.Message).getStr()),
      96                 :            :             reinterpret_cast< LPCWSTR >(rtl::OUString("Fatal Error").getStr()),
      97                 :            :             (MB_OK | MB_ICONERROR | MB_DEFBUTTON1 | MB_TASKMODAL
      98                 :            :              | MB_SETFOREGROUND | MB_TOPMOST));
      99                 :            : #endif
     100                 :            :         throw; // to get exception type printed
     101                 :            :     }
     102                 :            : #endif
     103                 :            : }
     104                 :            : 
     105                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10