xref: /aoo41x/main/toolkit/source/awt/vclxwindows.cxx (revision b0724fc6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_toolkit.hxx"
26 #include <toolkit/awt/vclxwindows.hxx>
27 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
28 #include <com/sun/star/graphic/XGraphicProvider.hpp>
29 #include <toolkit/helper/vclunohelper.hxx>
30 #include <toolkit/helper/macros.hxx>
31 #include <toolkit/helper/property.hxx>
32 #include <toolkit/helper/convert.hxx>
33 #include <toolkit/helper/imagealign.hxx>
34 #include <toolkit/helper/accessibilityclient.hxx>
35 #include <toolkit/helper/fixedhyperbase.hxx>
36 #include <toolkit/helper/tkresmgr.hxx>
37 #include <cppuhelper/typeprovider.hxx>
38 #include <com/sun/star/awt/VisualEffect.hpp>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <com/sun/star/system/XSystemShellExecute.hpp>
41 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
42 #include <com/sun/star/resource/XStringResourceResolver.hpp>
43 #include <com/sun/star/awt/ImageScaleMode.hpp>
44 #include <com/sun/star/awt/XItemList.hpp>
45 #include <comphelper/componentcontext.hxx>
46 #include <comphelper/namedvaluecollection.hxx>
47 #include <comphelper/processfactory.hxx>
48 
49 #ifndef _SV_BUTTON_HXX
50 #include <vcl/button.hxx>
51 #endif
52 #include <vcl/lstbox.hxx>
53 #include <vcl/combobox.hxx>
54 #include <vcl/field.hxx>
55 #include <vcl/longcurr.hxx>
56 #include <vcl/imgctrl.hxx>
57 #include <vcl/dialog.hxx>
58 #include <vcl/msgbox.hxx>
59 #include <vcl/scrbar.hxx>
60 #include <vcl/svapp.hxx>
61 #include <vcl/tabpage.hxx>
62 #include <vcl/tabctrl.hxx>
63 #include <tools/diagnose_ex.h>
64 
65 #include <boost/bind.hpp>
66 #include <boost/function.hpp>
67 
68 using ::com::sun::star::uno::Any;
69 using ::com::sun::star::uno::Reference;
70 using ::com::sun::star::uno::makeAny;
71 using ::com::sun::star::uno::RuntimeException;
72 using ::com::sun::star::lang::EventObject;
73 using ::com::sun::star::awt::ItemListEvent;
74 using ::com::sun::star::awt::XItemList;
75 using ::com::sun::star::graphic::XGraphic;
76 using ::com::sun::star::graphic::XGraphicProvider;
77 
78 using namespace ::com::sun::star;
79 using namespace ::com::sun::star::awt::VisualEffect;
80 namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
81 
82 static double ImplCalcLongValue( double nValue, sal_uInt16 nDigits )
83 {
84 	double n = nValue;
85 	for ( sal_uInt16 d = 0; d < nDigits; d++ )
86 		n *= 10;
87 	return n;
88 }
89 
90 static double ImplCalcDoubleValue( double nValue, sal_uInt16 nDigits )
91 {
92 	double n = nValue;
93 	for ( sal_uInt16 d = 0; d < nDigits; d++ )
94 		n /= 10;
95 	return n;
96 }
97 
98 namespace toolkit
99 {
100     /** sets the "face color" for button like controls (scroll bar, spin button)
101     */
102     void setButtonLikeFaceColor( Window* _pWindow, const ::com::sun::star::uno::Any& _rColorValue )
103     {
104         AllSettings aSettings = _pWindow->GetSettings();
105 	    StyleSettings aStyleSettings = aSettings.GetStyleSettings();
106 
107         if ( !_rColorValue.hasValue() )
108         {
109 	        const StyleSettings& aAppStyle = Application::GetSettings().GetStyleSettings();
110             aStyleSettings.SetFaceColor( aAppStyle.GetFaceColor( ) );
111             aStyleSettings.SetCheckedColor( aAppStyle.GetCheckedColor( ) );
112             aStyleSettings.SetLightBorderColor( aAppStyle.GetLightBorderColor() );
113             aStyleSettings.SetLightColor( aAppStyle.GetLightColor() );
114             aStyleSettings.SetShadowColor( aAppStyle.GetShadowColor() );
115             aStyleSettings.SetDarkShadowColor( aAppStyle.GetDarkShadowColor() );
116         }
117         else
118         {
119 			sal_Int32 nBackgroundColor = 0;
120             _rColorValue >>= nBackgroundColor;
121             aStyleSettings.SetFaceColor( nBackgroundColor );
122 
123             // for the real background (everything except the buttons and the thumb),
124             // use an average between the desired color and "white"
125             Color aWhite( COL_WHITE );
126             Color aBackground( nBackgroundColor );
127             aBackground.SetRed( ( aBackground.GetRed() + aWhite.GetRed() ) / 2 );
128             aBackground.SetGreen( ( aBackground.GetGreen() + aWhite.GetGreen() ) / 2 );
129             aBackground.SetBlue( ( aBackground.GetBlue() + aWhite.GetBlue() ) / 2 );
130             aStyleSettings.SetCheckedColor( aBackground );
131 
132             sal_Int32 nBackgroundLuminance = Color( nBackgroundColor ).GetLuminance();
133             sal_Int32 nWhiteLuminance = Color( COL_WHITE ).GetLuminance();
134 
135             Color aLightShadow( nBackgroundColor );
136             aLightShadow.IncreaseLuminance( (sal_uInt8)( ( nWhiteLuminance - nBackgroundLuminance ) * 2 / 3 ) );
137             aStyleSettings.SetLightBorderColor( aLightShadow );
138 
139             Color aLight( nBackgroundColor );
140             aLight.IncreaseLuminance( (sal_uInt8)( ( nWhiteLuminance - nBackgroundLuminance ) * 1 / 3 ) );
141             aStyleSettings.SetLightColor( aLight );
142 
143             Color aShadow( nBackgroundColor );
144             aShadow.DecreaseLuminance( (sal_uInt8)( nBackgroundLuminance * 1 / 3 ) );
145             aStyleSettings.SetShadowColor( aShadow );
146 
147             Color aDarkShadow( nBackgroundColor );
148             aDarkShadow.DecreaseLuminance( (sal_uInt8)( nBackgroundLuminance * 2 / 3 ) );
149             aStyleSettings.SetDarkShadowColor( aDarkShadow );
150         }
151 
152         aSettings.SetStyleSettings( aStyleSettings );
153         _pWindow->SetSettings( aSettings, sal_True );
154     }
155 
156     Any getButtonLikeFaceColor( const Window* _pWindow )
157     {
158 		sal_Int32 nBackgroundColor = _pWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
159         return makeAny( nBackgroundColor );
160     }
161 
162     static void adjustBooleanWindowStyle( const Any& _rValue, Window* _pWindow, WinBits _nBits, sal_Bool _bInverseSemantics )
163     {
164         WinBits nStyle = _pWindow->GetStyle();
165         sal_Bool bValue( sal_False );
166         OSL_VERIFY( _rValue >>= bValue );
167         if ( bValue != _bInverseSemantics )
168             nStyle |= _nBits;
169         else
170             nStyle &= ~_nBits;
171         _pWindow->SetStyle( nStyle );
172     }
173 
174     static void setVisualEffect( const Any& _rValue, Window* _pWindow )
175     {
176         AllSettings aSettings = _pWindow->GetSettings();
177 	    StyleSettings aStyleSettings = aSettings.GetStyleSettings();
178 
179         sal_Int16 nStyle = LOOK3D;
180         OSL_VERIFY( _rValue >>= nStyle );
181         switch ( nStyle )
182         {
183         case FLAT:
184             aStyleSettings.SetOptions( aStyleSettings.GetOptions() & ~STYLE_OPTION_MONO );
185             break;
186         case LOOK3D:
187         default:
188             aStyleSettings.SetOptions( aStyleSettings.GetOptions() | STYLE_OPTION_MONO );
189         }
190         aSettings.SetStyleSettings( aStyleSettings );
191         _pWindow->SetSettings( aSettings );
192     }
193 
194     static Any getVisualEffect( Window* _pWindow )
195     {
196         Any aEffect;
197 
198         StyleSettings aStyleSettings = _pWindow->GetSettings().GetStyleSettings();
199         if ( (aStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
200             aEffect <<= (sal_Int16)FLAT;
201         else
202             aEffect <<= (sal_Int16)LOOK3D;
203         return aEffect;
204     }
205 }
206 
207 //	----------------------------------------------------
208 //	class VCLXGraphicControl
209 //	----------------------------------------------------
210 
211 void VCLXGraphicControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
212 {
213     VCLXWindow::ImplGetPropertyIds( rIds );
214 }
215 
216 void VCLXGraphicControl::ImplSetNewImage()
217 {
218     OSL_PRECOND( GetWindow(), "VCLXGraphicControl::ImplSetNewImage: window is required to be not-NULL!" );
219 	Button* pButton = static_cast< Button* >( GetWindow() );
220 	pButton->SetModeImage( GetImage() );
221 }
222 
223 void VCLXGraphicControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, short Flags ) throw(::com::sun::star::uno::RuntimeException)
224 {
225 	::vos::OGuard aGuard( GetMutex() );
226 
227 	if ( GetWindow() )
228 	{
229 		Size aOldSize = GetWindow()->GetSizePixel();
230 		VCLXWindow::setPosSize( X, Y, Width, Height, Flags );
231 		if ( ( aOldSize.Width() != Width ) || ( aOldSize.Height() != Height ) )
232 			ImplSetNewImage();
233 	}
234 }
235 
236 void VCLXGraphicControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
237 {
238 	::vos::OGuard aGuard( GetMutex() );
239 
240 	Button* pButton = static_cast< Button* >( GetWindow() );
241     if ( !pButton )
242         return;
243     sal_uInt16 nPropType = GetPropertyId( PropertyName );
244     switch ( nPropType )
245     {
246         case BASEPROPERTY_GRAPHIC:
247         {
248             Reference< XGraphic > xGraphic;
249             OSL_VERIFY( Value >>= xGraphic );
250             maImage = Image( xGraphic );
251             ImplSetNewImage();
252         }
253         break;
254 
255         case BASEPROPERTY_IMAGEALIGN:
256         {
257             WindowType eType = GetWindow()->GetType();
258             if (  ( eType == WINDOW_PUSHBUTTON )
259                || ( eType == WINDOW_RADIOBUTTON )
260                || ( eType == WINDOW_CHECKBOX )
261                )
262             {
263                 sal_Int16 nAlignment = sal_Int16();
264                 if ( Value >>= nAlignment )
265                     pButton->SetImageAlign( static_cast< ImageAlign >( nAlignment ) );
266             }
267         }
268         break;
269         case BASEPROPERTY_IMAGEPOSITION:
270         {
271             WindowType eType = GetWindow()->GetType();
272             if (  ( eType == WINDOW_PUSHBUTTON )
273                || ( eType == WINDOW_RADIOBUTTON )
274                || ( eType == WINDOW_CHECKBOX )
275                )
276             {
277                 sal_Int16 nImagePosition = 2;
278                 OSL_VERIFY( Value >>= nImagePosition );
279                 pButton->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition ) );
280             }
281         }
282         break;
283         default:
284             VCLXWindow::setProperty( PropertyName, Value );
285             break;
286 	}
287 }
288 
289 ::com::sun::star::uno::Any VCLXGraphicControl::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
290 {
291 	::vos::OGuard aGuard( GetMutex() );
292 
293 	::com::sun::star::uno::Any aProp;
294     if ( !GetWindow() )
295         return aProp;
296 
297     sal_uInt16 nPropType = GetPropertyId( PropertyName );
298 	switch ( nPropType )
299 	{
300         case BASEPROPERTY_GRAPHIC:
301             aProp <<= maImage.GetXGraphic();
302             break;
303 		case BASEPROPERTY_IMAGEALIGN:
304 		{
305             WindowType eType = GetWindow()->GetType();
306             if  (  ( eType == WINDOW_PUSHBUTTON )
307                 || ( eType == WINDOW_RADIOBUTTON )
308                 || ( eType == WINDOW_CHECKBOX )
309                 )
310             {
311  				aProp <<= ::toolkit::getCompatibleImageAlign( static_cast< Button* >( GetWindow() )->GetImageAlign() );
312             }
313 		}
314 		break;
315 		case BASEPROPERTY_IMAGEPOSITION:
316         {
317             WindowType eType = GetWindow()->GetType();
318             if  (  ( eType == WINDOW_PUSHBUTTON )
319                 || ( eType == WINDOW_RADIOBUTTON )
320                 || ( eType == WINDOW_CHECKBOX )
321                 )
322             {
323                 aProp <<= ::toolkit::translateImagePosition( static_cast< Button* >( GetWindow() )->GetImageAlign() );
324             }
325         }
326         break;
327 		default:
328 		{
329 			aProp <<= VCLXWindow::getProperty( PropertyName );
330 		}
331         break;
332 	}
333 	return aProp;
334 }
335 
336 //--------------------------------------------------------------------
337 //	class VCLXButton
338 //	----------------------------------------------------
339 
340 void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
341 {
342     PushPropertyIds( rIds,
343                      BASEPROPERTY_BACKGROUNDCOLOR,
344                      BASEPROPERTY_DEFAULTBUTTON,
345                      BASEPROPERTY_DEFAULTCONTROL,
346                      BASEPROPERTY_ENABLED,
347                      BASEPROPERTY_ENABLEVISIBLE,
348                      BASEPROPERTY_FONTDESCRIPTOR,
349                      BASEPROPERTY_GRAPHIC,
350                      BASEPROPERTY_HELPTEXT,
351                      BASEPROPERTY_HELPURL,
352                      BASEPROPERTY_IMAGEALIGN,
353                      BASEPROPERTY_IMAGEPOSITION,
354                      BASEPROPERTY_IMAGEURL,
355                      BASEPROPERTY_LABEL,
356                      BASEPROPERTY_PRINTABLE,
357                      BASEPROPERTY_PUSHBUTTONTYPE,
358                      BASEPROPERTY_REPEAT,
359                      BASEPROPERTY_REPEAT_DELAY,
360                      BASEPROPERTY_STATE,
361                      BASEPROPERTY_TABSTOP,
362                      BASEPROPERTY_TOGGLE,
363                      BASEPROPERTY_FOCUSONCLICK,
364                      BASEPROPERTY_MULTILINE,
365                      BASEPROPERTY_ALIGN,
366                      BASEPROPERTY_VERTICALALIGN,
367                      BASEPROPERTY_WRITING_MODE,
368                      BASEPROPERTY_CONTEXT_WRITING_MODE,
369                      BASEPROPERTY_REFERENCE_DEVICE,
370                      0);
371     VCLXGraphicControl::ImplGetPropertyIds( rIds );
372 }
373 
374 VCLXButton::VCLXButton()
375     :maActionListeners( *this )
376     ,maItemListeners( *this )
377 {
378 }
379 
380 VCLXButton::~VCLXButton()
381 {
382 }
383 
384 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext()
385 {
386     return getAccessibleFactory().createAccessibleContext( this );
387 }
388 
389 void VCLXButton::dispose() throw(::com::sun::star::uno::RuntimeException)
390 {
391 	::vos::OGuard aGuard( GetMutex() );
392 
393 	::com::sun::star::lang::EventObject aObj;
394 	aObj.Source = (::cppu::OWeakObject*)this;
395 	maActionListeners.disposeAndClear( aObj );
396 	maItemListeners.disposeAndClear( aObj );
397 	VCLXGraphicControl::dispose();
398 }
399 
400 void VCLXButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l  )throw(::com::sun::star::uno::RuntimeException)
401 {
402 	::vos::OGuard aGuard( GetMutex() );
403 	maActionListeners.addInterface( l );
404 }
405 
406 void VCLXButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
407 {
408 	::vos::OGuard aGuard( GetMutex() );
409 	maActionListeners.removeInterface( l );
410 }
411 
412 void VCLXButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l  )throw(::com::sun::star::uno::RuntimeException)
413 {
414 	::vos::OGuard aGuard( GetMutex() );
415 	maItemListeners.addInterface( l );
416 }
417 
418 void VCLXButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
419 {
420 	::vos::OGuard aGuard( GetMutex() );
421 	maItemListeners.removeInterface( l );
422 }
423 
424 void VCLXButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
425 {
426 	::vos::OGuard aGuard( GetMutex() );
427 
428 	Window* pWindow = GetWindow();
429 	if ( pWindow )
430 		pWindow->SetText( rLabel );
431 }
432 
433 void VCLXButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
434 {
435 	::vos::OGuard aGuard( GetMutex() );
436 
437 	maActionCommand = rCommand;
438 }
439 
440 ::com::sun::star::awt::Size VCLXButton::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
441 {
442 	::vos::OGuard aGuard( GetMutex() );
443 
444 	Size aSz;
445 	PushButton* pButton = (PushButton*) GetWindow();
446 	if ( pButton )
447 		aSz = pButton->CalcMinimumSize();
448 	return AWTSize(aSz);
449 }
450 
451 ::com::sun::star::awt::Size VCLXButton::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
452 {
453 	::com::sun::star::awt::Size aSz = getMinimumSize();
454 	aSz.Width += 16;
455 	aSz.Height += 10;
456 	return aSz;
457 }
458 
459 ::com::sun::star::awt::Size VCLXButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
460 {
461 	::vos::OGuard aGuard( GetMutex() );
462 
463 	Size aSz = VCLSize(rNewSize);
464 	PushButton* pButton = (PushButton*) GetWindow();
465 	if ( pButton )
466 	{
467 		Size aMinSz = pButton->CalcMinimumSize();
468 		// Kein Text, also Image
469 		if ( !pButton->GetText().Len() )
470 		{
471 			if ( aSz.Width() < aMinSz.Width() )
472 				aSz.Width() = aMinSz.Width();
473 			if ( aSz.Height() < aMinSz.Height() )
474 				aSz.Height() = aMinSz.Height();
475 		}
476 		else
477 		{
478 			if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
479 				aSz.Height() = aMinSz.Height();
480 			else
481 				aSz = aMinSz;
482 		}
483 	}
484 	return AWTSize(aSz);
485 }
486 
487 void VCLXButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
488 {
489 	::vos::OGuard aGuard( GetMutex() );
490 
491 	Button* pButton = (Button*)GetWindow();
492 	if ( pButton )
493 	{
494 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
495 		switch ( nPropType )
496 		{
497             case BASEPROPERTY_FOCUSONCLICK:
498                 ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_NOPOINTERFOCUS, sal_True );
499                 break;
500 
501             case BASEPROPERTY_TOGGLE:
502                 ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_TOGGLE, sal_False );
503                 break;
504 
505             case BASEPROPERTY_DEFAULTBUTTON:
506 			{
507 				WinBits nStyle = pButton->GetStyle() | WB_DEFBUTTON;
508 				sal_Bool b = sal_Bool();
509 				if ( ( Value >>= b ) && !b )
510 					nStyle &= ~WB_DEFBUTTON;
511 				pButton->SetStyle( nStyle );
512 			}
513 			break;
514 			case BASEPROPERTY_STATE:
515 			{
516                 if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON )
517                 {
518 				    sal_Int16 n = sal_Int16();
519 				    if ( Value >>= n )
520 					    ((PushButton*)pButton)->SetState( (TriState)n );
521                 }
522 			}
523 			break;
524 			default:
525 			{
526 				VCLXGraphicControl::setProperty( PropertyName, Value );
527 			}
528 		}
529 	}
530 }
531 
532 ::com::sun::star::uno::Any VCLXButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
533 {
534 	::vos::OGuard aGuard( GetMutex() );
535 
536 	::com::sun::star::uno::Any aProp;
537 	Button* pButton = (Button*)GetWindow();
538 	if ( pButton )
539 	{
540 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
541 		switch ( nPropType )
542 		{
543             case BASEPROPERTY_FOCUSONCLICK:
544                 aProp <<= (sal_Bool)( ( pButton->GetStyle() & WB_NOPOINTERFOCUS ) == 0 );
545                 break;
546 
547             case BASEPROPERTY_TOGGLE:
548                 aProp <<= (sal_Bool)( ( pButton->GetStyle() & WB_TOGGLE ) != 0 );
549                 break;
550 
551 			case BASEPROPERTY_DEFAULTBUTTON:
552 			{
553 				aProp <<= (sal_Bool) ( ( pButton->GetStyle() & WB_DEFBUTTON ) ? sal_True : sal_False );
554 			}
555 			break;
556 			case BASEPROPERTY_STATE:
557 			{
558                 if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON )
559                 {
560  				    aProp <<= (sal_Int16)((PushButton*)pButton)->GetState();
561                 }
562 			}
563 			break;
564 			default:
565 			{
566 				aProp <<= VCLXGraphicControl::getProperty( PropertyName );
567 			}
568 		}
569 	}
570 	return aProp;
571 }
572 
573 void VCLXButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
574 {
575 	switch ( rVclWindowEvent.GetId() )
576 	{
577 		case VCLEVENT_BUTTON_CLICK:
578         {
579             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
580                 // since we call listeners below, there is a potential that we will be destroyed
581                 // during the listener call. To prevent the resulting crashs, we keep us
582                 // alive as long as we're here
583                 // #20178# - 2003-10-01 - fs@openoffice.org
584 
585 			if ( maActionListeners.getLength() )
586 			{
587 				::com::sun::star::awt::ActionEvent aEvent;
588 				aEvent.Source = (::cppu::OWeakObject*)this;
589 				aEvent.ActionCommand = maActionCommand;
590 
591                 Callback aCallback = ::boost::bind(
592                     &ActionListenerMultiplexer::actionPerformed,
593                     &maActionListeners,
594                     aEvent
595                 );
596                 ImplExecuteAsyncWithoutSolarLock( aCallback );
597 			}
598         }
599 		break;
600 
601         case VCLEVENT_PUSHBUTTON_TOGGLE:
602         {
603 	        PushButton& rButton = dynamic_cast< PushButton& >( *rVclWindowEvent.GetWindow() );
604 
605             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
606 			if ( maItemListeners.getLength() )
607 			{
608 				::com::sun::star::awt::ItemEvent aEvent;
609 				aEvent.Source = (::cppu::OWeakObject*)this;
610                 aEvent.Selected = ( rButton.GetState() == STATE_CHECK ) ? 1 : 0;
611 				maItemListeners.itemStateChanged( aEvent );
612 			}
613         }
614 		break;
615 
616 		default:
617 			VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent );
618 			break;
619 	}
620 }
621 
622 //	----------------------------------------------------
623 //	class VCLXImageControl
624 //	----------------------------------------------------
625 
626 void VCLXImageControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
627 {
628     PushPropertyIds( rIds,
629                      BASEPROPERTY_BACKGROUNDCOLOR,
630                      BASEPROPERTY_BORDER,
631                      BASEPROPERTY_BORDERCOLOR,
632                      BASEPROPERTY_DEFAULTCONTROL,
633                      BASEPROPERTY_ENABLED,
634                      BASEPROPERTY_ENABLEVISIBLE,
635                      BASEPROPERTY_GRAPHIC,
636                      BASEPROPERTY_HELPTEXT,
637                      BASEPROPERTY_HELPURL,
638                      BASEPROPERTY_IMAGEURL,
639                      BASEPROPERTY_PRINTABLE,
640                      BASEPROPERTY_SCALEIMAGE,
641                      BASEPROPERTY_IMAGE_SCALE_MODE,
642                      BASEPROPERTY_TABSTOP,
643                      BASEPROPERTY_WRITING_MODE,
644                      BASEPROPERTY_CONTEXT_WRITING_MODE,
645                      0);
646     VCLXGraphicControl::ImplGetPropertyIds( rIds );
647 }
648 
649 VCLXImageControl::VCLXImageControl()
650 {
651 }
652 
653 VCLXImageControl::~VCLXImageControl()
654 {
655 }
656 
657 void VCLXImageControl::ImplSetNewImage()
658 {
659     OSL_PRECOND( GetWindow(), "VCLXImageControl::ImplSetNewImage: window is required to be not-NULL!" );
660 	ImageControl* pControl = static_cast< ImageControl* >( GetWindow() );
661 	pControl->SetImage( GetImage() );
662 }
663 
664 ::com::sun::star::awt::Size VCLXImageControl::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
665 {
666 	::vos::OGuard aGuard( GetMutex() );
667 
668 	Size aSz = GetImage().GetSizePixel();
669 	aSz = ImplCalcWindowSize( aSz );
670 
671 	return AWTSize(aSz);
672 }
673 
674 ::com::sun::star::awt::Size VCLXImageControl::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
675 {
676 	return getMinimumSize();
677 }
678 
679 ::com::sun::star::awt::Size VCLXImageControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
680 {
681 	::vos::OGuard aGuard( GetMutex() );
682 
683 	::com::sun::star::awt::Size aSz = rNewSize;
684 	::com::sun::star::awt::Size aMinSz = getMinimumSize();
685 	if ( aSz.Width < aMinSz.Width )
686 		aSz.Width = aMinSz.Width;
687 	if ( aSz.Height < aMinSz.Height )
688 		aSz.Height = aMinSz.Height;
689 	return aSz;
690 }
691 
692 void VCLXImageControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
693 {
694 	::vos::OGuard aGuard( GetMutex() );
695 
696 	ImageControl* pImageControl = (ImageControl*)GetWindow();
697 
698     sal_uInt16 nPropType = GetPropertyId( PropertyName );
699 	switch ( nPropType )
700 	{
701         case BASEPROPERTY_IMAGE_SCALE_MODE:
702         {
703             sal_Int16 nScaleMode( ImageScaleMode::Anisotropic );
704             if ( pImageControl && ( Value >>= nScaleMode ) )
705             {
706                 pImageControl->SetScaleMode( nScaleMode );
707             }
708         }
709         break;
710 
711 		case BASEPROPERTY_SCALEIMAGE:
712 		{
713             // this is for compatibility only, nowadays, the ImageScaleMode property should be used
714 			sal_Bool bScaleImage = sal_False;
715             if ( pImageControl && ( Value >>= bScaleImage ) )
716             {
717                 pImageControl->SetScaleMode( bScaleImage ? ImageScaleMode::Anisotropic : ImageScaleMode::None );
718             }
719 		}
720 		break;
721 
722         default:
723 			VCLXGraphicControl::setProperty( PropertyName, Value );
724             break;
725 	}
726 }
727 
728 ::com::sun::star::uno::Any VCLXImageControl::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
729 {
730 	::vos::OGuard aGuard( GetMutex() );
731 
732 	::com::sun::star::uno::Any aProp;
733 	ImageControl* pImageControl = (ImageControl*)GetWindow();
734 	sal_uInt16 nPropType = GetPropertyId( PropertyName );
735 
736     switch ( nPropType )
737 	{
738         case BASEPROPERTY_IMAGE_SCALE_MODE:
739             aProp <<= ( pImageControl ? pImageControl->GetScaleMode() : ImageScaleMode::Anisotropic );
740             break;
741 
742 		case BASEPROPERTY_SCALEIMAGE:
743             aProp <<= ( pImageControl && pImageControl->GetScaleMode() != ImageScaleMode::None ) ? sal_True : sal_False;
744 		    break;
745 
746 		default:
747 			aProp = VCLXGraphicControl::getProperty( PropertyName );
748             break;
749 	}
750 	return aProp;
751 }
752 
753 //	----------------------------------------------------
754 //	class VCLXCheckBox
755 //	----------------------------------------------------
756 
757 
758 void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
759 {
760     PushPropertyIds( rIds,
761                      BASEPROPERTY_DEFAULTCONTROL,
762                      BASEPROPERTY_ENABLED,
763                      BASEPROPERTY_ENABLEVISIBLE,
764                      BASEPROPERTY_FONTDESCRIPTOR,
765                      BASEPROPERTY_GRAPHIC,
766                      BASEPROPERTY_HELPTEXT,
767                      BASEPROPERTY_HELPURL,
768                      BASEPROPERTY_IMAGEPOSITION,
769                      BASEPROPERTY_IMAGEURL,
770                      BASEPROPERTY_LABEL,
771                      BASEPROPERTY_PRINTABLE,
772                      BASEPROPERTY_STATE,
773                      BASEPROPERTY_TABSTOP,
774                      BASEPROPERTY_TRISTATE,
775                      BASEPROPERTY_VISUALEFFECT,
776                      BASEPROPERTY_MULTILINE,
777                      BASEPROPERTY_BACKGROUNDCOLOR,
778                      BASEPROPERTY_ALIGN,
779                      BASEPROPERTY_VERTICALALIGN,
780                      BASEPROPERTY_WRITING_MODE,
781                      BASEPROPERTY_CONTEXT_WRITING_MODE,
782                      BASEPROPERTY_REFERENCE_DEVICE,
783                      0);
784     VCLXGraphicControl::ImplGetPropertyIds( rIds );
785 }
786 
787 VCLXCheckBox::VCLXCheckBox() :  maActionListeners( *this ), maItemListeners( *this )
788 {
789 }
790 
791 // ::com::sun::star::uno::XInterface
792 ::com::sun::star::uno::Any VCLXCheckBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
793 {
794 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
795 										SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ),
796 										SAL_STATIC_CAST( ::com::sun::star::awt::XCheckBox*, this ) );
797 	return (aRet.hasValue() ? aRet : VCLXGraphicControl::queryInterface( rType ));
798 }
799 
800 // ::com::sun::star::lang::XTypeProvider
801 IMPL_XTYPEPROVIDER_START( VCLXCheckBox )
802 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
803 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox>* ) NULL ),
804 	VCLXGraphicControl::getTypes()
805 IMPL_XTYPEPROVIDER_END
806 
807 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXCheckBox::CreateAccessibleContext()
808 {
809     return getAccessibleFactory().createAccessibleContext( this );
810 }
811 
812 void VCLXCheckBox::dispose() throw(::com::sun::star::uno::RuntimeException)
813 {
814 	::vos::OGuard aGuard( GetMutex() );
815 
816 	::com::sun::star::lang::EventObject aObj;
817 	aObj.Source = (::cppu::OWeakObject*)this;
818 	maItemListeners.disposeAndClear( aObj );
819 	VCLXGraphicControl::dispose();
820 }
821 
822 void VCLXCheckBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
823 {
824 	::vos::OGuard aGuard( GetMutex() );
825 	maItemListeners.addInterface( l );
826 }
827 
828 void VCLXCheckBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
829 {
830 	::vos::OGuard aGuard( GetMutex() );
831 	maItemListeners.removeInterface( l );
832 }
833 
834 void VCLXCheckBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l  )throw(::com::sun::star::uno::RuntimeException)
835 {
836 	::vos::OGuard aGuard( GetMutex() );
837 	maActionListeners.addInterface( l );
838 }
839 
840 void VCLXCheckBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
841 {
842 	::vos::OGuard aGuard( GetMutex() );
843 	maActionListeners.removeInterface( l );
844 }
845 
846 void VCLXCheckBox::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
847 {
848 	::vos::OGuard aGuard( GetMutex() );
849 	maActionCommand = rCommand;
850 }
851 
852 void VCLXCheckBox::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
853 {
854 	::vos::OGuard aGuard( GetMutex() );
855 
856 	Window* pWindow = GetWindow();
857 	if ( pWindow )
858 		pWindow->SetText( rLabel );
859 }
860 
861 void VCLXCheckBox::setState( short n ) throw(::com::sun::star::uno::RuntimeException)
862 {
863 	::vos::OGuard aGuard( GetMutex() );
864 
865 	CheckBox* pCheckBox = (CheckBox*)GetWindow();
866 	if ( pCheckBox)
867 	{
868         TriState eState;
869         switch ( n )
870         {
871             case 0:     eState = STATE_NOCHECK;     break;
872             case 1:     eState = STATE_CHECK;       break;
873             case 2:     eState = STATE_DONTKNOW;    break;
874             default:    eState = STATE_NOCHECK;
875         }
876 		pCheckBox->SetState( eState );
877 
878         // #105198# call C++ click listeners (needed for accessibility)
879         // pCheckBox->GetClickHdl().Call( pCheckBox );
880 
881         // #107218# Call same virtual methods and listeners like VCL would do after user interaction
882         SetSynthesizingVCLEvent( sal_True );
883         pCheckBox->Toggle();
884         pCheckBox->Click();
885         SetSynthesizingVCLEvent( sal_False );
886 	}
887 }
888 
889 short VCLXCheckBox::getState() throw(::com::sun::star::uno::RuntimeException)
890 {
891     ::vos::OGuard aGuard( GetMutex() );
892 
893     short nState = -1;
894     CheckBox* pCheckBox = (CheckBox*)GetWindow();
895     if ( pCheckBox )
896     {
897         switch ( pCheckBox->GetState() )
898         {
899             case STATE_NOCHECK:     nState = 0; break;
900             case STATE_CHECK:       nState = 1; break;
901             case STATE_DONTKNOW:    nState = 2; break;
902             default:                DBG_ERROR( "VCLXCheckBox::getState(): unknown TriState!" );
903         }
904     }
905 
906     return nState;
907 }
908 
909 void VCLXCheckBox::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
910 {
911 	::vos::OGuard aGuard( GetMutex() );
912 
913 	CheckBox* pCheckBox = (CheckBox*)GetWindow();
914 	if ( pCheckBox)
915 		pCheckBox->EnableTriState( b );
916 }
917 
918 ::com::sun::star::awt::Size VCLXCheckBox::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
919 {
920 	::vos::OGuard aGuard( GetMutex() );
921 
922 	Size aSz;
923 	CheckBox* pCheckBox = (CheckBox*) GetWindow();
924 	if ( pCheckBox )
925 		aSz = pCheckBox->CalcMinimumSize();
926 	return AWTSize(aSz);
927 }
928 
929 ::com::sun::star::awt::Size VCLXCheckBox::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
930 {
931 	return getMinimumSize();
932 }
933 
934 ::com::sun::star::awt::Size VCLXCheckBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
935 {
936 	::vos::OGuard aGuard( GetMutex() );
937 
938 	Size aSz = VCLSize(rNewSize);
939 	CheckBox* pCheckBox = (CheckBox*) GetWindow();
940 	if ( pCheckBox )
941 	{
942 		Size aMinSz = pCheckBox->CalcMinimumSize();
943 		if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
944 			aSz.Height() = aMinSz.Height();
945 		else
946 			aSz = aMinSz;
947 	}
948 	return AWTSize(aSz);
949 }
950 
951 void VCLXCheckBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
952 {
953 	::vos::OGuard aGuard( GetMutex() );
954 
955 	CheckBox* pCheckBox = (CheckBox*)GetWindow();
956 	if ( pCheckBox )
957 	{
958 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
959 		switch ( nPropType )
960 		{
961             case BASEPROPERTY_VISUALEFFECT:
962                 ::toolkit::setVisualEffect( Value, pCheckBox );
963                 break;
964 
965 			case BASEPROPERTY_TRISTATE:
966 			{
967 				sal_Bool b = sal_Bool();
968 				if ( Value >>= b )
969  					pCheckBox->EnableTriState( b );
970 			}
971 			break;
972 			case BASEPROPERTY_STATE:
973 			{
974 				sal_Int16 n = sal_Int16();
975 				if ( Value >>= n )
976 					setState( n );
977 			}
978 			break;
979 			default:
980 			{
981 				VCLXGraphicControl::setProperty( PropertyName, Value );
982 			}
983 		}
984 	}
985 }
986 
987 ::com::sun::star::uno::Any VCLXCheckBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
988 {
989 	::vos::OGuard aGuard( GetMutex() );
990 
991 	::com::sun::star::uno::Any aProp;
992 	CheckBox* pCheckBox = (CheckBox*)GetWindow();
993 	if ( pCheckBox )
994 	{
995 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
996 		switch ( nPropType )
997 		{
998             case BASEPROPERTY_VISUALEFFECT:
999                 aProp = ::toolkit::getVisualEffect( pCheckBox );
1000                 break;
1001 			case BASEPROPERTY_TRISTATE:
1002  				aProp <<= (sal_Bool)pCheckBox->IsTriStateEnabled();
1003     			break;
1004 			case BASEPROPERTY_STATE:
1005  				aProp <<= (sal_Int16)pCheckBox->GetState();
1006     			break;
1007 			default:
1008 			{
1009 				aProp <<= VCLXGraphicControl::getProperty( PropertyName );
1010 			}
1011 		}
1012 	}
1013 	return aProp;
1014 }
1015 
1016 void VCLXCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1017 {
1018 	switch ( rVclWindowEvent.GetId() )
1019 	{
1020 		case VCLEVENT_CHECKBOX_TOGGLE:
1021         {
1022             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1023                 // since we call listeners below, there is a potential that we will be destroyed
1024                 // in during the listener call. To prevent the resulting crashs, we keep us
1025                 // alive as long as we're here
1026                 // #20178# - 2003-10-01 - fs@openoffice.org
1027 
1028 			CheckBox* pCheckBox = (CheckBox*)GetWindow();
1029 			if ( pCheckBox )
1030 			{
1031     			if ( maItemListeners.getLength() )
1032     			{
1033     				::com::sun::star::awt::ItemEvent aEvent;
1034     				aEvent.Source = (::cppu::OWeakObject*)this;
1035     				aEvent.Highlighted = sal_False;
1036     				aEvent.Selected = pCheckBox->GetState();
1037     				maItemListeners.itemStateChanged( aEvent );
1038     			}
1039     			if ( !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
1040     			{
1041     				::com::sun::star::awt::ActionEvent aEvent;
1042     				aEvent.Source = (::cppu::OWeakObject*)this;
1043     				aEvent.ActionCommand = maActionCommand;
1044     				maActionListeners.actionPerformed( aEvent );
1045     			}
1046 			}
1047 		}
1048 		break;
1049 
1050 		default:
1051 			VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent );
1052 			break;
1053 	}
1054 }
1055 
1056 //	----------------------------------------------------
1057 //	class VCLXRadioButton
1058 //	----------------------------------------------------
1059 void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1060 {
1061     PushPropertyIds( rIds,
1062                      BASEPROPERTY_DEFAULTCONTROL,
1063                      BASEPROPERTY_ENABLED,
1064                      BASEPROPERTY_ENABLEVISIBLE,
1065                      BASEPROPERTY_FONTDESCRIPTOR,
1066                      BASEPROPERTY_GRAPHIC,
1067                      BASEPROPERTY_HELPTEXT,
1068                      BASEPROPERTY_HELPURL,
1069                      BASEPROPERTY_IMAGEPOSITION,
1070                      BASEPROPERTY_IMAGEURL,
1071                      BASEPROPERTY_LABEL,
1072                      BASEPROPERTY_PRINTABLE,
1073                      BASEPROPERTY_STATE,
1074                      BASEPROPERTY_TABSTOP,
1075                      BASEPROPERTY_VISUALEFFECT,
1076                      BASEPROPERTY_MULTILINE,
1077                      BASEPROPERTY_BACKGROUNDCOLOR,
1078                      BASEPROPERTY_ALIGN,
1079                      BASEPROPERTY_VERTICALALIGN,
1080                      BASEPROPERTY_WRITING_MODE,
1081                      BASEPROPERTY_CONTEXT_WRITING_MODE,
1082                      BASEPROPERTY_REFERENCE_DEVICE,
1083                      0);
1084     VCLXGraphicControl::ImplGetPropertyIds( rIds );
1085 }
1086 
1087 
1088 VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ), maActionListeners( *this )
1089 {
1090 }
1091 
1092 // ::com::sun::star::uno::XInterface
1093 ::com::sun::star::uno::Any VCLXRadioButton::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
1094 {
1095 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
1096 										SAL_STATIC_CAST( ::com::sun::star::awt::XRadioButton*, this ),
1097 										SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ) );
1098 	return (aRet.hasValue() ? aRet : VCLXGraphicControl::queryInterface( rType ));
1099 }
1100 
1101 // ::com::sun::star::lang::XTypeProvider
1102 IMPL_XTYPEPROVIDER_START( VCLXRadioButton )
1103 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ),
1104 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
1105 	VCLXGraphicControl::getTypes()
1106 IMPL_XTYPEPROVIDER_END
1107 
1108 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXRadioButton::CreateAccessibleContext()
1109 {
1110     return getAccessibleFactory().createAccessibleContext( this );
1111 }
1112 
1113 void VCLXRadioButton::dispose() throw(::com::sun::star::uno::RuntimeException)
1114 {
1115 	::vos::OGuard aGuard( GetMutex() );
1116 
1117 	::com::sun::star::lang::EventObject aObj;
1118 	aObj.Source = (::cppu::OWeakObject*)this;
1119 	maItemListeners.disposeAndClear( aObj );
1120 	VCLXGraphicControl::dispose();
1121 }
1122 
1123 void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
1124 {
1125 	::vos::OGuard aGuard( GetMutex() );
1126 
1127 	RadioButton* pButton = (RadioButton*)GetWindow();
1128 	if ( pButton )
1129 	{
1130 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
1131 		switch ( nPropType )
1132 		{
1133             case BASEPROPERTY_VISUALEFFECT:
1134                 ::toolkit::setVisualEffect( Value, pButton );
1135                 break;
1136 
1137 			case BASEPROPERTY_STATE:
1138 			{
1139 				sal_Int16 n = sal_Int16();
1140 				if ( Value >>= n )
1141 				{
1142 					sal_Bool b = n ? sal_True : sal_False;
1143 					if ( pButton->IsRadioCheckEnabled() )
1144 						pButton->Check( b );
1145 					else
1146 						pButton->SetState( b );
1147 				}
1148 			}
1149 			break;
1150 			case BASEPROPERTY_AUTOTOGGLE:
1151 			{
1152 				sal_Bool b = sal_Bool();
1153 				if ( Value >>= b )
1154 					pButton->EnableRadioCheck( b );
1155 			}
1156 			break;
1157 			default:
1158 			{
1159 				VCLXGraphicControl::setProperty( PropertyName, Value );
1160 			}
1161 		}
1162 	}
1163 }
1164 
1165 ::com::sun::star::uno::Any VCLXRadioButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
1166 {
1167 	::vos::OGuard aGuard( GetMutex() );
1168 
1169 	::com::sun::star::uno::Any aProp;
1170 	RadioButton* pButton = (RadioButton*)GetWindow();
1171 	if ( pButton )
1172 	{
1173 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
1174 		switch ( nPropType )
1175 		{
1176             case BASEPROPERTY_VISUALEFFECT:
1177                 aProp = ::toolkit::getVisualEffect( pButton );
1178                 break;
1179 			case BASEPROPERTY_STATE:
1180 				aProp <<= (sal_Int16) ( pButton->IsChecked() ? 1 : 0 );
1181     			break;
1182 			case BASEPROPERTY_AUTOTOGGLE:
1183 				aProp <<= (sal_Bool) pButton->IsRadioCheckEnabled();
1184     			break;
1185 			default:
1186 			{
1187 				aProp <<= VCLXGraphicControl::getProperty( PropertyName );
1188 			}
1189 		}
1190 	}
1191 	return aProp;
1192 }
1193 
1194 void VCLXRadioButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1195 {
1196 	::vos::OGuard aGuard( GetMutex() );
1197 	maItemListeners.addInterface( l );
1198 }
1199 
1200 void VCLXRadioButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1201 {
1202 	::vos::OGuard aGuard( GetMutex() );
1203 	maItemListeners.removeInterface( l );
1204 }
1205 
1206 void VCLXRadioButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l  )throw(::com::sun::star::uno::RuntimeException)
1207 {
1208 	::vos::OGuard aGuard( GetMutex() );
1209 	maActionListeners.addInterface( l );
1210 }
1211 
1212 void VCLXRadioButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1213 {
1214 	::vos::OGuard aGuard( GetMutex() );
1215 	maActionListeners.removeInterface( l );
1216 }
1217 
1218 void VCLXRadioButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
1219 {
1220 	::vos::OGuard aGuard( GetMutex() );
1221 
1222 	Window* pWindow = GetWindow();
1223 	if ( pWindow )
1224 		pWindow->SetText( rLabel );
1225 }
1226 
1227 void VCLXRadioButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
1228 {
1229 	::vos::OGuard aGuard( GetMutex() );
1230 	maActionCommand = rCommand;
1231 }
1232 
1233 void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
1234 {
1235 	::vos::OGuard aGuard( GetMutex() );
1236 
1237 	RadioButton* pRadioButton = (RadioButton*)GetWindow();
1238 	if ( pRadioButton)
1239     {
1240 		pRadioButton->Check( b );
1241         // #102717# item listeners are called, but not C++ click listeners in StarOffice code => call click hdl
1242         // But this is needed in old code because Accessibility API uses it.
1243         // pRadioButton->GetClickHdl().Call( pRadioButton );
1244 
1245         // #107218# Call same virtual methods and listeners like VCL would do after user interaction
1246         SetSynthesizingVCLEvent( sal_True );
1247         pRadioButton->Click();
1248         SetSynthesizingVCLEvent( sal_False );
1249     }
1250 }
1251 
1252 sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeException)
1253 {
1254 	::vos::OGuard aGuard( GetMutex() );
1255 
1256 	RadioButton* pRadioButton = (RadioButton*)GetWindow();
1257 	return pRadioButton ? pRadioButton->IsChecked() : sal_False;
1258 }
1259 
1260 ::com::sun::star::awt::Size VCLXRadioButton::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
1261 {
1262 	::vos::OGuard aGuard( GetMutex() );
1263 
1264 	Size aSz;
1265 	RadioButton* pRadioButton = (RadioButton*) GetWindow();
1266 	if ( pRadioButton )
1267 		aSz = pRadioButton->CalcMinimumSize();
1268 	return AWTSize(aSz);
1269 }
1270 
1271 ::com::sun::star::awt::Size VCLXRadioButton::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
1272 {
1273 	return getMinimumSize();
1274 }
1275 
1276 ::com::sun::star::awt::Size VCLXRadioButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
1277 {
1278 	::vos::OGuard aGuard( GetMutex() );
1279 
1280 	Size aSz = VCLSize(rNewSize);
1281 	RadioButton* pRadioButton = (RadioButton*) GetWindow();
1282 	if ( pRadioButton )
1283 	{
1284 		Size aMinSz = pRadioButton->CalcMinimumSize();
1285 		if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
1286 			aSz.Height() = aMinSz.Height();
1287 		else
1288 			aSz = aMinSz;
1289 	}
1290 	return AWTSize(aSz);
1291 }
1292 
1293 void VCLXRadioButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1294 {
1295     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1296         // since we call listeners below, there is a potential that we will be destroyed
1297         // in during the listener call. To prevent the resulting crashs, we keep us
1298         // alive as long as we're here
1299         // #20178# - 2003-10-01 - fs@openoffice.org
1300 
1301 	switch ( rVclWindowEvent.GetId() )
1302 	{
1303 		case VCLEVENT_BUTTON_CLICK:
1304 			if ( !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
1305 			{
1306 				::com::sun::star::awt::ActionEvent aEvent;
1307 				aEvent.Source = (::cppu::OWeakObject*)this;
1308 				aEvent.ActionCommand = maActionCommand;
1309 				maActionListeners.actionPerformed( aEvent );
1310 			}
1311 			ImplClickedOrToggled( sal_False );
1312             break;
1313 
1314 		case VCLEVENT_RADIOBUTTON_TOGGLE:
1315 		    ImplClickedOrToggled( sal_True );
1316             break;
1317 
1318 		default:
1319 			VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent );
1320 			break;
1321 	}
1322 }
1323 
1324 void VCLXRadioButton::ImplClickedOrToggled( sal_Bool bToggled )
1325 {
1326 	// In the formulars, RadioChecked is not enabled, call itemStateChanged only for click
1327 	// In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled
1328 	RadioButton* pRadioButton = (RadioButton*)GetWindow();
1329 	if ( pRadioButton && ( pRadioButton->IsRadioCheckEnabled() == bToggled ) && ( bToggled || pRadioButton->IsStateChanged() ) && maItemListeners.getLength() )
1330 	{
1331 		::com::sun::star::awt::ItemEvent aEvent;
1332 		aEvent.Source = (::cppu::OWeakObject*)this;
1333 		aEvent.Highlighted = sal_False;
1334 		aEvent.Selected = pRadioButton->IsChecked();
1335 		maItemListeners.itemStateChanged( aEvent );
1336 	}
1337 }
1338 
1339 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > VCLXRadioButton::getFirstActionListener ()
1340 {
1341     if (!maItemListeners.getLength ())
1342         return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ();
1343     return maActionListeners.getElements()[0];
1344 }
1345 
1346 //	----------------------------------------------------
1347 //	class VCLXSpinField
1348 //	----------------------------------------------------
1349 void VCLXSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1350 {
1351     PushPropertyIds( rIds,
1352                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
1353                      0 );
1354     VCLXEdit::ImplGetPropertyIds( rIds );
1355 }
1356 
1357 VCLXSpinField::VCLXSpinField() : maSpinListeners( *this )
1358 {
1359 }
1360 
1361 // ::com::sun::star::uno::XInterface
1362 ::com::sun::star::uno::Any VCLXSpinField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
1363 {
1364 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
1365 										SAL_STATIC_CAST( ::com::sun::star::awt::XSpinField*, this ) );
1366 	return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType ));
1367 }
1368 
1369 // ::com::sun::star::lang::XTypeProvider
1370 IMPL_XTYPEPROVIDER_START( VCLXSpinField )
1371 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinField>* ) NULL ),
1372 	VCLXEdit::getTypes()
1373 IMPL_XTYPEPROVIDER_END
1374 
1375 void VCLXSpinField::addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1376 {
1377 	::vos::OGuard aGuard( GetMutex() );
1378 	maSpinListeners.addInterface( l );
1379 }
1380 
1381 void VCLXSpinField::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1382 {
1383 	::vos::OGuard aGuard( GetMutex() );
1384 	maSpinListeners.removeInterface( l );
1385 }
1386 
1387 void VCLXSpinField::up() throw(::com::sun::star::uno::RuntimeException)
1388 {
1389 	::vos::OGuard aGuard( GetMutex() );
1390 
1391 	SpinField* pSpinField = (SpinField*) GetWindow();
1392 	if ( pSpinField )
1393 		pSpinField->Up();
1394 }
1395 
1396 void VCLXSpinField::down() throw(::com::sun::star::uno::RuntimeException)
1397 {
1398 	::vos::OGuard aGuard( GetMutex() );
1399 
1400 	SpinField* pSpinField = (SpinField*) GetWindow();
1401 	if ( pSpinField )
1402 		pSpinField->Down();
1403 }
1404 
1405 void VCLXSpinField::first() throw(::com::sun::star::uno::RuntimeException)
1406 {
1407 	::vos::OGuard aGuard( GetMutex() );
1408 
1409 	SpinField* pSpinField = (SpinField*) GetWindow();
1410 	if ( pSpinField )
1411 		pSpinField->First();
1412 }
1413 
1414 void VCLXSpinField::last() throw(::com::sun::star::uno::RuntimeException)
1415 {
1416 	::vos::OGuard aGuard( GetMutex() );
1417 
1418 	SpinField* pSpinField = (SpinField*) GetWindow();
1419 	if ( pSpinField )
1420 		pSpinField->Last();
1421 }
1422 
1423 void VCLXSpinField::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException)
1424 {
1425 	::vos::OGuard aGuard( GetMutex() );
1426 
1427 	Window* pWindow = GetWindow();
1428 	if ( pWindow )
1429 	{
1430 		WinBits nStyle = pWindow->GetStyle();
1431 		if ( bRepeat )
1432 			nStyle |= WB_REPEAT;
1433 		else
1434 			nStyle &= ~WB_REPEAT;
1435 		pWindow->SetStyle( nStyle );
1436 	}
1437 }
1438 
1439 void VCLXSpinField::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1440 {
1441 	switch ( rVclWindowEvent.GetId() )
1442 	{
1443 		case VCLEVENT_SPINFIELD_UP:
1444 		case VCLEVENT_SPINFIELD_DOWN:
1445 		case VCLEVENT_SPINFIELD_FIRST:
1446 		case VCLEVENT_SPINFIELD_LAST:
1447         {
1448             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1449                 // since we call listeners below, there is a potential that we will be destroyed
1450                 // in during the listener call. To prevent the resulting crashs, we keep us
1451                 // alive as long as we're here
1452                 // #20178# - 2003-10-01 - fs@openoffice.org
1453 
1454 			if ( maSpinListeners.getLength() )
1455 			{
1456 				::com::sun::star::awt::SpinEvent aEvent;
1457 				aEvent.Source = (::cppu::OWeakObject*)this;
1458 				switch ( rVclWindowEvent.GetId() )
1459 				{
1460 					case VCLEVENT_SPINFIELD_UP:     maSpinListeners.up( aEvent );
1461 													break;
1462 					case VCLEVENT_SPINFIELD_DOWN:   maSpinListeners.down( aEvent );
1463 													break;
1464 					case VCLEVENT_SPINFIELD_FIRST:  maSpinListeners.first( aEvent );
1465 													break;
1466 					case VCLEVENT_SPINFIELD_LAST:   maSpinListeners.last( aEvent );
1467 													break;
1468 				}
1469 
1470 			}
1471 		}
1472 		break;
1473 
1474 		default:
1475 			VCLXEdit::ProcessWindowEvent( rVclWindowEvent );
1476 			break;
1477 	}
1478 }
1479 
1480 
1481 //	----------------------------------------------------
1482 //	class VCLXListBox
1483 //	----------------------------------------------------
1484 void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1485 {
1486     PushPropertyIds( rIds,
1487                      BASEPROPERTY_BACKGROUNDCOLOR,
1488                      BASEPROPERTY_BORDER,
1489                      BASEPROPERTY_BORDERCOLOR,
1490                      BASEPROPERTY_DEFAULTCONTROL,
1491                      BASEPROPERTY_DROPDOWN,
1492                      BASEPROPERTY_ENABLED,
1493                      BASEPROPERTY_ENABLEVISIBLE,
1494                      BASEPROPERTY_FONTDESCRIPTOR,
1495                      BASEPROPERTY_HELPTEXT,
1496                      BASEPROPERTY_HELPURL,
1497                      BASEPROPERTY_LINECOUNT,
1498                      BASEPROPERTY_MULTISELECTION,
1499                      BASEPROPERTY_MULTISELECTION_SIMPLEMODE,
1500                      BASEPROPERTY_ITEM_SEPARATOR_POS,
1501                      BASEPROPERTY_PRINTABLE,
1502                      BASEPROPERTY_SELECTEDITEMS,
1503                      BASEPROPERTY_STRINGITEMLIST,
1504                      BASEPROPERTY_TABSTOP,
1505                      BASEPROPERTY_READONLY,
1506                      BASEPROPERTY_ALIGN,
1507                      BASEPROPERTY_WRITING_MODE,
1508                      BASEPROPERTY_CONTEXT_WRITING_MODE,
1509                      BASEPROPERTY_REFERENCE_DEVICE,
1510                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
1511                      0);
1512     VCLXWindow::ImplGetPropertyIds( rIds );
1513 }
1514 
1515 
1516 VCLXListBox::VCLXListBox()
1517 	: maActionListeners( *this ),
1518 	  maItemListeners( *this )
1519 {
1520 }
1521 
1522 void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException)
1523 {
1524 	::vos::OGuard aGuard( GetMutex() );
1525 
1526 	::com::sun::star::lang::EventObject aObj;
1527 	aObj.Source = (::cppu::OWeakObject*)this;
1528 	maItemListeners.disposeAndClear( aObj );
1529 	maActionListeners.disposeAndClear( aObj );
1530 	VCLXWindow::dispose();
1531 }
1532 
1533 void VCLXListBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1534 {
1535 	::vos::OGuard aGuard( GetMutex() );
1536 	maItemListeners.addInterface( l );
1537 }
1538 
1539 void VCLXListBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1540 {
1541 	::vos::OGuard aGuard( GetMutex() );
1542 	maItemListeners.removeInterface( l );
1543 }
1544 
1545 void VCLXListBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1546 {
1547 	::vos::OGuard aGuard( GetMutex() );
1548 	maActionListeners.addInterface( l );
1549 }
1550 
1551 void VCLXListBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1552 {
1553 	::vos::OGuard aGuard( GetMutex() );
1554 	maActionListeners.removeInterface( l );
1555 }
1556 
1557 void VCLXListBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
1558 {
1559 	::vos::OGuard aGuard( GetMutex() );
1560 
1561 	ListBox* pBox = (ListBox*) GetWindow();
1562 	if ( pBox )
1563 		pBox->InsertEntry( aItem, nPos );
1564 }
1565 
1566 void VCLXListBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
1567 {
1568 	::vos::OGuard aGuard( GetMutex() );
1569 
1570 	ListBox* pBox = (ListBox*) GetWindow();
1571 	if ( pBox )
1572 	{
1573 	    sal_uInt16 nP = nPos;
1574         const ::rtl::OUString* pItems = aItems.getConstArray();
1575         const ::rtl::OUString* pItemsEnd = aItems.getConstArray() + aItems.getLength();
1576 		while ( pItems != pItemsEnd )
1577 		{
1578 			if ( (sal_uInt16)nP == 0xFFFF )
1579             {
1580                 OSL_ENSURE( false, "VCLXListBox::addItems: too many entries!" );
1581                 // skip remaining entries, list cannot hold them, anyway
1582                 break;
1583             }
1584 
1585             pBox->InsertEntry( *pItems++, nP++ );
1586 		}
1587 	}
1588 }
1589 
1590 void VCLXListBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
1591 {
1592 	::vos::OGuard aGuard( GetMutex() );
1593 
1594 	ListBox* pBox = (ListBox*) GetWindow();
1595 	if ( pBox )
1596 	{
1597 		for ( sal_uInt16 n = nCount; n; )
1598 			pBox->RemoveEntry( nPos + (--n) );
1599 	}
1600 }
1601 
1602 sal_Int16 VCLXListBox::getItemCount() throw(::com::sun::star::uno::RuntimeException)
1603 {
1604 	::vos::OGuard aGuard( GetMutex() );
1605 
1606 	ListBox* pBox = (ListBox*) GetWindow();
1607 	return pBox ? pBox->GetEntryCount() : 0;
1608 }
1609 
1610 ::rtl::OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
1611 {
1612 	::vos::OGuard aGuard( GetMutex() );
1613 
1614 	String aItem;
1615 	ListBox* pBox = (ListBox*) GetWindow();
1616 	if ( pBox )
1617 		aItem = pBox->GetEntry( nPos );
1618 	return aItem;
1619 }
1620 
1621 ::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getItems() throw(::com::sun::star::uno::RuntimeException)
1622 {
1623 	::vos::OGuard aGuard( GetMutex() );
1624 
1625 	::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
1626 	ListBox* pBox = (ListBox*) GetWindow();
1627 	if ( pBox )
1628 	{
1629 		sal_uInt16 nEntries = pBox->GetEntryCount();
1630 		aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries );
1631 		for ( sal_uInt16 n = nEntries; n; )
1632 		{
1633 			--n;
1634 			aSeq.getArray()[n] = ::rtl::OUString( pBox->GetEntry( n ) );
1635 		}
1636 	}
1637 	return aSeq;
1638 }
1639 
1640 sal_Int16 VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException)
1641 {
1642 	::vos::OGuard aGuard( GetMutex() );
1643 
1644 	ListBox* pBox = (ListBox*) GetWindow();
1645 	return pBox ? pBox->GetSelectEntryPos() : 0;
1646 }
1647 
1648 ::com::sun::star::uno::Sequence<sal_Int16> VCLXListBox::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException)
1649 {
1650 	::vos::OGuard aGuard( GetMutex() );
1651 
1652 	::com::sun::star::uno::Sequence<sal_Int16> aSeq;
1653 	ListBox* pBox = (ListBox*) GetWindow();
1654 	if ( pBox )
1655 	{
1656 		sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
1657 		aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nSelEntries );
1658 		for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
1659 			aSeq.getArray()[n] = pBox->GetSelectEntryPos( n );
1660 	}
1661 	return aSeq;
1662 }
1663 
1664 ::rtl::OUString VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeException)
1665 {
1666 	::vos::OGuard aGuard( GetMutex() );
1667 
1668 	String aItem;
1669 	ListBox* pBox = (ListBox*) GetWindow();
1670 	if ( pBox )
1671 		aItem = pBox->GetSelectEntry();
1672 	return aItem;
1673 }
1674 
1675 ::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getSelectedItems() throw(::com::sun::star::uno::RuntimeException)
1676 {
1677 	::vos::OGuard aGuard( GetMutex() );
1678 
1679 	::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
1680 	ListBox* pBox = (ListBox*) GetWindow();
1681 	if ( pBox )
1682 	{
1683 		sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
1684 		aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nSelEntries );
1685 		for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
1686 			aSeq.getArray()[n] = ::rtl::OUString( pBox->GetSelectEntry( n ) );
1687 	}
1688 	return aSeq;
1689 }
1690 
1691 void VCLXListBox::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
1692 {
1693 	::vos::OGuard aGuard( GetMutex() );
1694 
1695 	ListBox* pBox = (ListBox*) GetWindow();
1696 	if ( pBox && ( pBox->IsEntryPosSelected( nPos ) != bSelect ) )
1697     {
1698 		pBox->SelectEntryPos( nPos, bSelect );
1699 
1700         // VCL doesn't call select handler after API call.
1701         // ImplCallItemListeners();
1702 
1703         // #107218# Call same listeners like VCL would do after user interaction
1704         SetSynthesizingVCLEvent( sal_True );
1705         pBox->Select();
1706         SetSynthesizingVCLEvent( sal_False );
1707     }
1708 }
1709 
1710 void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
1711 {
1712 	::vos::OGuard aGuard( GetMutex() );
1713 
1714 	ListBox* pBox = (ListBox*) GetWindow();
1715 	if ( pBox )
1716 	{
1717         sal_Bool bChanged = sal_False;
1718 		for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; )
1719         {
1720             sal_uInt16 nPos = (sal_uInt16) aPositions.getConstArray()[--n];
1721             if ( pBox->IsEntryPosSelected( nPos ) != bSelect )
1722             {
1723 			    pBox->SelectEntryPos( nPos, bSelect );
1724                 bChanged = sal_True;
1725             }
1726         }
1727 
1728         if ( bChanged )
1729         {
1730             // VCL doesn't call select handler after API call.
1731             // ImplCallItemListeners();
1732 
1733             // #107218# Call same listeners like VCL would do after user interaction
1734             SetSynthesizingVCLEvent( sal_True );
1735             pBox->Select();
1736             SetSynthesizingVCLEvent( sal_False );
1737         }
1738 	}
1739 }
1740 
1741 void VCLXListBox::selectItem( const ::rtl::OUString& rItemText, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
1742 {
1743 	::vos::OGuard aGuard( GetMutex() );
1744 
1745 	ListBox* pBox = (ListBox*) GetWindow();
1746 	if ( pBox )
1747     {
1748         String aItemText( rItemText );
1749 		selectItemPos( pBox->GetEntryPos( aItemText ), bSelect );
1750     }
1751 }
1752 
1753 
1754 void VCLXListBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
1755 {
1756 	::vos::OGuard aGuard( GetMutex() );
1757 
1758 	ListBox* pBox = (ListBox*) GetWindow();
1759 	if ( pBox )
1760 		pBox->SetDropDownLineCount( nLines );
1761 }
1762 
1763 sal_Int16 VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
1764 {
1765 	::vos::OGuard aGuard( GetMutex() );
1766 
1767 	sal_Int16 nLines = 0;
1768 	ListBox* pBox = (ListBox*) GetWindow();
1769 	if ( pBox )
1770 		nLines = pBox->GetDropDownLineCount();
1771 	return nLines;
1772 }
1773 
1774 sal_Bool VCLXListBox::isMutipleMode() throw(::com::sun::star::uno::RuntimeException)
1775 {
1776 	::vos::OGuard aGuard( GetMutex() );
1777 
1778 	sal_Bool bMulti = sal_False;
1779 	ListBox* pBox = (ListBox*) GetWindow();
1780 	if ( pBox )
1781 		bMulti = pBox->IsMultiSelectionEnabled();
1782 	return bMulti;
1783 }
1784 
1785 void VCLXListBox::setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException)
1786 {
1787 	::vos::OGuard aGuard( GetMutex() );
1788 
1789 	ListBox* pBox = (ListBox*) GetWindow();
1790 	if ( pBox )
1791 		pBox->EnableMultiSelection( bMulti );
1792 }
1793 
1794 void VCLXListBox::makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException)
1795 {
1796 	::vos::OGuard aGuard( GetMutex() );
1797 
1798 	ListBox* pBox = (ListBox*) GetWindow();
1799 	if ( pBox )
1800 		pBox->SetTopEntry( nEntry );
1801 }
1802 
1803 void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1804 {
1805     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1806         // since we call listeners below, there is a potential that we will be destroyed
1807         // in during the listener call. To prevent the resulting crashs, we keep us
1808         // alive as long as we're here
1809         // #20178# - 2003-10-01 - fs@openoffice.org
1810 
1811 	switch ( rVclWindowEvent.GetId() )
1812 	{
1813 		case VCLEVENT_LISTBOX_SELECT:
1814 		{
1815 			ListBox* pListBox = (ListBox*)GetWindow();
1816 
1817             if( pListBox )
1818             {
1819 			    sal_Bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) ? sal_True : sal_False;
1820 			    if ( bDropDown && !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
1821 			    {
1822 				    // Bei DropDown den ActionListener rufen...
1823 				    ::com::sun::star::awt::ActionEvent aEvent;
1824 				    aEvent.Source = (::cppu::OWeakObject*)this;
1825 				    aEvent.ActionCommand = pListBox->GetSelectEntry();
1826 				    maActionListeners.actionPerformed( aEvent );
1827 			    }
1828 
1829 			    if ( maItemListeners.getLength() )
1830 			    {
1831                     ImplCallItemListeners();
1832 			    }
1833             }
1834 		}
1835 		break;
1836 
1837 		case VCLEVENT_LISTBOX_DOUBLECLICK:
1838 			if ( GetWindow() && maActionListeners.getLength() )
1839 			{
1840 				::com::sun::star::awt::ActionEvent aEvent;
1841 				aEvent.Source = (::cppu::OWeakObject*)this;
1842 				aEvent.ActionCommand = ((ListBox*)GetWindow())->GetSelectEntry();
1843 				maActionListeners.actionPerformed( aEvent );
1844 			}
1845     		break;
1846 
1847 		default:
1848             VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
1849 			break;
1850 	}
1851 }
1852 
1853 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXListBox::CreateAccessibleContext()
1854 {
1855 	::vos::OGuard aGuard( GetMutex() );
1856 
1857     return getAccessibleFactory().createAccessibleContext( this );
1858 }
1859 
1860 void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
1861 {
1862 	::vos::OGuard aGuard( GetMutex() );
1863 
1864 	ListBox* pListBox = (ListBox*)GetWindow();
1865 	if ( pListBox )
1866 	{
1867 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
1868 		switch ( nPropType )
1869 		{
1870             case BASEPROPERTY_ITEM_SEPARATOR_POS:
1871             {
1872                 sal_Int16 nSeparatorPos(0);
1873                 if ( Value >>= nSeparatorPos )
1874                     pListBox->SetSeparatorPos( nSeparatorPos );
1875             }
1876             break;
1877 			case BASEPROPERTY_READONLY:
1878 			{
1879 				sal_Bool b = sal_Bool();
1880 				if ( Value >>= b )
1881  					pListBox->SetReadOnly( b);
1882 			}
1883 			break;
1884 			case BASEPROPERTY_MULTISELECTION:
1885 			{
1886 				sal_Bool b = sal_Bool();
1887 				if ( Value >>= b )
1888  					pListBox->EnableMultiSelection( b );
1889 			}
1890 			break;
1891 			case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
1892                 ::toolkit::adjustBooleanWindowStyle( Value, pListBox, WB_SIMPLEMODE, sal_False );
1893 			    break;
1894 			case BASEPROPERTY_LINECOUNT:
1895 			{
1896 				sal_Int16 n = sal_Int16();
1897 				if ( Value >>= n )
1898  					pListBox->SetDropDownLineCount( n );
1899 			}
1900 			break;
1901 			case BASEPROPERTY_STRINGITEMLIST:
1902 			{
1903 				::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
1904 				if ( Value >>= aItems )
1905 				{
1906 					pListBox->Clear();
1907 					addItems( aItems, 0 );
1908 				}
1909 			}
1910 			break;
1911 			case BASEPROPERTY_SELECTEDITEMS:
1912 			{
1913 				::com::sun::star::uno::Sequence<sal_Int16> aItems;
1914 				if ( Value >>= aItems )
1915 				{
1916 					for ( sal_uInt16 n = pListBox->GetEntryCount(); n; )
1917 						pListBox->SelectEntryPos( --n, sal_False );
1918 
1919                     if ( aItems.getLength() )
1920 					    selectItemsPos( aItems, sal_True );
1921                     else
1922                         pListBox->SetNoSelection();
1923 
1924 					if ( !pListBox->GetSelectEntryCount() )
1925 						pListBox->SetTopEntry( 0 );
1926 				}
1927 			}
1928 			break;
1929 			default:
1930 			{
1931 				VCLXWindow::setProperty( PropertyName, Value );
1932 			}
1933 		}
1934 	}
1935 }
1936 
1937 ::com::sun::star::uno::Any VCLXListBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
1938 {
1939 	::vos::OGuard aGuard( GetMutex() );
1940 
1941 	::com::sun::star::uno::Any aProp;
1942 	ListBox* pListBox = (ListBox*)GetWindow();
1943 	if ( pListBox )
1944 	{
1945 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
1946 		switch ( nPropType )
1947 		{
1948             case BASEPROPERTY_ITEM_SEPARATOR_POS:
1949                 aProp <<= sal_Int16( pListBox->GetSeparatorPos() );
1950                 break;
1951 			case BASEPROPERTY_READONLY:
1952 			{
1953  				aProp <<= (sal_Bool) pListBox->IsReadOnly();
1954 			}
1955 			break;
1956 			case BASEPROPERTY_MULTISELECTION:
1957 			{
1958  				aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled();
1959 			}
1960 			break;
1961 			case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
1962             {
1963                 aProp <<= (sal_Bool)( ( pListBox->GetStyle() & WB_SIMPLEMODE ) == 0 );
1964             }
1965             break;
1966 			case BASEPROPERTY_LINECOUNT:
1967 			{
1968  				aProp <<= (sal_Int16) pListBox->GetDropDownLineCount();
1969 			}
1970 			break;
1971 			case BASEPROPERTY_STRINGITEMLIST:
1972 			{
1973 				sal_uInt16 nItems = pListBox->GetEntryCount();
1974 				::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems );
1975 				::rtl::OUString* pStrings = aSeq.getArray();
1976 				for ( sal_uInt16 n = 0; n < nItems; n++ )
1977 					pStrings[n] = pListBox->GetEntry( n );
1978 				aProp <<= aSeq;
1979 
1980 			}
1981 			break;
1982 			default:
1983 			{
1984 				aProp <<= VCLXWindow::getProperty( PropertyName );
1985 			}
1986 		}
1987 	}
1988 	return aProp;
1989 }
1990 
1991 ::com::sun::star::awt::Size VCLXListBox::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
1992 {
1993 	::vos::OGuard aGuard( GetMutex() );
1994 
1995 	Size aSz;
1996 	ListBox* pListBox = (ListBox*) GetWindow();
1997 	if ( pListBox )
1998 		aSz = pListBox->CalcMinimumSize();
1999 	return AWTSize(aSz);
2000 }
2001 
2002 ::com::sun::star::awt::Size VCLXListBox::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
2003 {
2004 	::vos::OGuard aGuard( GetMutex() );
2005 
2006 	Size aSz;
2007 	ListBox* pListBox = (ListBox*) GetWindow();
2008 	if ( pListBox )
2009 	{
2010 		aSz = pListBox->CalcMinimumSize();
2011 		if ( pListBox->GetStyle() & WB_DROPDOWN )
2012 			aSz.Height() += 4;
2013 	}
2014 	return AWTSize(aSz);
2015 }
2016 
2017 ::com::sun::star::awt::Size VCLXListBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
2018 {
2019 	::vos::OGuard aGuard( GetMutex() );
2020 
2021 	Size aSz = VCLSize(rNewSize);
2022 	ListBox* pListBox = (ListBox*) GetWindow();
2023 	if ( pListBox )
2024 		aSz = pListBox->CalcAdjustedSize( aSz );
2025 	return AWTSize(aSz);
2026 }
2027 
2028 ::com::sun::star::awt::Size VCLXListBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
2029 {
2030 	::vos::OGuard aGuard( GetMutex() );
2031 
2032 	Size aSz;
2033 	ListBox* pListBox = (ListBox*) GetWindow();
2034 	if ( pListBox )
2035 		aSz = pListBox->CalcSize( nCols, nLines );
2036 	return AWTSize(aSz);
2037 }
2038 
2039 void VCLXListBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
2040 {
2041 	::vos::OGuard aGuard( GetMutex() );
2042 
2043 	nCols = nLines = 0;
2044 	ListBox* pListBox = (ListBox*) GetWindow();
2045 	if ( pListBox )
2046 	{
2047 		sal_uInt16 nC, nL;
2048 		pListBox->GetMaxVisColumnsAndLines( nC, nL );
2049 		nCols = nC;
2050 		nLines = nL;
2051 	}
2052 }
2053 
2054 void VCLXListBox::ImplCallItemListeners()
2055 {
2056 	ListBox* pListBox = (ListBox*) GetWindow();
2057     if ( pListBox && maItemListeners.getLength() )
2058     {
2059 	    ::com::sun::star::awt::ItemEvent aEvent;
2060 	    aEvent.Source = (::cppu::OWeakObject*)this;
2061 	    aEvent.Highlighted = sal_False;
2062 
2063 	    // Bei Mehrfachselektion 0xFFFF, sonst die ID
2064 	    aEvent.Selected = (pListBox->GetSelectEntryCount() == 1 ) ? pListBox->GetSelectEntryPos() : 0xFFFF;
2065 
2066 	    maItemListeners.itemStateChanged( aEvent );
2067     }
2068 }
2069 namespace
2070 {
2071 	 Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL )
2072 	 {
2073 		 if ( !i_rImageURL.getLength() )
2074 			 return Image();
2075 
2076 		try
2077 		{
2078 			 ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
2079 			 Reference< XGraphicProvider > xProvider;
2080 			 if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
2081 			 {
2082 				 ::comphelper::NamedValueCollection aMediaProperties;
2083 				 aMediaProperties.put( "URL", i_rImageURL );
2084 				 Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
2085 				return Image( xGraphic );
2086 			 }
2087 		 }
2088 		 catch( const uno::Exception& )
2089 		 {
2090 			 DBG_UNHANDLED_EXCEPTION();
2091 		 }
2092 		 return Image();
2093 	 }
2094 }
2095 void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
2096 {
2097 	::vos::OGuard aGuard( GetMutex() );
2098 
2099     ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2100 
2101     ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemInserted: no ListBox?!" );
2102     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pListBox->GetEntryCount() ) ),
2103         "VCLXListBox::listItemInserted: illegal (inconsistent) item position!" );
2104     pListBox->InsertEntry(
2105         i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
2106         i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
2107         i_rEvent.ItemPosition );
2108 }
2109 
2110 void SAL_CALL VCLXListBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
2111 {
2112 	::vos::OGuard aGuard( GetMutex() );
2113 
2114     ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2115 
2116     ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemRemoved: no ListBox?!" );
2117     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
2118         "VCLXListBox::listItemRemoved: illegal (inconsistent) item position!" );
2119 
2120     pListBox->RemoveEntry( i_rEvent.ItemPosition );
2121 }
2122 
2123 void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
2124 {
2125 	::vos::OGuard aGuard( GetMutex() );
2126 
2127     ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2128 
2129     ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
2130     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
2131         "VCLXListBox::listItemModified: illegal (inconsistent) item position!" );
2132 
2133     // VCL's ListBox does not support changing an entry's text or image, so remove and re-insert
2134 
2135     const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pListBox->GetEntry( i_rEvent.ItemPosition ) );
2136     const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition  ) );
2137 
2138     pListBox->RemoveEntry( i_rEvent.ItemPosition );
2139     pListBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
2140 }
2141 
2142 void SAL_CALL VCLXListBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
2143 {
2144 	::vos::OGuard aGuard( GetMutex() );
2145 
2146     ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2147     ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
2148 
2149     pListBox->Clear();
2150 
2151     (void)i_rEvent;
2152 }
2153 
2154 void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
2155 {
2156 	::vos::OGuard aGuard( GetMutex() );
2157 
2158     ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2159     ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
2160 
2161     pListBox->Clear();
2162 
2163     uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW );
2164     uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
2165     uno::Reference< resource::XStringResourceResolver > xStringResourceResolver;
2166     if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) )
2167     {
2168         xStringResourceResolver.set(
2169             xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ),
2170             uno::UNO_QUERY
2171         );
2172     }
2173 
2174 
2175     Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
2176     uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
2177     for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
2178     {
2179         ::rtl::OUString aLocalizationKey( aItems[i].First );
2180         if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' )
2181         {
2182             aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
2183         }
2184         pListBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) );
2185     }
2186 }
2187 
2188 void SAL_CALL VCLXListBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
2189 {
2190     // just disambiguate
2191     VCLXWindow::disposing( i_rEvent );
2192 }
2193 
2194 //	----------------------------------------------------
2195 //	class VCLXMessageBox
2196 //	----------------------------------------------------
2197 
2198 void VCLXMessageBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2199 {
2200     VCLXTopWindow::ImplGetPropertyIds( rIds );
2201 }
2202 
2203 VCLXMessageBox::VCLXMessageBox()
2204 {
2205 }
2206 
2207 VCLXMessageBox::~VCLXMessageBox()
2208 {
2209 }
2210 
2211 // ::com::sun::star::uno::XInterface
2212 ::com::sun::star::uno::Any VCLXMessageBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2213 {
2214 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2215 										SAL_STATIC_CAST( ::com::sun::star::awt::XMessageBox*, this ) );
2216 	return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
2217 }
2218 
2219 // ::com::sun::star::lang::XTypeProvider
2220 IMPL_XTYPEPROVIDER_START( VCLXMessageBox )
2221 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox>* ) NULL ),
2222 	VCLXTopWindow::getTypes()
2223 IMPL_XTYPEPROVIDER_END
2224 
2225 void VCLXMessageBox::setCaptionText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
2226 {
2227 	::vos::OGuard aGuard( GetMutex() );
2228 
2229 	Window* pWindow = GetWindow();
2230 	if ( pWindow )
2231 		pWindow->SetText( rText );
2232 }
2233 
2234 ::rtl::OUString VCLXMessageBox::getCaptionText() throw(::com::sun::star::uno::RuntimeException)
2235 {
2236 	::vos::OGuard aGuard( GetMutex() );
2237 
2238 	String aText;
2239 	Window* pWindow = GetWindow();
2240 	if ( pWindow )
2241 		aText = pWindow->GetText();
2242 	return aText;
2243 }
2244 
2245 void VCLXMessageBox::setMessageText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
2246 {
2247 	::vos::OGuard aGuard( GetMutex() );
2248 
2249 	MessBox* pBox = (MessBox*)GetWindow();
2250 	if ( pBox )
2251 		pBox->SetMessText( rText );
2252 }
2253 
2254 ::rtl::OUString VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeException)
2255 {
2256 	::vos::OGuard aGuard( GetMutex() );
2257 
2258 	::rtl::OUString aText;
2259 	MessBox* pBox = (MessBox*)GetWindow();
2260 	if ( pBox )
2261 		aText = pBox->GetMessText();
2262 	return aText;
2263 }
2264 
2265 sal_Int16 VCLXMessageBox::execute() throw(::com::sun::star::uno::RuntimeException)
2266 {
2267 	::vos::OGuard aGuard( GetMutex() );
2268 
2269 	MessBox* pBox = (MessBox*)GetWindow();
2270 	return pBox ? pBox->Execute() : 0;
2271 }
2272 
2273 ::com::sun::star::awt::Size SAL_CALL VCLXMessageBox::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
2274 {
2275     ::vos::OGuard aGuard( GetMutex() );
2276     return ::com::sun::star::awt::Size( 250, 100 );
2277 }
2278 
2279 //	----------------------------------------------------
2280 //	class VCLXDialog
2281 //	----------------------------------------------------
2282 void VCLXDialog::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2283 {
2284     VCLXTopWindow::ImplGetPropertyIds( rIds );
2285 }
2286 
2287 VCLXDialog::VCLXDialog()
2288 {
2289 }
2290 
2291 VCLXDialog::~VCLXDialog()
2292 {
2293 #ifndef __SUNPRO_CC
2294     OSL_TRACE ("%s", __FUNCTION__);
2295 #endif
2296 }
2297 
2298 // ::com::sun::star::uno::XInterface
2299 ::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2300 {
2301 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2302 										SAL_STATIC_CAST( ::com::sun::star::awt::XDialog2*, this ),
2303 										SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) );
2304 	return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
2305 }
2306 
2307 // ::com::sun::star::lang::XTypeProvider
2308 IMPL_XTYPEPROVIDER_START( VCLXDialog )
2309 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ),
2310 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
2311 	VCLXTopWindow::getTypes()
2312 IMPL_XTYPEPROVIDER_END
2313 
2314 void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
2315 {
2316     ::vos::OGuard aGuard( GetMutex() );
2317 
2318     Dialog* pDialog = dynamic_cast< Dialog* >( GetWindow() );
2319     if ( pDialog )
2320         pDialog->EndDialog( i_result );
2321 }
2322 
2323 void SAL_CALL VCLXDialog::setHelpId( const ::rtl::OUString& rId ) throw (RuntimeException)
2324 {
2325     ::vos::OGuard aGuard( GetMutex() );
2326 
2327     Window* pWindow = GetWindow();
2328     if ( pWindow )
2329         pWindow->SetHelpId( rtl::OUStringToOString( rId, RTL_TEXTENCODING_UTF8 ) );
2330 }
2331 
2332 void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException)
2333 {
2334 	::vos::OGuard aGuard( GetMutex() );
2335 
2336 	Window* pWindow = GetWindow();
2337 	if ( pWindow )
2338 		pWindow->SetText( Title );
2339 }
2340 
2341 ::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException)
2342 {
2343 	::vos::OGuard aGuard( GetMutex() );
2344 
2345 	::rtl::OUString aTitle;
2346 	Window* pWindow = GetWindow();
2347 	if ( pWindow )
2348 		aTitle = pWindow->GetText();
2349 	return aTitle;
2350 }
2351 
2352 sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException)
2353 {
2354 	::vos::OGuard aGuard( GetMutex() );
2355 
2356 	sal_Int16 nRet = 0;
2357 	if ( GetWindow() )
2358 	{
2359 		Dialog* pDlg = (Dialog*) GetWindow();
2360 		Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP );
2361 		Window* pOldParent = NULL;
2362         Window* pSetParent = NULL;
2363 		if ( pParent && !pParent->IsReallyVisible() )
2364 		{
2365 			pOldParent = pDlg->GetParent();
2366             Window* pFrame = pDlg->GetWindow( WINDOW_FRAME );
2367             if( pFrame != pDlg )
2368             {
2369                 pDlg->SetParent( pFrame );
2370                 pSetParent = pFrame;
2371             }
2372 		}
2373 
2374 		nRet = pDlg->Execute();
2375 
2376         // set the parent back only in case no new parent was set from outside
2377         // in other words, revert only own changes
2378 		if ( pOldParent && pDlg->GetParent() == pSetParent )
2379 			pDlg->SetParent( pOldParent );
2380 	}
2381 	return nRet;
2382 }
2383 
2384 void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException)
2385 {
2386     endDialog(0);
2387 }
2388 
2389 void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
2390 {
2391 	::vos::OGuard aGuard( GetMutex() );
2392 	Window* pWindow = GetWindow();
2393 
2394 	if ( pWindow )
2395 	{
2396 		OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
2397 		if ( !pDev )
2398 			pDev = pWindow->GetParent();
2399 
2400 		Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
2401 		Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
2402 
2403 		pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
2404     }
2405 }
2406 
2407 ::com::sun::star::awt::DeviceInfo VCLXDialog::getInfo() throw(::com::sun::star::uno::RuntimeException)
2408 {
2409 	::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
2410 
2411 	::vos::OGuard aGuard( GetMutex() );
2412 	Dialog* pDlg = (Dialog*) GetWindow();
2413 	if ( pDlg )
2414 	    pDlg->GetDrawWindowBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
2415 
2416 	return aInfo;
2417 }
2418 
2419 
2420 void SAL_CALL VCLXDialog::setProperty(
2421     const ::rtl::OUString& PropertyName,
2422     const ::com::sun::star::uno::Any& Value )
2423 throw(::com::sun::star::uno::RuntimeException)
2424 {
2425 	::vos::OGuard aGuard( GetMutex() );
2426 
2427 	Dialog* pDialog = (Dialog*)GetWindow();
2428 	if ( pDialog )
2429 	{
2430 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
2431 
2432 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
2433 		switch ( nPropType )
2434 		{
2435 			case BASEPROPERTY_GRAPHIC:
2436             {
2437                 Reference< XGraphic > xGraphic;
2438                 if (( Value >>= xGraphic ) && xGraphic.is() )
2439                 {
2440                     Image aImage( xGraphic );
2441 
2442                     Wallpaper aWallpaper( aImage.GetBitmapEx());
2443                     aWallpaper.SetStyle( WALLPAPER_SCALE );
2444                     pDialog->SetBackground( aWallpaper );
2445                 }
2446                 else if ( bVoid || !xGraphic.is() )
2447                 {
2448                     Color aColor = pDialog->GetControlBackground().GetColor();
2449                     if ( aColor == COL_AUTO )
2450                         aColor = pDialog->GetSettings().GetStyleSettings().GetDialogColor();
2451 
2452                     Wallpaper aWallpaper( aColor );
2453                     pDialog->SetBackground( aWallpaper );
2454                 }
2455             }
2456             break;
2457 
2458             default:
2459 			{
2460 				VCLXWindow::setProperty( PropertyName, Value );
2461 			}
2462         }
2463     }
2464 }
2465 
2466 //	----------------------------------------------------
2467 //	class VCLXTabPage
2468 //	----------------------------------------------------
2469 VCLXTabPage::VCLXTabPage()
2470 {
2471 }
2472 
2473 VCLXTabPage::~VCLXTabPage()
2474 {
2475 }
2476 
2477 ::com::sun::star::uno::Any SAL_CALL VCLXTabPage::queryInterface(const ::com::sun::star::uno::Type & rType )
2478 throw(::com::sun::star::uno::RuntimeException)
2479 {
2480 	return VCLXContainer::queryInterface( rType );
2481 }
2482 
2483 // ::com::sun::star::lang::XTypeProvider
2484 IMPL_XTYPEPROVIDER_START( VCLXTabPage )
2485 	VCLXContainer::getTypes()
2486 IMPL_XTYPEPROVIDER_END
2487 
2488 // ::com::sun::star::awt::XView
2489 void SAL_CALL VCLXTabPage::draw( sal_Int32 nX, sal_Int32 nY )
2490 throw(::com::sun::star::uno::RuntimeException)
2491 {
2492 	::vos::OGuard aGuard( GetMutex() );
2493 	Window* pWindow = GetWindow();
2494 
2495 	if ( pWindow )
2496 	{
2497 		OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
2498 		if ( !pDev )
2499 			pDev = pWindow->GetParent();
2500 
2501 		Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
2502 		Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
2503 
2504 		pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
2505     }
2506 }
2507 
2508 // ::com::sun::star::awt::XDevice,
2509 ::com::sun::star::awt::DeviceInfo SAL_CALL VCLXTabPage::getInfo()
2510 throw(::com::sun::star::uno::RuntimeException)
2511 {
2512 	::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
2513 	return aInfo;
2514 }
2515 
2516 void SAL_CALL VCLXTabPage::setProperty(
2517     const ::rtl::OUString& PropertyName,
2518     const ::com::sun::star::uno::Any& Value )
2519 throw(::com::sun::star::uno::RuntimeException)
2520 {
2521 	::vos::OGuard aGuard( GetMutex() );
2522 
2523 	TabPage* pTabPage = (TabPage*)GetWindow();
2524 	if ( pTabPage )
2525 	{
2526 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
2527 
2528 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
2529 		switch ( nPropType )
2530 		{
2531 			case BASEPROPERTY_GRAPHIC:
2532             {
2533                 Reference< XGraphic > xGraphic;
2534                 if (( Value >>= xGraphic ) && xGraphic.is() )
2535                 {
2536                     Image aImage( xGraphic );
2537 
2538                     Wallpaper aWallpaper( aImage.GetBitmapEx());
2539                     aWallpaper.SetStyle( WALLPAPER_SCALE );
2540                     pTabPage->SetBackground( aWallpaper );
2541                 }
2542                 else if ( bVoid || !xGraphic.is() )
2543                 {
2544                     Color aColor = pTabPage->GetControlBackground().GetColor();
2545                     if ( aColor == COL_AUTO )
2546                         aColor = pTabPage->GetSettings().GetStyleSettings().GetDialogColor();
2547 
2548                     Wallpaper aWallpaper( aColor );
2549                     pTabPage->SetBackground( aWallpaper );
2550                 }
2551             }
2552             break;
2553             case BASEPROPERTY_TITLE:
2554                 {
2555                     ::rtl::OUString sTitle;
2556                     if ( Value >>= sTitle )
2557                     {
2558                         pTabPage->SetText(sTitle);
2559                     }
2560                 }
2561                 break;
2562 
2563             default:
2564 			{
2565 				VCLXContainer::setProperty( PropertyName, Value );
2566 			}
2567         }
2568     }
2569 }
2570 
2571 //	----------------------------------------------------
2572 //  class VCLXFixedHyperlink
2573 //	----------------------------------------------------
2574 VCLXFixedHyperlink::VCLXFixedHyperlink() :
2575 
2576     maActionListeners( *this )
2577 
2578 {
2579 }
2580 
2581 VCLXFixedHyperlink::~VCLXFixedHyperlink()
2582 {
2583 }
2584 
2585 // ::com::sun::star::uno::XInterface
2586 ::com::sun::star::uno::Any VCLXFixedHyperlink::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2587 {
2588 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2589                                         SAL_STATIC_CAST( ::com::sun::star::awt::XFixedHyperlink*, this ) );
2590 	return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
2591 }
2592 
2593 void VCLXFixedHyperlink::dispose() throw(::com::sun::star::uno::RuntimeException)
2594 {
2595         ::vos::OGuard aGuard( GetMutex() );
2596 
2597         ::com::sun::star::lang::EventObject aObj;
2598         aObj.Source = (::cppu::OWeakObject*)this;
2599         maActionListeners.disposeAndClear( aObj );
2600         VCLXWindow::dispose();
2601 }
2602 
2603 // ::com::sun::star::lang::XTypeProvider
2604 IMPL_XTYPEPROVIDER_START( VCLXFixedHyperlink )
2605     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedHyperlink>* ) NULL ),
2606 	VCLXWindow::getTypes()
2607 IMPL_XTYPEPROVIDER_END
2608 
2609 void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
2610 {
2611     switch ( rVclWindowEvent.GetId() )
2612     {
2613         case VCLEVENT_BUTTON_CLICK:
2614         {
2615             if ( maActionListeners.getLength() )
2616             {
2617                 ::com::sun::star::awt::ActionEvent aEvent;
2618                 aEvent.Source = (::cppu::OWeakObject*)this;
2619                 maActionListeners.actionPerformed( aEvent );
2620             }
2621             else
2622             {
2623                 // open the URL
2624                 ::rtl::OUString sURL;
2625                 ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2626                 if ( pBase )
2627                     sURL = pBase->GetURL();
2628                 Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
2629                     ::comphelper::getProcessServiceFactory()->createInstance(
2630                         ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), uno::UNO_QUERY );
2631                 if ( sURL.getLength() > 0 && xSystemShellExecute.is() )
2632                 {
2633                     try
2634                     {
2635                         // start browser
2636                         xSystemShellExecute->execute(
2637                             sURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::DEFAULTS );
2638                     }
2639                     catch( uno::Exception& )
2640                     {
2641                     }
2642                 }
2643             }
2644         }
2645 
2646         default:
2647             VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
2648             break;
2649     }
2650 }
2651 
2652 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXFixedHyperlink::CreateAccessibleContext()
2653 {
2654     return getAccessibleFactory().createAccessibleContext( this );
2655 }
2656 
2657 void VCLXFixedHyperlink::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException)
2658 {
2659 	::vos::OGuard aGuard( GetMutex() );
2660 
2661     ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2662     if ( pBase )
2663         pBase->SetDescription( Text );
2664 }
2665 
2666 ::rtl::OUString VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeException)
2667 {
2668 	::vos::OGuard aGuard( GetMutex() );
2669 
2670 	::rtl::OUString aText;
2671     Window* pWindow = GetWindow();
2672     if ( pWindow )
2673         aText = pWindow->GetText();
2674 	return aText;
2675 }
2676 
2677 void VCLXFixedHyperlink::setURL( const ::rtl::OUString& URL ) throw(::com::sun::star::uno::RuntimeException)
2678 {
2679     ::vos::OGuard aGuard( GetMutex() );
2680 
2681     ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2682     if ( pBase )
2683         pBase->SetURL( URL );
2684 }
2685 
2686 ::rtl::OUString VCLXFixedHyperlink::getURL(  ) throw(::com::sun::star::uno::RuntimeException)
2687 {
2688     ::vos::OGuard aGuard( GetMutex() );
2689 
2690     ::rtl::OUString aText;
2691     ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2692     if ( pBase )
2693         aText = pBase->GetURL();
2694     return aText;
2695 }
2696 
2697 void VCLXFixedHyperlink::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException)
2698 {
2699 	::vos::OGuard aGuard( GetMutex() );
2700 
2701 	Window* pWindow = GetWindow();
2702 	if ( pWindow )
2703 	{
2704 		WinBits nNewBits = 0;
2705 		if ( nAlign == ::com::sun::star::awt::TextAlign::LEFT )
2706 			nNewBits = WB_LEFT;
2707 		else if ( nAlign == ::com::sun::star::awt::TextAlign::CENTER )
2708 			nNewBits = WB_CENTER;
2709 		else
2710 			nNewBits = WB_RIGHT;
2711 
2712 		WinBits nStyle = pWindow->GetStyle();
2713 		nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
2714 		pWindow->SetStyle( nStyle | nNewBits );
2715 	}
2716 }
2717 
2718 short VCLXFixedHyperlink::getAlignment() throw(::com::sun::star::uno::RuntimeException)
2719 {
2720 	::vos::OGuard aGuard( GetMutex() );
2721 
2722 	short nAlign = 0;
2723 	Window* pWindow = GetWindow();
2724 	if ( pWindow )
2725 	{
2726 		WinBits nStyle = pWindow->GetStyle();
2727 		if ( nStyle & WB_LEFT )
2728 			nAlign = ::com::sun::star::awt::TextAlign::LEFT;
2729 		else if ( nStyle & WB_CENTER )
2730 			nAlign = ::com::sun::star::awt::TextAlign::CENTER;
2731 		else
2732 			nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
2733 	}
2734 	return nAlign;
2735 }
2736 
2737 void VCLXFixedHyperlink::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l  )throw(::com::sun::star::uno::RuntimeException)
2738 {
2739         ::vos::OGuard aGuard( GetMutex() );
2740         maActionListeners.addInterface( l );
2741 }
2742 
2743 void VCLXFixedHyperlink::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
2744 {
2745         ::vos::OGuard aGuard( GetMutex() );
2746         maActionListeners.removeInterface( l );
2747 }
2748 
2749 ::com::sun::star::awt::Size VCLXFixedHyperlink::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
2750 {
2751 	::vos::OGuard aGuard( GetMutex() );
2752 
2753 	Size aSz;
2754     FixedText* pFixedText = (FixedText*)GetWindow();
2755     if ( pFixedText )
2756         aSz = pFixedText->CalcMinimumSize();
2757 	return AWTSize(aSz);
2758 }
2759 
2760 ::com::sun::star::awt::Size VCLXFixedHyperlink::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
2761 {
2762 	return getMinimumSize();
2763 }
2764 
2765 ::com::sun::star::awt::Size VCLXFixedHyperlink::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
2766 {
2767 	::vos::OGuard aGuard( GetMutex() );
2768 
2769 	::com::sun::star::awt::Size aSz = rNewSize;
2770 	::com::sun::star::awt::Size aMinSz = getMinimumSize();
2771 	if ( aSz.Height != aMinSz.Height )
2772 		aSz.Height = aMinSz.Height;
2773 
2774 	return aSz;
2775 }
2776 
2777 void VCLXFixedHyperlink::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
2778 {
2779     ::vos::OGuard aGuard( GetMutex() );
2780 
2781     ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2782     if ( pBase )
2783     {
2784         sal_uInt16 nPropType = GetPropertyId( PropertyName );
2785         switch ( nPropType )
2786         {
2787             case BASEPROPERTY_LABEL:
2788             {
2789                 ::rtl::OUString sNewLabel;
2790                 if ( Value >>= sNewLabel )
2791                     pBase->SetDescription( sNewLabel );
2792                 break;
2793             }
2794 
2795             case BASEPROPERTY_URL:
2796             {
2797                 ::rtl::OUString sNewURL;
2798                 if ( Value >>= sNewURL )
2799                     pBase->SetURL( sNewURL );
2800                 break;
2801             }
2802 
2803             default:
2804             {
2805                 VCLXWindow::setProperty( PropertyName, Value );
2806             }
2807         }
2808     }
2809 }
2810 
2811 ::com::sun::star::uno::Any VCLXFixedHyperlink::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
2812 {
2813     ::vos::OGuard aGuard( GetMutex() );
2814 
2815     ::com::sun::star::uno::Any aProp;
2816     ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2817     if ( pBase )
2818     {
2819         sal_uInt16 nPropType = GetPropertyId( PropertyName );
2820         switch ( nPropType )
2821         {
2822             case BASEPROPERTY_URL:
2823             {
2824                 aProp = makeAny( ::rtl::OUString( pBase->GetURL() ) );
2825                 break;
2826             }
2827 
2828             default:
2829             {
2830                 aProp <<= VCLXWindow::getProperty( PropertyName );
2831             }
2832         }
2833     }
2834     return aProp;
2835 }
2836 
2837 void VCLXFixedHyperlink::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2838 {
2839     PushPropertyIds( rIds,
2840                      BASEPROPERTY_ALIGN,
2841                      BASEPROPERTY_BACKGROUNDCOLOR,
2842                      BASEPROPERTY_BORDER,
2843                      BASEPROPERTY_BORDERCOLOR,
2844                      BASEPROPERTY_DEFAULTCONTROL,
2845                      BASEPROPERTY_ENABLED,
2846                      BASEPROPERTY_ENABLEVISIBLE,
2847                      BASEPROPERTY_FONTDESCRIPTOR,
2848                      BASEPROPERTY_HELPTEXT,
2849                      BASEPROPERTY_HELPURL,
2850                      BASEPROPERTY_LABEL,
2851                      BASEPROPERTY_MULTILINE,
2852                      BASEPROPERTY_NOLABEL,
2853                      BASEPROPERTY_PRINTABLE,
2854                      BASEPROPERTY_TABSTOP,
2855                      BASEPROPERTY_VERTICALALIGN,
2856                      BASEPROPERTY_URL,
2857                      BASEPROPERTY_WRITING_MODE,
2858                      BASEPROPERTY_CONTEXT_WRITING_MODE,
2859                      0);
2860     VCLXWindow::ImplGetPropertyIds( rIds );
2861 }
2862 
2863 //  ----------------------------------------------------
2864 //  class VCLXFixedText
2865 //  ----------------------------------------------------
2866 void VCLXFixedText::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2867 {
2868     PushPropertyIds( rIds,
2869                      BASEPROPERTY_ALIGN,
2870                      BASEPROPERTY_BACKGROUNDCOLOR,
2871                      BASEPROPERTY_BORDER,
2872                      BASEPROPERTY_BORDERCOLOR,
2873                      BASEPROPERTY_DEFAULTCONTROL,
2874                      BASEPROPERTY_ENABLED,
2875                      BASEPROPERTY_ENABLEVISIBLE,
2876                      BASEPROPERTY_FONTDESCRIPTOR,
2877                      BASEPROPERTY_HELPTEXT,
2878                      BASEPROPERTY_HELPURL,
2879                      BASEPROPERTY_LABEL,
2880                      BASEPROPERTY_MULTILINE,
2881                      BASEPROPERTY_NOLABEL,
2882                      BASEPROPERTY_PRINTABLE,
2883                      BASEPROPERTY_TABSTOP,
2884                      BASEPROPERTY_VERTICALALIGN,
2885                      BASEPROPERTY_WRITING_MODE,
2886                      BASEPROPERTY_CONTEXT_WRITING_MODE,
2887                      BASEPROPERTY_REFERENCE_DEVICE,
2888                      0);
2889     VCLXWindow::ImplGetPropertyIds( rIds );
2890 }
2891 
2892 VCLXFixedText::VCLXFixedText()
2893 {
2894 }
2895 
2896 VCLXFixedText::~VCLXFixedText()
2897 {
2898 }
2899 
2900 // ::com::sun::star::uno::XInterface
2901 ::com::sun::star::uno::Any VCLXFixedText::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2902 {
2903     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2904                                         SAL_STATIC_CAST( ::com::sun::star::awt::XFixedText*, this ) );
2905     return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
2906 }
2907 
2908 // ::com::sun::star::lang::XTypeProvider
2909 IMPL_XTYPEPROVIDER_START( VCLXFixedText )
2910     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText>* ) NULL ),
2911     VCLXWindow::getTypes()
2912 IMPL_XTYPEPROVIDER_END
2913 
2914 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXFixedText::CreateAccessibleContext()
2915 {
2916     return getAccessibleFactory().createAccessibleContext( this );
2917 }
2918 
2919 void VCLXFixedText::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException)
2920 {
2921     ::vos::OGuard aGuard( GetMutex() );
2922 
2923     Window* pWindow = GetWindow();
2924     if ( pWindow )
2925         pWindow->SetText( Text );
2926 }
2927 
2928 ::rtl::OUString VCLXFixedText::getText() throw(::com::sun::star::uno::RuntimeException)
2929 {
2930     ::vos::OGuard aGuard( GetMutex() );
2931 
2932     ::rtl::OUString aText;
2933     Window* pWindow = GetWindow();
2934     if ( pWindow )
2935         aText = pWindow->GetText();
2936     return aText;
2937 }
2938 
2939 void VCLXFixedText::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException)
2940 {
2941     ::vos::OGuard aGuard( GetMutex() );
2942 
2943     Window* pWindow = GetWindow();
2944     if ( pWindow )
2945     {
2946         WinBits nNewBits = 0;
2947         if ( nAlign == ::com::sun::star::awt::TextAlign::LEFT )
2948             nNewBits = WB_LEFT;
2949         else if ( nAlign == ::com::sun::star::awt::TextAlign::CENTER )
2950             nNewBits = WB_CENTER;
2951         else
2952             nNewBits = WB_RIGHT;
2953 
2954         WinBits nStyle = pWindow->GetStyle();
2955         nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
2956         pWindow->SetStyle( nStyle | nNewBits );
2957     }
2958 }
2959 
2960 short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeException)
2961 {
2962     ::vos::OGuard aGuard( GetMutex() );
2963 
2964     short nAlign = 0;
2965     Window* pWindow = GetWindow();
2966     if ( pWindow )
2967     {
2968         WinBits nStyle = pWindow->GetStyle();
2969         if ( nStyle & WB_LEFT )
2970             nAlign = ::com::sun::star::awt::TextAlign::LEFT;
2971         else if ( nStyle & WB_CENTER )
2972             nAlign = ::com::sun::star::awt::TextAlign::CENTER;
2973         else
2974             nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
2975     }
2976     return nAlign;
2977 }
2978 
2979 ::com::sun::star::awt::Size VCLXFixedText::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
2980 {
2981     ::vos::OGuard aGuard( GetMutex() );
2982 
2983     Size aSz;
2984     FixedText* pFixedText = (FixedText*)GetWindow();
2985     if ( pFixedText )
2986         aSz = pFixedText->CalcMinimumSize();
2987     return AWTSize(aSz);
2988 }
2989 
2990 ::com::sun::star::awt::Size VCLXFixedText::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
2991 {
2992     return getMinimumSize();
2993 }
2994 
2995 ::com::sun::star::awt::Size VCLXFixedText::calcAdjustedSize( const ::com::sun::star::awt::Size& rMaxSize ) throw(::com::sun::star::uno::RuntimeException)
2996 {
2997     ::vos::OGuard aGuard( GetMutex() );
2998 
2999     Size aAdjustedSize( VCLUnoHelper::ConvertToVCLSize( rMaxSize ) );
3000     FixedText* pFixedText = (FixedText*)GetWindow();
3001     if ( pFixedText )
3002         aAdjustedSize = pFixedText->CalcMinimumSize( rMaxSize.Width );
3003     return VCLUnoHelper::ConvertToAWTSize( aAdjustedSize );
3004 }
3005 
3006 //	----------------------------------------------------
3007 //	class VCLXScrollBar
3008 //	----------------------------------------------------
3009 void VCLXScrollBar::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
3010 {
3011     PushPropertyIds( rIds,
3012                      BASEPROPERTY_BACKGROUNDCOLOR,
3013                      BASEPROPERTY_BLOCKINCREMENT,
3014                      BASEPROPERTY_BORDER,
3015                      BASEPROPERTY_BORDERCOLOR,
3016                      BASEPROPERTY_DEFAULTCONTROL,
3017                      BASEPROPERTY_ENABLED,
3018                      BASEPROPERTY_ENABLEVISIBLE,
3019                      BASEPROPERTY_HELPTEXT,
3020                      BASEPROPERTY_HELPURL,
3021                      BASEPROPERTY_LINEINCREMENT,
3022                      BASEPROPERTY_LIVE_SCROLL,
3023                      BASEPROPERTY_ORIENTATION,
3024                      BASEPROPERTY_PRINTABLE,
3025                      BASEPROPERTY_REPEAT_DELAY,
3026                      BASEPROPERTY_SCROLLVALUE,
3027                      BASEPROPERTY_SCROLLVALUE_MAX,
3028                      BASEPROPERTY_SCROLLVALUE_MIN,
3029                      BASEPROPERTY_SYMBOL_COLOR,
3030                      BASEPROPERTY_TABSTOP,
3031                      BASEPROPERTY_VISIBLESIZE,
3032                      BASEPROPERTY_WRITING_MODE,
3033                      BASEPROPERTY_CONTEXT_WRITING_MODE,
3034                      0);
3035     VCLXWindow::ImplGetPropertyIds( rIds );
3036 }
3037 
3038 VCLXScrollBar::VCLXScrollBar() : maAdjustmentListeners( *this )
3039 {
3040 }
3041 
3042 // ::com::sun::star::uno::XInterface
3043 ::com::sun::star::uno::Any VCLXScrollBar::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
3044 {
3045 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
3046 										SAL_STATIC_CAST( ::com::sun::star::awt::XScrollBar*, this ) );
3047 	return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
3048 }
3049 
3050 // ::com::sun::star::lang::XTypeProvider
3051 IMPL_XTYPEPROVIDER_START( VCLXScrollBar )
3052 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XScrollBar>* ) NULL ),
3053 	VCLXWindow::getTypes()
3054 IMPL_XTYPEPROVIDER_END
3055 
3056 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXScrollBar::CreateAccessibleContext()
3057 {
3058     return getAccessibleFactory().createAccessibleContext( this );
3059 }
3060 
3061 // ::com::sun::star::lang::XComponent
3062 void VCLXScrollBar::dispose() throw(::com::sun::star::uno::RuntimeException)
3063 {
3064 	::vos::OGuard aGuard( GetMutex() );
3065 
3066 	::com::sun::star::lang::EventObject aObj;
3067 	aObj.Source = (::cppu::OWeakObject*)this;
3068 	maAdjustmentListeners.disposeAndClear( aObj );
3069 	VCLXWindow::dispose();
3070 }
3071 
3072 // ::com::sun::star::awt::XScrollbar
3073 void VCLXScrollBar::addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3074 {
3075 	::vos::OGuard aGuard( GetMutex() );
3076 	maAdjustmentListeners.addInterface( l );
3077 }
3078 
3079 void VCLXScrollBar::removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3080 {
3081 	::vos::OGuard aGuard( GetMutex() );
3082 	maAdjustmentListeners.removeInterface( l );
3083 }
3084 
3085 void VCLXScrollBar::setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3086 {
3087 	::vos::OGuard aGuard( GetMutex() );
3088 
3089 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3090 	if ( pScrollBar )
3091 		pScrollBar->DoScroll( n );
3092 }
3093 
3094 void VCLXScrollBar::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException)
3095 {
3096 	::vos::OGuard aGuard( GetMutex() );
3097 
3098 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3099 	if ( pScrollBar )
3100 	{
3101 		pScrollBar->SetVisibleSize( nVisible );
3102 		pScrollBar->SetRangeMax( nMax );
3103 		pScrollBar->DoScroll( nValue );
3104 	}
3105 }
3106 
3107 sal_Int32 VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeException)
3108 {
3109 	::vos::OGuard aGuard( GetMutex() );
3110 
3111 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3112 	return pScrollBar ? pScrollBar->GetThumbPos() : 0;
3113 }
3114 
3115 void VCLXScrollBar::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3116 {
3117 	::vos::OGuard aGuard( GetMutex() );
3118 
3119 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3120 	if ( pScrollBar )
3121 		pScrollBar->SetRangeMax( n );
3122 }
3123 
3124 sal_Int32 VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeException)
3125 {
3126 	::vos::OGuard aGuard( GetMutex() );
3127 
3128 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3129 	return pScrollBar ? pScrollBar->GetRangeMax() : 0;
3130 }
3131 
3132 void VCLXScrollBar::setMinimum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3133 {
3134 	::vos::OGuard aGuard( GetMutex() );
3135 
3136 	ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
3137 	if ( pScrollBar )
3138 		pScrollBar->SetRangeMin( n );
3139 }
3140 
3141 sal_Int32 VCLXScrollBar::getMinimum() throw(::com::sun::star::uno::RuntimeException)
3142 {
3143 	::vos::OGuard aGuard( GetMutex() );
3144 
3145 	ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
3146 	return pScrollBar ? pScrollBar->GetRangeMin() : 0;
3147 }
3148 
3149 void VCLXScrollBar::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3150 {
3151 	::vos::OGuard aGuard( GetMutex() );
3152 
3153 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3154 	if ( pScrollBar )
3155 		pScrollBar->SetLineSize( n );
3156 }
3157 
3158 sal_Int32 VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::RuntimeException)
3159 {
3160 	::vos::OGuard aGuard( GetMutex() );
3161 
3162 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3163 	return pScrollBar ? pScrollBar->GetLineSize() : 0;
3164 }
3165 
3166 void VCLXScrollBar::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3167 {
3168 	::vos::OGuard aGuard( GetMutex() );
3169 
3170 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3171 	if ( pScrollBar )
3172 		pScrollBar->SetPageSize( n );
3173 }
3174 
3175 sal_Int32 VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException)
3176 {
3177 	::vos::OGuard aGuard( GetMutex() );
3178 
3179 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3180 	return pScrollBar ? pScrollBar->GetPageSize() : 0;
3181 }
3182 
3183 void VCLXScrollBar::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3184 {
3185 	::vos::OGuard aGuard( GetMutex() );
3186 
3187 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3188 	if ( pScrollBar )
3189 		pScrollBar->SetVisibleSize( n );
3190 }
3191 
3192 sal_Int32 VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeException)
3193 {
3194 	::vos::OGuard aGuard( GetMutex() );
3195 
3196 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3197 	return pScrollBar ? pScrollBar->GetVisibleSize() : 0;
3198 }
3199 
3200 void VCLXScrollBar::setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3201 {
3202 	::vos::OGuard aGuard( GetMutex() );
3203 
3204 	Window* pWindow = GetWindow();
3205 	if ( pWindow )
3206 	{
3207 		WinBits nStyle = pWindow->GetStyle();
3208 		nStyle &= ~(WB_HORZ|WB_VERT);
3209 		if ( n == ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL )
3210 			nStyle |= WB_HORZ;
3211 		else
3212 			nStyle |= WB_VERT;
3213 
3214 		pWindow->SetStyle( nStyle );
3215         pWindow->Resize();
3216 	}
3217 }
3218 
3219 sal_Int32 VCLXScrollBar::getOrientation() throw(::com::sun::star::uno::RuntimeException)
3220 {
3221 	::vos::OGuard aGuard( GetMutex() );
3222 
3223 	sal_Int32 n = 0;
3224 	Window* pWindow = GetWindow();
3225 	if ( pWindow )
3226 	{
3227 		WinBits nStyle = pWindow->GetStyle();
3228 		if ( nStyle & WB_HORZ )
3229 			n = ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL;
3230 		else
3231 			n = ::com::sun::star::awt::ScrollBarOrientation::VERTICAL;
3232 	}
3233 	return n;
3234 
3235 }
3236 
3237 // ::com::sun::star::awt::VclWindowPeer
3238 void VCLXScrollBar::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
3239 {
3240 	::vos::OGuard aGuard( GetMutex() );
3241 
3242 	ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
3243 	if ( pScrollBar )
3244 	{
3245 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
3246 
3247 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
3248 		switch ( nPropType )
3249 		{
3250 			case BASEPROPERTY_LIVE_SCROLL:
3251             {
3252                 sal_Bool bDo = sal_False;
3253                 if ( !bVoid )
3254                 {
3255                     OSL_VERIFY( Value >>= bDo );
3256                 }
3257                 AllSettings aSettings( pScrollBar->GetSettings() );
3258                 StyleSettings aStyle( aSettings.GetStyleSettings() );
3259                 sal_uLong nDragOptions = aStyle.GetDragFullOptions();
3260                 if ( bDo )
3261                     nDragOptions |= DRAGFULL_OPTION_SCROLL;
3262                 else
3263                     nDragOptions &= ~DRAGFULL_OPTION_SCROLL;
3264                 aStyle.SetDragFullOptions( nDragOptions );
3265                 aSettings.SetStyleSettings( aStyle );
3266                 pScrollBar->SetSettings( aSettings );
3267             }
3268             break;
3269 
3270 			case BASEPROPERTY_SCROLLVALUE:
3271 			{
3272 				if ( !bVoid )
3273 				{
3274 					sal_Int32 n = 0;
3275 					if ( Value >>= n )
3276 						setValue( n );
3277 				}
3278 			}
3279 			break;
3280 			case BASEPROPERTY_SCROLLVALUE_MAX:
3281             case BASEPROPERTY_SCROLLVALUE_MIN:
3282 			{
3283 				if ( !bVoid )
3284 				{
3285 					sal_Int32 n = 0;
3286 					if ( Value >>= n )
3287                     {
3288                         if ( nPropType == BASEPROPERTY_SCROLLVALUE_MAX )
3289 						    setMaximum( n );
3290                         else
3291 						    setMinimum( n );
3292                     }
3293 				}
3294 			}
3295 			break;
3296 			case BASEPROPERTY_LINEINCREMENT:
3297 			{
3298 				if ( !bVoid )
3299 				{
3300 					sal_Int32 n = 0;
3301 					if ( Value >>= n )
3302 						setLineIncrement( n );
3303 				}
3304 			}
3305 			break;
3306 			case BASEPROPERTY_BLOCKINCREMENT:
3307 			{
3308 				if ( !bVoid )
3309 				{
3310 					sal_Int32 n = 0;
3311 					if ( Value >>= n )
3312 						setBlockIncrement( n );
3313 				}
3314 			}
3315 			break;
3316 			case BASEPROPERTY_VISIBLESIZE:
3317 			{
3318 				if ( !bVoid )
3319 				{
3320 					sal_Int32 n = 0;
3321 					if ( Value >>= n )
3322 						setVisibleSize( n );
3323 				}
3324 			}
3325 			break;
3326 			case BASEPROPERTY_ORIENTATION:
3327 			{
3328 				if ( !bVoid )
3329 				{
3330 					sal_Int32 n = 0;
3331 					if ( Value >>= n )
3332 						setOrientation( n );
3333 				}
3334 			}
3335 			break;
3336 
3337             case BASEPROPERTY_BACKGROUNDCOLOR:
3338             {
3339                 // the default implementation of the base class doesn't work here, since our
3340                 // interpretation for this property is slightly different
3341                 ::toolkit::setButtonLikeFaceColor( pScrollBar, Value);
3342             }
3343             break;
3344 
3345 			default:
3346 			{
3347 				VCLXWindow::setProperty( PropertyName, Value );
3348 			}
3349 		}
3350 	}
3351 }
3352 
3353 ::com::sun::star::uno::Any VCLXScrollBar::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
3354 {
3355 	::vos::OGuard aGuard( GetMutex() );
3356 
3357 	::com::sun::star::uno::Any aProp;
3358 	ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
3359 	if ( pScrollBar )
3360 	{
3361 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
3362 
3363 		switch ( nPropType )
3364 		{
3365 			case BASEPROPERTY_LIVE_SCROLL:
3366             {
3367                 aProp <<= (sal_Bool)( 0 != ( pScrollBar->GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SCROLL ) );
3368             }
3369             break;
3370 			case BASEPROPERTY_SCROLLVALUE:
3371 			{
3372 				aProp <<= (sal_Int32) getValue();
3373 			}
3374 			break;
3375 			case BASEPROPERTY_SCROLLVALUE_MAX:
3376 			{
3377 				aProp <<= (sal_Int32) getMaximum();
3378 			}
3379 			break;
3380             case BASEPROPERTY_SCROLLVALUE_MIN:
3381 			{
3382 				aProp <<= (sal_Int32) getMinimum();
3383 			}
3384 			break;
3385 			case BASEPROPERTY_LINEINCREMENT:
3386 			{
3387 				aProp <<= (sal_Int32) getLineIncrement();
3388 			}
3389 			break;
3390 			case BASEPROPERTY_BLOCKINCREMENT:
3391 			{
3392 				aProp <<= (sal_Int32) getBlockIncrement();
3393 			}
3394 			break;
3395 			case BASEPROPERTY_VISIBLESIZE:
3396 			{
3397 				aProp <<= (sal_Int32) getVisibleSize();
3398 			}
3399 			break;
3400 			case BASEPROPERTY_ORIENTATION:
3401 			{
3402 				aProp <<= (sal_Int32) getOrientation();
3403 			}
3404 			break;
3405             case BASEPROPERTY_BACKGROUNDCOLOR:
3406             {
3407                 // the default implementation of the base class doesn't work here, since our
3408                 // interpretation for this property is slightly different
3409                 aProp = ::toolkit::getButtonLikeFaceColor( pScrollBar );
3410             }
3411             break;
3412 
3413 			default:
3414 			{
3415 				aProp <<= VCLXWindow::getProperty( PropertyName );
3416 			}
3417 		}
3418 	}
3419 	return aProp;
3420 }
3421 
3422 void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
3423 {
3424 	switch ( rVclWindowEvent.GetId() )
3425 	{
3426 		case VCLEVENT_SCROLLBAR_SCROLL:
3427         {
3428             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
3429                 // since we call listeners below, there is a potential that we will be destroyed
3430                 // in during the listener call. To prevent the resulting crashs, we keep us
3431                 // alive as long as we're here
3432                 // #20178# - 2003-10-01 - fs@openoffice.org
3433 
3434 			if ( maAdjustmentListeners.getLength() )
3435 			{
3436     			ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
3437 
3438                 if( pScrollBar )
3439                 {
3440 				    ::com::sun::star::awt::AdjustmentEvent aEvent;
3441 				    aEvent.Source = (::cppu::OWeakObject*)this;
3442 				    aEvent.Value = pScrollBar->GetThumbPos();
3443 
3444 				    // set adjustment type
3445 				    ScrollType aType = pScrollBar->GetType();
3446 				    if ( aType == SCROLL_LINEUP || aType == SCROLL_LINEDOWN )
3447 				    {
3448 					    aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_LINE;
3449 				    }
3450 				    else if ( aType == SCROLL_PAGEUP || aType == SCROLL_PAGEDOWN )
3451 				    {
3452 					    aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_PAGE;
3453 				    }
3454 				    else if ( aType == SCROLL_DRAG )
3455 				    {
3456 					    aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_ABS;
3457 				    }
3458 
3459 				    maAdjustmentListeners.adjustmentValueChanged( aEvent );
3460                 }
3461 			}
3462         }
3463         break;
3464 
3465 		default:
3466 			VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
3467 			break;
3468 	}
3469 }
3470 
3471 ::com::sun::star::awt::Size SAL_CALL VCLXScrollBar::implGetMinimumSize( Window* p ) throw(::com::sun::star::uno::RuntimeException)
3472 {
3473     long n = p->GetSettings().GetStyleSettings().GetScrollBarSize();
3474     return ::com::sun::star::awt::Size( n, n );
3475 }
3476 
3477 ::com::sun::star::awt::Size SAL_CALL VCLXScrollBar::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
3478 {
3479 	::vos::OGuard aGuard( GetMutex() );
3480     return implGetMinimumSize( GetWindow() );
3481 }
3482 
3483 
3484 //	----------------------------------------------------
3485 //	class VCLXEdit
3486 //	----------------------------------------------------
3487 
3488 void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
3489 {
3490     PushPropertyIds( rIds,
3491                      BASEPROPERTY_ALIGN,
3492                      BASEPROPERTY_BACKGROUNDCOLOR,
3493                      BASEPROPERTY_BORDER,
3494                      BASEPROPERTY_BORDERCOLOR,
3495                      BASEPROPERTY_DEFAULTCONTROL,
3496                      BASEPROPERTY_ECHOCHAR,
3497                      BASEPROPERTY_ENABLED,
3498                      BASEPROPERTY_ENABLEVISIBLE,
3499                      BASEPROPERTY_FONTDESCRIPTOR,
3500                      BASEPROPERTY_HARDLINEBREAKS,
3501                      BASEPROPERTY_HELPTEXT,
3502                      BASEPROPERTY_HELPURL,
3503                      BASEPROPERTY_HSCROLL,
3504                      BASEPROPERTY_LINE_END_FORMAT,
3505                      BASEPROPERTY_MAXTEXTLEN,
3506                      BASEPROPERTY_MULTILINE,
3507                      BASEPROPERTY_PRINTABLE,
3508                      BASEPROPERTY_READONLY,
3509                      BASEPROPERTY_TABSTOP,
3510                      BASEPROPERTY_TEXT,
3511                      BASEPROPERTY_VSCROLL,
3512                      BASEPROPERTY_HIDEINACTIVESELECTION,
3513                      BASEPROPERTY_PAINTTRANSPARENT,
3514                      BASEPROPERTY_AUTOHSCROLL,
3515                      BASEPROPERTY_AUTOVSCROLL,
3516                      BASEPROPERTY_VERTICALALIGN,
3517                      BASEPROPERTY_WRITING_MODE,
3518                      BASEPROPERTY_CONTEXT_WRITING_MODE,
3519                      0);
3520     VCLXWindow::ImplGetPropertyIds( rIds );
3521 }
3522 
3523 VCLXEdit::VCLXEdit() : maTextListeners( *this )
3524 {
3525 }
3526 
3527 // ::com::sun::star::uno::XInterface
3528 ::com::sun::star::uno::Any VCLXEdit::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
3529 {
3530 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
3531 										SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent*, this ),
3532 										SAL_STATIC_CAST( ::com::sun::star::awt::XTextEditField*, this ),
3533 										SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) );
3534 	return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
3535 }
3536 
3537 // ::com::sun::star::lang::XTypeProvider
3538 IMPL_XTYPEPROVIDER_START( VCLXEdit )
3539 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
3540 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextEditField>* ) NULL ),
3541 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
3542 	VCLXWindow::getTypes()
3543 IMPL_XTYPEPROVIDER_END
3544 
3545 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXEdit::CreateAccessibleContext()
3546 {
3547     return getAccessibleFactory().createAccessibleContext( this );
3548 }
3549 
3550 void VCLXEdit::dispose() throw(::com::sun::star::uno::RuntimeException)
3551 {
3552 	::vos::OGuard aGuard( GetMutex() );
3553 
3554 	::com::sun::star::lang::EventObject aObj;
3555 	aObj.Source = (::cppu::OWeakObject*)this;
3556 	maTextListeners.disposeAndClear( aObj );
3557 	VCLXWindow::dispose();
3558 }
3559 
3560 void VCLXEdit::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3561 {
3562 	::vos::OGuard aGuard( GetMutex() );
3563 	GetTextListeners().addInterface( l );
3564 }
3565 
3566 void VCLXEdit::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3567 {
3568 	::vos::OGuard aGuard( GetMutex() );
3569 	GetTextListeners().removeInterface( l );
3570 }
3571 
3572 void VCLXEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
3573 {
3574 	::vos::OGuard aGuard( GetMutex() );
3575 
3576 	Edit* pEdit = (Edit*)GetWindow();
3577 	if ( pEdit )
3578 	{
3579 		pEdit->SetText( aText );
3580 
3581         // #107218# Call same listeners like VCL would do after user interaction
3582         SetSynthesizingVCLEvent( sal_True );
3583         pEdit->SetModifyFlag();
3584         pEdit->Modify();
3585         SetSynthesizingVCLEvent( sal_False );
3586 	}
3587 }
3588 
3589 void VCLXEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
3590 {
3591 	::vos::OGuard aGuard( GetMutex() );
3592 
3593 	Edit* pEdit = (Edit*)GetWindow();
3594 	if ( pEdit )
3595 	{
3596 		pEdit->SetSelection( Selection( rSel.Min, rSel.Max ) );
3597 		pEdit->ReplaceSelected( aText );
3598 
3599         // #107218# Call same listeners like VCL would do after user interaction
3600         SetSynthesizingVCLEvent( sal_True );
3601         pEdit->SetModifyFlag();
3602         pEdit->Modify();
3603         SetSynthesizingVCLEvent( sal_False );
3604 	}
3605 }
3606 
3607 ::rtl::OUString VCLXEdit::getText() throw(::com::sun::star::uno::RuntimeException)
3608 {
3609 	::vos::OGuard aGuard( GetMutex() );
3610 
3611 	::rtl::OUString aText;
3612 	Window* pWindow = GetWindow();
3613 	if ( pWindow )
3614 		aText = pWindow->GetText();
3615 	return aText;
3616 }
3617 
3618 ::rtl::OUString VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
3619 {
3620 	::vos::OGuard aGuard( GetMutex() );
3621 
3622 	::rtl::OUString aText;
3623 	Edit* pEdit = (Edit*) GetWindow();
3624 	if ( pEdit)
3625 		aText = pEdit->GetSelected();
3626 	return aText;
3627 
3628 }
3629 
3630 void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
3631 {
3632 	::vos::OGuard aGuard( GetMutex() );
3633 
3634 	Edit* pEdit = (Edit*) GetWindow();
3635 	if ( pEdit )
3636 		pEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
3637 }
3638 
3639 ::com::sun::star::awt::Selection VCLXEdit::getSelection() throw(::com::sun::star::uno::RuntimeException)
3640 {
3641 	::vos::OGuard aGuard( GetMutex() );
3642 
3643 	Selection aSel;
3644 	Edit* pEdit = (Edit*) GetWindow();
3645 	if ( pEdit )
3646 		aSel = pEdit->GetSelection();
3647 	return ::com::sun::star::awt::Selection( aSel.Min(), aSel.Max() );
3648 }
3649 
3650 sal_Bool VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException)
3651 {
3652 	::vos::OGuard aGuard( GetMutex() );
3653 
3654 	Edit* pEdit = (Edit*) GetWindow();
3655 	return ( pEdit && !pEdit->IsReadOnly() && pEdit->IsEnabled() ) ? sal_True : sal_False;
3656 }
3657 
3658 void VCLXEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
3659 {
3660 	::vos::OGuard aGuard( GetMutex() );
3661 
3662 	Edit* pEdit = (Edit*) GetWindow();
3663 	if ( pEdit )
3664 		pEdit->SetReadOnly( !bEditable );
3665 }
3666 
3667 
3668 void VCLXEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
3669 {
3670 	::vos::OGuard aGuard( GetMutex() );
3671 
3672 	Edit* pEdit = (Edit*) GetWindow();
3673 	if ( pEdit )
3674 		pEdit->SetMaxTextLen( nLen );
3675 }
3676 
3677 sal_Int16 VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
3678 {
3679 	::vos::OGuard aGuard( GetMutex() );
3680 
3681 	Edit* pEdit = (Edit*) GetWindow();
3682 	return pEdit ? pEdit->GetMaxTextLen() : 0;
3683 }
3684 
3685 void VCLXEdit::setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::RuntimeException)
3686 {
3687 	::vos::OGuard aGuard( GetMutex() );
3688 
3689 	Edit* pEdit = (Edit*) GetWindow();
3690 	if ( pEdit )
3691 		pEdit->SetEchoChar( cEcho );
3692 }
3693 
3694 void VCLXEdit::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
3695 {
3696 	::vos::OGuard aGuard( GetMutex() );
3697 
3698 	Edit* pEdit = (Edit*)GetWindow();
3699 	if ( pEdit )
3700 	{
3701 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
3702 		switch ( nPropType )
3703 		{
3704             case BASEPROPERTY_HIDEINACTIVESELECTION:
3705                 ::toolkit::adjustBooleanWindowStyle( Value, pEdit, WB_NOHIDESELECTION, sal_True );
3706                 if ( pEdit->GetSubEdit() )
3707                     ::toolkit::adjustBooleanWindowStyle( Value, pEdit->GetSubEdit(), WB_NOHIDESELECTION, sal_True );
3708                 break;
3709 
3710             case BASEPROPERTY_READONLY:
3711 			{
3712 				sal_Bool b = sal_Bool();
3713 				if ( Value >>= b )
3714  					pEdit->SetReadOnly( b );
3715 			}
3716 			break;
3717 			case BASEPROPERTY_ECHOCHAR:
3718 			{
3719 				sal_Int16 n = sal_Int16();
3720 				if ( Value >>= n )
3721  					pEdit->SetEchoChar( n );
3722 			}
3723 			break;
3724 			case BASEPROPERTY_MAXTEXTLEN:
3725 			{
3726 				sal_Int16 n = sal_Int16();
3727 				if ( Value >>= n )
3728  					pEdit->SetMaxTextLen( n );
3729 			}
3730 			break;
3731 			default:
3732 			{
3733 				VCLXWindow::setProperty( PropertyName, Value );
3734 			}
3735 		}
3736 	}
3737 }
3738 
3739 ::com::sun::star::uno::Any VCLXEdit::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
3740 {
3741 	::vos::OGuard aGuard( GetMutex() );
3742 
3743 	::com::sun::star::uno::Any aProp;
3744 	Edit* pEdit = (Edit*)GetWindow();
3745 	if ( pEdit )
3746 	{
3747 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
3748 		switch ( nPropType )
3749 		{
3750             case BASEPROPERTY_HIDEINACTIVESELECTION:
3751                 aProp <<= (sal_Bool)( ( pEdit->GetStyle() & WB_NOHIDESELECTION ) == 0 );
3752                 break;
3753 			case BASEPROPERTY_READONLY:
3754  				aProp <<= (sal_Bool) pEdit->IsReadOnly();
3755     			break;
3756 			case BASEPROPERTY_ECHOCHAR:
3757  				aProp <<= (sal_Int16) pEdit->GetEchoChar();
3758     			break;
3759 			case BASEPROPERTY_MAXTEXTLEN:
3760  				aProp <<= (sal_Int16) pEdit->GetMaxTextLen();
3761     			break;
3762 			default:
3763 			{
3764 				aProp = VCLXWindow::getProperty( PropertyName );
3765 			}
3766 		}
3767 	}
3768 	return aProp;
3769 }
3770 
3771 ::com::sun::star::awt::Size VCLXEdit::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
3772 {
3773 	::vos::OGuard aGuard( GetMutex() );
3774 
3775 	Size aSz;
3776 	Edit* pEdit = (Edit*) GetWindow();
3777 	if ( pEdit )
3778 		aSz = pEdit->CalcMinimumSize();
3779 	return AWTSize(aSz);
3780 }
3781 
3782 ::com::sun::star::awt::Size VCLXEdit::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
3783 {
3784 	::vos::OGuard aGuard( GetMutex() );
3785 
3786 	Size aSz;
3787 	Edit* pEdit = (Edit*) GetWindow();
3788 	if ( pEdit )
3789 	{
3790 		aSz = pEdit->CalcMinimumSize();
3791 		aSz.Height() += 4;
3792 	}
3793 	return AWTSize(aSz);
3794 }
3795 
3796 ::com::sun::star::awt::Size VCLXEdit::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
3797 {
3798 	::vos::OGuard aGuard( GetMutex() );
3799 
3800 	::com::sun::star::awt::Size aSz = rNewSize;
3801 	::com::sun::star::awt::Size aMinSz = getMinimumSize();
3802 	if ( aSz.Height != aMinSz.Height )
3803 		aSz.Height = aMinSz.Height;
3804 
3805 	return aSz;
3806 }
3807 
3808 ::com::sun::star::awt::Size VCLXEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 ) throw(::com::sun::star::uno::RuntimeException)
3809 {
3810 	::vos::OGuard aGuard( GetMutex() );
3811 
3812 	Size aSz;
3813 	Edit* pEdit = (Edit*) GetWindow();
3814 	if ( pEdit )
3815 	{
3816 		if ( nCols )
3817 			aSz = pEdit->CalcSize( nCols );
3818 		else
3819 			aSz = pEdit->CalcMinimumSize();
3820 	}
3821 	return AWTSize(aSz);
3822 }
3823 
3824 void VCLXEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
3825 {
3826 	::vos::OGuard aGuard( GetMutex() );
3827 
3828 	nLines = 1;
3829 	nCols = 0;
3830 	Edit* pEdit = (Edit*) GetWindow();
3831 	if ( pEdit )
3832 		nCols = pEdit->GetMaxVisChars();
3833 }
3834 
3835 void VCLXEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
3836 {
3837 	switch ( rVclWindowEvent.GetId() )
3838 	{
3839 		case VCLEVENT_EDIT_MODIFY:
3840         {
3841             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
3842                 // since we call listeners below, there is a potential that we will be destroyed
3843                 // during the listener call. To prevent the resulting crashs, we keep us
3844                 // alive as long as we're here
3845                 // #20178# - 2003-10-01 - fs@openoffice.org
3846 
3847 			if ( GetTextListeners().getLength() )
3848 			{
3849 				::com::sun::star::awt::TextEvent aEvent;
3850 				aEvent.Source = (::cppu::OWeakObject*)this;
3851 				GetTextListeners().textChanged( aEvent );
3852 			}
3853         }
3854 		break;
3855 
3856 		default:
3857 			VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
3858 			break;
3859 	}
3860 }
3861 
3862 //	----------------------------------------------------
3863 //	class VCLXComboBox
3864 //	----------------------------------------------------
3865 
3866 void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
3867 {
3868     PushPropertyIds( rIds,
3869                      BASEPROPERTY_AUTOCOMPLETE,
3870                      BASEPROPERTY_BACKGROUNDCOLOR,
3871                      BASEPROPERTY_BORDER,
3872                      BASEPROPERTY_BORDERCOLOR,
3873                      BASEPROPERTY_DEFAULTCONTROL,
3874                      BASEPROPERTY_DROPDOWN,
3875                      BASEPROPERTY_ENABLED,
3876                      BASEPROPERTY_ENABLEVISIBLE,
3877                      BASEPROPERTY_FONTDESCRIPTOR,
3878                      BASEPROPERTY_HELPTEXT,
3879                      BASEPROPERTY_HELPURL,
3880                      BASEPROPERTY_LINECOUNT,
3881                      BASEPROPERTY_MAXTEXTLEN,
3882                      BASEPROPERTY_PRINTABLE,
3883                      BASEPROPERTY_READONLY,
3884                      BASEPROPERTY_STRINGITEMLIST,
3885                      BASEPROPERTY_TABSTOP,
3886                      BASEPROPERTY_TEXT,
3887                      BASEPROPERTY_HIDEINACTIVESELECTION,
3888                      BASEPROPERTY_ALIGN,
3889                      BASEPROPERTY_WRITING_MODE,
3890                      BASEPROPERTY_CONTEXT_WRITING_MODE,
3891                      BASEPROPERTY_REFERENCE_DEVICE,
3892                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
3893                      0);
3894     // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box
3895     // #i92690# / 2008-08-12 / frank.schoenheit@sun.com
3896     // VCLXEdit::ImplGetPropertyIds( rIds );
3897     VCLXWindow::ImplGetPropertyIds( rIds );
3898 }
3899 
3900 VCLXComboBox::VCLXComboBox()
3901 	: maActionListeners( *this ), maItemListeners( *this )
3902 {
3903 }
3904 
3905 VCLXComboBox::~VCLXComboBox()
3906 {
3907 #ifndef __SUNPRO_CC
3908     OSL_TRACE ("%s", __FUNCTION__);
3909 #endif
3910 }
3911 
3912 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXComboBox::CreateAccessibleContext()
3913 {
3914 	::vos::OGuard aGuard( GetMutex() );
3915 
3916     return getAccessibleFactory().createAccessibleContext( this );
3917 }
3918 
3919 void VCLXComboBox::dispose() throw(::com::sun::star::uno::RuntimeException)
3920 {
3921 	::vos::OGuard aGuard( GetMutex() );
3922 
3923 	::com::sun::star::lang::EventObject aObj;
3924 	aObj.Source = (::cppu::OWeakObject*)this;
3925 	maItemListeners.disposeAndClear( aObj );
3926 	maActionListeners.disposeAndClear( aObj );
3927 	VCLXEdit::dispose();
3928 }
3929 
3930 
3931 void VCLXComboBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3932 {
3933 	::vos::OGuard aGuard( GetMutex() );
3934 	maItemListeners.addInterface( l );
3935 }
3936 
3937 void VCLXComboBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3938 {
3939 	::vos::OGuard aGuard( GetMutex() );
3940 	maItemListeners.removeInterface( l );
3941 }
3942 
3943 void VCLXComboBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3944 {
3945 	::vos::OGuard aGuard( GetMutex() );
3946 	maActionListeners.addInterface( l );
3947 }
3948 
3949 void VCLXComboBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3950 {
3951 	::vos::OGuard aGuard( GetMutex() );
3952 	maActionListeners.removeInterface( l );
3953 }
3954 
3955 void VCLXComboBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
3956 {
3957 	::vos::OGuard aGuard( GetMutex() );
3958 
3959 	ComboBox* pBox = (ComboBox*) GetWindow();
3960 	if ( pBox )
3961 		pBox->InsertEntry( aItem, nPos );
3962 }
3963 
3964 void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
3965 {
3966 	::vos::OGuard aGuard( GetMutex() );
3967 
3968 	ComboBox* pBox = (ComboBox*) GetWindow();
3969 	if ( pBox )
3970 	{
3971 		sal_uInt16 nP = nPos;
3972 		for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ )
3973 		{
3974 			pBox->InsertEntry( aItems.getConstArray()[n], nP );
3975 			if ( nP == 0xFFFF )
3976             {
3977                 OSL_ENSURE( false, "VCLXComboBox::addItems: too many entries!" );
3978                 // skip remaining entries, list cannot hold them, anyway
3979                 break;
3980             }
3981 		}
3982 	}
3983 }
3984 
3985 void VCLXComboBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
3986 {
3987 	::vos::OGuard aGuard( GetMutex() );
3988 
3989 	ComboBox* pBox = (ComboBox*) GetWindow();
3990 	if ( pBox )
3991 	{
3992 		for ( sal_uInt16 n = nCount; n; )
3993 			pBox->RemoveEntry( nPos + (--n) );
3994 	}
3995 }
3996 
3997 sal_Int16 VCLXComboBox::getItemCount() throw(::com::sun::star::uno::RuntimeException)
3998 {
3999 	::vos::OGuard aGuard( GetMutex() );
4000 
4001 	ComboBox* pBox = (ComboBox*) GetWindow();
4002 	return pBox ? pBox->GetEntryCount() : 0;
4003 }
4004 
4005 ::rtl::OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
4006 {
4007 	::vos::OGuard aGuard( GetMutex() );
4008 
4009 	::rtl::OUString aItem;
4010 	ComboBox* pBox = (ComboBox*) GetWindow();
4011 	if ( pBox )
4012 		aItem = pBox->GetEntry( nPos );
4013 	return aItem;
4014 }
4015 
4016 ::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXComboBox::getItems() throw(::com::sun::star::uno::RuntimeException)
4017 {
4018 	::vos::OGuard aGuard( GetMutex() );
4019 
4020 	::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
4021 	ComboBox* pBox = (ComboBox*) GetWindow();
4022 	if ( pBox )
4023 	{
4024 		sal_uInt16 nEntries = pBox->GetEntryCount();
4025 		aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries );
4026 		for ( sal_uInt16 n = nEntries; n; )
4027 		{
4028 			--n;
4029 			aSeq.getArray()[n] = pBox->GetEntry( n );
4030 		}
4031 	}
4032 	return aSeq;
4033 }
4034 
4035 void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
4036 {
4037 	::vos::OGuard aGuard( GetMutex() );
4038 
4039 	ComboBox* pBox = (ComboBox*) GetWindow();
4040 	if ( pBox )
4041 		pBox->SetDropDownLineCount( nLines );
4042 }
4043 
4044 sal_Int16 VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
4045 {
4046 	::vos::OGuard aGuard( GetMutex() );
4047 
4048 	sal_Int16 nLines = 0;
4049 	ComboBox* pBox = (ComboBox*) GetWindow();
4050 	if ( pBox )
4051 		nLines = pBox->GetDropDownLineCount();
4052 	return nLines;
4053 }
4054 
4055 void VCLXComboBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
4056 {
4057 	::vos::OGuard aGuard( GetMutex() );
4058 
4059 	ComboBox* pComboBox = (ComboBox*)GetWindow();
4060 	if ( pComboBox )
4061 	{
4062 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4063 		switch ( nPropType )
4064 		{
4065 			case BASEPROPERTY_LINECOUNT:
4066 			{
4067 				sal_Int16 n = sal_Int16();
4068 				if ( Value >>= n )
4069  					pComboBox->SetDropDownLineCount( n );
4070 			}
4071 			break;
4072 			case BASEPROPERTY_AUTOCOMPLETE:
4073 			{
4074 				sal_Int16 n = sal_Int16();
4075 				if ( Value >>= n )
4076  					pComboBox->EnableAutocomplete( n != 0 );
4077 			}
4078 			break;
4079 			case BASEPROPERTY_STRINGITEMLIST:
4080 			{
4081                 ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
4082 				if ( Value >>= aItems )
4083 				{
4084 					pComboBox->Clear();
4085 					addItems( aItems, 0 );
4086 				}
4087 			}
4088 			break;
4089 			default:
4090 			{
4091 				VCLXEdit::setProperty( PropertyName, Value );
4092 
4093 				// #109385# SetBorderStyle is not virtual
4094 				if ( nPropType == BASEPROPERTY_BORDER )
4095 				{
4096 					sal_uInt16 nBorder = sal_uInt16();
4097 					if ( (Value >>= nBorder) && nBorder != 0 )
4098 						pComboBox->SetBorderStyle( nBorder );
4099 				}
4100 			}
4101 		}
4102 	}
4103 }
4104 
4105 ::com::sun::star::uno::Any VCLXComboBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
4106 {
4107 	::vos::OGuard aGuard( GetMutex() );
4108 
4109 	::com::sun::star::uno::Any aProp;
4110 	ComboBox* pComboBox = (ComboBox*)GetWindow();
4111 	if ( pComboBox )
4112 	{
4113 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4114 		switch ( nPropType )
4115 		{
4116 			case BASEPROPERTY_LINECOUNT:
4117 			{
4118  				aProp <<= (sal_Int16)  pComboBox->GetDropDownLineCount();
4119 			}
4120 			break;
4121 			case BASEPROPERTY_AUTOCOMPLETE:
4122 			{
4123  				aProp <<= (sal_Bool) pComboBox->IsAutocompleteEnabled();
4124 			}
4125 			break;
4126 			case BASEPROPERTY_STRINGITEMLIST:
4127 			{
4128 				sal_uInt16 nItems = pComboBox->GetEntryCount();
4129 				::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems );
4130 				::rtl::OUString* pStrings = aSeq.getArray();
4131 				for ( sal_uInt16 n = 0; n < nItems; n++ )
4132 					pStrings[n] = pComboBox->GetEntry( n );
4133 				aProp <<= aSeq;
4134 
4135 			}
4136 			break;
4137 			default:
4138 			{
4139 				aProp <<= VCLXEdit::getProperty( PropertyName );
4140 			}
4141 		}
4142 	}
4143 	return aProp;
4144 }
4145 
4146 void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
4147 {
4148     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
4149         // since we call listeners below, there is a potential that we will be destroyed
4150         // during the listener call. To prevent the resulting crashs, we keep us
4151         // alive as long as we're here
4152         // #20178# - 2003-10-01 - fs@openoffice.org
4153 
4154 	switch ( rVclWindowEvent.GetId() )
4155 	{
4156 		case VCLEVENT_COMBOBOX_SELECT:
4157 			if ( maItemListeners.getLength() )
4158 			{
4159 				ComboBox* pComboBox = (ComboBox*)GetWindow();
4160                 if( pComboBox )
4161                 {
4162 				    if ( !pComboBox->IsTravelSelect() )
4163 				    {
4164 					    ::com::sun::star::awt::ItemEvent aEvent;
4165 					    aEvent.Source = (::cppu::OWeakObject*)this;
4166 					    aEvent.Highlighted = sal_False;
4167 
4168 					    // Bei Mehrfachselektion 0xFFFF, sonst die ID
4169 					    aEvent.Selected = pComboBox->GetEntryPos( pComboBox->GetText() );
4170 
4171 					    maItemListeners.itemStateChanged( aEvent );
4172 				    }
4173                 }
4174 			}
4175 			break;
4176 
4177 		case VCLEVENT_COMBOBOX_DOUBLECLICK:
4178 			if ( maActionListeners.getLength() )
4179 			{
4180 				::com::sun::star::awt::ActionEvent aEvent;
4181 				aEvent.Source = (::cppu::OWeakObject*)this;
4182 //				aEvent.ActionCommand = ...;
4183 				maActionListeners.actionPerformed( aEvent );
4184 			}
4185 			break;
4186 
4187 		default:
4188 			VCLXEdit::ProcessWindowEvent( rVclWindowEvent );
4189 			break;
4190 	}
4191 }
4192 
4193 ::com::sun::star::awt::Size VCLXComboBox::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
4194 {
4195 	::vos::OGuard aGuard( GetMutex() );
4196 
4197 	Size aSz;
4198 	ComboBox* pComboBox = (ComboBox*) GetWindow();
4199 	if ( pComboBox )
4200 		aSz = pComboBox->CalcMinimumSize();
4201 	return AWTSize(aSz);
4202 }
4203 
4204 ::com::sun::star::awt::Size VCLXComboBox::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
4205 {
4206 	::vos::OGuard aGuard( GetMutex() );
4207 
4208 	Size aSz;
4209 	ComboBox* pComboBox = (ComboBox*) GetWindow();
4210 	if ( pComboBox )
4211 	{
4212 		aSz = pComboBox->CalcMinimumSize();
4213 		if ( pComboBox->GetStyle() & WB_DROPDOWN )
4214 			aSz.Height() += 4;
4215 	}
4216 	return AWTSize(aSz);
4217 }
4218 
4219 ::com::sun::star::awt::Size VCLXComboBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
4220 {
4221 	::vos::OGuard aGuard( GetMutex() );
4222 
4223 	Size aSz = VCLSize(rNewSize);
4224 	ComboBox* pComboBox = (ComboBox*) GetWindow();
4225 	if ( pComboBox )
4226 		aSz = pComboBox->CalcAdjustedSize( aSz );
4227 	return AWTSize(aSz);
4228 }
4229 
4230 ::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
4231 {
4232 	::vos::OGuard aGuard( GetMutex() );
4233 
4234 	Size aSz;
4235 	ComboBox* pComboBox = (ComboBox*) GetWindow();
4236 	if ( pComboBox )
4237 		aSz = pComboBox->CalcSize( nCols, nLines );
4238 	return AWTSize(aSz);
4239 }
4240 
4241 void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
4242 {
4243 	::vos::OGuard aGuard( GetMutex() );
4244 
4245 	nCols = nLines = 0;
4246 	ComboBox* pComboBox = (ComboBox*) GetWindow();
4247 	if ( pComboBox )
4248 	{
4249 		sal_uInt16 nC, nL;
4250 		pComboBox->GetMaxVisColumnsAndLines( nC, nL );
4251 		nCols = nC;
4252 		nLines = nL;
4253 	}
4254 }
4255 void SAL_CALL VCLXComboBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
4256 {
4257 	::vos::OGuard aGuard( GetMutex() );
4258 
4259     ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4260 
4261     ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemInserted: no ComboBox?!" );
4262     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pComboBox->GetEntryCount() ) ),
4263         "VCLXComboBox::listItemInserted: illegal (inconsistent) item position!" );
4264     pComboBox->InsertEntry(
4265         i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
4266         i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
4267         i_rEvent.ItemPosition );
4268 }
4269 
4270 void SAL_CALL VCLXComboBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
4271 {
4272 	::vos::OGuard aGuard( GetMutex() );
4273 
4274     ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4275 
4276     ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemRemoved: no ComboBox?!" );
4277     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
4278         "VCLXComboBox::listItemRemoved: illegal (inconsistent) item position!" );
4279 
4280     pComboBox->RemoveEntry( i_rEvent.ItemPosition );
4281 }
4282 
4283 void SAL_CALL VCLXComboBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
4284 {
4285 	::vos::OGuard aGuard( GetMutex() );
4286 
4287     ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4288 
4289     ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
4290     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
4291         "VCLXComboBox::listItemModified: illegal (inconsistent) item position!" );
4292 
4293     // VCL's ComboBox does not support changing an entry's text or image, so remove and re-insert
4294 
4295     const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pComboBox->GetEntry( i_rEvent.ItemPosition ) );
4296     const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pComboBox->GetEntryImage( i_rEvent.ItemPosition  ) );
4297 
4298     pComboBox->RemoveEntry( i_rEvent.ItemPosition );
4299     pComboBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
4300 }
4301 
4302 void SAL_CALL VCLXComboBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
4303 {
4304 	::vos::OGuard aGuard( GetMutex() );
4305 
4306     ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4307     ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
4308 
4309     pComboBox->Clear();
4310 
4311     (void)i_rEvent;
4312 }
4313 
4314 void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
4315 {
4316 	::vos::OGuard aGuard( GetMutex() );
4317 
4318     ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4319     ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
4320 
4321     pComboBox->Clear();
4322 
4323     uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW );
4324     uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
4325     // bool localize = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) );
4326     uno::Reference< resource::XStringResourceResolver > xStringResourceResolver;
4327     if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) )
4328     {
4329         xStringResourceResolver.set(
4330             xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ),
4331             uno::UNO_QUERY
4332         );
4333     }
4334 
4335 
4336     Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
4337     uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
4338     for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
4339     {
4340         ::rtl::OUString aLocalizationKey( aItems[i].First );
4341         if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' )
4342         {
4343             aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
4344         }
4345         pComboBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) );
4346     }
4347 }
4348 void SAL_CALL VCLXComboBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
4349 {
4350     // just disambiguate
4351     VCLXEdit::disposing( i_rEvent );
4352 }
4353 
4354 //	----------------------------------------------------
4355 //	class VCLXFormattedSpinField
4356 //	----------------------------------------------------
4357 void VCLXFormattedSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
4358 {
4359     // Interestingly in the UnoControl API this is
4360     // - not derived from XEdit ultimately, (correct ?) - so cut this here ...
4361 //    VCLXSpinField::ImplGetPropertyIds( rIds );
4362     VCLXWindow::ImplGetPropertyIds( rIds );
4363 }
4364 
4365 VCLXFormattedSpinField::VCLXFormattedSpinField()
4366 {
4367 }
4368 
4369 VCLXFormattedSpinField::~VCLXFormattedSpinField()
4370 {
4371 }
4372 
4373 void VCLXFormattedSpinField::setStrictFormat( sal_Bool bStrict )
4374 {
4375 	::vos::OGuard aGuard( GetMutex() );
4376 
4377 	FormatterBase* pFormatter = GetFormatter();
4378 	if ( pFormatter )
4379 		pFormatter->SetStrictFormat( bStrict );
4380 }
4381 
4382 sal_Bool VCLXFormattedSpinField::isStrictFormat()
4383 {
4384 	FormatterBase* pFormatter = GetFormatter();
4385 	return pFormatter ? pFormatter->IsStrictFormat() : sal_False;
4386 }
4387 
4388 
4389 void VCLXFormattedSpinField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
4390 {
4391 	::vos::OGuard aGuard( GetMutex() );
4392 
4393 	FormatterBase* pFormatter = GetFormatter();
4394 	if ( pFormatter )
4395 	{
4396 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4397 		switch ( nPropType )
4398 		{
4399 			case BASEPROPERTY_SPIN:
4400 			{
4401 				sal_Bool b = sal_Bool();
4402 				if ( Value >>= b )
4403 				{
4404 					WinBits nStyle = GetWindow()->GetStyle() | WB_SPIN;
4405 					if ( !b )
4406 						nStyle &= ~WB_SPIN;
4407 					GetWindow()->SetStyle( nStyle );
4408 				}
4409 			}
4410 			break;
4411 			case BASEPROPERTY_STRICTFORMAT:
4412 			{
4413 				sal_Bool b = sal_Bool();
4414 				if ( Value >>= b )
4415 				{
4416 	 				pFormatter->SetStrictFormat( b );
4417 				}
4418 			}
4419 			break;
4420 			default:
4421 			{
4422 				VCLXSpinField::setProperty( PropertyName, Value );
4423 			}
4424 		}
4425 	}
4426 }
4427 
4428 ::com::sun::star::uno::Any VCLXFormattedSpinField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
4429 {
4430 	::vos::OGuard aGuard( GetMutex() );
4431 
4432 	::com::sun::star::uno::Any aProp;
4433 	FormatterBase* pFormatter = GetFormatter();
4434 	if ( pFormatter )
4435 	{
4436 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4437 		switch ( nPropType )
4438 		{
4439 			case BASEPROPERTY_TABSTOP:
4440 			{
4441                 aProp <<= (sal_Bool) ( ( GetWindow()->GetStyle() & WB_SPIN ) ? sal_True : sal_False );
4442 			}
4443 			break;
4444 			case BASEPROPERTY_STRICTFORMAT:
4445 			{
4446 				aProp <<= (sal_Bool) pFormatter->IsStrictFormat();
4447 			}
4448 			break;
4449 			default:
4450 			{
4451 				aProp <<= VCLXSpinField::getProperty( PropertyName );
4452 			}
4453 		}
4454 	}
4455 	return aProp;
4456 }
4457 
4458 
4459 //	----------------------------------------------------
4460 //	class VCLXDateField
4461 //	----------------------------------------------------
4462 
4463 void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
4464 {
4465     PushPropertyIds( rIds,
4466                      BASEPROPERTY_ALIGN,
4467                      BASEPROPERTY_BACKGROUNDCOLOR,
4468                      BASEPROPERTY_BORDER,
4469                      BASEPROPERTY_BORDERCOLOR,
4470                      BASEPROPERTY_DATE,
4471                      BASEPROPERTY_DATEMAX,
4472                      BASEPROPERTY_DATEMIN,
4473                      BASEPROPERTY_DATESHOWCENTURY,
4474                      BASEPROPERTY_DEFAULTCONTROL,
4475                      BASEPROPERTY_DROPDOWN,
4476                      BASEPROPERTY_ENABLED,
4477                      BASEPROPERTY_ENABLEVISIBLE,
4478                      BASEPROPERTY_EXTDATEFORMAT,
4479                      BASEPROPERTY_FONTDESCRIPTOR,
4480                      BASEPROPERTY_HELPTEXT,
4481                      BASEPROPERTY_HELPURL,
4482                      BASEPROPERTY_PRINTABLE,
4483                      BASEPROPERTY_READONLY,
4484                      BASEPROPERTY_REPEAT,
4485                      BASEPROPERTY_REPEAT_DELAY,
4486                      BASEPROPERTY_SPIN,
4487                      BASEPROPERTY_STRICTFORMAT,
4488                      BASEPROPERTY_TABSTOP,
4489                      BASEPROPERTY_ENFORCE_FORMAT,
4490                      BASEPROPERTY_TEXT,
4491                      BASEPROPERTY_HIDEINACTIVESELECTION,
4492                      BASEPROPERTY_VERTICALALIGN,
4493                      BASEPROPERTY_WRITING_MODE,
4494                      BASEPROPERTY_CONTEXT_WRITING_MODE,
4495                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
4496                      0);
4497     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
4498 }
4499 
4500 VCLXDateField::VCLXDateField()
4501 {
4502 }
4503 
4504 VCLXDateField::~VCLXDateField()
4505 {
4506 }
4507 
4508 // ::com::sun::star::uno::XInterface
4509 ::com::sun::star::uno::Any VCLXDateField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
4510 {
4511 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
4512 										SAL_STATIC_CAST( ::com::sun::star::awt::XDateField*, this ) );
4513 	return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
4514 }
4515 
4516 // ::com::sun::star::lang::XTypeProvider
4517 IMPL_XTYPEPROVIDER_START( VCLXDateField )
4518 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDateField>* ) NULL ),
4519 	VCLXFormattedSpinField::getTypes()
4520 IMPL_XTYPEPROVIDER_END
4521 
4522 void VCLXDateField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
4523 {
4524 	::vos::OGuard aGuard( GetMutex() );
4525 
4526 	if ( GetWindow() )
4527 	{
4528 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
4529 
4530 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4531 		switch ( nPropType )
4532 		{
4533 			case BASEPROPERTY_DATE:
4534 			{
4535 				if ( bVoid )
4536 				{
4537 					((DateField*)GetWindow())->EnableEmptyFieldValue( sal_True );
4538 					((DateField*)GetWindow())->SetEmptyFieldValue();
4539 				}
4540 				else
4541 				{
4542 					sal_Int32 n = 0;
4543 					if ( Value >>= n )
4544  						setDate( n );
4545 				}
4546 			}
4547 			break;
4548 			case BASEPROPERTY_DATEMIN:
4549 			{
4550 				sal_Int32 n = 0;
4551 				if ( Value >>= n )
4552  					setMin( n );
4553 			}
4554 			break;
4555 			case BASEPROPERTY_DATEMAX:
4556 			{
4557 				sal_Int32 n = 0;
4558 				if ( Value >>= n )
4559  					setMax( n );
4560 			}
4561 			break;
4562 			case BASEPROPERTY_EXTDATEFORMAT:
4563 			{
4564 				sal_Int16 n = sal_Int16();
4565 				if ( Value >>= n )
4566 					((DateField*)GetWindow())->SetExtDateFormat( (ExtDateFieldFormat) n );
4567 			}
4568 			break;
4569 			case BASEPROPERTY_DATESHOWCENTURY:
4570 			{
4571 				sal_Bool b = sal_Bool();
4572 				if ( Value >>= b )
4573  					((DateField*)GetWindow())->SetShowDateCentury( b );
4574 			}
4575 			break;
4576             case BASEPROPERTY_ENFORCE_FORMAT:
4577             {
4578 				sal_Bool bEnforce( sal_True );
4579 				OSL_VERIFY( Value >>= bEnforce );
4580                 static_cast< DateField* >( GetWindow() )->EnforceValidValue( bEnforce );
4581             }
4582             break;
4583 			default:
4584 			{
4585 				VCLXFormattedSpinField::setProperty( PropertyName, Value );
4586 			}
4587 		}
4588 	}
4589 }
4590 
4591 ::com::sun::star::uno::Any VCLXDateField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
4592 {
4593 	::vos::OGuard aGuard( GetMutex() );
4594 
4595 	::com::sun::star::uno::Any aProp;
4596 	FormatterBase* pFormatter = GetFormatter();
4597 	if ( pFormatter )
4598 	{
4599 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4600 		switch ( nPropType )
4601 		{
4602 			case BASEPROPERTY_DATE:
4603 			{
4604 				aProp <<= (sal_Int32) getDate();
4605 			}
4606 			break;
4607 			case BASEPROPERTY_DATEMIN:
4608 			{
4609 				aProp <<= (sal_Int32) getMin();
4610 			}
4611 			break;
4612 			case BASEPROPERTY_DATEMAX:
4613 			{
4614 				aProp <<= (sal_Int32) getMax();
4615 			}
4616 			break;
4617 			case BASEPROPERTY_DATESHOWCENTURY:
4618 			{
4619 			    aProp <<= ((DateField*)GetWindow())->IsShowDateCentury();
4620 			}
4621 			break;
4622             case BASEPROPERTY_ENFORCE_FORMAT:
4623             {
4624                 aProp <<= (sal_Bool)static_cast< DateField* >( GetWindow() )->IsEnforceValidValue( );
4625             }
4626             break;
4627 			default:
4628 			{
4629 				aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
4630 			}
4631 		}
4632 	}
4633 	return aProp;
4634 }
4635 
4636 
4637 void VCLXDateField::setDate( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4638 {
4639 	::vos::OGuard aGuard( GetMutex() );
4640 
4641 	DateField* pDateField = (DateField*) GetWindow();
4642 	if ( pDateField )
4643     {
4644 		pDateField->SetDate( nDate );
4645 
4646         // #107218# Call same listeners like VCL would do after user interaction
4647         SetSynthesizingVCLEvent( sal_True );
4648         pDateField->SetModifyFlag();
4649         pDateField->Modify();
4650         SetSynthesizingVCLEvent( sal_False );
4651     }
4652 }
4653 
4654 sal_Int32 VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException)
4655 {
4656 	::vos::OGuard aGuard( GetMutex() );
4657 
4658 	sal_Int32 nDate = 0;
4659 	DateField* pDateField = (DateField*) GetWindow();
4660 	if ( pDateField )
4661 		nDate = pDateField->GetDate().GetDate();
4662 
4663 	return nDate;
4664 }
4665 
4666 void VCLXDateField::setMin( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4667 {
4668 	::vos::OGuard aGuard( GetMutex() );
4669 
4670 	DateField* pDateField = (DateField*) GetWindow();
4671 	if ( pDateField )
4672 		pDateField->SetMin( nDate );
4673 }
4674 
4675 sal_Int32 VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException)
4676 {
4677 	::vos::OGuard aGuard( GetMutex() );
4678 
4679 	sal_Int32 nDate = 0;
4680 	DateField* pDateField = (DateField*) GetWindow();
4681 	if ( pDateField )
4682 		nDate = pDateField->GetMin().GetDate();
4683 
4684 	return nDate;
4685 }
4686 
4687 void VCLXDateField::setMax( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4688 {
4689 	::vos::OGuard aGuard( GetMutex() );
4690 
4691 	DateField* pDateField = (DateField*) GetWindow();
4692 	if ( pDateField )
4693 		pDateField->SetMax( nDate );
4694 }
4695 
4696 sal_Int32 VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException)
4697 {
4698 	::vos::OGuard aGuard( GetMutex() );
4699 
4700 	sal_Int32 nDate = 0;
4701 	DateField* pDateField = (DateField*) GetWindow();
4702 	if ( pDateField )
4703 		nDate = pDateField->GetMax().GetDate();
4704 
4705 	return nDate;
4706 }
4707 
4708 void VCLXDateField::setFirst( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4709 {
4710 	::vos::OGuard aGuard( GetMutex() );
4711 
4712 	DateField* pDateField = (DateField*) GetWindow();
4713 	if ( pDateField )
4714 		pDateField->SetFirst( nDate );
4715 }
4716 
4717 sal_Int32 VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException)
4718 {
4719 	::vos::OGuard aGuard( GetMutex() );
4720 
4721 	sal_Int32 nDate = 0;
4722 	DateField* pDateField = (DateField*) GetWindow();
4723 	if ( pDateField )
4724 		nDate = pDateField->GetFirst().GetDate();
4725 
4726 	return nDate;
4727 }
4728 
4729 void VCLXDateField::setLast( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4730 {
4731 	::vos::OGuard aGuard( GetMutex() );
4732 
4733 	DateField* pDateField = (DateField*) GetWindow();
4734 	if ( pDateField )
4735 		pDateField->SetLast( nDate );
4736 }
4737 
4738 sal_Int32 VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException)
4739 {
4740 	::vos::OGuard aGuard( GetMutex() );
4741 
4742 	sal_Int32 nDate = 0;
4743 	DateField* pDateField = (DateField*) GetWindow();
4744 	if ( pDateField )
4745 		nDate = pDateField->GetLast().GetDate();
4746 
4747 	return nDate;
4748 }
4749 
4750 void VCLXDateField::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException)
4751 {
4752 	::vos::OGuard aGuard( GetMutex() );
4753 
4754 	DateField* pDateField = (DateField*) GetWindow();
4755 	if ( pDateField )
4756 		pDateField->SetLongFormat( bLong );
4757 }
4758 
4759 sal_Bool VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeException)
4760 {
4761 	::vos::OGuard aGuard( GetMutex() );
4762 
4763 	DateField* pDateField = (DateField*) GetWindow();
4764 	return pDateField ? pDateField->IsLongFormat() : sal_False;
4765 }
4766 
4767 void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
4768 {
4769 	::vos::OGuard aGuard( GetMutex() );
4770 
4771 	DateField* pDateField = (DateField*) GetWindow();
4772 	if ( pDateField )
4773     {
4774 		pDateField->SetEmptyDate();
4775 
4776         // #107218# Call same listeners like VCL would do after user interaction
4777         SetSynthesizingVCLEvent( sal_True );
4778         pDateField->SetModifyFlag();
4779         pDateField->Modify();
4780         SetSynthesizingVCLEvent( sal_False );
4781     }
4782 }
4783 
4784 sal_Bool VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException)
4785 {
4786 	::vos::OGuard aGuard( GetMutex() );
4787 
4788 	DateField* pDateField = (DateField*) GetWindow();
4789 	return pDateField ? pDateField->IsEmptyDate() : sal_False;
4790 }
4791 
4792 void VCLXDateField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
4793 {
4794 	VCLXFormattedSpinField::setStrictFormat( bStrict );
4795 }
4796 
4797 sal_Bool VCLXDateField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
4798 {
4799 	return VCLXFormattedSpinField::isStrictFormat();
4800 }
4801 
4802 
4803 //	----------------------------------------------------
4804 //	class VCLXTimeField
4805 //	----------------------------------------------------
4806 
4807 void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
4808 {
4809     PushPropertyIds( rIds,
4810                      BASEPROPERTY_ALIGN,
4811                      BASEPROPERTY_BACKGROUNDCOLOR,
4812                      BASEPROPERTY_BORDER,
4813                      BASEPROPERTY_BORDERCOLOR,
4814                      BASEPROPERTY_DEFAULTCONTROL,
4815                      BASEPROPERTY_ENABLED,
4816                      BASEPROPERTY_ENABLEVISIBLE,
4817                      BASEPROPERTY_EXTTIMEFORMAT,
4818                      BASEPROPERTY_FONTDESCRIPTOR,
4819                      BASEPROPERTY_HELPTEXT,
4820                      BASEPROPERTY_HELPURL,
4821                      BASEPROPERTY_PRINTABLE,
4822                      BASEPROPERTY_READONLY,
4823                      BASEPROPERTY_REPEAT,
4824                      BASEPROPERTY_REPEAT_DELAY,
4825                      BASEPROPERTY_SPIN,
4826                      BASEPROPERTY_STRICTFORMAT,
4827                      BASEPROPERTY_TABSTOP,
4828                      BASEPROPERTY_TIME,
4829                      BASEPROPERTY_TIMEMAX,
4830                      BASEPROPERTY_TIMEMIN,
4831                      BASEPROPERTY_ENFORCE_FORMAT,
4832                      BASEPROPERTY_TEXT,
4833                      BASEPROPERTY_HIDEINACTIVESELECTION,
4834                      BASEPROPERTY_VERTICALALIGN,
4835                      BASEPROPERTY_WRITING_MODE,
4836                      BASEPROPERTY_CONTEXT_WRITING_MODE,
4837                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
4838                      0);
4839     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
4840 }
4841 
4842 VCLXTimeField::VCLXTimeField()
4843 {
4844 }
4845 
4846 VCLXTimeField::~VCLXTimeField()
4847 {
4848 }
4849 
4850 // ::com::sun::star::uno::XInterface
4851 ::com::sun::star::uno::Any VCLXTimeField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
4852 {
4853 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
4854 										SAL_STATIC_CAST( ::com::sun::star::awt::XTimeField*, this ) );
4855 	return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
4856 }
4857 
4858 // ::com::sun::star::lang::XTypeProvider
4859 IMPL_XTYPEPROVIDER_START( VCLXTimeField )
4860 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTimeField>* ) NULL ),
4861 	VCLXFormattedSpinField::getTypes()
4862 IMPL_XTYPEPROVIDER_END
4863 
4864 void VCLXTimeField::setTime( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
4865 {
4866 	::vos::OGuard aGuard( GetMutex() );
4867 
4868 	TimeField* pTimeField = (TimeField*) GetWindow();
4869 	if ( pTimeField )
4870     {
4871 		pTimeField->SetTime( nTime );
4872 
4873         // #107218# Call same listeners like VCL would do after user interaction
4874         SetSynthesizingVCLEvent( sal_True );
4875         pTimeField->SetModifyFlag();
4876         pTimeField->Modify();
4877         SetSynthesizingVCLEvent( sal_False );
4878     }
4879 }
4880 
4881 sal_Int32 VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException)
4882 {
4883 	::vos::OGuard aGuard( GetMutex() );
4884 
4885 	sal_Int32 nTime = 0;
4886 	TimeField* pTimeField = (TimeField*) GetWindow();
4887 	if ( pTimeField )
4888 		nTime = pTimeField->GetTime().GetTime();
4889 
4890 	return nTime;
4891 }
4892 
4893 void VCLXTimeField::setMin( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
4894 {
4895 	::vos::OGuard aGuard( GetMutex() );
4896 
4897 	TimeField* pTimeField = (TimeField*) GetWindow();
4898 	if ( pTimeField )
4899 		pTimeField->SetMin( nTime );
4900 }
4901 
4902 sal_Int32 VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException)
4903 {
4904 	::vos::OGuard aGuard( GetMutex() );
4905 
4906 	sal_Int32 nTime = 0;
4907 	TimeField* pTimeField = (TimeField*) GetWindow();
4908 	if ( pTimeField )
4909 		nTime = pTimeField->GetMin().GetTime();
4910 
4911 	return nTime;
4912 }
4913 
4914 void VCLXTimeField::setMax( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
4915 {
4916 	::vos::OGuard aGuard( GetMutex() );
4917 
4918 	TimeField* pTimeField = (TimeField*) GetWindow();
4919 	if ( pTimeField )
4920 		pTimeField->SetMax( nTime );
4921 }
4922 
4923 sal_Int32 VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException)
4924 {
4925 	::vos::OGuard aGuard( GetMutex() );
4926 
4927 	sal_Int32 nTime = 0;
4928 	TimeField* pTimeField = (TimeField*) GetWindow();
4929 	if ( pTimeField )
4930 		nTime = pTimeField->GetMax().GetTime();
4931 
4932 	return nTime;
4933 }
4934 
4935 void VCLXTimeField::setFirst( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
4936 {
4937 	::vos::OGuard aGuard( GetMutex() );
4938 
4939 	TimeField* pTimeField = (TimeField*) GetWindow();
4940 	if ( pTimeField )
4941 		pTimeField->SetFirst( nTime );
4942 }
4943 
4944 sal_Int32 VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException)
4945 {
4946 	::vos::OGuard aGuard( GetMutex() );
4947 
4948 	sal_Int32 nTime = 0;
4949 	TimeField* pTimeField = (TimeField*) GetWindow();
4950 	if ( pTimeField )
4951 		nTime = pTimeField->GetFirst().GetTime();
4952 
4953 	return nTime;
4954 }
4955 
4956 void VCLXTimeField::setLast( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
4957 {
4958 	::vos::OGuard aGuard( GetMutex() );
4959 
4960 	TimeField* pTimeField = (TimeField*) GetWindow();
4961 	if ( pTimeField )
4962 		pTimeField->SetLast( nTime );
4963 }
4964 
4965 sal_Int32 VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException)
4966 {
4967 	::vos::OGuard aGuard( GetMutex() );
4968 
4969 	sal_Int32 nTime = 0;
4970 	TimeField* pTimeField = (TimeField*) GetWindow();
4971 	if ( pTimeField )
4972 		nTime = pTimeField->GetLast().GetTime();
4973 
4974 	return nTime;
4975 }
4976 
4977 void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
4978 {
4979 	::vos::OGuard aGuard( GetMutex() );
4980 
4981 	TimeField* pTimeField = (TimeField*) GetWindow();
4982 	if ( pTimeField )
4983 		pTimeField->SetEmptyTime();
4984 }
4985 
4986 sal_Bool VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException)
4987 {
4988 	::vos::OGuard aGuard( GetMutex() );
4989 
4990 	TimeField* pTimeField = (TimeField*) GetWindow();
4991 	return pTimeField ? pTimeField->IsEmptyTime() : sal_False;
4992 }
4993 
4994 void VCLXTimeField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
4995 {
4996 	VCLXFormattedSpinField::setStrictFormat( bStrict );
4997 }
4998 
4999 sal_Bool VCLXTimeField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5000 {
5001 	return VCLXFormattedSpinField::isStrictFormat();
5002 }
5003 
5004 
5005 void VCLXTimeField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5006 {
5007 	::vos::OGuard aGuard( GetMutex() );
5008 
5009 	if ( GetWindow() )
5010 	{
5011 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
5012 
5013 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
5014 		switch ( nPropType )
5015 		{
5016 			case BASEPROPERTY_TIME:
5017 			{
5018 				if ( bVoid )
5019 				{
5020 					((TimeField*)GetWindow())->EnableEmptyFieldValue( sal_True );
5021 					((TimeField*)GetWindow())->SetEmptyFieldValue();
5022 				}
5023 				else
5024 				{
5025 					sal_Int32 n = 0;
5026 					if ( Value >>= n )
5027  						setTime( n );
5028 				}
5029 			}
5030 			break;
5031 			case BASEPROPERTY_TIMEMIN:
5032 			{
5033 				sal_Int32 n = 0;
5034 				if ( Value >>= n )
5035  					setMin( n );
5036 			}
5037 			break;
5038 			case BASEPROPERTY_TIMEMAX:
5039 			{
5040 				sal_Int32 n = 0;
5041 				if ( Value >>= n )
5042  					setMax( n );
5043 			}
5044 			break;
5045 			case BASEPROPERTY_EXTTIMEFORMAT:
5046 			{
5047 				sal_Int16 n = sal_Int16();
5048 				if ( Value >>= n )
5049 					((TimeField*)GetWindow())->SetExtFormat( (ExtTimeFieldFormat) n );
5050 			}
5051 			break;
5052             case BASEPROPERTY_ENFORCE_FORMAT:
5053             {
5054 				sal_Bool bEnforce( sal_True );
5055 				OSL_VERIFY( Value >>= bEnforce );
5056                 static_cast< TimeField* >( GetWindow() )->EnforceValidValue( bEnforce );
5057             }
5058             break;
5059 			default:
5060 			{
5061 				VCLXFormattedSpinField::setProperty( PropertyName, Value );
5062 			}
5063 		}
5064 	}
5065 }
5066 
5067 ::com::sun::star::uno::Any VCLXTimeField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
5068 {
5069 	::vos::OGuard aGuard( GetMutex() );
5070 
5071 	::com::sun::star::uno::Any aProp;
5072 	if ( GetWindow() )
5073 	{
5074 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
5075 		switch ( nPropType )
5076 		{
5077 			case BASEPROPERTY_TIME:
5078 			{
5079 				aProp <<= (sal_Int32) getTime();
5080 			}
5081 			break;
5082 			case BASEPROPERTY_TIMEMIN:
5083 			{
5084 				aProp <<= (sal_Int32) getMin();
5085 			}
5086 			break;
5087 			case BASEPROPERTY_TIMEMAX:
5088 			{
5089 				aProp <<= (sal_Int32) getMax();
5090 			}
5091 			break;
5092             case BASEPROPERTY_ENFORCE_FORMAT:
5093             {
5094                 aProp <<= (sal_Bool)static_cast< TimeField* >( GetWindow() )->IsEnforceValidValue( );
5095             }
5096             break;
5097 			default:
5098 			{
5099 				aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
5100 			}
5101 		}
5102 	}
5103 	return aProp;
5104 }
5105 
5106 //	----------------------------------------------------
5107 //	class VCLXNumericField
5108 //	----------------------------------------------------
5109 
5110 void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
5111 {
5112     PushPropertyIds( rIds,
5113                      BASEPROPERTY_ALIGN,
5114                      BASEPROPERTY_BACKGROUNDCOLOR,
5115                      BASEPROPERTY_BORDER,
5116                      BASEPROPERTY_BORDERCOLOR,
5117                      BASEPROPERTY_DECIMALACCURACY,
5118                      BASEPROPERTY_DEFAULTCONTROL,
5119                      BASEPROPERTY_ENABLED,
5120                      BASEPROPERTY_ENABLEVISIBLE,
5121                      BASEPROPERTY_FONTDESCRIPTOR,
5122                      BASEPROPERTY_HELPTEXT,
5123                      BASEPROPERTY_HELPURL,
5124                      BASEPROPERTY_NUMSHOWTHOUSANDSEP,
5125                      BASEPROPERTY_PRINTABLE,
5126                      BASEPROPERTY_READONLY,
5127                      BASEPROPERTY_REPEAT,
5128                      BASEPROPERTY_REPEAT_DELAY,
5129                      BASEPROPERTY_SPIN,
5130                      BASEPROPERTY_STRICTFORMAT,
5131                      BASEPROPERTY_TABSTOP,
5132                      BASEPROPERTY_VALUEMAX_DOUBLE,
5133                      BASEPROPERTY_VALUEMIN_DOUBLE,
5134                      BASEPROPERTY_VALUESTEP_DOUBLE,
5135                      BASEPROPERTY_VALUE_DOUBLE,
5136                      BASEPROPERTY_ENFORCE_FORMAT,
5137                      BASEPROPERTY_HIDEINACTIVESELECTION,
5138                      BASEPROPERTY_VERTICALALIGN,
5139                      BASEPROPERTY_WRITING_MODE,
5140                      BASEPROPERTY_CONTEXT_WRITING_MODE,
5141                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
5142                      0);
5143     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
5144 }
5145 
5146 VCLXNumericField::VCLXNumericField()
5147 {
5148 }
5149 
5150 VCLXNumericField::~VCLXNumericField()
5151 {
5152 }
5153 
5154 // ::com::sun::star::uno::XInterface
5155 ::com::sun::star::uno::Any VCLXNumericField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
5156 {
5157 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
5158 										SAL_STATIC_CAST( ::com::sun::star::awt::XNumericField*, this ) );
5159 	return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
5160 }
5161 
5162 // ::com::sun::star::lang::XTypeProvider
5163 IMPL_XTYPEPROVIDER_START( VCLXNumericField )
5164 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ),
5165 	VCLXFormattedSpinField::getTypes()
5166 IMPL_XTYPEPROVIDER_END
5167 
5168 void VCLXNumericField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
5169 {
5170 	::vos::OGuard aGuard( GetMutex() );
5171 
5172 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5173 	if ( pNumericFormatter )
5174 	{
5175 		// z.B. 105, 2 Digits => 1,05
5176 		// ein float 1,05 muss also eine 105 einstellen...
5177 		pNumericFormatter->SetValue(
5178 			(long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
5179 
5180         // #107218# Call same listeners like VCL would do after user interaction
5181 	    Edit* pEdit = (Edit*)GetWindow();
5182 	    if ( pEdit )
5183         {
5184             SetSynthesizingVCLEvent( sal_True );
5185             pEdit->SetModifyFlag();
5186             pEdit->Modify();
5187             SetSynthesizingVCLEvent( sal_False );
5188         }
5189 	}
5190 }
5191 
5192 double VCLXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException)
5193 {
5194 	::vos::OGuard aGuard( GetMutex() );
5195 
5196 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5197 	return pNumericFormatter
5198 		? ImplCalcDoubleValue( (double)pNumericFormatter->GetValue(), pNumericFormatter->GetDecimalDigits() )
5199 		: 0;
5200 }
5201 
5202 void VCLXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
5203 {
5204 	::vos::OGuard aGuard( GetMutex() );
5205 
5206 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5207 	if ( pNumericFormatter )
5208 		pNumericFormatter->SetMin(
5209 			(long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
5210 }
5211 
5212 double VCLXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException)
5213 {
5214 	::vos::OGuard aGuard( GetMutex() );
5215 
5216 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5217 	return pNumericFormatter
5218 		? ImplCalcDoubleValue( (double)pNumericFormatter->GetMin(), pNumericFormatter->GetDecimalDigits() )
5219 		: 0;
5220 }
5221 
5222 void VCLXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
5223 {
5224 	::vos::OGuard aGuard( GetMutex() );
5225 
5226 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5227 	if ( pNumericFormatter )
5228 		pNumericFormatter->SetMax(
5229 			(long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
5230 }
5231 
5232 double VCLXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException)
5233 {
5234 	::vos::OGuard aGuard( GetMutex() );
5235 
5236 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5237 	return pNumericFormatter
5238 		? ImplCalcDoubleValue( (double)pNumericFormatter->GetMax(), pNumericFormatter->GetDecimalDigits() )
5239 		: 0;
5240 }
5241 
5242 void VCLXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
5243 {
5244 	::vos::OGuard aGuard( GetMutex() );
5245 
5246 	NumericField* pNumericField = (NumericField*) GetWindow();
5247 	if ( pNumericField )
5248 		pNumericField->SetFirst(
5249 			(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
5250 }
5251 
5252 double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException)
5253 {
5254 	::vos::OGuard aGuard( GetMutex() );
5255 
5256 	NumericField* pNumericField = (NumericField*) GetWindow();
5257 	return pNumericField
5258 		? ImplCalcDoubleValue( (double)pNumericField->GetFirst(), pNumericField->GetDecimalDigits() )
5259 		: 0;
5260 }
5261 
5262 void VCLXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
5263 {
5264 	::vos::OGuard aGuard( GetMutex() );
5265 
5266 	NumericField* pNumericField = (NumericField*) GetWindow();
5267 	if ( pNumericField )
5268 		pNumericField->SetLast(
5269 			(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
5270 }
5271 
5272 double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException)
5273 {
5274 	::vos::OGuard aGuard( GetMutex() );
5275 
5276 	NumericField* pNumericField = (NumericField*) GetWindow();
5277 	return pNumericField
5278 		? ImplCalcDoubleValue( (double)pNumericField->GetLast(), pNumericField->GetDecimalDigits() )
5279 		: 0;
5280 }
5281 
5282 void VCLXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5283 {
5284 	VCLXFormattedSpinField::setStrictFormat( bStrict );
5285 }
5286 
5287 sal_Bool VCLXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5288 {
5289 	return VCLXFormattedSpinField::isStrictFormat();
5290 }
5291 
5292 
5293 void VCLXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
5294 {
5295 	::vos::OGuard aGuard( GetMutex() );
5296 
5297 	NumericField* pNumericField = (NumericField*) GetWindow();
5298 	if ( pNumericField )
5299 		pNumericField->SetSpinSize(
5300 			(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
5301 }
5302 
5303 double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
5304 {
5305 	::vos::OGuard aGuard( GetMutex() );
5306 
5307 	NumericField* pNumericField = (NumericField*) GetWindow();
5308 	return pNumericField
5309 		? ImplCalcDoubleValue( (double)pNumericField->GetSpinSize(), pNumericField->GetDecimalDigits() )
5310 		: 0;
5311 }
5312 
5313 void VCLXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
5314 {
5315 	::vos::OGuard aGuard( GetMutex() );
5316 
5317 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5318 	if ( pNumericFormatter )
5319 	{
5320 		double n = getValue();
5321 		pNumericFormatter->SetDecimalDigits( Value );
5322 		setValue( n );
5323    	}
5324 }
5325 
5326 sal_Int16 VCLXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
5327 {
5328 	::vos::OGuard aGuard( GetMutex() );
5329 
5330 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5331 	return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0;
5332 }
5333 
5334 void VCLXNumericField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5335 {
5336 	::vos::OGuard aGuard( GetMutex() );
5337 
5338 	if ( GetWindow() )
5339 	{
5340 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
5341 
5342 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
5343 		switch ( nPropType )
5344 		{
5345 			case BASEPROPERTY_VALUE_DOUBLE:
5346 			{
5347 				if ( bVoid )
5348 				{
5349 					((NumericField*)GetWindow())->EnableEmptyFieldValue( sal_True );
5350 					((NumericField*)GetWindow())->SetEmptyFieldValue();
5351 				}
5352 				else
5353 				{
5354 					double d = 0;
5355 					if ( Value >>= d )
5356  						setValue( d );
5357 				}
5358 			}
5359 			break;
5360 			case BASEPROPERTY_VALUEMIN_DOUBLE:
5361 			{
5362 				double d = 0;
5363 				if ( Value >>= d )
5364  					setMin( d );
5365 			}
5366 			break;
5367 			case BASEPROPERTY_VALUEMAX_DOUBLE:
5368 			{
5369 				double d = 0;
5370 				if ( Value >>= d )
5371  					setMax( d );
5372 			}
5373 			break;
5374 			case BASEPROPERTY_VALUESTEP_DOUBLE:
5375 			{
5376 				double d = 0;
5377 				if ( Value >>= d )
5378  					setSpinSize( d );
5379 			}
5380 			break;
5381 			case BASEPROPERTY_DECIMALACCURACY:
5382 			{
5383 				sal_Int16 n = sal_Int16();
5384 				if ( Value >>= n )
5385  					setDecimalDigits( n );
5386 			}
5387 			break;
5388 			case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5389 			{
5390 				sal_Bool b = sal_Bool();
5391 				if ( Value >>= b )
5392  					((NumericField*)GetWindow())->SetUseThousandSep( b );
5393 			}
5394 			break;
5395 			default:
5396 			{
5397 				VCLXFormattedSpinField::setProperty( PropertyName, Value );
5398 			}
5399 		}
5400 	}
5401 }
5402 
5403 ::com::sun::star::uno::Any VCLXNumericField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
5404 {
5405 	::vos::OGuard aGuard( GetMutex() );
5406 
5407 	::com::sun::star::uno::Any aProp;
5408 	FormatterBase* pFormatter = GetFormatter();
5409 	if ( pFormatter )
5410 	{
5411 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
5412 		switch ( nPropType )
5413 		{
5414 			case BASEPROPERTY_VALUE_DOUBLE:
5415 			{
5416 				aProp <<= (double) getValue();
5417 			}
5418 			break;
5419 			case BASEPROPERTY_VALUEMIN_DOUBLE:
5420 			{
5421 				aProp <<= (double) getMin();
5422 			}
5423 			break;
5424 			case BASEPROPERTY_VALUEMAX_DOUBLE:
5425 			{
5426 				aProp <<= (double) getMax();
5427 			}
5428 			break;
5429 			case BASEPROPERTY_VALUESTEP_DOUBLE:
5430 			{
5431 				aProp <<= (double) getSpinSize();
5432 			}
5433 			break;
5434 			case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5435 			{
5436 			    aProp <<= (sal_Bool) ((NumericField*)GetWindow())->IsUseThousandSep();
5437 			}
5438 			break;
5439 			default:
5440 			{
5441 				aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
5442 			}
5443 		}
5444 	}
5445 	return aProp;
5446 }
5447 
5448 
5449 //    ----------------------------------------------------
5450 //    class VCLXMetricField
5451 //    ----------------------------------------------------
5452 
5453 void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
5454 {
5455     PushPropertyIds( rIds,
5456                      BASEPROPERTY_ALIGN,
5457                      BASEPROPERTY_BACKGROUNDCOLOR,
5458                      BASEPROPERTY_BORDER,
5459                      BASEPROPERTY_BORDERCOLOR,
5460                      BASEPROPERTY_DECIMALACCURACY,
5461                      BASEPROPERTY_DEFAULTCONTROL,
5462                      BASEPROPERTY_ENABLED,
5463                      BASEPROPERTY_ENABLEVISIBLE,
5464                      BASEPROPERTY_FONTDESCRIPTOR,
5465                      BASEPROPERTY_HELPTEXT,
5466                      BASEPROPERTY_HELPURL,
5467                      BASEPROPERTY_NUMSHOWTHOUSANDSEP,
5468                      BASEPROPERTY_PRINTABLE,
5469                      BASEPROPERTY_READONLY,
5470                      BASEPROPERTY_REPEAT,
5471                      BASEPROPERTY_REPEAT_DELAY,
5472                      BASEPROPERTY_SPIN,
5473                      BASEPROPERTY_STRICTFORMAT,
5474                      BASEPROPERTY_TABSTOP,
5475                      BASEPROPERTY_ENFORCE_FORMAT,
5476                      BASEPROPERTY_HIDEINACTIVESELECTION,
5477                      BASEPROPERTY_UNIT,
5478                      BASEPROPERTY_CUSTOMUNITTEXT,
5479                      BASEPROPERTY_WRITING_MODE,
5480                      BASEPROPERTY_CONTEXT_WRITING_MODE,
5481                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
5482                      0);
5483     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
5484 }
5485 
5486 VCLXMetricField::VCLXMetricField()
5487 {
5488 }
5489 
5490 VCLXMetricField::~VCLXMetricField()
5491 {
5492 }
5493 
5494 MetricFormatter *VCLXMetricField::GetMetricFormatter() throw(::com::sun::star::uno::RuntimeException)
5495 {
5496     MetricFormatter *pFormatter = (MetricFormatter *) GetFormatter();
5497     if (!pFormatter)
5498         throw ::com::sun::star::uno::RuntimeException();
5499     return pFormatter;
5500 }
5501 
5502 MetricField *VCLXMetricField::GetMetricField() throw(::com::sun::star::uno::RuntimeException)
5503 {
5504     MetricField *pField = (MetricField *) GetWindow();
5505     if (!pField)
5506         throw ::com::sun::star::uno::RuntimeException();
5507     return pField;
5508 }
5509 
5510 // ::com::sun::star::uno::XInterface
5511 ::com::sun::star::uno::Any VCLXMetricField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
5512 {
5513     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
5514                                                               SAL_STATIC_CAST( ::com::sun::star::awt::XMetricField*, this ) );
5515     return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
5516 }
5517 
5518 // ::com::sun::star::lang::XTypeProvider
5519 IMPL_XTYPEPROVIDER_START( VCLXMetricField )
5520     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMetricField>* ) NULL ),
5521     VCLXFormattedSpinField::getTypes()
5522 IMPL_XTYPEPROVIDER_END
5523 
5524 // FIXME: later ...
5525 #define MetricUnitUnoToVcl(a) ((FieldUnit)(a))
5526 
5527 #define METRIC_MAP_PAIR(method,parent) \
5528     sal_Int64 VCLXMetricField::get##method( sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
5529     { \
5530         ::vos::OGuard aGuard( GetMutex() ); \
5531         return GetMetric##parent()->Get##method( MetricUnitUnoToVcl( nUnit ) ); \
5532     } \
5533     void VCLXMetricField::set##method( sal_Int64 nValue, sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
5534     { \
5535         ::vos::OGuard aGuard( GetMutex() ); \
5536         GetMetric##parent()->Set##method( nValue, MetricUnitUnoToVcl( nUnit ) ); \
5537     }
5538 
5539 METRIC_MAP_PAIR(Min, Formatter)
5540 METRIC_MAP_PAIR(Max, Formatter)
5541 METRIC_MAP_PAIR(First, Field)
5542 METRIC_MAP_PAIR(Last,  Field)
5543 
5544 #undef METRIC_MAP_PAIR
5545 
5546 ::sal_Int64 VCLXMetricField::getValue( ::sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException)
5547 {
5548     ::vos::OGuard aGuard( GetMutex() );
5549     return GetMetricFormatter()->GetValue( MetricUnitUnoToVcl( nUnit ) );
5550 }
5551 
5552 ::sal_Int64 VCLXMetricField::getCorrectedValue( ::sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException)
5553 {
5554     ::vos::OGuard aGuard( GetMutex() );
5555     return GetMetricFormatter()->GetCorrectedValue( MetricUnitUnoToVcl( nUnit ) );
5556 }
5557 
5558 // FIXME: acute cut/paste evilness - move this to the parent Edit class ?
5559 void VCLXMetricField::CallListeners()
5560 {
5561     // #107218# Call same listeners like VCL would do after user interaction
5562     Edit* pEdit = (Edit*)GetWindow();
5563     if ( pEdit )
5564     {
5565         SetSynthesizingVCLEvent( sal_True );
5566         pEdit->SetModifyFlag();
5567         pEdit->Modify();
5568         SetSynthesizingVCLEvent( sal_False );
5569     }
5570 }
5571 
5572 void VCLXMetricField::setValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException)
5573 {
5574     ::vos::OGuard aGuard( GetMutex() );
5575     GetMetricFormatter()->SetValue( Value, MetricUnitUnoToVcl( Unit ) );
5576     CallListeners();
5577 }
5578 
5579 void VCLXMetricField::setUserValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException)
5580 {
5581     ::vos::OGuard aGuard( GetMutex() );
5582     GetMetricFormatter()->SetUserValue( Value, MetricUnitUnoToVcl( Unit ) );
5583     CallListeners();
5584 }
5585 
5586 void VCLXMetricField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5587 {
5588     VCLXFormattedSpinField::setStrictFormat( bStrict );
5589 }
5590 
5591 sal_Bool VCLXMetricField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5592 {
5593     return VCLXFormattedSpinField::isStrictFormat();
5594 }
5595 
5596 void VCLXMetricField::setSpinSize( sal_Int64 Value ) throw(::com::sun::star::uno::RuntimeException)
5597 {
5598     ::vos::OGuard aGuard( GetMutex() );
5599     GetMetricField()->SetSpinSize( Value );
5600 }
5601 
5602 sal_Int64 VCLXMetricField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
5603 {
5604     ::vos::OGuard aGuard( GetMutex() );
5605     return GetMetricField()->GetSpinSize();
5606 }
5607 
5608 void VCLXMetricField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
5609 {
5610     ::vos::OGuard aGuard( GetMutex() );
5611     GetMetricFormatter()->SetDecimalDigits( Value );
5612 }
5613 
5614 sal_Int16 VCLXMetricField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
5615 {
5616     ::vos::OGuard aGuard( GetMutex() );
5617 
5618     NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5619     return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0;
5620 }
5621 
5622 void VCLXMetricField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5623 {
5624     ::vos::OGuard aGuard( GetMutex() );
5625 
5626     if ( GetWindow() )
5627     {
5628         sal_uInt16 nPropType = GetPropertyId( PropertyName );
5629         switch ( nPropType )
5630         {
5631             case BASEPROPERTY_DECIMALACCURACY:
5632             {
5633                 sal_Int16 n = 0;
5634                 if ( Value >>= n )
5635                      setDecimalDigits( n );
5636                 break;
5637             }
5638             case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5639             {
5640                 sal_Bool b = sal_False;
5641                 if ( Value >>= b )
5642                      ((NumericField*)GetWindow())->SetUseThousandSep( b );
5643             }
5644             break;
5645             case BASEPROPERTY_UNIT:
5646             {
5647                 sal_uInt16 nVal = 0;
5648                 if ( Value >>= nVal )
5649                     ((MetricField*)GetWindow())->SetUnit( (FieldUnit) nVal );
5650                 break;
5651             }
5652             case BASEPROPERTY_CUSTOMUNITTEXT:
5653             {
5654                 rtl::OUString aStr;
5655                 if ( Value >>= aStr )
5656                     ((MetricField*)GetWindow())->SetCustomUnitText( aStr );
5657                 break;
5658             }
5659             default:
5660             {
5661                 VCLXFormattedSpinField::setProperty( PropertyName, Value );
5662                 break;
5663             }
5664         }
5665     }
5666 }
5667 
5668 ::com::sun::star::uno::Any VCLXMetricField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
5669 {
5670     ::vos::OGuard aGuard( GetMutex() );
5671 
5672     ::com::sun::star::uno::Any aProp;
5673     FormatterBase* pFormatter = GetFormatter();
5674     if ( pFormatter )
5675     {
5676         sal_uInt16 nPropType = GetPropertyId( PropertyName );
5677         switch ( nPropType )
5678         {
5679             case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5680                 aProp <<= (sal_Bool) ((NumericField*)GetWindow())->IsUseThousandSep();
5681                 break;
5682             case BASEPROPERTY_UNIT:
5683                 aProp <<= (sal_uInt16) ((MetricField*)GetWindow())->GetUnit();
5684                 break;
5685             case BASEPROPERTY_CUSTOMUNITTEXT:
5686                 aProp <<= rtl::OUString (((MetricField*)GetWindow())->GetCustomUnitText());
5687                 break;
5688             default:
5689             {
5690                 aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
5691                 break;
5692             }
5693         }
5694     }
5695     return aProp;
5696 }
5697 
5698 
5699 //	----------------------------------------------------
5700 //	class VCLXCurrencyField
5701 //	----------------------------------------------------
5702 
5703 void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
5704 {
5705     PushPropertyIds( rIds,
5706                      BASEPROPERTY_ALIGN,
5707                      BASEPROPERTY_BACKGROUNDCOLOR,
5708                      BASEPROPERTY_BORDER,
5709                      BASEPROPERTY_BORDERCOLOR,
5710                      BASEPROPERTY_CURRENCYSYMBOL,
5711                      BASEPROPERTY_CURSYM_POSITION,
5712                      BASEPROPERTY_DECIMALACCURACY,
5713                      BASEPROPERTY_DEFAULTCONTROL,
5714                      BASEPROPERTY_ENABLED,
5715                      BASEPROPERTY_ENABLEVISIBLE,
5716                      BASEPROPERTY_FONTDESCRIPTOR,
5717                      BASEPROPERTY_HELPTEXT,
5718                      BASEPROPERTY_HELPURL,
5719                      BASEPROPERTY_NUMSHOWTHOUSANDSEP,
5720                      BASEPROPERTY_PRINTABLE,
5721                      BASEPROPERTY_READONLY,
5722                      BASEPROPERTY_REPEAT,
5723                      BASEPROPERTY_REPEAT_DELAY,
5724                      BASEPROPERTY_SPIN,
5725                      BASEPROPERTY_STRICTFORMAT,
5726                      BASEPROPERTY_TABSTOP,
5727                      BASEPROPERTY_VALUEMAX_DOUBLE,
5728                      BASEPROPERTY_VALUEMIN_DOUBLE,
5729                      BASEPROPERTY_VALUESTEP_DOUBLE,
5730                      BASEPROPERTY_VALUE_DOUBLE,
5731                      BASEPROPERTY_ENFORCE_FORMAT,
5732                      BASEPROPERTY_HIDEINACTIVESELECTION,
5733                      BASEPROPERTY_VERTICALALIGN,
5734                      BASEPROPERTY_WRITING_MODE,
5735                      BASEPROPERTY_CONTEXT_WRITING_MODE,
5736                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
5737                      0);
5738     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
5739 }
5740 
5741 VCLXCurrencyField::VCLXCurrencyField()
5742 {
5743 }
5744 
5745 VCLXCurrencyField::~VCLXCurrencyField()
5746 {
5747 }
5748 
5749 // ::com::sun::star::uno::XInterface
5750 ::com::sun::star::uno::Any VCLXCurrencyField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
5751 {
5752 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
5753 										SAL_STATIC_CAST( ::com::sun::star::awt::XCurrencyField*, this ) );
5754 	return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
5755 }
5756 
5757 // ::com::sun::star::lang::XTypeProvider
5758 IMPL_XTYPEPROVIDER_START( VCLXCurrencyField )
5759 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ),
5760 	VCLXFormattedSpinField::getTypes()
5761 IMPL_XTYPEPROVIDER_END
5762 
5763 void VCLXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
5764 {
5765 	::vos::OGuard aGuard( GetMutex() );
5766 
5767 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5768 	if ( pCurrencyFormatter )
5769 	{
5770 		// z.B. 105, 2 Digits => 1,05
5771 		// ein float 1,05 muss also eine 105 einstellen...
5772 		pCurrencyFormatter->SetValue(
5773 			ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
5774 
5775         // #107218# Call same listeners like VCL would do after user interaction
5776 	    Edit* pEdit = (Edit*)GetWindow();
5777 	    if ( pEdit )
5778         {
5779             SetSynthesizingVCLEvent( sal_True );
5780             pEdit->SetModifyFlag();
5781             pEdit->Modify();
5782             SetSynthesizingVCLEvent( sal_False );
5783         }
5784 	}
5785 }
5786 
5787 double VCLXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException)
5788 {
5789 	::vos::OGuard aGuard( GetMutex() );
5790 
5791 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5792 	return pCurrencyFormatter
5793 		? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetValue(), pCurrencyFormatter->GetDecimalDigits() )
5794 		: 0;
5795 }
5796 
5797 void VCLXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
5798 {
5799 	::vos::OGuard aGuard( GetMutex() );
5800 
5801 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5802 	if ( pCurrencyFormatter )
5803 		pCurrencyFormatter->SetMin(
5804 			ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
5805 }
5806 
5807 double VCLXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException)
5808 {
5809 	::vos::OGuard aGuard( GetMutex() );
5810 
5811 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5812 	return pCurrencyFormatter
5813 		? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMin(), pCurrencyFormatter->GetDecimalDigits() )
5814 		: 0;
5815 }
5816 
5817 void VCLXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
5818 {
5819 	::vos::OGuard aGuard( GetMutex() );
5820 
5821 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5822 	if ( pCurrencyFormatter )
5823 		pCurrencyFormatter->SetMax(
5824 			ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
5825 }
5826 
5827 double VCLXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException)
5828 {
5829 	::vos::OGuard aGuard( GetMutex() );
5830 
5831 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5832 	return pCurrencyFormatter
5833 		? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMax(), pCurrencyFormatter->GetDecimalDigits() )
5834 		: 0;
5835 }
5836 
5837 void VCLXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
5838 {
5839 	::vos::OGuard aGuard( GetMutex() );
5840 
5841 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5842 	if ( pCurrencyField )
5843 		pCurrencyField->SetFirst(
5844 			ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
5845 }
5846 
5847 double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException)
5848 {
5849 	::vos::OGuard aGuard( GetMutex() );
5850 
5851 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5852 	return pCurrencyField
5853 		? ImplCalcDoubleValue( (double)pCurrencyField->GetFirst(), pCurrencyField->GetDecimalDigits() )
5854 		: 0;
5855 }
5856 
5857 void VCLXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
5858 {
5859 	::vos::OGuard aGuard( GetMutex() );
5860 
5861 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5862 	if ( pCurrencyField )
5863 		pCurrencyField->SetLast(
5864 			ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
5865 }
5866 
5867 double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException)
5868 {
5869 	::vos::OGuard aGuard( GetMutex() );
5870 
5871 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5872 	return pCurrencyField
5873 		? ImplCalcDoubleValue( (double)pCurrencyField->GetLast(), pCurrencyField->GetDecimalDigits() )
5874 		: 0;
5875 }
5876 
5877 void VCLXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
5878 {
5879 	::vos::OGuard aGuard( GetMutex() );
5880 
5881 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5882 	if ( pCurrencyField )
5883 		pCurrencyField->SetSpinSize(
5884 			ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
5885 }
5886 
5887 double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
5888 {
5889 	::vos::OGuard aGuard( GetMutex() );
5890 
5891 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5892 	return pCurrencyField
5893 		? ImplCalcDoubleValue( (double)pCurrencyField->GetSpinSize(), pCurrencyField->GetDecimalDigits() )
5894 		: 0;
5895 }
5896 
5897 void VCLXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5898 {
5899 	VCLXFormattedSpinField::setStrictFormat( bStrict );
5900 }
5901 
5902 sal_Bool VCLXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5903 {
5904 	return VCLXFormattedSpinField::isStrictFormat();
5905 }
5906 
5907 
5908 void VCLXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
5909 {
5910 	::vos::OGuard aGuard( GetMutex() );
5911 
5912 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5913 	if ( pCurrencyFormatter )
5914 	{
5915 		double n = getValue();
5916 		pCurrencyFormatter->SetDecimalDigits( Value );
5917 		setValue( n );
5918    	}
5919 }
5920 
5921 sal_Int16 VCLXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
5922 {
5923 	::vos::OGuard aGuard( GetMutex() );
5924 
5925 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5926 	return pCurrencyFormatter ? pCurrencyFormatter->GetDecimalDigits() : 0;
5927 }
5928 
5929 void VCLXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5930 {
5931 	::vos::OGuard aGuard( GetMutex() );
5932 
5933 	if ( GetWindow() )
5934 	{
5935 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
5936 
5937 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
5938 		switch ( nPropType )
5939 		{
5940 			case BASEPROPERTY_VALUE_DOUBLE:
5941 			{
5942 				if ( bVoid )
5943 				{
5944 					((LongCurrencyField*)GetWindow())->EnableEmptyFieldValue( sal_True );
5945 					((LongCurrencyField*)GetWindow())->SetEmptyFieldValue();
5946 				}
5947 				else
5948 				{
5949 					double d = 0;
5950 					if ( Value >>= d )
5951  						setValue( d );
5952 				}
5953 			}
5954 			break;
5955 			case BASEPROPERTY_VALUEMIN_DOUBLE:
5956 			{
5957 				double d = 0;
5958 				if ( Value >>= d )
5959  					setMin( d );
5960 			}
5961 			break;
5962 			case BASEPROPERTY_VALUEMAX_DOUBLE:
5963 			{
5964 				double d = 0;
5965 				if ( Value >>= d )
5966  					setMax( d );
5967 			}
5968 			break;
5969 			case BASEPROPERTY_VALUESTEP_DOUBLE:
5970 			{
5971 				double d = 0;
5972 				if ( Value >>= d )
5973  					setSpinSize( d );
5974 			}
5975 			break;
5976 			case BASEPROPERTY_DECIMALACCURACY:
5977 			{
5978 				sal_Int16 n = sal_Int16();
5979 				if ( Value >>= n )
5980  					setDecimalDigits( n );
5981 			}
5982 			break;
5983 			case BASEPROPERTY_CURRENCYSYMBOL:
5984 			{
5985 				::rtl::OUString aString;
5986 				if ( Value >>= aString )
5987  					((LongCurrencyField*)GetWindow())->SetCurrencySymbol( aString );
5988 			}
5989 			break;
5990 			case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5991 			{
5992 				sal_Bool b = sal_Bool();
5993 				if ( Value >>= b )
5994  					((LongCurrencyField*)GetWindow())->SetUseThousandSep( b );
5995 			}
5996 			break;
5997 			default:
5998 			{
5999 				VCLXFormattedSpinField::setProperty( PropertyName, Value );
6000 			}
6001 		}
6002 	}
6003 }
6004 
6005 ::com::sun::star::uno::Any VCLXCurrencyField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
6006 {
6007 	::vos::OGuard aGuard( GetMutex() );
6008 
6009 	::com::sun::star::uno::Any aProp;
6010 	FormatterBase* pFormatter = GetFormatter();
6011 	if ( pFormatter )
6012 	{
6013 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
6014 		switch ( nPropType )
6015 		{
6016 			case BASEPROPERTY_VALUE_DOUBLE:
6017 			{
6018 				aProp <<= (double) getValue();
6019 			}
6020 			break;
6021 			case BASEPROPERTY_VALUEMIN_DOUBLE:
6022 			{
6023 				aProp <<= (double) getMin();
6024 			}
6025 			break;
6026 			case BASEPROPERTY_VALUEMAX_DOUBLE:
6027 			{
6028 				aProp <<= (double) getMax();
6029 			}
6030 			break;
6031 			case BASEPROPERTY_VALUESTEP_DOUBLE:
6032 			{
6033 				aProp <<= (double) getSpinSize();
6034 			}
6035 			break;
6036 			case BASEPROPERTY_CURRENCYSYMBOL:
6037 			{
6038 			    aProp <<= ::rtl::OUString( ((LongCurrencyField*)GetWindow())->GetCurrencySymbol() );
6039 			}
6040 			break;
6041 			case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
6042 			{
6043 			    aProp <<= (sal_Bool) ((LongCurrencyField*)GetWindow())->IsUseThousandSep();
6044 			}
6045 			break;
6046 			default:
6047 			{
6048 				aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
6049 			}
6050 		}
6051 	}
6052 	return aProp;
6053 }
6054 
6055 //	----------------------------------------------------
6056 //	class VCLXPatternField
6057 //	----------------------------------------------------
6058 
6059 void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
6060 {
6061     PushPropertyIds( rIds,
6062                      BASEPROPERTY_ALIGN,
6063                      BASEPROPERTY_BACKGROUNDCOLOR,
6064                      BASEPROPERTY_BORDER,
6065                      BASEPROPERTY_BORDERCOLOR,
6066                      BASEPROPERTY_DEFAULTCONTROL,
6067                      BASEPROPERTY_EDITMASK,
6068                      BASEPROPERTY_ENABLED,
6069                      BASEPROPERTY_ENABLEVISIBLE,
6070                      BASEPROPERTY_FONTDESCRIPTOR,
6071                      BASEPROPERTY_HELPTEXT,
6072                      BASEPROPERTY_HELPURL,
6073                      BASEPROPERTY_LITERALMASK,
6074                      BASEPROPERTY_MAXTEXTLEN,
6075                      BASEPROPERTY_PRINTABLE,
6076                      BASEPROPERTY_READONLY,
6077                      BASEPROPERTY_STRICTFORMAT,
6078                      BASEPROPERTY_TABSTOP,
6079                      BASEPROPERTY_TEXT,
6080                      BASEPROPERTY_HIDEINACTIVESELECTION,
6081                      BASEPROPERTY_VERTICALALIGN,
6082                      BASEPROPERTY_WRITING_MODE,
6083                      BASEPROPERTY_CONTEXT_WRITING_MODE,
6084                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
6085                      0);
6086     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
6087 }
6088 
6089 VCLXPatternField::VCLXPatternField()
6090 {
6091 }
6092 
6093 VCLXPatternField::~VCLXPatternField()
6094 {
6095 }
6096 
6097 // ::com::sun::star::uno::XInterface
6098 ::com::sun::star::uno::Any VCLXPatternField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
6099 {
6100 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
6101 										SAL_STATIC_CAST( ::com::sun::star::awt::XPatternField*, this ) );
6102 	return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
6103 }
6104 
6105 // ::com::sun::star::lang::XTypeProvider
6106 IMPL_XTYPEPROVIDER_START( VCLXPatternField )
6107 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPatternField>* ) NULL ),
6108 	VCLXFormattedSpinField::getTypes()
6109 IMPL_XTYPEPROVIDER_END
6110 
6111 void VCLXPatternField::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
6112 {
6113 	::vos::OGuard aGuard( GetMutex() );
6114 
6115 	PatternField* pPatternField = (PatternField*) GetWindow();
6116 	if ( pPatternField )
6117 	{
6118 		pPatternField->SetMask(	ByteString( UniString( EditMask ), RTL_TEXTENCODING_ASCII_US ), LiteralMask );
6119 	}
6120 }
6121 
6122 void VCLXPatternField::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
6123 {
6124 	::vos::OGuard aGuard( GetMutex() );
6125 
6126 	PatternField* pPatternField = (PatternField*) GetWindow();
6127 	if ( pPatternField )
6128 	{
6129 		EditMask = String( pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US );
6130 		LiteralMask = pPatternField->GetLiteralMask();
6131 	}
6132 }
6133 
6134 void VCLXPatternField::setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException)
6135 {
6136 	::vos::OGuard aGuard( GetMutex() );
6137 
6138 	PatternField* pPatternField = (PatternField*) GetWindow();
6139 	if ( pPatternField )
6140 	{
6141 		pPatternField->SetString( Str );
6142 	}
6143 }
6144 
6145 ::rtl::OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException)
6146 {
6147 	::vos::OGuard aGuard( GetMutex() );
6148 
6149 	::rtl::OUString aString;
6150 	PatternField* pPatternField = (PatternField*) GetWindow();
6151 	if ( pPatternField )
6152 		aString = pPatternField->GetString();
6153 	return aString;
6154 }
6155 
6156 void VCLXPatternField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
6157 {
6158 	VCLXFormattedSpinField::setStrictFormat( bStrict );
6159 }
6160 
6161 sal_Bool VCLXPatternField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
6162 {
6163 	return VCLXFormattedSpinField::isStrictFormat();
6164 }
6165 
6166 void VCLXPatternField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
6167 {
6168 	::vos::OGuard aGuard( GetMutex() );
6169 
6170 	if ( GetWindow() )
6171 	{
6172 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
6173 		switch ( nPropType )
6174 		{
6175 			case BASEPROPERTY_EDITMASK:
6176 			case BASEPROPERTY_LITERALMASK:
6177 			{
6178 				::rtl::OUString aString;
6179 				if ( Value >>= aString )
6180 				{
6181 					::rtl::OUString aEditMask, aLiteralMask;
6182 					getMasks( aEditMask, aLiteralMask );
6183 					if ( nPropType == BASEPROPERTY_EDITMASK )
6184 						aEditMask = aString;
6185 					else
6186 						aLiteralMask = aString;
6187  					setMasks( aEditMask, aLiteralMask );
6188 				}
6189 			}
6190 			break;
6191 			default:
6192 			{
6193 				VCLXFormattedSpinField::setProperty( PropertyName, Value );
6194 			}
6195 		}
6196 	}
6197 }
6198 
6199 ::com::sun::star::uno::Any VCLXPatternField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
6200 {
6201 	::vos::OGuard aGuard( GetMutex() );
6202 
6203 	::com::sun::star::uno::Any aProp;
6204 	if ( GetWindow() )
6205 	{
6206 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
6207 		switch ( nPropType )
6208 		{
6209 			case BASEPROPERTY_EDITMASK:
6210 			case BASEPROPERTY_LITERALMASK:
6211 			{
6212 				::rtl::OUString aEditMask, aLiteralMask;
6213 				getMasks( aEditMask, aLiteralMask );
6214 				if ( nPropType == BASEPROPERTY_EDITMASK )
6215 					aProp <<= aEditMask;
6216 				else
6217 					aProp <<= aLiteralMask;
6218 			}
6219 			break;
6220 			default:
6221 			{
6222 				aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
6223 			}
6224 		}
6225 	}
6226 	return aProp;
6227 }
6228 
6229 //	----------------------------------------------------
6230 //	class VCLXToolBox
6231 //	----------------------------------------------------
6232 VCLXToolBox::VCLXToolBox()
6233 {
6234 }
6235 
6236 VCLXToolBox::~VCLXToolBox()
6237 {
6238 }
6239 
6240 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXToolBox::CreateAccessibleContext()
6241 {
6242     return getAccessibleFactory().createAccessibleContext( this );
6243 }
6244 
6245