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 :
22 : #include <cppuhelper/bootstrap.hxx>
23 : #include <comphelper/processfactory.hxx>
24 :
25 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 : #include <com/sun/star/uno/XComponentContext.hpp>
27 :
28 : #include <vcl/event.hxx>
29 : #include <vcl/svapp.hxx>
30 : #include <vcl/wrkwin.hxx>
31 : #include <tools/extendapplicationenvironment.hxx>
32 :
33 : #include <svx/dlgctrl.hxx>
34 :
35 : #include <rtl/strbuf.hxx>
36 : #include <rtl/ustrbuf.hxx>
37 :
38 : #include <math.h>
39 :
40 : using namespace ::com::sun::star::uno;
41 : using namespace ::com::sun::star::lang;
42 : using namespace cppu;
43 :
44 : // Forward declaration
45 : void Main();
46 :
47 0 : SAL_IMPLEMENT_MAIN()
48 : {
49 0 : tools::extendApplicationEnvironment();
50 :
51 : // create the global service-manager
52 0 : Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext();
53 0 : Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
54 :
55 0 : if( !xServiceManager.is() )
56 0 : Application::Abort( "Failed to bootstrap" );
57 :
58 0 : comphelper::setProcessServiceFactory( xServiceManager );
59 :
60 0 : InitVCL();
61 0 : ::Main();
62 0 : DeInitVCL();
63 :
64 0 : return 0;
65 : }
66 :
67 0 : class MyWin : public WorkWindow
68 : {
69 : SvxPixelCtl maPixelCtl;
70 :
71 : public:
72 : MyWin( vcl::Window* pParent, WinBits nWinStyle );
73 :
74 : void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
75 : void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
76 : void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
77 : void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
78 : void KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
79 : void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
80 : void Resize() SAL_OVERRIDE;
81 :
82 : bool Close() SAL_OVERRIDE;
83 : };
84 :
85 0 : void Main()
86 : {
87 0 : MyWin aMainWin( NULL, WB_STDWORK );
88 0 : aMainWin.SetText( OUString( "SvxPixelCtl" ) );
89 0 : aMainWin.Show();
90 :
91 0 : Application::Execute();
92 0 : }
93 :
94 0 : MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
95 : WorkWindow( pParent, nWinStyle ),
96 0 : maPixelCtl( this )
97 : {
98 0 : maPixelCtl.SetPosSizePixel( Point( 10, 10 ), Size( 200, 200 ) );
99 0 : maPixelCtl.Show();
100 :
101 0 : }
102 :
103 0 : bool MyWin::Close()
104 : {
105 0 : bool bRet = WorkWindow::Close();
106 0 : if( bRet )
107 0 : Application::Quit();
108 0 : return bRet;
109 : }
110 :
111 0 : void MyWin::MouseMove( const MouseEvent& rMEvt )
112 : {
113 0 : WorkWindow::MouseMove( rMEvt );
114 0 : }
115 :
116 0 : void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
117 : {
118 0 : WorkWindow::MouseButtonDown( rMEvt );
119 0 : }
120 :
121 0 : void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
122 : {
123 0 : WorkWindow::MouseButtonUp( rMEvt );
124 0 : }
125 :
126 0 : void MyWin::KeyInput( const KeyEvent& rKEvt )
127 : {
128 0 : WorkWindow::KeyInput( rKEvt );
129 0 : }
130 :
131 0 : void MyWin::KeyUp( const KeyEvent& rKEvt )
132 : {
133 0 : WorkWindow::KeyUp( rKEvt );
134 0 : }
135 :
136 0 : void MyWin::Paint( const Rectangle& rRect )
137 : {
138 0 : WorkWindow::Paint( rRect );
139 0 : }
140 :
141 0 : void MyWin::Resize()
142 : {
143 0 : WorkWindow::Resize();
144 0 : }
145 :
146 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|