xref: /aoo41x/main/toolkit/workben/controls.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_toolkit.hxx"
30*cdf0e10cSrcweir #include <tools/debug.hxx>
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <vcl/window.hxx>
33*cdf0e10cSrcweir #include <vcl/svapp.hxx>
34*cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
35*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #include <stardiv/uno/awt/window.hxx>
39*cdf0e10cSrcweir #include <stardiv/uno/awt/vclwin.hxx>
40*cdf0e10cSrcweir #include <stardiv/uno/awt/printer.hxx>
41*cdf0e10cSrcweir #include <stardiv/uno/repos/serinfo.hxx>
42*cdf0e10cSrcweir #include <stardiv/uno/lang/factory.hxx>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir #include <unoctrl.hxx>
46*cdf0e10cSrcweir // #include <unoctrl2.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <svtools/unoiface.hxx>	// InitExtToolkit
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir UsrAny UsrAny_UINT16( UINT16 n )
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir 	UsrAny aVal;
53*cdf0e10cSrcweir 	aVal.setUINT16( n );
54*cdf0e10cSrcweir 	return aVal;
55*cdf0e10cSrcweir }
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir // -----------------------------------------------------------------------
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir class MyApp : public Application
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir public:
62*cdf0e10cSrcweir     void        Main();
63*cdf0e10cSrcweir };
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir MyApp aMyApp;
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir // -----------------------------------------------------------------------
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir class MyWin : public WorkWindow
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir 	XControlRef				xCtrl;
72*cdf0e10cSrcweir 	XPropertySetRef			xCtrlModel;
73*cdf0e10cSrcweir 	XControlContainerRef	xCont;
74*cdf0e10cSrcweir 	XPropertySetRef			xContModel;
75*cdf0e10cSrcweir 	XControlRef				xDrawCtrl;
76*cdf0e10cSrcweir 	XGraphicsRef			xG;
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir public:
79*cdf0e10cSrcweir                 MyWin( Window* pParent, WinBits nWinStyle );
80*cdf0e10cSrcweir                 ~MyWin();
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir     void        MouseButtonDown( const MouseEvent& rMEvt );
83*cdf0e10cSrcweir     void        Resize();
84*cdf0e10cSrcweir     void        Paint( const Rectangle& r );
85*cdf0e10cSrcweir };
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir // -----------------------------------------------------------------------
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir void MyApp::Main()
90*cdf0e10cSrcweir {
91*cdf0e10cSrcweir 	createAndSetDefaultServiceManager();
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir     MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
94*cdf0e10cSrcweir     aMainWin.SetText( "Uno-Controls - Workbench" );
95*cdf0e10cSrcweir     aMainWin.Show();
96*cdf0e10cSrcweir     Execute();
97*cdf0e10cSrcweir }
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir // -----------------------------------------------------------------------
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir MyWin::MyWin( Window* pParent, WinBits nWinStyle ) :
102*cdf0e10cSrcweir     WorkWindow( pParent, nWinStyle )
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir // -----------------------------------------------------------------------
107*cdf0e10cSrcweir MyWin::~MyWin()
108*cdf0e10cSrcweir {
109*cdf0e10cSrcweir 	XComponentRef xC1( xCont, USR_QUERY );
110*cdf0e10cSrcweir 	xC1->dispose();
111*cdf0e10cSrcweir 	XComponentRef xC2( xContModel, USR_QUERY );
112*cdf0e10cSrcweir 	xC2->dispose();
113*cdf0e10cSrcweir }
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir // -----------------------------------------------------------------------
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
118*cdf0e10cSrcweir {
119*cdf0e10cSrcweir 	if( rMEvt.GetClicks() == 2 )
120*cdf0e10cSrcweir 	{
121*cdf0e10cSrcweir 		XViewRef xV( xDrawCtrl, USR_QUERY );
122*cdf0e10cSrcweir 		XWindowRef xC( xDrawCtrl, USR_QUERY );
123*cdf0e10cSrcweir 		xV->draw( xC->getPosSize().Left(), xC->getPosSize().Top() );
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 		// Printer Testen...
126*cdf0e10cSrcweir /*
127*cdf0e10cSrcweir 		XServiceManagerRef xProv = getGlobalServiceManager();
128*cdf0e10cSrcweir 		XServiceProviderRef xSSI = xProv->queryServiceProvider( L"stardiv.vcl.PrinterServer" );
129*cdf0e10cSrcweir 		XPrinterServerRef xPrinterServer( xSSI->createInstance(), USR_QUERY );
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 		Sequence< UString >	aPrinterNames = xPrinterServer->getPrinterNames();
132*cdf0e10cSrcweir 		USHORT nPrinters = aPrinterNames.getLen();
133*cdf0e10cSrcweir 		String aInfo( "Printers: " );
134*cdf0e10cSrcweir 		aInfo += nPrinters;
135*cdf0e10cSrcweir 		if ( nPrinters )
136*cdf0e10cSrcweir 		{
137*cdf0e10cSrcweir 			for ( USHORT n = 0; n < nPrinters; n++ )
138*cdf0e10cSrcweir 			{
139*cdf0e10cSrcweir 				aInfo += '\n';
140*cdf0e10cSrcweir 				aInfo += OUStringToString( aPrinterNames.getConstArray()[n], CHARSET_SYSTEM );
141*cdf0e10cSrcweir 			}
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 			XPrinterRef xPrinter = xPrinterServer->createPrinter( aPrinterNames.getConstArray()[0] );
144*cdf0e10cSrcweir 			xPrinter->start( L"UNOPrinterTest", 1, TRUE );
145*cdf0e10cSrcweir 			XDeviceRef xDev = xPrinter->startPage();
146*cdf0e10cSrcweir 			XGraphicsRef xGraphics = xDev->createGraphics();
147*cdf0e10cSrcweir 			xGraphics->drawText( 200, 200, L"Printed with UNO"  );
148*cdf0e10cSrcweir 			xPrinter->endPage();
149*cdf0e10cSrcweir 			xPrinter->end();
150*cdf0e10cSrcweir 		}
151*cdf0e10cSrcweir 		InfoBox( this, aInfo ).Execute();
152*cdf0e10cSrcweir */
153*cdf0e10cSrcweir 	}
154*cdf0e10cSrcweir 	else if( rMEvt.GetClicks() == 1 )
155*cdf0e10cSrcweir 	{
156*cdf0e10cSrcweir 		if( xContModel )
157*cdf0e10cSrcweir 		{
158*cdf0e10cSrcweir 			static INT32 nColor = 0x001788ab;
159*cdf0e10cSrcweir  			xContModel->setPropertyValue( L"BackgroundColor", UsrAny( nColor ) );
160*cdf0e10cSrcweir 			nColor += 0x00111111;
161*cdf0e10cSrcweir 			nColor &= 0xFFFFFF;
162*cdf0e10cSrcweir 		}
163*cdf0e10cSrcweir 		else
164*cdf0e10cSrcweir 		{
165*cdf0e10cSrcweir 			XServiceManagerRef xProv = getGlobalServiceManager();
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 			XMultiServiceFactoryRef xMSF = NAMESPACE_USR( getProcessServiceManager )();
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir 			XServiceProviderRef xSSI = xProv->queryServiceProvider( L"stardiv.vcl.VclToolkit" );
170*cdf0e10cSrcweir 			XToolkitRef xToolkit( xMSF->createInstance( L"stardiv.vcl.VclToolkit" ), USR_QUERY );
171*cdf0e10cSrcweir 			DBG_ASSERT( xToolkit, "No Toolkit!" );
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 			// Uno Container + Model erzeugen
174*cdf0e10cSrcweir 			XServiceProviderRef xModelProv; // = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.ControlContainer" );
175*cdf0e10cSrcweir 			XInterfaceRef xCMRef( xMSF->createInstance(L"stardiv.vcl.controlmodel.ControlContainer") );
176*cdf0e10cSrcweir 			xCMRef->queryInterface( XPropertySet::getSmartUik(), xContModel );
177*cdf0e10cSrcweir  			xContModel->setPropertyValue( L"Border", UsrAny_UINT16( 1 ) );
178*cdf0e10cSrcweir  			xContModel->setPropertyValue( L"BackgroundColor", UsrAny( (UINT32)0x00CCCCCC) );
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.control.ControlContainer" );
181*cdf0e10cSrcweir 			XInterfaceRef xCCRef( xModelProv->createInstance(), USR_QUERY );
182*cdf0e10cSrcweir 			xCCRef->queryInterface( XControlContainer::getSmartUik(), xCont );
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 			XControlModelRef xCM( xContModel, USR_QUERY );
185*cdf0e10cSrcweir 			XControlRef xContControl( xCont, USR_QUERY );
186*cdf0e10cSrcweir 			xContControl->setModel( xCM );
187*cdf0e10cSrcweir 			XWindowRef xContComp( xCont, USR_QUERY );
188*cdf0e10cSrcweir 			xContComp->setPosSize( 0, 0, 500, 600, PosSize_POSSIZE );
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 			// Zwei EditControls auf einem Model...
191*cdf0e10cSrcweir //			xModelProv = xProv->queryServiceProvider( L"stardiv.uno.awt.UnoControlEditModel" );
192*cdf0e10cSrcweir 			XInterfaceRef xModel( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEditModel") );
193*cdf0e10cSrcweir 			DBG_ASSERT( xModel, "No Model!" );
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 			XPropertySetRef xPSet( xModel, USR_QUERY );
196*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Text", UsrAny( UString( L"Hallo!" ) ) );
197*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"FontName", UsrAny( UString( L"Times New Roman" ) ) );
198*cdf0e10cSrcweir //			xPSet->setPropertyValue( L"FontWeight", UsrAny( 200 ) );
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 			XServiceProviderRef xEditCtrlProv = xProv->queryServiceProvider( L"stardiv.uno.awt.UnoControlEdit" );
201*cdf0e10cSrcweir 			// Edit1
202*cdf0e10cSrcweir 			XControlRef xEdit1( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEdit"), USR_QUERY );
203*cdf0e10cSrcweir 			xModel->queryInterface( XControlModel::getSmartUik(), xCM );
204*cdf0e10cSrcweir 			xEdit1->setModel( xCM );
205*cdf0e10cSrcweir 			XWindowRef xEditCmp1( xEdit1, USR_QUERY );
206*cdf0e10cSrcweir 			xEditCmp1->setPosSize( 50, 50, 100, 60, PosSize_POSSIZE );
207*cdf0e10cSrcweir 			xCont->addControl( L"", xEdit1 );
208*cdf0e10cSrcweir 			// Edit2
209*cdf0e10cSrcweir 			XControlRef xEdit2( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEdit"), USR_QUERY );
210*cdf0e10cSrcweir 			xModel->queryInterface( XControlModel::getSmartUik(), xCM );
211*cdf0e10cSrcweir 			xEdit2->setModel( xCM );
212*cdf0e10cSrcweir 			XWindowRef xEditCmp2( xEdit2, USR_QUERY );
213*cdf0e10cSrcweir 			XLayoutConstrainsRef xL( xEdit2, USR_QUERY );
214*cdf0e10cSrcweir 			if ( xL.is() )
215*cdf0e10cSrcweir 			{
216*cdf0e10cSrcweir 				Size aSz = xL->getPreferredSize();
217*cdf0e10cSrcweir 				xEditCmp2->setPosSize( 100, 180, aSz.Width(), aSz.Height(), PosSize_POSSIZE );
218*cdf0e10cSrcweir 			}
219*cdf0e10cSrcweir 			else
220*cdf0e10cSrcweir 				xEditCmp2->setPosSize( 100, 180, 100, 40, PosSize_POSSIZE );
221*cdf0e10cSrcweir 			xCont->addControl( L"", xEdit2 );
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.NumericField" );
224*cdf0e10cSrcweir 			XInterfaceRef xNumModel( xModelProv->createInstance(), USR_QUERY );
225*cdf0e10cSrcweir 			DBG_ASSERT( xNumModel, "No Model!" );
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 			XServiceProviderRef xNumFieldProv = xProv->queryServiceProvider( L"stardiv.vcl.control.NumericField" );
229*cdf0e10cSrcweir 			XControlRef xNumField( xNumFieldProv->createInstance(), USR_QUERY );
230*cdf0e10cSrcweir 			xNumModel->queryInterface( XControlModel::getSmartUik(), xCM );
231*cdf0e10cSrcweir 			xNumField->setModel( xCM );
232*cdf0e10cSrcweir 			XWindowRef xNumFieldWin( xNumField, USR_QUERY );
233*cdf0e10cSrcweir 			xNumFieldWin->setPosSize( 50, 250, 100, 60, PosSize_POSSIZE );
234*cdf0e10cSrcweir 			xCont->addControl( L"", xNumField );
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 			XMultiPropertySetRef xPSet2( xNumModel, USR_QUERY );
237*cdf0e10cSrcweir 			Sequence<UString> Names( 2 );
238*cdf0e10cSrcweir 			Names.getArray()[0] = L"Value";
239*cdf0e10cSrcweir 			Names.getArray()[1] = L"ValueMin";
240*cdf0e10cSrcweir 			Sequence<UsrAny> Values( 2 );
241*cdf0e10cSrcweir 			Values.getArray()[0] = UsrAny( -2000000.0 );
242*cdf0e10cSrcweir 			Values.getArray()[1] = UsrAny( -2000000.0 );
243*cdf0e10cSrcweir 			xPSet2->setPropertyValues( Names, Values );
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 			// Button...
247*cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.Button" );
248*cdf0e10cSrcweir 			xModelProv->createInstance()->queryInterface( XInterface::getSmartUik(), xModel );
249*cdf0e10cSrcweir 			DBG_ASSERT( xModel, "No Model!" );
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 			xModel->queryInterface( XPropertySet::getSmartUik(), xPSet );
252*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Press!" ) );
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 			XServiceProviderRef xButtonCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.Button" );
255*cdf0e10cSrcweir 			XControlRef xButton1( xButtonCtrlProv->createInstance(), USR_QUERY );
256*cdf0e10cSrcweir 			xModel->queryInterface( XControlModel::getSmartUik(), xCM );
257*cdf0e10cSrcweir 			xButton1->setModel( xCM );
258*cdf0e10cSrcweir 			XWindowRef xButtonCmp1( xButton1, USR_QUERY );
259*cdf0e10cSrcweir 			xButtonCmp1->setPosSize( 170, 80, 80, 80, PosSize_POSSIZE );
260*cdf0e10cSrcweir 			// Unsichtbar, nur im MBDown mit DrawRoutine bei Doppel-Klick...
261*cdf0e10cSrcweir 			xButtonCmp1->setVisible( FALSE );
262*cdf0e10cSrcweir 			xDrawCtrl = xButton1;
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 			xCont->addControl( L"", xButton1 );
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir /*
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 			// ListBox...
269*cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.ListBox" );
270*cdf0e10cSrcweir 			xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
273*cdf0e10cSrcweir 			Sequence<UString> aSeq( 7 );
274*cdf0e10cSrcweir 			aSeq.getArray()[0] = L"Item1";
275*cdf0e10cSrcweir 			aSeq.getArray()[1] = L"Item2";
276*cdf0e10cSrcweir 			aSeq.getArray()[2] = L"Item3";
277*cdf0e10cSrcweir 			aSeq.getArray()[3] = L"Item4";
278*cdf0e10cSrcweir 			aSeq.getArray()[4] = L"Item5";
279*cdf0e10cSrcweir 			aSeq.getArray()[5] = L"Item6";
280*cdf0e10cSrcweir 			aSeq.getArray()[6] = L"Item7";
281*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"StringItemList", UsrAny( &aSeq, Sequence<UString>::getReflection() ) );
282*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"LineCount", UsrAny_UINT16( 4 ) );
283*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Dropdown", UsrAny( (BOOL)TRUE ) );
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir 			XServiceProviderRef xListBoxCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.ListBox" );
286*cdf0e10cSrcweir 			XControlRef xListBox1 = (XControl*)xListBoxCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
287*cdf0e10cSrcweir 			xListBox1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
288*cdf0e10cSrcweir 			XWindowRef xListBoxCmp1 = (XWindow*)xListBox1->queryInterface( XWindow::getSmartUik() );
289*cdf0e10cSrcweir 			xListBoxCmp1->setPosSize( 20, 250, 200, 20, PosSize_POSSIZE );
290*cdf0e10cSrcweir 			xCont->addControl( L"", xListBox1 );
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 			// FixedText...
293*cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.FixedText" );
294*cdf0e10cSrcweir 			xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
295*cdf0e10cSrcweir 			DBG_ASSERT( xModel, "No Model!" );
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
298*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Label:" ) );
299*cdf0e10cSrcweir  			xPSet->setPropertyValue( L"BackgroundColor", UsrAny( (UINT32)0x00888888) );
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 			Font_Attribs aFontAttrs;
302*cdf0e10cSrcweir 			aFontAttrs.Italic = ITALIC_NORMAL;
303*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Font_Attribs", UsrAny( &aFontAttrs, Font_Attribs_getReflection() ) );
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 			XPropertyStateRef xState = (XPropertyState*)xPSet->queryInterface( XPropertyState::getSmartUik() );
306*cdf0e10cSrcweir 			xState->getPropertyState( L"Font_Attribs" );
307*cdf0e10cSrcweir 			xState->getPropertyState( L"Font_Size" );
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 			XServiceProviderRef xFixedTextCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.FixedText" );
310*cdf0e10cSrcweir 			XControlRef xFixedText1 = (XControl*)xFixedTextCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
311*cdf0e10cSrcweir 			DBG_ASSERT( xFixedText1, "No FixedText!" );
312*cdf0e10cSrcweir 			xFixedText1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
313*cdf0e10cSrcweir 			XWindowRef xFixedTextCmp1 = (XWindow*)xFixedText1->queryInterface( XWindow::getSmartUik() );
314*cdf0e10cSrcweir 			xFixedTextCmp1->setPosSize( 20, 20, 120, 20, PosSize_POSSIZE );
315*cdf0e10cSrcweir 			xCont->addControl( L"", xFixedText1 );
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir 			// TabTest...
318*cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.GroupBox" );
319*cdf0e10cSrcweir 			xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
320*cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
321*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Radio-Test:" ) );
322*cdf0e10cSrcweir 			XServiceProviderRef xGroupBoxCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.GroupBox" );
323*cdf0e10cSrcweir 			XControlRef xGroupBox1 = (XControl*)xGroupBoxCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
324*cdf0e10cSrcweir 			xGroupBox1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
325*cdf0e10cSrcweir 			XWindowRef xGroupBoxCmp1 = (XWindow*)xGroupBox1->queryInterface( XWindow::getSmartUik() );
326*cdf0e10cSrcweir 			xGroupBoxCmp1->setPosSize( 30, 410, 100, 130, PosSize_POSSIZE );
327*cdf0e10cSrcweir 			xCont->addControl( L"", xGroupBox1 );
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 			XServiceProviderRef xRadioButtonModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.RadioButton" );
330*cdf0e10cSrcweir 			XServiceProviderRef xRadioButtonCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.RadioButton" );
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 			xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
333*cdf0e10cSrcweir 			XControlRef xT1 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
334*cdf0e10cSrcweir 			xT1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
335*cdf0e10cSrcweir 			XWindowRef xTC1 = (XWindow*)xT1->queryInterface( XWindow::getSmartUik() );
336*cdf0e10cSrcweir 			xTC1->setPosSize( 40, 430, 80, 20, PosSize_POSSIZE );
337*cdf0e10cSrcweir 			xCont->addControl( L"", xT1 );
338*cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
339*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Radio1" ) );
340*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"State", UsrAny_UINT16( 1 ) );
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir 			xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
343*cdf0e10cSrcweir 			XControlRef xT2 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
344*cdf0e10cSrcweir 			xT2->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
345*cdf0e10cSrcweir 			XWindowRef xTC2 = (XWindow*)xT2->queryInterface( XWindow::getSmartUik() );
346*cdf0e10cSrcweir 			xTC2->setPosSize( 40, 470, 80, 20, PosSize_POSSIZE );
347*cdf0e10cSrcweir 			xCont->addControl( L"", xT2 );
348*cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
349*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Radio2" ) );
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir 			xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
352*cdf0e10cSrcweir 			XControlRef xT3 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
353*cdf0e10cSrcweir 			xT3->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
354*cdf0e10cSrcweir 			XWindowRef xTC3 = (XWindow*)xT3->queryInterface( XWindow::getSmartUik() );
355*cdf0e10cSrcweir 			xTC3->setPosSize( 40, 510, 80, 20, PosSize_POSSIZE );
356*cdf0e10cSrcweir 			xCont->addControl( L"", xT3 );
357*cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
358*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Radio3" ) );
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 			xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
361*cdf0e10cSrcweir 			XControlRef xT4 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
362*cdf0e10cSrcweir 			xT4->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
363*cdf0e10cSrcweir 			XWindowRef xTC4 = (XWindow*)xT4->queryInterface( XWindow::getSmartUik() );
364*cdf0e10cSrcweir 			xTC4->setPosSize( 40, 550, 80, 20, PosSize_POSSIZE );
365*cdf0e10cSrcweir 			xCont->addControl( L"", xT4 );
366*cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
367*cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Radio4 - no" ) );
368*cdf0e10cSrcweir     		xPSet->setPropertyValue( L"Tabstop", UsrAny( (BOOL)TRUE ) );
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir 			// TabController:
371*cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.TabController" );
372*cdf0e10cSrcweir 			xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
373*cdf0e10cSrcweir 			XTabControllerModelRef xTCModel = (XTabControllerModel*)xModel->queryInterface( XTabControllerModel::getSmartUik() );
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 			XServiceProviderRef xTCProv = xProv->queryServiceProvider( L"stardiv.vcl.control.TabController" );
376*cdf0e10cSrcweir 			XTabControllerRef xTC = (XTabController*)xTCProv->createInstance()->queryInterface( XTabController::getSmartUik() );
377*cdf0e10cSrcweir 			xTC->setModel( (XTabControllerModel*)xModel->queryInterface( XTabControllerModel::getSmartUik() ) );
378*cdf0e10cSrcweir 			XUnoControlContainerRef xUCC = (XUnoControlContainer*)xCont->queryInterface( XUnoControlContainer::getSmartUik() );
379*cdf0e10cSrcweir 			xUCC->addTabController( xTC );
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 			Sequence<XControlModelRef> aControls( 5 );
382*cdf0e10cSrcweir 			aControls.getArray()[0] = xGroupBox1->getModel();
383*cdf0e10cSrcweir 			aControls.getArray()[1] = xT1->getModel();
384*cdf0e10cSrcweir 			aControls.getArray()[2] = xT3->getModel();
385*cdf0e10cSrcweir 			aControls.getArray()[3] = xT2->getModel();
386*cdf0e10cSrcweir 			aControls.getArray()[4] = xT4->getModel();
387*cdf0e10cSrcweir 			xTCModel->setControls( aControls );
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir 			Sequence<XControlModelRef> aGroup( 3 );
390*cdf0e10cSrcweir 			aGroup.getArray()[0] = xT1->getModel();
391*cdf0e10cSrcweir 			aGroup.getArray()[1] = xT3->getModel();
392*cdf0e10cSrcweir 			aGroup.getArray()[2] = xT2->getModel();
393*cdf0e10cSrcweir 			xTCModel->setGroup( aGroup, L"test" );
394*cdf0e10cSrcweir */
395*cdf0e10cSrcweir 			// Container anzeigen...
396*cdf0e10cSrcweir 			// Als Child zu diesem Fenster
397*cdf0e10cSrcweir 			xContControl->createPeer( XToolkitRef(), GetComponentInterface( TRUE ) );
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir 			XDeviceRef xD( xContControl->getPeer(), USR_QUERY );
400*cdf0e10cSrcweir 			xG = xD->createGraphics();
401*cdf0e10cSrcweir 			XViewRef xV ( xDrawCtrl, USR_QUERY );
402*cdf0e10cSrcweir 			xV->setGraphics( xG );
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir //		((UnoControl*)(XControl*)xNumField))->updateFromModel();
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir /*
407*cdf0e10cSrcweir 			// TEST:
408*cdf0e10cSrcweir 			WindowDecriptor aDescr;
409*cdf0e10cSrcweir 			aDescr.ComponentServiceName = "window";
410*cdf0e10cSrcweir 			aDescr.Type = VCLCOMPONENTTYPE_CONTAINER;
411*cdf0e10cSrcweir 			aDescr.Parent = GetComponentInterface( TRUE );
412*cdf0e10cSrcweir 			aDescr.WindowAttributes = WA_SHOW|WA_BORDER;
413*cdf0e10cSrcweir 			aDescr.Bounds = Rectangle( Point( 500, 50 ), Size( 300, 200 ) );
414*cdf0e10cSrcweir 			XVclWindowPeerRef xSPWin = xToolkit->createComponent( aDescr );
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir 			WindowDecriptor aDescr2;
417*cdf0e10cSrcweir 			aDescr2.ComponentServiceName = "scrollbar";
418*cdf0e10cSrcweir 			aDescr2.Type = VCLCOMPONENTTYPE_SIMPLE;
419*cdf0e10cSrcweir 			aDescr2.Parent = xSPWin;
420*cdf0e10cSrcweir 			aDescr2.WindowAttributes = WA_SHOW|WA_BORDER|WA_VSCROLL;
421*cdf0e10cSrcweir 			aDescr2.Bounds = Rectangle( Point( 250, 0 ), Size( 50, 200 ) );
422*cdf0e10cSrcweir 			XVclWindowPeerRef xSB = xToolkit->createComponent( aDescr2 );
423*cdf0e10cSrcweir */
424*cdf0e10cSrcweir 		}
425*cdf0e10cSrcweir 		return;
426*cdf0e10cSrcweir 	}
427*cdf0e10cSrcweir     WorkWindow::MouseButtonDown( rMEvt );
428*cdf0e10cSrcweir }
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir 
431*cdf0e10cSrcweir // -----------------------------------------------------------------------
432*cdf0e10cSrcweir 
433*cdf0e10cSrcweir void MyWin::Resize()
434*cdf0e10cSrcweir {
435*cdf0e10cSrcweir     WorkWindow::Resize();
436*cdf0e10cSrcweir }
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir void MyWin::Paint( const Rectangle& r )
439*cdf0e10cSrcweir {
440*cdf0e10cSrcweir 	// Muss ueber PaintListener geschehen...
441*cdf0e10cSrcweir 	if ( xDrawCtrl.is() )
442*cdf0e10cSrcweir 	{
443*cdf0e10cSrcweir 		XViewRef xV( xDrawCtrl, USR_QUERY );
444*cdf0e10cSrcweir 		XWindowRef xC( xDrawCtrl, USR_QUERY );
445*cdf0e10cSrcweir 		xV->draw( xC->getPosSize().Left(), xC->getPosSize().Top() );
446*cdf0e10cSrcweir 	}
447*cdf0e10cSrcweir 
448*cdf0e10cSrcweir }
449*cdf0e10cSrcweir 
450