1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_vcl.hxx"
32 #include <tools/extendapplicationenvironment.hxx>
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 #include <vcl/event.hxx>
36 #include <vcl/svapp.hxx>
37 #include <vcl/wrkwin.hxx>
38 #include <vcl/msgbox.hxx>
39 #include <vcl/introwin.hxx>
40 #include <vcl/msgbox.hxx>
42 #include <comphelper/processfactory.hxx>
43 #include <cppuhelper/servicefactory.hxx>
44 #include <cppuhelper/bootstrap.hxx>
49 using namespace ::com::sun::star::uno
;
50 using namespace ::com::sun::star::lang
;
51 // -----------------------------------------------------------------------
53 // Forward declaration
56 // -----------------------------------------------------------------------
60 tools::extendApplicationEnvironment();
62 Reference
< XMultiServiceFactory
> xMS
;
63 xMS
= cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True
);
72 // -----------------------------------------------------------------------
74 class MyWin
: public WorkWindow
77 MyWin( Window
* pParent
, WinBits nWinStyle
);
79 void MouseMove( const MouseEvent
& rMEvt
);
80 void MouseButtonDown( const MouseEvent
& rMEvt
);
81 void MouseButtonUp( const MouseEvent
& rMEvt
);
82 void KeyInput( const KeyEvent
& rKEvt
);
83 void KeyUp( const KeyEvent
& rKEvt
);
84 void Paint( const Rectangle
& rRect
);
88 // -----------------------------------------------------------------------
99 MyWin
aMainWin( NULL
, WB_APP
| WB_STDWORK
);
100 aMainWin
.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCLDemo - VCL Workbench" ) ) );
104 InfoBox ib(NULL, String((sal_Char*)"Test", sizeof("Test")));
108 Application::Execute();
111 // -----------------------------------------------------------------------
113 MyWin::MyWin( Window
* pParent
, WinBits nWinStyle
) :
114 WorkWindow( pParent
, nWinStyle
)
118 // -----------------------------------------------------------------------
120 void MyWin::MouseMove( const MouseEvent
& rMEvt
)
122 WorkWindow::MouseMove( rMEvt
);
125 // -----------------------------------------------------------------------
127 void MyWin::MouseButtonDown( const MouseEvent
& rMEvt
)
129 Rectangle
aRect(0,0,4,4);
130 aRect
.SetPos( rMEvt
.GetPosPixel() );
131 SetFillColor(Color(COL_RED
));
135 // -----------------------------------------------------------------------
137 void MyWin::MouseButtonUp( const MouseEvent
& rMEvt
)
139 WorkWindow::MouseButtonUp( rMEvt
);
142 // -----------------------------------------------------------------------
144 void MyWin::KeyInput( const KeyEvent
& rKEvt
)
146 WorkWindow::KeyInput( rKEvt
);
149 // -----------------------------------------------------------------------
151 void MyWin::KeyUp( const KeyEvent
& rKEvt
)
153 WorkWindow::KeyUp( rKEvt
);
156 // -----------------------------------------------------------------------
158 void MyWin::Paint( const Rectangle
& rRect
)
160 fprintf(stderr
, "MyWin::Paint(%ld,%ld,%ld,%ld)\n", rRect
.getX(), rRect
.getY(), rRect
.getWidth(), rRect
.getHeight());
162 Size
aSz(GetSizePixel());
164 Rectangle
r(aPt
, aSz
);
166 SetFillColor(Color(COL_BLUE
));
167 SetLineColor(Color(COL_YELLOW
));
171 for(int i
=0; i
<aSz
.Height(); i
+=15)
172 DrawLine( Point(r
.nLeft
, r
.nTop
+i
), Point(r
.nRight
, r
.nBottom
-i
) );
173 for(int i
=0; i
<aSz
.Width(); i
+=15)
174 DrawLine( Point(r
.nLeft
+i
, r
.nBottom
), Point(r
.nRight
-i
, r
.nTop
) );
176 SetTextColor( Color( COL_WHITE
) );
177 Font
aFont( String( RTL_CONSTASCII_USTRINGPARAM( "Times" ) ), Size( 0, 25 ) );
179 DrawText( Point( 20, 30 ), String( RTL_CONSTASCII_USTRINGPARAM( "Just a simple test text" ) ) );
182 // -----------------------------------------------------------------------
186 WorkWindow::Resize();