Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / vcl / workben / svdem.cxx
blob64960323596e606f11652ec7727cdd852e3b170b
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 <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;
36 using namespace cppu;
38 // Forward declaration
39 void Main();
41 SAL_IMPLEMENT_MAIN()
43 try
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 );
55 InitVCL();
56 ::Main();
57 DeInitVCL();
59 catch (const Exception& e)
61 SAL_WARN("vcl.app", "Fatal exception: " << e.Message);
62 return 1;
64 catch (const std::exception &e)
66 fprintf(stderr, "fatal error: %s\n", e.what());
67 return 1;
70 return 0;
73 class MyWin : public WorkWindow
75 public:
76 MyWin( vcl::Window* pParent, WinBits nWinStyle );
79 void Main()
81 ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_APP | WB_STDWORK );
82 aMainWin->SetText("VCL - Workbench");
83 aMainWin->Show();
85 Application::Execute();
88 MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
89 WorkWindow( pParent, nWinStyle )
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */