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 <tools/extendapplicationenvironment.hxx>
23 #include <cppuhelper/bootstrap.hxx>
24 #include <comphelper/processfactory.hxx>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/uno/XComponentContext.hpp>
29 #include <vcl/event.hxx>
30 #include <vcl/svapp.hxx>
31 #include <vcl/wrkwin.hxx>
32 #include <vcl/msgbox.hxx>
34 using namespace ::com::sun::star::uno
;
35 using namespace ::com::sun::star::lang
;
38 // Forward declaration
45 tools::extendApplicationEnvironment();
47 Reference
< XComponentContext
> xContext
= defaultBootstrap_InitialComponentContext();
48 Reference
< XMultiServiceFactory
> xServiceManager( xContext
->getServiceManager(), UNO_QUERY
);
50 if( !xServiceManager
.is() )
51 Application::Abort( "Failed to bootstrap" );
53 comphelper::setProcessServiceFactory( xServiceManager
);
59 catch (const Exception
& e
)
61 SAL_WARN("vcl.app", "Fatal exception: " << e
.Message
);
64 catch (const std::exception
&e
)
66 fprintf(stderr
, "fatal error: %s\n", e
.what());
73 class MyWin
: public WorkWindow
76 MyWin( vcl::Window
* pParent
, WinBits nWinStyle
);
81 ScopedVclPtrInstance
< MyWin
> aMainWin( nullptr, WB_APP
| WB_STDWORK
);
82 aMainWin
->SetText("VCL - Workbench");
85 Application::Execute();
88 MyWin::MyWin( vcl::Window
* pParent
, WinBits nWinStyle
) :
89 WorkWindow( pParent
, nWinStyle
)
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */