Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <sal/main.h>
21 : #include <tools/extendapplicationenvironment.hxx>
22 :
23 : #include <cppuhelper/bootstrap.hxx>
24 : #include <comphelper/processfactory.hxx>
25 :
26 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 : #include <com/sun/star/uno/XComponentContext.hpp>
28 :
29 : #include <vcl/event.hxx>
30 : #include <vcl/svapp.hxx>
31 : #include <vcl/wrkwin.hxx>
32 : #include <vcl/msgbox.hxx>
33 :
34 : using namespace ::com::sun::star::uno;
35 : using namespace ::com::sun::star::lang;
36 : using namespace cppu;
37 :
38 : // Forward declaration
39 : void Main();
40 :
41 0 : SAL_IMPLEMENT_MAIN()
42 : {
43 0 : tools::extendApplicationEnvironment();
44 :
45 0 : Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext();
46 0 : Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
47 :
48 0 : if( !xServiceManager.is() )
49 0 : Application::Abort( "Failed to bootstrap" );
50 :
51 0 : comphelper::setProcessServiceFactory( xServiceManager );
52 :
53 0 : InitVCL();
54 0 : ::Main();
55 0 : DeInitVCL();
56 :
57 0 : return 0;
58 : }
59 :
60 0 : class MyWin : public WorkWindow
61 : {
62 : public:
63 : MyWin( vcl::Window* pParent, WinBits nWinStyle );
64 :
65 : void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
66 : void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
67 : void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
68 : void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
69 : void KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
70 : void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
71 : void Resize() SAL_OVERRIDE;
72 : };
73 :
74 0 : void Main()
75 : {
76 0 : MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
77 0 : aMainWin.SetText(OUString("VCL - Workbench"));
78 0 : aMainWin.Show();
79 :
80 0 : Application::Execute();
81 0 : }
82 :
83 0 : MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
84 0 : WorkWindow( pParent, nWinStyle )
85 : {
86 0 : }
87 :
88 0 : void MyWin::MouseMove( const MouseEvent& rMEvt )
89 : {
90 0 : WorkWindow::MouseMove( rMEvt );
91 0 : }
92 :
93 0 : void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
94 : {
95 0 : WorkWindow::MouseButtonDown( rMEvt );
96 0 : }
97 :
98 0 : void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
99 : {
100 0 : WorkWindow::MouseButtonUp( rMEvt );
101 0 : }
102 :
103 0 : void MyWin::KeyInput( const KeyEvent& rKEvt )
104 : {
105 0 : WorkWindow::KeyInput( rKEvt );
106 0 : }
107 :
108 0 : void MyWin::KeyUp( const KeyEvent& rKEvt )
109 : {
110 0 : WorkWindow::KeyUp( rKEvt );
111 0 : }
112 :
113 0 : void MyWin::Paint( const Rectangle& rRect )
114 : {
115 0 : WorkWindow::Paint( rRect );
116 0 : }
117 :
118 0 : void MyWin::Resize()
119 : {
120 0 : WorkWindow::Resize();
121 0 : }
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|