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
);
68 class MyWin
: public WorkWindow
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
;
84 ScopedVclPtrInstance
< MyWin
> aMainWin( nullptr, WB_APP
| WB_STDWORK
);
85 aMainWin
->SetText(OUString("VCL - Workbench"));
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
);
128 WorkWindow::Resize();
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */