bump product version to 5.0.4.1
[LibreOffice.git] / vcl / workben / svdem.cxx
blob365ad38048e475a58e809c3ee1a4fa1bd2eb0bdd
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;
65 return 0;
68 class MyWin : public WorkWindow
70 public:
71 MyWin( vcl::Window* pParent, WinBits nWinStyle );
73 void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
74 void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
75 void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
76 void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
77 void KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
78 void Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect ) SAL_OVERRIDE;
79 void Resize() SAL_OVERRIDE;
82 void Main()
84 ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_APP | WB_STDWORK );
85 aMainWin->SetText(OUString("VCL - Workbench"));
86 aMainWin->Show();
88 Application::Execute();
91 MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
92 WorkWindow( pParent, nWinStyle )
96 void MyWin::MouseMove( const MouseEvent& rMEvt )
98 WorkWindow::MouseMove( rMEvt );
101 void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
103 WorkWindow::MouseButtonDown( rMEvt );
106 void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
108 WorkWindow::MouseButtonUp( rMEvt );
111 void MyWin::KeyInput( const KeyEvent& rKEvt )
113 WorkWindow::KeyInput( rKEvt );
116 void MyWin::KeyUp( const KeyEvent& rKEvt )
118 WorkWindow::KeyUp( rKEvt );
121 void MyWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
123 WorkWindow::Paint(rRenderContext, rRect);
126 void MyWin::Resize()
128 WorkWindow::Resize();
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */