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 : #include "sal/config.h"
21 :
22 : #include "desktopdllapi.h"
23 :
24 : #include "app.hxx"
25 : #include "cmdlineargs.hxx"
26 : #include "cmdlinehelp.hxx"
27 :
28 : #include <rtl/logfile.hxx>
29 : #include <rtl/bootstrap.hxx>
30 : #include <tools/extendapplicationenvironment.hxx>
31 :
32 : int SVMain();
33 :
34 : // -=-= main() -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
35 :
36 0 : extern "C" int DESKTOP_DLLPUBLIC soffice_main()
37 : {
38 : #if defined ANDROID
39 : try {
40 : rtl::Bootstrap::setIniFilename(
41 : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///assets/program/lofficerc")));
42 : #endif
43 0 : tools::extendApplicationEnvironment();
44 :
45 0 : RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Main()" );
46 :
47 0 : desktop::Desktop aDesktop;
48 : // This string is used during initialization of the Gtk+ VCL module
49 0 : aDesktop.SetAppName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("soffice")) );
50 : #ifdef UNX
51 : // handle --version and --help already here, otherwise they would be handled
52 : // after VCL initialization that might fail if $DISPLAY is not set
53 0 : const desktop::CommandLineArgs& rCmdLineArgs = aDesktop.GetCommandLineArgs();
54 0 : OUString aUnknown( rCmdLineArgs.GetUnknown() );
55 0 : if ( !aUnknown.isEmpty() )
56 : {
57 0 : desktop::Desktop::InitApplicationServiceManager();
58 0 : desktop::displayCmdlineHelp( aUnknown );
59 0 : return EXIT_FAILURE;
60 : }
61 0 : if ( rCmdLineArgs.IsHelp() )
62 : {
63 0 : desktop::Desktop::InitApplicationServiceManager();
64 0 : desktop::displayCmdlineHelp( OUString() );
65 0 : return EXIT_SUCCESS;
66 : }
67 0 : if ( rCmdLineArgs.IsVersion() )
68 : {
69 0 : desktop::Desktop::InitApplicationServiceManager();
70 0 : desktop::displayVersion();
71 0 : return EXIT_SUCCESS;
72 : }
73 : #endif
74 0 : return SVMain();
75 : #if defined ANDROID
76 : } catch (const ::com::sun::star::uno::Exception &e) {
77 : fprintf (stderr, "Not handled UNO exception at main: '%s'\n",
78 : rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
79 : throw; // to get exception type printed
80 : }
81 : #endif
82 : }
83 :
84 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|