OInterfaceContainerHelper3 needs to be thread-safe
[LibreOffice.git] / vcl / workben / svdem.cxx
blob399a3683f8533892a68ac4fa1194f4a37f8a43a2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <sal/main.h>
21 #include <sal/log.hxx>
22 #include <tools/diagnose_ex.h>
23 #include <tools/extendapplicationenvironment.hxx>
25 #include <cppuhelper/bootstrap.hxx>
26 #include <comphelper/processfactory.hxx>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <vcl/event.hxx>
32 #include <vcl/svapp.hxx>
33 #include <vcl/wrkwin.hxx>
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::lang;
37 using namespace cppu;
39 // Forward declaration
40 static void Main();
42 SAL_IMPLEMENT_MAIN()
44 try
46 tools::extendApplicationEnvironment();
48 Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext();
49 Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
51 if( !xServiceManager.is() )
52 Application::Abort( "Failed to bootstrap" );
54 comphelper::setProcessServiceFactory( xServiceManager );
56 InitVCL();
57 ::Main();
58 DeInitVCL();
60 catch (const Exception&)
62 TOOLS_WARN_EXCEPTION("vcl.app", "Fatal");
63 return 1;
65 catch (const std::exception &e)
67 fprintf(stderr, "fatal error: %s\n", e.what());
68 return 1;
71 return 0;
74 namespace {
76 class MyWin : public WorkWindow
78 public:
79 MyWin( vcl::Window* pParent, WinBits nWinStyle );
84 void Main()
86 ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_APP | WB_STDWORK );
87 aMainWin->SetText("VCL - Workbench");
88 aMainWin->Show();
90 Application::Execute();
93 MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
94 WorkWindow( pParent, nWinStyle )
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */