1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include <sal/log.hxx>
22 #include <comphelper/diagnose_ex.hxx>
23 #include <tools/extendapplicationenvironment.hxx>
24 #include <cppuhelper/bootstrap.hxx>
25 #include <comphelper/processfactory.hxx>
26 #include <i18nlangtag/languagetag.hxx>
27 #include <i18nlangtag/mslangid.hxx>
28 #include <framework/desktop.hxx>
30 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31 #include <com/sun/star/uno/XComponentContext.hpp>
33 #include <vcl/event.hxx>
34 #include <vcl/svapp.hxx>
35 #include <vcl/wrkwin.hxx>
37 using namespace ::com::sun::star::uno
;
38 using namespace ::com::sun::star::lang
;
41 // Forward declaration
48 tools::extendApplicationEnvironment();
50 Reference
< XComponentContext
> xContext
= defaultBootstrap_InitialComponentContext();
51 Reference
< XMultiServiceFactory
> xServiceManager( xContext
->getServiceManager(), UNO_QUERY
);
53 if( !xServiceManager
.is() )
54 Application::Abort( "Failed to bootstrap" );
56 comphelper::setProcessServiceFactory( xServiceManager
);
58 LanguageTag::setConfiguredSystemLanguage(MsLangId::getSystemLanguage());
63 framework::getDesktop(::comphelper::getProcessComponentContext())->terminate();
67 catch (const Exception
&)
69 TOOLS_WARN_EXCEPTION("vcl.app", "Fatal");
72 catch (const std::exception
&e
)
74 fprintf(stderr
, "fatal error: %s\n", e
.what());
83 class MyWin
: public WorkWindow
86 MyWin( vcl::Window
* pParent
, WinBits nWinStyle
);
93 ScopedVclPtrInstance
< MyWin
> aMainWin( nullptr, WB_APP
| WB_STDWORK
);
94 aMainWin
->SetText("VCL - Workbench");
97 Application::Execute();
100 MyWin::MyWin( vcl::Window
* pParent
, WinBits nWinStyle
) :
101 WorkWindow( pParent
, nWinStyle
)
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */