1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: vclxwindows.cxx,v $
10 * $Revision: 1.69.4.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
33 #include <toolkit/awt/vclxwindows.hxx>
34 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
35 #include <com/sun/star/graphic/XGraphic.hpp>
36 #include <toolkit/helper/vclunohelper.hxx>
37 #include <toolkit/helper/macros.hxx>
38 #include <toolkit/helper/property.hxx>
39 #include <toolkit/helper/convert.hxx>
40 #include <toolkit/helper/imagealign.hxx>
41 #include <toolkit/helper/accessibilityclient.hxx>
42 #include <toolkit/helper/fixedhyperbase.hxx>
43 #include <cppuhelper/typeprovider.hxx>
44 #include <com/sun/star/awt/VisualEffect.hpp>
45 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46 #include <com/sun/star/system/XSystemShellExecute.hpp>
47 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
48 #include <com/sun/star/awt/ImageScaleMode.hpp>
49 #include <comphelper/processfactory.hxx>
51 #ifndef _SV_BUTTON_HXX
52 #include <vcl/button.hxx>
54 #include <vcl/lstbox.hxx>
55 #include <vcl/combobox.hxx>
56 #include <vcl/field.hxx>
57 #include <vcl/longcurr.hxx>
58 #include <vcl/imgctrl.hxx>
59 #include <vcl/dialog.hxx>
60 #include <vcl/msgbox.hxx>
61 #include <vcl/scrbar.hxx>
62 #include <vcl/svapp.hxx>
63 #include <vcl/tabpage.hxx>
64 #include <tools/debug.hxx>
66 using ::com::sun::star::uno::Any
;
67 using ::com::sun::star::uno::Reference
;
68 using ::com::sun::star::uno::makeAny
;
69 using ::com::sun::star::graphic::XGraphic
;
71 using namespace ::com::sun::star
;
72 using namespace ::com::sun::star::awt::VisualEffect
;
73 namespace ImageScaleMode
= ::com::sun::star::awt::ImageScaleMode
;
75 static double ImplCalcLongValue( double nValue
, sal_uInt16 nDigits
)
78 for ( sal_uInt16 d
= 0; d
< nDigits
; d
++ )
83 static double ImplCalcDoubleValue( double nValue
, sal_uInt16 nDigits
)
86 for ( sal_uInt16 d
= 0; d
< nDigits
; d
++ )
93 /** sets the "face color" for button like controls (scroll bar, spin button)
95 void setButtonLikeFaceColor( Window
* _pWindow
, const ::com::sun::star::uno::Any
& _rColorValue
)
97 AllSettings aSettings
= _pWindow
->GetSettings();
98 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
100 if ( !_rColorValue
.hasValue() )
102 const StyleSettings
& aAppStyle
= Application::GetSettings().GetStyleSettings();
103 aStyleSettings
.SetFaceColor( aAppStyle
.GetFaceColor( ) );
104 aStyleSettings
.SetCheckedColor( aAppStyle
.GetCheckedColor( ) );
105 aStyleSettings
.SetLightBorderColor( aAppStyle
.GetLightBorderColor() );
106 aStyleSettings
.SetLightColor( aAppStyle
.GetLightColor() );
107 aStyleSettings
.SetShadowColor( aAppStyle
.GetShadowColor() );
108 aStyleSettings
.SetDarkShadowColor( aAppStyle
.GetDarkShadowColor() );
112 sal_Int32 nBackgroundColor
= 0;
113 _rColorValue
>>= nBackgroundColor
;
114 aStyleSettings
.SetFaceColor( nBackgroundColor
);
116 // for the real background (everything except the buttons and the thumb),
117 // use an average between the desired color and "white"
118 Color
aWhite( COL_WHITE
);
119 Color
aBackground( nBackgroundColor
);
120 aBackground
.SetRed( ( aBackground
.GetRed() + aWhite
.GetRed() ) / 2 );
121 aBackground
.SetGreen( ( aBackground
.GetGreen() + aWhite
.GetGreen() ) / 2 );
122 aBackground
.SetBlue( ( aBackground
.GetBlue() + aWhite
.GetBlue() ) / 2 );
123 aStyleSettings
.SetCheckedColor( aBackground
);
125 sal_Int32 nBackgroundLuminance
= Color( nBackgroundColor
).GetLuminance();
126 sal_Int32 nWhiteLuminance
= Color( COL_WHITE
).GetLuminance();
128 Color
aLightShadow( nBackgroundColor
);
129 aLightShadow
.IncreaseLuminance( (UINT8
)( ( nWhiteLuminance
- nBackgroundLuminance
) * 2 / 3 ) );
130 aStyleSettings
.SetLightBorderColor( aLightShadow
);
132 Color
aLight( nBackgroundColor
);
133 aLight
.IncreaseLuminance( (UINT8
)( ( nWhiteLuminance
- nBackgroundLuminance
) * 1 / 3 ) );
134 aStyleSettings
.SetLightColor( aLight
);
136 Color
aShadow( nBackgroundColor
);
137 aShadow
.DecreaseLuminance( (UINT8
)( nBackgroundLuminance
* 1 / 3 ) );
138 aStyleSettings
.SetShadowColor( aShadow
);
140 Color
aDarkShadow( nBackgroundColor
);
141 aDarkShadow
.DecreaseLuminance( (UINT8
)( nBackgroundLuminance
* 2 / 3 ) );
142 aStyleSettings
.SetDarkShadowColor( aDarkShadow
);
145 aSettings
.SetStyleSettings( aStyleSettings
);
146 _pWindow
->SetSettings( aSettings
, TRUE
);
149 Any
getButtonLikeFaceColor( const Window
* _pWindow
)
151 sal_Int32 nBackgroundColor
= _pWindow
->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
152 return makeAny( nBackgroundColor
);
155 static void adjustBooleanWindowStyle( const Any
& _rValue
, Window
* _pWindow
, WinBits _nBits
, sal_Bool _bInverseSemantics
)
157 WinBits nStyle
= _pWindow
->GetStyle();
158 sal_Bool
bValue( sal_False
);
159 OSL_VERIFY( _rValue
>>= bValue
);
160 if ( bValue
!= _bInverseSemantics
)
164 _pWindow
->SetStyle( nStyle
);
167 static void setVisualEffect( const Any
& _rValue
, Window
* _pWindow
, void (StyleSettings::*pSetter
)( USHORT
), sal_Int16 _nFlatBits
, sal_Int16 _n3DBits
)
169 AllSettings aSettings
= _pWindow
->GetSettings();
170 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
172 sal_Int16 nStyle
= LOOK3D
;
173 OSL_VERIFY( _rValue
>>= nStyle
);
177 (aStyleSettings
.*pSetter
)( _nFlatBits
);
181 (aStyleSettings
.*pSetter
)( _n3DBits
);
183 aSettings
.SetStyleSettings( aStyleSettings
);
184 _pWindow
->SetSettings( aSettings
);
187 static Any
getVisualEffect( Window
* _pWindow
, USHORT (StyleSettings::*pGetter
)( ) const, sal_Int16 _nFlatBits
)
191 StyleSettings aStyleSettings
= _pWindow
->GetSettings().GetStyleSettings();
192 if ( (aStyleSettings
.*pGetter
)() == _nFlatBits
)
193 aEffect
<<= (sal_Int16
)FLAT
;
195 aEffect
<<= (sal_Int16
)LOOK3D
;
200 // ----------------------------------------------------
201 // class VCLXImageConsumer
202 // ----------------------------------------------------
204 void VCLXImageConsumer::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
206 VCLXWindow::ImplGetPropertyIds( rIds
);
209 void VCLXImageConsumer::ImplSetNewImage()
211 OSL_PRECOND( GetWindow(), "VCLXImageConsumer::ImplSetNewImage: window is required to be not-NULL!" );
212 Button
* pButton
= static_cast< Button
* >( GetWindow() );
213 pButton
->SetModeBitmap( GetBitmap() );
216 void VCLXImageConsumer::ImplUpdateImage( sal_Bool bGetNewImage
)
221 if ( bGetNewImage
&& !maImageConsumer
.GetData( maImage
) )
227 void VCLXImageConsumer::setPosSize( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, short Flags
) throw(::com::sun::star::uno::RuntimeException
)
229 ::vos::OGuard
aGuard( GetMutex() );
233 Size aOldSize
= GetWindow()->GetSizePixel();
234 VCLXWindow::setPosSize( X
, Y
, Width
, Height
, Flags
);
235 if ( ( aOldSize
.Width() != Width
) || ( aOldSize
.Height() != Height
) )
236 ImplUpdateImage( sal_False
);
240 void VCLXImageConsumer::init( sal_Int32 Width
, sal_Int32 Height
) throw(::com::sun::star::uno::RuntimeException
)
242 ::vos::OGuard
aGuard( GetMutex() );
244 maImageConsumer
.Init( Width
, Height
);
247 void VCLXImageConsumer::setColorModel( sal_Int16 BitCount
, const ::com::sun::star::uno::Sequence
< sal_Int32
>& RGBAPal
, sal_Int32 RedMask
, sal_Int32 GreenMask
, sal_Int32 BlueMask
, sal_Int32 AlphaMask
) throw(::com::sun::star::uno::RuntimeException
)
249 ::vos::OGuard
aGuard( GetMutex() );
251 maImageConsumer
.SetColorModel( BitCount
, RGBAPal
.getLength(), (const sal_uInt32
*) RGBAPal
.getConstArray(), RedMask
, GreenMask
, BlueMask
, AlphaMask
);
254 void VCLXImageConsumer::setPixelsByBytes( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, const ::com::sun::star::uno::Sequence
< sal_Int8
>& ProducerData
, sal_Int32 Offset
, sal_Int32 Scansize
) throw(::com::sun::star::uno::RuntimeException
)
256 ::vos::OGuard
aGuard( GetMutex() );
258 maImageConsumer
.SetPixelsByBytes( X
, Y
, Width
, Height
, (sal_uInt8
*)ProducerData
.getConstArray(), Offset
, Scansize
);
259 ImplUpdateImage( sal_True
);
262 void VCLXImageConsumer::setPixelsByLongs( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, const ::com::sun::star::uno::Sequence
< sal_Int32
>& ProducerData
, sal_Int32 Offset
, sal_Int32 Scansize
) throw(::com::sun::star::uno::RuntimeException
)
264 ::vos::OGuard
aGuard( GetMutex() );
266 maImageConsumer
.SetPixelsByLongs( X
, Y
, Width
, Height
, (const sal_uInt32
*) ProducerData
.getConstArray(), Offset
, Scansize
);
267 ImplUpdateImage( sal_True
);
270 void VCLXImageConsumer::complete( sal_Int32 Status
, const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XImageProducer
> & ) throw(::com::sun::star::uno::RuntimeException
)
272 ::vos::OGuard
aGuard( GetMutex() );
274 maImageConsumer
.Completed( Status
);
275 ImplUpdateImage( sal_True
);
278 void VCLXImageConsumer::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
280 ::vos::OGuard
aGuard( GetMutex() );
282 Button
* pButton
= static_cast< Button
* >( GetWindow() );
285 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
288 case BASEPROPERTY_GRAPHIC
:
290 Reference
< XGraphic
> xGraphic
;
291 OSL_VERIFY( Value
>>= xGraphic
);
292 maImage
= Image( xGraphic
);
297 case BASEPROPERTY_IMAGEALIGN
:
299 WindowType eType
= GetWindow()->GetType();
300 if ( ( eType
== WINDOW_PUSHBUTTON
)
301 || ( eType
== WINDOW_RADIOBUTTON
)
302 || ( eType
== WINDOW_CHECKBOX
)
305 sal_Int16 nAlignment
= sal_Int16();
306 if ( Value
>>= nAlignment
)
307 pButton
->SetImageAlign( static_cast< ImageAlign
>( nAlignment
) );
311 case BASEPROPERTY_IMAGEPOSITION
:
313 WindowType eType
= GetWindow()->GetType();
314 if ( ( eType
== WINDOW_PUSHBUTTON
)
315 || ( eType
== WINDOW_RADIOBUTTON
)
316 || ( eType
== WINDOW_CHECKBOX
)
319 sal_Int16 nImagePosition
= 2;
320 OSL_VERIFY( Value
>>= nImagePosition
);
321 pButton
->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition
) );
326 VCLXWindow::setProperty( PropertyName
, Value
);
331 ::com::sun::star::uno::Any
VCLXImageConsumer::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
333 ::vos::OGuard
aGuard( GetMutex() );
335 ::com::sun::star::uno::Any aProp
;
339 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
342 case BASEPROPERTY_GRAPHIC
:
343 aProp
<<= maImage
.GetXGraphic();
345 case BASEPROPERTY_IMAGEALIGN
:
347 WindowType eType
= GetWindow()->GetType();
348 if ( ( eType
== WINDOW_PUSHBUTTON
)
349 || ( eType
== WINDOW_RADIOBUTTON
)
350 || ( eType
== WINDOW_CHECKBOX
)
353 aProp
<<= ::toolkit::getCompatibleImageAlign( static_cast< Button
* >( GetWindow() )->GetImageAlign() );
357 case BASEPROPERTY_IMAGEPOSITION
:
359 WindowType eType
= GetWindow()->GetType();
360 if ( ( eType
== WINDOW_PUSHBUTTON
)
361 || ( eType
== WINDOW_RADIOBUTTON
)
362 || ( eType
== WINDOW_CHECKBOX
)
365 aProp
<<= ::toolkit::translateImagePosition( static_cast< Button
* >( GetWindow() )->GetImageAlign() );
371 aProp
<<= VCLXWindow::getProperty( PropertyName
);
378 //--------------------------------------------------------------------
380 // ----------------------------------------------------
382 void VCLXButton::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
384 PushPropertyIds( rIds
,
385 BASEPROPERTY_BACKGROUNDCOLOR
,
386 BASEPROPERTY_DEFAULTBUTTON
,
387 BASEPROPERTY_DEFAULTCONTROL
,
388 BASEPROPERTY_ENABLED
,
389 BASEPROPERTY_ENABLEVISIBLE
,
390 BASEPROPERTY_FONTDESCRIPTOR
,
391 BASEPROPERTY_GRAPHIC
,
392 BASEPROPERTY_HELPTEXT
,
393 BASEPROPERTY_HELPURL
,
394 BASEPROPERTY_IMAGEALIGN
,
395 BASEPROPERTY_IMAGEPOSITION
,
396 BASEPROPERTY_IMAGEURL
,
398 BASEPROPERTY_PRINTABLE
,
399 BASEPROPERTY_PUSHBUTTONTYPE
,
401 BASEPROPERTY_REPEAT_DELAY
,
403 BASEPROPERTY_TABSTOP
,
405 BASEPROPERTY_FOCUSONCLICK
,
406 BASEPROPERTY_MULTILINE
,
408 BASEPROPERTY_VERTICALALIGN
,
409 BASEPROPERTY_WRITING_MODE
,
410 BASEPROPERTY_CONTEXT_WRITING_MODE
,
412 VCLXImageConsumer::ImplGetPropertyIds( rIds
);
415 VCLXButton::VCLXButton()
416 :maActionListeners( *this )
417 ,maItemListeners( *this )
421 VCLXButton::~VCLXButton()
424 OSL_TRACE ("%s", __FUNCTION__
);
428 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXButton::CreateAccessibleContext()
430 return getAccessibleFactory().createAccessibleContext( this );
433 void VCLXButton::dispose() throw(::com::sun::star::uno::RuntimeException
)
435 ::vos::OGuard
aGuard( GetMutex() );
437 ::com::sun::star::lang::EventObject aObj
;
438 aObj
.Source
= (::cppu::OWeakObject
*)this;
439 maActionListeners
.disposeAndClear( aObj
);
440 maItemListeners
.disposeAndClear( aObj
);
441 VCLXImageConsumer::dispose();
444 void VCLXButton::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
)throw(::com::sun::star::uno::RuntimeException
)
446 ::vos::OGuard
aGuard( GetMutex() );
447 maActionListeners
.addInterface( l
);
450 void VCLXButton::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
452 ::vos::OGuard
aGuard( GetMutex() );
453 maActionListeners
.removeInterface( l
);
456 void VCLXButton::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
)throw(::com::sun::star::uno::RuntimeException
)
458 ::vos::OGuard
aGuard( GetMutex() );
459 maItemListeners
.addInterface( l
);
462 void VCLXButton::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
464 ::vos::OGuard
aGuard( GetMutex() );
465 maItemListeners
.removeInterface( l
);
468 void VCLXButton::setLabel( const ::rtl::OUString
& rLabel
) throw(::com::sun::star::uno::RuntimeException
)
470 ::vos::OGuard
aGuard( GetMutex() );
472 Window
* pWindow
= GetWindow();
474 pWindow
->SetText( rLabel
);
477 void VCLXButton::setActionCommand( const ::rtl::OUString
& rCommand
) throw(::com::sun::star::uno::RuntimeException
)
479 ::vos::OGuard
aGuard( GetMutex() );
481 maActionCommand
= rCommand
;
484 ::com::sun::star::awt::Size
VCLXButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
486 ::vos::OGuard
aGuard( GetMutex() );
489 PushButton
* pButton
= (PushButton
*) GetWindow();
491 aSz
= pButton
->CalcMinimumSize();
495 ::com::sun::star::awt::Size
VCLXButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
497 ::com::sun::star::awt::Size aSz
= getMinimumSize();
503 ::com::sun::star::awt::Size
VCLXButton::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
505 ::vos::OGuard
aGuard( GetMutex() );
507 Size aSz
= VCLSize(rNewSize
);
508 PushButton
* pButton
= (PushButton
*) GetWindow();
511 Size aMinSz
= pButton
->CalcMinimumSize();
512 // Kein Text, also Image
513 if ( !pButton
->GetText().Len() )
515 if ( aSz
.Width() < aMinSz
.Width() )
516 aSz
.Width() = aMinSz
.Width();
517 if ( aSz
.Height() < aMinSz
.Height() )
518 aSz
.Height() = aMinSz
.Height();
522 if ( ( aSz
.Width() > aMinSz
.Width() ) && ( aSz
.Height() < aMinSz
.Height() ) )
523 aSz
.Height() = aMinSz
.Height();
531 void VCLXButton::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
533 ::vos::OGuard
aGuard( GetMutex() );
535 Button
* pButton
= (Button
*)GetWindow();
538 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
541 case BASEPROPERTY_FOCUSONCLICK
:
542 ::toolkit::adjustBooleanWindowStyle( Value
, pButton
, WB_NOPOINTERFOCUS
, sal_True
);
545 case BASEPROPERTY_TOGGLE
:
546 ::toolkit::adjustBooleanWindowStyle( Value
, pButton
, WB_TOGGLE
, sal_False
);
549 case BASEPROPERTY_DEFAULTBUTTON
:
551 WinBits nStyle
= pButton
->GetStyle() | WB_DEFBUTTON
;
552 sal_Bool b
= sal_Bool();
553 if ( ( Value
>>= b
) && !b
)
554 nStyle
&= ~WB_DEFBUTTON
;
555 pButton
->SetStyle( nStyle
);
558 case BASEPROPERTY_STATE
:
560 if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON
)
562 sal_Int16 n
= sal_Int16();
564 ((PushButton
*)pButton
)->SetState( (TriState
)n
);
570 VCLXImageConsumer::setProperty( PropertyName
, Value
);
576 ::com::sun::star::uno::Any
VCLXButton::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
578 ::vos::OGuard
aGuard( GetMutex() );
580 ::com::sun::star::uno::Any aProp
;
581 Button
* pButton
= (Button
*)GetWindow();
584 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
587 case BASEPROPERTY_FOCUSONCLICK
:
588 aProp
<<= (sal_Bool
)( ( pButton
->GetStyle() & WB_NOPOINTERFOCUS
) == 0 );
591 case BASEPROPERTY_TOGGLE
:
592 aProp
<<= (sal_Bool
)( ( pButton
->GetStyle() & WB_TOGGLE
) != 0 );
595 case BASEPROPERTY_DEFAULTBUTTON
:
597 aProp
<<= (sal_Bool
) ( ( pButton
->GetStyle() & WB_DEFBUTTON
) ? sal_True
: sal_False
);
600 case BASEPROPERTY_STATE
:
602 if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON
)
604 aProp
<<= (sal_Int16
)((PushButton
*)pButton
)->GetState();
610 aProp
<<= VCLXImageConsumer::getProperty( PropertyName
);
617 void VCLXButton::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
619 switch ( rVclWindowEvent
.GetId() )
621 case VCLEVENT_BUTTON_CLICK
:
623 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
624 // since we call listeners below, there is a potential that we will be destroyed
625 // during the listener call. To prevent the resulting crashs, we keep us
626 // alive as long as we're here
627 // #20178# - 2003-10-01 - fs@openoffice.org
629 if ( maActionListeners
.getLength() )
631 ::com::sun::star::awt::ActionEvent aEvent
;
632 aEvent
.Source
= (::cppu::OWeakObject
*)this;
633 aEvent
.ActionCommand
= maActionCommand
;
634 maActionListeners
.actionPerformed( aEvent
);
639 case VCLEVENT_PUSHBUTTON_TOGGLE
:
641 PushButton
& rButton
= dynamic_cast< PushButton
& >( *rVclWindowEvent
.GetWindow() );
643 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
644 if ( maItemListeners
.getLength() )
646 ::com::sun::star::awt::ItemEvent aEvent
;
647 aEvent
.Source
= (::cppu::OWeakObject
*)this;
648 aEvent
.Selected
= ( rButton
.GetState() == STATE_CHECK
) ? 1 : 0;
649 maItemListeners
.itemStateChanged( aEvent
);
655 VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent
);
660 // ----------------------------------------------------
661 // class VCLXImageControl
662 // ----------------------------------------------------
664 void VCLXImageControl::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
666 PushPropertyIds( rIds
,
667 BASEPROPERTY_BACKGROUNDCOLOR
,
669 BASEPROPERTY_BORDERCOLOR
,
670 BASEPROPERTY_DEFAULTCONTROL
,
671 BASEPROPERTY_ENABLED
,
672 BASEPROPERTY_ENABLEVISIBLE
,
673 BASEPROPERTY_GRAPHIC
,
674 BASEPROPERTY_HELPTEXT
,
675 BASEPROPERTY_HELPURL
,
676 BASEPROPERTY_IMAGEURL
,
677 BASEPROPERTY_PRINTABLE
,
678 BASEPROPERTY_SCALEIMAGE
,
679 BASEPROPERTY_IMAGE_SCALE_MODE
,
680 BASEPROPERTY_TABSTOP
,
681 BASEPROPERTY_WRITING_MODE
,
682 BASEPROPERTY_CONTEXT_WRITING_MODE
,
684 VCLXImageConsumer::ImplGetPropertyIds( rIds
);
687 VCLXImageControl::VCLXImageControl()
691 VCLXImageControl::~VCLXImageControl()
695 void VCLXImageControl::ImplSetNewImage()
697 OSL_PRECOND( GetWindow(), "VCLXImageControl::ImplSetNewImage: window is required to be not-NULL!" );
698 ImageControl
* pControl
= static_cast< ImageControl
* >( GetWindow() );
699 pControl
->SetBitmap( GetBitmap() );
702 ::com::sun::star::awt::Size
VCLXImageControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
704 ::vos::OGuard
aGuard( GetMutex() );
706 Size aSz
= GetBitmap().GetSizePixel();
707 aSz
= ImplCalcWindowSize( aSz
);
712 ::com::sun::star::awt::Size
VCLXImageControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
714 return getMinimumSize();
717 ::com::sun::star::awt::Size
VCLXImageControl::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
719 ::vos::OGuard
aGuard( GetMutex() );
721 ::com::sun::star::awt::Size aSz
= rNewSize
;
722 ::com::sun::star::awt::Size aMinSz
= getMinimumSize();
723 if ( aSz
.Width
< aMinSz
.Width
)
724 aSz
.Width
= aMinSz
.Width
;
725 if ( aSz
.Height
< aMinSz
.Height
)
726 aSz
.Height
= aMinSz
.Height
;
730 void VCLXImageControl::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
732 ::vos::OGuard
aGuard( GetMutex() );
734 ImageControl
* pImageControl
= (ImageControl
*)GetWindow();
736 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
739 case BASEPROPERTY_IMAGE_SCALE_MODE
:
741 sal_Int16
nScaleMode( ImageScaleMode::Anisotropic
);
742 if ( pImageControl
&& ( Value
>>= nScaleMode
) )
744 pImageControl
->SetScaleMode( nScaleMode
);
749 case BASEPROPERTY_SCALEIMAGE
:
751 // this is for compatibility only, nowadays, the ImageScaleMode property should be used
752 sal_Bool bScaleImage
= sal_False
;
753 if ( pImageControl
&& ( Value
>>= bScaleImage
) )
755 pImageControl
->SetScaleMode( bScaleImage
? ImageScaleMode::Anisotropic
: ImageScaleMode::None
);
761 VCLXImageConsumer::setProperty( PropertyName
, Value
);
766 ::com::sun::star::uno::Any
VCLXImageControl::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
768 ::vos::OGuard
aGuard( GetMutex() );
770 ::com::sun::star::uno::Any aProp
;
771 ImageControl
* pImageControl
= (ImageControl
*)GetWindow();
772 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
776 case BASEPROPERTY_IMAGE_SCALE_MODE
:
777 aProp
<<= ( pImageControl
? pImageControl
->GetScaleMode() : ImageScaleMode::Anisotropic
);
780 case BASEPROPERTY_SCALEIMAGE
:
781 aProp
<<= ( pImageControl
&& pImageControl
->GetScaleMode() != ImageScaleMode::None
) ? sal_True
: sal_False
;
785 aProp
= VCLXImageConsumer::getProperty( PropertyName
);
791 // ----------------------------------------------------
792 // class VCLXCheckBox
793 // ----------------------------------------------------
796 void VCLXCheckBox::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
798 PushPropertyIds( rIds
,
799 BASEPROPERTY_DEFAULTCONTROL
,
800 BASEPROPERTY_ENABLED
,
801 BASEPROPERTY_ENABLEVISIBLE
,
802 BASEPROPERTY_FONTDESCRIPTOR
,
803 BASEPROPERTY_GRAPHIC
,
804 BASEPROPERTY_HELPTEXT
,
805 BASEPROPERTY_HELPURL
,
806 BASEPROPERTY_IMAGEPOSITION
,
807 BASEPROPERTY_IMAGEURL
,
809 BASEPROPERTY_PRINTABLE
,
811 BASEPROPERTY_TABSTOP
,
812 BASEPROPERTY_TRISTATE
,
813 BASEPROPERTY_VISUALEFFECT
,
814 BASEPROPERTY_MULTILINE
,
815 BASEPROPERTY_BACKGROUNDCOLOR
,
817 BASEPROPERTY_VERTICALALIGN
,
818 BASEPROPERTY_WRITING_MODE
,
819 BASEPROPERTY_CONTEXT_WRITING_MODE
,
821 VCLXImageConsumer::ImplGetPropertyIds( rIds
);
824 VCLXCheckBox::VCLXCheckBox() : maActionListeners( *this ), maItemListeners( *this )
828 // ::com::sun::star::uno::XInterface
829 ::com::sun::star::uno::Any
VCLXCheckBox::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
831 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
832 SAL_STATIC_CAST( ::com::sun::star::awt::XButton
*, this ),
833 SAL_STATIC_CAST( ::com::sun::star::awt::XCheckBox
*, this ) );
834 return (aRet
.hasValue() ? aRet
: VCLXImageConsumer::queryInterface( rType
));
837 // ::com::sun::star::lang::XTypeProvider
838 IMPL_XTYPEPROVIDER_START( VCLXCheckBox
)
839 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XButton
>* ) NULL
),
840 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XCheckBox
>* ) NULL
),
841 VCLXImageConsumer::getTypes()
842 IMPL_XTYPEPROVIDER_END
844 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXCheckBox::CreateAccessibleContext()
846 return getAccessibleFactory().createAccessibleContext( this );
849 void VCLXCheckBox::dispose() throw(::com::sun::star::uno::RuntimeException
)
851 ::vos::OGuard
aGuard( GetMutex() );
853 ::com::sun::star::lang::EventObject aObj
;
854 aObj
.Source
= (::cppu::OWeakObject
*)this;
855 maItemListeners
.disposeAndClear( aObj
);
856 VCLXImageConsumer::dispose();
859 void VCLXCheckBox::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
861 ::vos::OGuard
aGuard( GetMutex() );
862 maItemListeners
.addInterface( l
);
865 void VCLXCheckBox::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
867 ::vos::OGuard
aGuard( GetMutex() );
868 maItemListeners
.removeInterface( l
);
871 void VCLXCheckBox::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
)throw(::com::sun::star::uno::RuntimeException
)
873 ::vos::OGuard
aGuard( GetMutex() );
874 maActionListeners
.addInterface( l
);
877 void VCLXCheckBox::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
879 ::vos::OGuard
aGuard( GetMutex() );
880 maActionListeners
.removeInterface( l
);
883 void VCLXCheckBox::setActionCommand( const ::rtl::OUString
& rCommand
) throw(::com::sun::star::uno::RuntimeException
)
885 ::vos::OGuard
aGuard( GetMutex() );
886 maActionCommand
= rCommand
;
889 void VCLXCheckBox::setLabel( const ::rtl::OUString
& rLabel
) throw(::com::sun::star::uno::RuntimeException
)
891 ::vos::OGuard
aGuard( GetMutex() );
893 Window
* pWindow
= GetWindow();
895 pWindow
->SetText( rLabel
);
898 void VCLXCheckBox::setState( short n
) throw(::com::sun::star::uno::RuntimeException
)
900 ::vos::OGuard
aGuard( GetMutex() );
902 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
908 case 0: eState
= STATE_NOCHECK
; break;
909 case 1: eState
= STATE_CHECK
; break;
910 case 2: eState
= STATE_DONTKNOW
; break;
911 default: eState
= STATE_NOCHECK
;
913 pCheckBox
->SetState( eState
);
915 // #105198# call C++ click listeners (needed for accessibility)
916 // pCheckBox->GetClickHdl().Call( pCheckBox );
918 // #107218# Call same virtual methods and listeners like VCL would do after user interaction
919 SetSynthesizingVCLEvent( sal_True
);
922 SetSynthesizingVCLEvent( sal_False
);
926 short VCLXCheckBox::getState() throw(::com::sun::star::uno::RuntimeException
)
928 ::vos::OGuard
aGuard( GetMutex() );
931 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
934 switch ( pCheckBox
->GetState() )
936 case STATE_NOCHECK
: nState
= 0; break;
937 case STATE_CHECK
: nState
= 1; break;
938 case STATE_DONTKNOW
: nState
= 2; break;
939 default: DBG_ERROR( "VCLXCheckBox::getState(): unknown TriState!" );
946 void VCLXCheckBox::enableTriState( sal_Bool b
) throw(::com::sun::star::uno::RuntimeException
)
948 ::vos::OGuard
aGuard( GetMutex() );
950 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
952 pCheckBox
->EnableTriState( b
);
955 ::com::sun::star::awt::Size
VCLXCheckBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
957 ::vos::OGuard
aGuard( GetMutex() );
960 CheckBox
* pCheckBox
= (CheckBox
*) GetWindow();
962 aSz
= pCheckBox
->CalcMinimumSize();
966 ::com::sun::star::awt::Size
VCLXCheckBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
968 return getMinimumSize();
971 ::com::sun::star::awt::Size
VCLXCheckBox::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
973 ::vos::OGuard
aGuard( GetMutex() );
975 Size aSz
= VCLSize(rNewSize
);
976 CheckBox
* pCheckBox
= (CheckBox
*) GetWindow();
979 Size aMinSz
= pCheckBox
->CalcMinimumSize();
980 if ( ( aSz
.Width() > aMinSz
.Width() ) && ( aSz
.Height() < aMinSz
.Height() ) )
981 aSz
.Height() = aMinSz
.Height();
988 void VCLXCheckBox::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
990 ::vos::OGuard
aGuard( GetMutex() );
992 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
995 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
998 case BASEPROPERTY_VISUALEFFECT
:
999 ::toolkit::setVisualEffect( Value
, pCheckBox
, &StyleSettings::SetCheckBoxStyle
, STYLE_CHECKBOX_MONO
, STYLE_CHECKBOX_WIN
);
1002 case BASEPROPERTY_TRISTATE
:
1004 sal_Bool b
= sal_Bool();
1006 pCheckBox
->EnableTriState( b
);
1009 case BASEPROPERTY_STATE
:
1011 sal_Int16 n
= sal_Int16();
1018 VCLXImageConsumer::setProperty( PropertyName
, Value
);
1024 ::com::sun::star::uno::Any
VCLXCheckBox::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
1026 ::vos::OGuard
aGuard( GetMutex() );
1028 ::com::sun::star::uno::Any aProp
;
1029 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
1032 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1033 switch ( nPropType
)
1035 case BASEPROPERTY_VISUALEFFECT
:
1036 aProp
= ::toolkit::getVisualEffect( pCheckBox
, &StyleSettings::GetCheckBoxStyle
, STYLE_CHECKBOX_MONO
);
1038 case BASEPROPERTY_TRISTATE
:
1039 aProp
<<= (sal_Bool
)pCheckBox
->IsTriStateEnabled();
1041 case BASEPROPERTY_STATE
:
1042 aProp
<<= (sal_Int16
)pCheckBox
->GetState();
1046 aProp
<<= VCLXImageConsumer::getProperty( PropertyName
);
1053 void VCLXCheckBox::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1055 switch ( rVclWindowEvent
.GetId() )
1057 case VCLEVENT_CHECKBOX_TOGGLE
:
1059 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
1060 // since we call listeners below, there is a potential that we will be destroyed
1061 // in during the listener call. To prevent the resulting crashs, we keep us
1062 // alive as long as we're here
1063 // #20178# - 2003-10-01 - fs@openoffice.org
1065 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
1068 if ( maItemListeners
.getLength() )
1070 ::com::sun::star::awt::ItemEvent aEvent
;
1071 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1072 aEvent
.Highlighted
= sal_False
;
1073 aEvent
.Selected
= pCheckBox
->GetState();
1074 maItemListeners
.itemStateChanged( aEvent
);
1076 if ( !IsSynthesizingVCLEvent() && maActionListeners
.getLength() )
1078 ::com::sun::star::awt::ActionEvent aEvent
;
1079 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1080 aEvent
.ActionCommand
= maActionCommand
;
1081 maActionListeners
.actionPerformed( aEvent
);
1088 VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent
);
1093 // ----------------------------------------------------
1094 // class VCLXRadioButton
1095 // ----------------------------------------------------
1096 void VCLXRadioButton::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1098 PushPropertyIds( rIds
,
1099 BASEPROPERTY_DEFAULTCONTROL
,
1100 BASEPROPERTY_ENABLED
,
1101 BASEPROPERTY_ENABLEVISIBLE
,
1102 BASEPROPERTY_FONTDESCRIPTOR
,
1103 BASEPROPERTY_GRAPHIC
,
1104 BASEPROPERTY_HELPTEXT
,
1105 BASEPROPERTY_HELPURL
,
1106 BASEPROPERTY_IMAGEPOSITION
,
1107 BASEPROPERTY_IMAGEURL
,
1109 BASEPROPERTY_PRINTABLE
,
1111 BASEPROPERTY_TABSTOP
,
1112 BASEPROPERTY_VISUALEFFECT
,
1113 BASEPROPERTY_MULTILINE
,
1114 BASEPROPERTY_BACKGROUNDCOLOR
,
1116 BASEPROPERTY_VERTICALALIGN
,
1117 BASEPROPERTY_WRITING_MODE
,
1118 BASEPROPERTY_CONTEXT_WRITING_MODE
,
1119 BASEPROPERTY_GROUPNAME
,
1121 VCLXImageConsumer::ImplGetPropertyIds( rIds
);
1125 VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ), maActionListeners( *this )
1129 // ::com::sun::star::uno::XInterface
1130 ::com::sun::star::uno::Any
VCLXRadioButton::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
1132 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
1133 SAL_STATIC_CAST( ::com::sun::star::awt::XRadioButton
*, this ),
1134 SAL_STATIC_CAST( ::com::sun::star::awt::XButton
*, this ) );
1135 return (aRet
.hasValue() ? aRet
: VCLXImageConsumer::queryInterface( rType
));
1138 // ::com::sun::star::lang::XTypeProvider
1139 IMPL_XTYPEPROVIDER_START( VCLXRadioButton
)
1140 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XRadioButton
>* ) NULL
),
1141 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XButton
>* ) NULL
),
1142 VCLXImageConsumer::getTypes()
1143 IMPL_XTYPEPROVIDER_END
1145 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXRadioButton::CreateAccessibleContext()
1147 return getAccessibleFactory().createAccessibleContext( this );
1150 void VCLXRadioButton::dispose() throw(::com::sun::star::uno::RuntimeException
)
1152 ::vos::OGuard
aGuard( GetMutex() );
1154 ::com::sun::star::lang::EventObject aObj
;
1155 aObj
.Source
= (::cppu::OWeakObject
*)this;
1156 maItemListeners
.disposeAndClear( aObj
);
1157 VCLXImageConsumer::dispose();
1160 void VCLXRadioButton::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1162 ::vos::OGuard
aGuard( GetMutex() );
1164 RadioButton
* pButton
= (RadioButton
*)GetWindow();
1167 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1168 switch ( nPropType
)
1170 case BASEPROPERTY_VISUALEFFECT
:
1171 ::toolkit::setVisualEffect( Value
, pButton
, &StyleSettings::SetRadioButtonStyle
, STYLE_RADIOBUTTON_MONO
, STYLE_RADIOBUTTON_WIN
);
1174 case BASEPROPERTY_STATE
:
1176 sal_Int16 n
= sal_Int16();
1179 BOOL b
= n
? sal_True
: sal_False
;
1180 if ( pButton
->IsRadioCheckEnabled() )
1181 pButton
->Check( b
);
1183 pButton
->SetState( b
);
1184 // If VBA - need to be able to test
1185 // simulate click event
1186 if ( maActionListeners
.getLength() )
1188 ::com::sun::star::awt::ActionEvent aEvent
;
1189 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1190 aEvent
.ActionCommand
= maActionCommand
;
1191 maActionListeners
.actionPerformed( aEvent
);
1197 case BASEPROPERTY_AUTOTOGGLE
:
1199 sal_Bool b
= sal_Bool();
1201 pButton
->EnableRadioCheck( b
);
1206 VCLXImageConsumer::setProperty( PropertyName
, Value
);
1212 ::com::sun::star::uno::Any
VCLXRadioButton::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
1214 ::vos::OGuard
aGuard( GetMutex() );
1216 ::com::sun::star::uno::Any aProp
;
1217 RadioButton
* pButton
= (RadioButton
*)GetWindow();
1220 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1221 switch ( nPropType
)
1223 case BASEPROPERTY_VISUALEFFECT
:
1224 aProp
= ::toolkit::getVisualEffect( pButton
, &StyleSettings::GetRadioButtonStyle
, STYLE_RADIOBUTTON_MONO
);
1226 case BASEPROPERTY_STATE
:
1227 aProp
<<= (sal_Int16
) ( pButton
->IsChecked() ? 1 : 0 );
1229 case BASEPROPERTY_AUTOTOGGLE
:
1230 aProp
<<= (sal_Bool
) pButton
->IsRadioCheckEnabled();
1234 aProp
<<= VCLXImageConsumer::getProperty( PropertyName
);
1241 void VCLXRadioButton::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1243 ::vos::OGuard
aGuard( GetMutex() );
1244 maItemListeners
.addInterface( l
);
1247 void VCLXRadioButton::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1249 ::vos::OGuard
aGuard( GetMutex() );
1250 maItemListeners
.removeInterface( l
);
1253 void VCLXRadioButton::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
)throw(::com::sun::star::uno::RuntimeException
)
1255 ::vos::OGuard
aGuard( GetMutex() );
1256 maActionListeners
.addInterface( l
);
1259 void VCLXRadioButton::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1261 ::vos::OGuard
aGuard( GetMutex() );
1262 maActionListeners
.removeInterface( l
);
1265 void VCLXRadioButton::setLabel( const ::rtl::OUString
& rLabel
) throw(::com::sun::star::uno::RuntimeException
)
1267 ::vos::OGuard
aGuard( GetMutex() );
1269 Window
* pWindow
= GetWindow();
1271 pWindow
->SetText( rLabel
);
1274 void VCLXRadioButton::setActionCommand( const ::rtl::OUString
& rCommand
) throw(::com::sun::star::uno::RuntimeException
)
1276 ::vos::OGuard
aGuard( GetMutex() );
1277 maActionCommand
= rCommand
;
1280 void VCLXRadioButton::setState( sal_Bool b
) throw(::com::sun::star::uno::RuntimeException
)
1282 ::vos::OGuard
aGuard( GetMutex() );
1284 RadioButton
* pRadioButton
= (RadioButton
*)GetWindow();
1287 pRadioButton
->Check( b
);
1288 // #102717# item listeners are called, but not C++ click listeners in StarOffice code => call click hdl
1289 // But this is needed in old code because Accessibility API uses it.
1290 // pRadioButton->GetClickHdl().Call( pRadioButton );
1292 // #107218# Call same virtual methods and listeners like VCL would do after user interaction
1293 SetSynthesizingVCLEvent( sal_True
);
1294 pRadioButton
->Click();
1295 SetSynthesizingVCLEvent( sal_False
);
1299 sal_Bool
VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeException
)
1301 ::vos::OGuard
aGuard( GetMutex() );
1303 RadioButton
* pRadioButton
= (RadioButton
*)GetWindow();
1304 return pRadioButton
? pRadioButton
->IsChecked() : sal_False
;
1307 ::com::sun::star::awt::Size
VCLXRadioButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
1309 ::vos::OGuard
aGuard( GetMutex() );
1312 RadioButton
* pRadioButton
= (RadioButton
*) GetWindow();
1314 aSz
= pRadioButton
->CalcMinimumSize();
1315 return AWTSize(aSz
);
1318 ::com::sun::star::awt::Size
VCLXRadioButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
1320 return getMinimumSize();
1323 ::com::sun::star::awt::Size
VCLXRadioButton::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
1325 ::vos::OGuard
aGuard( GetMutex() );
1327 Size aSz
= VCLSize(rNewSize
);
1328 RadioButton
* pRadioButton
= (RadioButton
*) GetWindow();
1331 Size aMinSz
= pRadioButton
->CalcMinimumSize();
1332 if ( ( aSz
.Width() > aMinSz
.Width() ) && ( aSz
.Height() < aMinSz
.Height() ) )
1333 aSz
.Height() = aMinSz
.Height();
1337 return AWTSize(aSz
);
1340 void VCLXRadioButton::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1342 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
1343 // since we call listeners below, there is a potential that we will be destroyed
1344 // in during the listener call. To prevent the resulting crashs, we keep us
1345 // alive as long as we're here
1346 // #20178# - 2003-10-01 - fs@openoffice.org
1348 switch ( rVclWindowEvent
.GetId() )
1350 case VCLEVENT_BUTTON_CLICK
:
1351 if ( !IsSynthesizingVCLEvent() && maActionListeners
.getLength() )
1353 ::com::sun::star::awt::ActionEvent aEvent
;
1354 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1355 aEvent
.ActionCommand
= maActionCommand
;
1356 maActionListeners
.actionPerformed( aEvent
);
1358 ImplClickedOrToggled( FALSE
);
1361 case VCLEVENT_RADIOBUTTON_TOGGLE
:
1362 ImplClickedOrToggled( TRUE
);
1366 VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent
);
1371 void VCLXRadioButton::ImplClickedOrToggled( BOOL bToggled
)
1373 // In the formulars, RadioChecked is not enabled, call itemStateChanged only for click
1374 // In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled
1375 RadioButton
* pRadioButton
= (RadioButton
*)GetWindow();
1376 if ( pRadioButton
&& ( pRadioButton
->IsRadioCheckEnabled() == bToggled
) && ( bToggled
|| pRadioButton
->IsStateChanged() ) && maItemListeners
.getLength() )
1378 ::com::sun::star::awt::ItemEvent aEvent
;
1379 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1380 aEvent
.Highlighted
= sal_False
;
1381 aEvent
.Selected
= pRadioButton
->IsChecked();
1382 maItemListeners
.itemStateChanged( aEvent
);
1386 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> VCLXRadioButton::getFirstActionListener ()
1388 if (!maItemListeners
.getLength ())
1389 return ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> ();
1390 return maActionListeners
.getElements()[0];
1393 // ----------------------------------------------------
1394 // class VCLXSpinField
1395 // ----------------------------------------------------
1396 void VCLXSpinField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1398 PushPropertyIds( rIds
,
1399 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
1401 VCLXEdit::ImplGetPropertyIds( rIds
);
1404 VCLXSpinField::VCLXSpinField() : maSpinListeners( *this )
1408 // ::com::sun::star::uno::XInterface
1409 ::com::sun::star::uno::Any
VCLXSpinField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
1411 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
1412 SAL_STATIC_CAST( ::com::sun::star::awt::XSpinField
*, this ) );
1413 return (aRet
.hasValue() ? aRet
: VCLXEdit::queryInterface( rType
));
1416 // ::com::sun::star::lang::XTypeProvider
1417 IMPL_XTYPEPROVIDER_START( VCLXSpinField
)
1418 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSpinField
>* ) NULL
),
1419 VCLXEdit::getTypes()
1420 IMPL_XTYPEPROVIDER_END
1422 void VCLXSpinField::addSpinListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSpinListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1424 ::vos::OGuard
aGuard( GetMutex() );
1425 maSpinListeners
.addInterface( l
);
1428 void VCLXSpinField::removeSpinListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSpinListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1430 ::vos::OGuard
aGuard( GetMutex() );
1431 maSpinListeners
.removeInterface( l
);
1434 void VCLXSpinField::up() throw(::com::sun::star::uno::RuntimeException
)
1436 ::vos::OGuard
aGuard( GetMutex() );
1438 SpinField
* pSpinField
= (SpinField
*) GetWindow();
1443 void VCLXSpinField::down() throw(::com::sun::star::uno::RuntimeException
)
1445 ::vos::OGuard
aGuard( GetMutex() );
1447 SpinField
* pSpinField
= (SpinField
*) GetWindow();
1452 void VCLXSpinField::first() throw(::com::sun::star::uno::RuntimeException
)
1454 ::vos::OGuard
aGuard( GetMutex() );
1456 SpinField
* pSpinField
= (SpinField
*) GetWindow();
1458 pSpinField
->First();
1461 void VCLXSpinField::last() throw(::com::sun::star::uno::RuntimeException
)
1463 ::vos::OGuard
aGuard( GetMutex() );
1465 SpinField
* pSpinField
= (SpinField
*) GetWindow();
1470 void VCLXSpinField::enableRepeat( sal_Bool bRepeat
) throw(::com::sun::star::uno::RuntimeException
)
1472 ::vos::OGuard
aGuard( GetMutex() );
1474 Window
* pWindow
= GetWindow();
1477 WinBits nStyle
= pWindow
->GetStyle();
1479 nStyle
|= WB_REPEAT
;
1481 nStyle
&= ~WB_REPEAT
;
1482 pWindow
->SetStyle( nStyle
);
1486 void VCLXSpinField::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1488 switch ( rVclWindowEvent
.GetId() )
1490 case VCLEVENT_SPINFIELD_UP
:
1491 case VCLEVENT_SPINFIELD_DOWN
:
1492 case VCLEVENT_SPINFIELD_FIRST
:
1493 case VCLEVENT_SPINFIELD_LAST
:
1495 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
1496 // since we call listeners below, there is a potential that we will be destroyed
1497 // in during the listener call. To prevent the resulting crashs, we keep us
1498 // alive as long as we're here
1499 // #20178# - 2003-10-01 - fs@openoffice.org
1501 if ( maSpinListeners
.getLength() )
1503 ::com::sun::star::awt::SpinEvent aEvent
;
1504 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1505 switch ( rVclWindowEvent
.GetId() )
1507 case VCLEVENT_SPINFIELD_UP
: maSpinListeners
.up( aEvent
);
1509 case VCLEVENT_SPINFIELD_DOWN
: maSpinListeners
.down( aEvent
);
1511 case VCLEVENT_SPINFIELD_FIRST
: maSpinListeners
.first( aEvent
);
1513 case VCLEVENT_SPINFIELD_LAST
: maSpinListeners
.last( aEvent
);
1522 VCLXEdit::ProcessWindowEvent( rVclWindowEvent
);
1528 // ----------------------------------------------------
1529 // class VCLXListBox
1530 // ----------------------------------------------------
1531 void VCLXListBox::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1533 PushPropertyIds( rIds
,
1534 BASEPROPERTY_BACKGROUNDCOLOR
,
1535 BASEPROPERTY_BORDER
,
1536 BASEPROPERTY_BORDERCOLOR
,
1537 BASEPROPERTY_DEFAULTCONTROL
,
1538 BASEPROPERTY_DROPDOWN
,
1539 BASEPROPERTY_ENABLED
,
1540 BASEPROPERTY_ENABLEVISIBLE
,
1541 BASEPROPERTY_FONTDESCRIPTOR
,
1542 BASEPROPERTY_HELPTEXT
,
1543 BASEPROPERTY_HELPURL
,
1544 BASEPROPERTY_LINECOUNT
,
1545 BASEPROPERTY_MULTISELECTION
,
1546 BASEPROPERTY_PRINTABLE
,
1547 BASEPROPERTY_SELECTEDITEMS
,
1548 BASEPROPERTY_STRINGITEMLIST
,
1549 BASEPROPERTY_TABSTOP
,
1550 BASEPROPERTY_READONLY
,
1552 BASEPROPERTY_WRITING_MODE
,
1553 BASEPROPERTY_CONTEXT_WRITING_MODE
,
1554 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
1556 VCLXWindow::ImplGetPropertyIds( rIds
);
1560 VCLXListBox::VCLXListBox()
1561 : maActionListeners( *this ),
1562 maItemListeners( *this )
1566 // ::com::sun::star::uno::XInterface
1567 ::com::sun::star::uno::Any
VCLXListBox::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
1569 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
1570 SAL_STATIC_CAST( ::com::sun::star::awt::XListBox
*, this ),
1571 SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains
*, this ) );
1572 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
1575 // ::com::sun::star::lang::XTypeProvider
1576 IMPL_XTYPEPROVIDER_START( VCLXListBox
)
1577 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XListBox
>* ) NULL
),
1578 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextLayoutConstrains
>* ) NULL
),
1579 VCLXWindow::getTypes()
1580 IMPL_XTYPEPROVIDER_END
1582 void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException
)
1584 ::vos::OGuard
aGuard( GetMutex() );
1586 ::com::sun::star::lang::EventObject aObj
;
1587 aObj
.Source
= (::cppu::OWeakObject
*)this;
1588 maItemListeners
.disposeAndClear( aObj
);
1589 maActionListeners
.disposeAndClear( aObj
);
1590 VCLXWindow::dispose();
1593 void VCLXListBox::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1595 ::vos::OGuard
aGuard( GetMutex() );
1596 maItemListeners
.addInterface( l
);
1599 void VCLXListBox::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1601 ::vos::OGuard
aGuard( GetMutex() );
1602 maItemListeners
.removeInterface( l
);
1605 void VCLXListBox::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1607 ::vos::OGuard
aGuard( GetMutex() );
1608 maActionListeners
.addInterface( l
);
1611 void VCLXListBox::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1613 ::vos::OGuard
aGuard( GetMutex() );
1614 maActionListeners
.removeInterface( l
);
1617 void VCLXListBox::addItem( const ::rtl::OUString
& aItem
, sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
1619 ::vos::OGuard
aGuard( GetMutex() );
1621 ListBox
* pBox
= (ListBox
*) GetWindow();
1623 pBox
->InsertEntry( aItem
, nPos
);
1626 void VCLXListBox::addItems( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aItems
, sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
1628 ::vos::OGuard
aGuard( GetMutex() );
1630 ListBox
* pBox
= (ListBox
*) GetWindow();
1633 sal_uInt16 nP
= nPos
;
1634 const ::rtl::OUString
* pItems
= aItems
.getConstArray();
1635 const ::rtl::OUString
* pItemsEnd
= aItems
.getConstArray() + aItems
.getLength();
1636 while ( pItems
!= pItemsEnd
)
1638 if ( (sal_uInt16
)nP
== 0xFFFF )
1640 OSL_ENSURE( false, "VCLXListBox::addItems: too many entries!" );
1641 // skip remaining entries, list cannot hold them, anyway
1645 pBox
->InsertEntry( *pItems
++, nP
++ );
1650 void VCLXListBox::removeItems( sal_Int16 nPos
, sal_Int16 nCount
) throw(::com::sun::star::uno::RuntimeException
)
1652 ::vos::OGuard
aGuard( GetMutex() );
1654 ListBox
* pBox
= (ListBox
*) GetWindow();
1657 for ( sal_uInt16 n
= nCount
; n
; )
1658 pBox
->RemoveEntry( nPos
+ (--n
) );
1662 sal_Int16
VCLXListBox::getItemCount() throw(::com::sun::star::uno::RuntimeException
)
1664 ::vos::OGuard
aGuard( GetMutex() );
1666 ListBox
* pBox
= (ListBox
*) GetWindow();
1667 return pBox
? pBox
->GetEntryCount() : 0;
1670 ::rtl::OUString
VCLXListBox::getItem( sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
1672 ::vos::OGuard
aGuard( GetMutex() );
1675 ListBox
* pBox
= (ListBox
*) GetWindow();
1677 aItem
= pBox
->GetEntry( nPos
);
1681 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> VCLXListBox::getItems() throw(::com::sun::star::uno::RuntimeException
)
1683 ::vos::OGuard
aGuard( GetMutex() );
1685 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSeq
;
1686 ListBox
* pBox
= (ListBox
*) GetWindow();
1689 sal_uInt16 nEntries
= pBox
->GetEntryCount();
1690 aSeq
= ::com::sun::star::uno::Sequence
< ::rtl::OUString
>( nEntries
);
1691 for ( sal_uInt16 n
= nEntries
; n
; )
1694 aSeq
.getArray()[n
] = ::rtl::OUString( pBox
->GetEntry( n
) );
1700 sal_Int16
VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException
)
1702 ::vos::OGuard
aGuard( GetMutex() );
1704 ListBox
* pBox
= (ListBox
*) GetWindow();
1705 return pBox
? pBox
->GetSelectEntryPos() : 0;
1708 ::com::sun::star::uno::Sequence
<sal_Int16
> VCLXListBox::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException
)
1710 ::vos::OGuard
aGuard( GetMutex() );
1712 ::com::sun::star::uno::Sequence
<sal_Int16
> aSeq
;
1713 ListBox
* pBox
= (ListBox
*) GetWindow();
1716 sal_uInt16 nSelEntries
= pBox
->GetSelectEntryCount();
1717 aSeq
= ::com::sun::star::uno::Sequence
<sal_Int16
>( nSelEntries
);
1718 for ( sal_uInt16 n
= 0; n
< nSelEntries
; n
++ )
1719 aSeq
.getArray()[n
] = pBox
->GetSelectEntryPos( n
);
1724 ::rtl::OUString
VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeException
)
1726 ::vos::OGuard
aGuard( GetMutex() );
1729 ListBox
* pBox
= (ListBox
*) GetWindow();
1731 aItem
= pBox
->GetSelectEntry();
1735 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> VCLXListBox::getSelectedItems() throw(::com::sun::star::uno::RuntimeException
)
1737 ::vos::OGuard
aGuard( GetMutex() );
1739 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSeq
;
1740 ListBox
* pBox
= (ListBox
*) GetWindow();
1743 sal_uInt16 nSelEntries
= pBox
->GetSelectEntryCount();
1744 aSeq
= ::com::sun::star::uno::Sequence
< ::rtl::OUString
>( nSelEntries
);
1745 for ( sal_uInt16 n
= 0; n
< nSelEntries
; n
++ )
1746 aSeq
.getArray()[n
] = ::rtl::OUString( pBox
->GetSelectEntry( n
) );
1751 void VCLXListBox::selectItemPos( sal_Int16 nPos
, sal_Bool bSelect
) throw(::com::sun::star::uno::RuntimeException
)
1753 ::vos::OGuard
aGuard( GetMutex() );
1755 ListBox
* pBox
= (ListBox
*) GetWindow();
1756 if ( pBox
&& ( pBox
->IsEntryPosSelected( nPos
) != bSelect
) )
1758 pBox
->SelectEntryPos( nPos
, bSelect
);
1760 // VCL doesn't call select handler after API call.
1761 // ImplCallItemListeners();
1763 // #107218# Call same listeners like VCL would do after user interaction
1764 SetSynthesizingVCLEvent( sal_True
);
1766 SetSynthesizingVCLEvent( sal_False
);
1770 void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence
<sal_Int16
>& aPositions
, sal_Bool bSelect
) throw(::com::sun::star::uno::RuntimeException
)
1772 ::vos::OGuard
aGuard( GetMutex() );
1774 ListBox
* pBox
= (ListBox
*) GetWindow();
1777 BOOL bChanged
= FALSE
;
1778 for ( sal_uInt16 n
= (sal_uInt16
)aPositions
.getLength(); n
; )
1780 USHORT nPos
= (USHORT
) aPositions
.getConstArray()[--n
];
1781 if ( pBox
->IsEntryPosSelected( nPos
) != bSelect
)
1783 pBox
->SelectEntryPos( nPos
, bSelect
);
1790 // VCL doesn't call select handler after API call.
1791 // ImplCallItemListeners();
1793 // #107218# Call same listeners like VCL would do after user interaction
1794 SetSynthesizingVCLEvent( sal_True
);
1796 SetSynthesizingVCLEvent( sal_False
);
1801 void VCLXListBox::selectItem( const ::rtl::OUString
& rItemText
, sal_Bool bSelect
) throw(::com::sun::star::uno::RuntimeException
)
1803 ::vos::OGuard
aGuard( GetMutex() );
1805 ListBox
* pBox
= (ListBox
*) GetWindow();
1808 String
aItemText( rItemText
);
1809 selectItemPos( pBox
->GetEntryPos( aItemText
), bSelect
);
1814 void VCLXListBox::setDropDownLineCount( sal_Int16 nLines
) throw(::com::sun::star::uno::RuntimeException
)
1816 ::vos::OGuard
aGuard( GetMutex() );
1818 ListBox
* pBox
= (ListBox
*) GetWindow();
1820 pBox
->SetDropDownLineCount( nLines
);
1823 sal_Int16
VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException
)
1825 ::vos::OGuard
aGuard( GetMutex() );
1827 sal_Int16 nLines
= 0;
1828 ListBox
* pBox
= (ListBox
*) GetWindow();
1830 nLines
= pBox
->GetDropDownLineCount();
1834 sal_Bool
VCLXListBox::isMutipleMode() throw(::com::sun::star::uno::RuntimeException
)
1836 ::vos::OGuard
aGuard( GetMutex() );
1838 sal_Bool bMulti
= sal_False
;
1839 ListBox
* pBox
= (ListBox
*) GetWindow();
1841 bMulti
= pBox
->IsMultiSelectionEnabled();
1845 void VCLXListBox::setMultipleMode( sal_Bool bMulti
) throw(::com::sun::star::uno::RuntimeException
)
1847 ::vos::OGuard
aGuard( GetMutex() );
1849 ListBox
* pBox
= (ListBox
*) GetWindow();
1851 pBox
->EnableMultiSelection( bMulti
);
1854 void VCLXListBox::makeVisible( sal_Int16 nEntry
) throw(::com::sun::star::uno::RuntimeException
)
1856 ::vos::OGuard
aGuard( GetMutex() );
1858 ListBox
* pBox
= (ListBox
*) GetWindow();
1860 pBox
->SetTopEntry( nEntry
);
1863 void VCLXListBox::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1865 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
1866 // since we call listeners below, there is a potential that we will be destroyed
1867 // in during the listener call. To prevent the resulting crashs, we keep us
1868 // alive as long as we're here
1869 // #20178# - 2003-10-01 - fs@openoffice.org
1871 switch ( rVclWindowEvent
.GetId() )
1873 case VCLEVENT_LISTBOX_SELECT
:
1875 ListBox
* pListBox
= (ListBox
*)GetWindow();
1879 sal_Bool bDropDown
= ( pListBox
->GetStyle() & WB_DROPDOWN
) ? sal_True
: sal_False
;
1880 if ( bDropDown
&& !IsSynthesizingVCLEvent() && maActionListeners
.getLength() )
1882 // Bei DropDown den ActionListener rufen...
1883 ::com::sun::star::awt::ActionEvent aEvent
;
1884 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1885 aEvent
.ActionCommand
= pListBox
->GetSelectEntry();
1886 maActionListeners
.actionPerformed( aEvent
);
1889 if ( maItemListeners
.getLength() )
1891 ImplCallItemListeners();
1897 case VCLEVENT_LISTBOX_DOUBLECLICK
:
1898 if ( GetWindow() && maActionListeners
.getLength() )
1900 ::com::sun::star::awt::ActionEvent aEvent
;
1901 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1902 aEvent
.ActionCommand
= ((ListBox
*)GetWindow())->GetSelectEntry();
1903 maActionListeners
.actionPerformed( aEvent
);
1908 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
1913 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXListBox::CreateAccessibleContext()
1915 ::vos::OGuard
aGuard( GetMutex() );
1917 return getAccessibleFactory().createAccessibleContext( this );
1920 void VCLXListBox::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1922 ::vos::OGuard
aGuard( GetMutex() );
1924 ListBox
* pListBox
= (ListBox
*)GetWindow();
1927 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1928 switch ( nPropType
)
1930 case BASEPROPERTY_READONLY
:
1932 sal_Bool b
= sal_Bool();
1934 pListBox
->SetReadOnly( b
);
1937 case BASEPROPERTY_MULTISELECTION
:
1939 sal_Bool b
= sal_Bool();
1941 pListBox
->EnableMultiSelection( b
);
1944 case BASEPROPERTY_LINECOUNT
:
1946 sal_Int16 n
= sal_Int16();
1948 pListBox
->SetDropDownLineCount( n
);
1951 case BASEPROPERTY_STRINGITEMLIST
:
1953 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aItems
;
1954 if ( Value
>>= aItems
)
1956 sal_Int16 nElem
= pListBox
->GetEntryCount();
1958 addItems( aItems
, 0 );
1959 if ( aItems
.getLength() == 0 && nElem
&& maItemListeners
.getLength() )
1960 ImplCallItemListeners();
1964 case BASEPROPERTY_SELECTEDITEMS
:
1966 ::com::sun::star::uno::Sequence
<sal_Int16
> aItems
;
1967 if ( Value
>>= aItems
)
1969 for ( sal_uInt16 n
= pListBox
->GetEntryCount(); n
; )
1970 pListBox
->SelectEntryPos( --n
, sal_False
);
1972 if ( aItems
.getLength() )
1974 selectItemsPos( aItems
, sal_True
);
1975 if ( maItemListeners
.getLength() )
1976 ImplCallItemListeners();
1979 pListBox
->SetNoSelection();
1981 if ( !pListBox
->GetSelectEntryCount() )
1982 pListBox
->SetTopEntry( 0 );
1988 VCLXWindow::setProperty( PropertyName
, Value
);
1994 ::com::sun::star::uno::Any
VCLXListBox::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
1996 ::vos::OGuard
aGuard( GetMutex() );
1998 ::com::sun::star::uno::Any aProp
;
1999 ListBox
* pListBox
= (ListBox
*)GetWindow();
2002 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2003 switch ( nPropType
)
2005 case BASEPROPERTY_READONLY
:
2007 aProp
<<= (sal_Bool
) pListBox
->IsReadOnly();
2010 case BASEPROPERTY_MULTISELECTION
:
2012 aProp
<<= (sal_Bool
) pListBox
->IsMultiSelectionEnabled();
2015 case BASEPROPERTY_LINECOUNT
:
2017 aProp
<<= (sal_Int16
) pListBox
->GetDropDownLineCount();
2020 case BASEPROPERTY_STRINGITEMLIST
:
2022 sal_uInt16 nItems
= pListBox
->GetEntryCount();
2023 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSeq( nItems
);
2024 ::rtl::OUString
* pStrings
= aSeq
.getArray();
2025 for ( sal_uInt16 n
= 0; n
< nItems
; n
++ )
2026 pStrings
[n
] = pListBox
->GetEntry( n
);
2033 aProp
<<= VCLXWindow::getProperty( PropertyName
);
2040 ::com::sun::star::awt::Size
VCLXListBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
2042 ::vos::OGuard
aGuard( GetMutex() );
2045 ListBox
* pListBox
= (ListBox
*) GetWindow();
2047 aSz
= pListBox
->CalcMinimumSize();
2048 return AWTSize(aSz
);
2051 ::com::sun::star::awt::Size
VCLXListBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
2053 ::vos::OGuard
aGuard( GetMutex() );
2056 ListBox
* pListBox
= (ListBox
*) GetWindow();
2059 aSz
= pListBox
->CalcMinimumSize();
2060 if ( pListBox
->GetStyle() & WB_DROPDOWN
)
2063 return AWTSize(aSz
);
2066 ::com::sun::star::awt::Size
VCLXListBox::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
2068 ::vos::OGuard
aGuard( GetMutex() );
2070 Size aSz
= VCLSize(rNewSize
);
2071 ListBox
* pListBox
= (ListBox
*) GetWindow();
2073 aSz
= pListBox
->CalcAdjustedSize( aSz
);
2074 return AWTSize(aSz
);
2077 ::com::sun::star::awt::Size
VCLXListBox::getMinimumSize( sal_Int16 nCols
, sal_Int16 nLines
) throw(::com::sun::star::uno::RuntimeException
)
2079 ::vos::OGuard
aGuard( GetMutex() );
2082 ListBox
* pListBox
= (ListBox
*) GetWindow();
2084 aSz
= pListBox
->CalcSize( nCols
, nLines
);
2085 return AWTSize(aSz
);
2088 void VCLXListBox::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
) throw(::com::sun::star::uno::RuntimeException
)
2090 ::vos::OGuard
aGuard( GetMutex() );
2093 ListBox
* pListBox
= (ListBox
*) GetWindow();
2097 pListBox
->GetMaxVisColumnsAndLines( nC
, nL
);
2103 void VCLXListBox::ImplCallItemListeners()
2105 ListBox
* pListBox
= (ListBox
*) GetWindow();
2106 if ( pListBox
&& maItemListeners
.getLength() )
2108 ::com::sun::star::awt::ItemEvent aEvent
;
2109 aEvent
.Source
= (::cppu::OWeakObject
*)this;
2110 aEvent
.Highlighted
= sal_False
;
2112 // Bei Mehrfachselektion 0xFFFF, sonst die ID
2113 aEvent
.Selected
= (pListBox
->GetSelectEntryCount() == 1 ) ? pListBox
->GetSelectEntryPos() : 0xFFFF;
2115 maItemListeners
.itemStateChanged( aEvent
);
2120 // ----------------------------------------------------
2121 // class VCLXMessageBox
2122 // ----------------------------------------------------
2124 void VCLXMessageBox::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2126 VCLXTopWindow::ImplGetPropertyIds( rIds
);
2129 VCLXMessageBox::VCLXMessageBox()
2133 VCLXMessageBox::~VCLXMessageBox()
2137 // ::com::sun::star::uno::XInterface
2138 ::com::sun::star::uno::Any
VCLXMessageBox::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2140 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2141 SAL_STATIC_CAST( ::com::sun::star::awt::XMessageBox
*, this ) );
2142 return (aRet
.hasValue() ? aRet
: VCLXTopWindow::queryInterface( rType
));
2145 // ::com::sun::star::lang::XTypeProvider
2146 IMPL_XTYPEPROVIDER_START( VCLXMessageBox
)
2147 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMessageBox
>* ) NULL
),
2148 VCLXTopWindow::getTypes()
2149 IMPL_XTYPEPROVIDER_END
2151 void VCLXMessageBox::setCaptionText( const ::rtl::OUString
& rText
) throw(::com::sun::star::uno::RuntimeException
)
2153 ::vos::OGuard
aGuard( GetMutex() );
2155 Window
* pWindow
= GetWindow();
2157 pWindow
->SetText( rText
);
2160 ::rtl::OUString
VCLXMessageBox::getCaptionText() throw(::com::sun::star::uno::RuntimeException
)
2162 ::vos::OGuard
aGuard( GetMutex() );
2165 Window
* pWindow
= GetWindow();
2167 aText
= pWindow
->GetText();
2171 void VCLXMessageBox::setMessageText( const ::rtl::OUString
& rText
) throw(::com::sun::star::uno::RuntimeException
)
2173 ::vos::OGuard
aGuard( GetMutex() );
2175 MessBox
* pBox
= (MessBox
*)GetWindow();
2177 pBox
->SetMessText( rText
);
2180 ::rtl::OUString
VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeException
)
2182 ::vos::OGuard
aGuard( GetMutex() );
2184 ::rtl::OUString aText
;
2185 MessBox
* pBox
= (MessBox
*)GetWindow();
2187 aText
= pBox
->GetMessText();
2191 sal_Int16
VCLXMessageBox::execute() throw(::com::sun::star::uno::RuntimeException
)
2193 ::vos::OGuard
aGuard( GetMutex() );
2195 MessBox
* pBox
= (MessBox
*)GetWindow();
2196 return pBox
? pBox
->Execute() : 0;
2199 ::com::sun::star::awt::Size SAL_CALL
VCLXMessageBox::getMinimumSize() throw(::com::sun::star::uno::RuntimeException
)
2201 ::vos::OGuard
aGuard( GetMutex() );
2202 return ::com::sun::star::awt::Size( 250, 100 );
2205 // ----------------------------------------------------
2207 // ----------------------------------------------------
2208 void VCLXDialog::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2210 VCLXTopWindow::ImplGetPropertyIds( rIds
);
2213 VCLXDialog::VCLXDialog()
2217 VCLXDialog::~VCLXDialog()
2220 OSL_TRACE ("%s", __FUNCTION__
);
2224 // ::com::sun::star::uno::XInterface
2225 ::com::sun::star::uno::Any
VCLXDialog::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2227 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2228 SAL_STATIC_CAST( ::com::sun::star::document::XVbaMethodParameter
*, this ), //liuchen 2009-6-23
2229 SAL_STATIC_CAST( ::com::sun::star::awt::XDialog
*, this ) );
2230 return (aRet
.hasValue() ? aRet
: VCLXTopWindow::queryInterface( rType
));
2233 // ::com::sun::star::lang::XTypeProvider
2234 IMPL_XTYPEPROVIDER_START( VCLXDialog
)
2235 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::document::XVbaMethodParameter
>* ) NULL
), //liuchen 2009-6-23
2236 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDialog
>* ) NULL
),
2237 VCLXTopWindow::getTypes()
2238 IMPL_XTYPEPROVIDER_END
2240 void VCLXDialog::setTitle( const ::rtl::OUString
& Title
) throw(::com::sun::star::uno::RuntimeException
)
2242 ::vos::OGuard
aGuard( GetMutex() );
2244 Window
* pWindow
= GetWindow();
2246 pWindow
->SetText( Title
);
2249 ::rtl::OUString
VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException
)
2251 ::vos::OGuard
aGuard( GetMutex() );
2253 ::rtl::OUString aTitle
;
2254 Window
* pWindow
= GetWindow();
2256 aTitle
= pWindow
->GetText();
2260 sal_Int16
VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException
)
2262 ::vos::OGuard
aGuard( GetMutex() );
2267 Dialog
* pDlg
= (Dialog
*) GetWindow();
2268 Window
* pParent
= pDlg
->GetWindow( WINDOW_PARENTOVERLAP
);
2269 Window
* pOldParent
= NULL
;
2270 if ( pParent
&& !pParent
->IsReallyVisible() )
2272 pOldParent
= pDlg
->GetParent();
2273 Window
* pFrame
= pDlg
->GetWindow( WINDOW_FRAME
);
2274 if( pFrame
!= pDlg
)
2275 pDlg
->SetParent( pFrame
);
2277 nRet
= pDlg
->Execute();
2279 pDlg
->SetParent( pOldParent
);
2284 void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException
)
2286 ::vos::OGuard
aGuard( GetMutex() );
2288 Dialog
* pDlg
= (Dialog
*) GetWindow();
2290 pDlg
->EndDialog( 0 );
2293 void SAL_CALL
VCLXDialog::draw( sal_Int32 nX
, sal_Int32 nY
) throw(::com::sun::star::uno::RuntimeException
)
2295 ::vos::OGuard
aGuard( GetMutex() );
2296 Window
* pWindow
= GetWindow();
2300 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( getGraphics() );
2302 pDev
= pWindow
->GetParent();
2304 Size aSize
= pDev
->PixelToLogic( pWindow
->GetSizePixel() );
2305 Point aPos
= pDev
->PixelToLogic( Point( nX
, nY
) );
2307 pWindow
->Draw( pDev
, aPos
, aSize
, WINDOW_DRAW_NOCONTROLS
);
2311 ::com::sun::star::awt::DeviceInfo
VCLXDialog::getInfo() throw(::com::sun::star::uno::RuntimeException
)
2313 ::com::sun::star::awt::DeviceInfo aInfo
= VCLXDevice::getInfo();
2315 ::vos::OGuard
aGuard( GetMutex() );
2316 Dialog
* pDlg
= (Dialog
*) GetWindow();
2318 pDlg
->GetDrawWindowBorder( aInfo
.LeftInset
, aInfo
.TopInset
, aInfo
.RightInset
, aInfo
.BottomInset
);
2324 // ::com::sun::star::document::XVbaMethodParameter
2325 void SAL_CALL
VCLXDialog::setVbaMethodParameter(
2326 const ::rtl::OUString
& PropertyName
,
2327 const ::com::sun::star::uno::Any
& Value
)
2328 throw(::com::sun::star::uno::RuntimeException
)
2330 if (rtl::OUString::createFromAscii( "Cancel" ) == PropertyName
)
2332 ::vos::OGuard
aGuard( GetMutex() );
2338 Dialog
* pDlg
= (Dialog
*) GetWindow();
2339 pDlg
->SetCloseFlag(nCancel
);
2344 ::com::sun::star::uno::Any SAL_CALL
VCLXDialog::getVbaMethodParameter(
2345 const ::rtl::OUString
& PropertyName
)
2346 throw(::com::sun::star::uno::RuntimeException
)
2348 ::vos::OGuard
aGuard( GetMutex() );
2350 ::com::sun::star::uno::Any aRet
;
2358 void SAL_CALL
VCLXDialog::setProperty(
2359 const ::rtl::OUString
& PropertyName
,
2360 const ::com::sun::star::uno::Any
& Value
)
2361 throw(::com::sun::star::uno::RuntimeException
)
2363 ::vos::OGuard
aGuard( GetMutex() );
2365 Dialog
* pDialog
= (Dialog
*)GetWindow();
2368 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
2370 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2371 switch ( nPropType
)
2373 case BASEPROPERTY_GRAPHIC
:
2375 Reference
< XGraphic
> xGraphic
;
2376 if (( Value
>>= xGraphic
) && xGraphic
.is() )
2378 Image
aImage( xGraphic
);
2380 Wallpaper
aWallpaper( aImage
.GetBitmapEx());
2381 aWallpaper
.SetStyle( WALLPAPER_SCALE
);
2382 pDialog
->SetBackground( aWallpaper
);
2384 else if ( bVoid
|| !xGraphic
.is() )
2386 Color aColor
= pDialog
->GetControlBackground().GetColor();
2387 if ( aColor
== COL_AUTO
)
2388 aColor
= pDialog
->GetSettings().GetStyleSettings().GetDialogColor();
2390 Wallpaper
aWallpaper( aColor
);
2391 pDialog
->SetBackground( aWallpaper
);
2398 VCLXWindow::setProperty( PropertyName
, Value
);
2404 // ----------------------------------------------------
2405 // class VCLXTabPage
2406 // ----------------------------------------------------
2407 VCLXTabPage::VCLXTabPage()
2411 VCLXTabPage::~VCLXTabPage()
2415 ::com::sun::star::uno::Any SAL_CALL
VCLXTabPage::queryInterface(const ::com::sun::star::uno::Type
& rType
)
2416 throw(::com::sun::star::uno::RuntimeException
)
2418 return VCLXContainer::queryInterface( rType
);
2421 // ::com::sun::star::lang::XTypeProvider
2422 IMPL_XTYPEPROVIDER_START( VCLXTabPage
)
2423 VCLXContainer::getTypes()
2424 IMPL_XTYPEPROVIDER_END
2426 // ::com::sun::star::awt::XView
2427 void SAL_CALL
VCLXTabPage::draw( sal_Int32 nX
, sal_Int32 nY
)
2428 throw(::com::sun::star::uno::RuntimeException
)
2430 ::vos::OGuard
aGuard( GetMutex() );
2431 Window
* pWindow
= GetWindow();
2435 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( getGraphics() );
2437 pDev
= pWindow
->GetParent();
2439 Size aSize
= pDev
->PixelToLogic( pWindow
->GetSizePixel() );
2440 Point aPos
= pDev
->PixelToLogic( Point( nX
, nY
) );
2442 pWindow
->Draw( pDev
, aPos
, aSize
, WINDOW_DRAW_NOCONTROLS
);
2446 // ::com::sun::star::awt::XDevice,
2447 ::com::sun::star::awt::DeviceInfo SAL_CALL
VCLXTabPage::getInfo()
2448 throw(::com::sun::star::uno::RuntimeException
)
2450 ::com::sun::star::awt::DeviceInfo aInfo
= VCLXDevice::getInfo();
2454 void SAL_CALL
VCLXTabPage::setProperty(
2455 const ::rtl::OUString
& PropertyName
,
2456 const ::com::sun::star::uno::Any
& Value
)
2457 throw(::com::sun::star::uno::RuntimeException
)
2459 ::vos::OGuard
aGuard( GetMutex() );
2461 TabPage
* pTabPage
= (TabPage
*)GetWindow();
2464 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
2466 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2467 switch ( nPropType
)
2469 case BASEPROPERTY_GRAPHIC
:
2471 Reference
< XGraphic
> xGraphic
;
2472 if (( Value
>>= xGraphic
) && xGraphic
.is() )
2474 Image
aImage( xGraphic
);
2476 Wallpaper
aWallpaper( aImage
.GetBitmapEx());
2477 aWallpaper
.SetStyle( WALLPAPER_SCALE
);
2478 pTabPage
->SetBackground( aWallpaper
);
2480 else if ( bVoid
|| !xGraphic
.is() )
2482 Color aColor
= pTabPage
->GetControlBackground().GetColor();
2483 if ( aColor
== COL_AUTO
)
2484 aColor
= pTabPage
->GetSettings().GetStyleSettings().GetDialogColor();
2486 Wallpaper
aWallpaper( aColor
);
2487 pTabPage
->SetBackground( aWallpaper
);
2494 VCLXContainer::setProperty( PropertyName
, Value
);
2500 // ----------------------------------------------------
2501 // class VCLXFixedHyperlink
2502 // ----------------------------------------------------
2503 VCLXFixedHyperlink::VCLXFixedHyperlink() :
2505 maActionListeners( *this )
2510 VCLXFixedHyperlink::~VCLXFixedHyperlink()
2514 // ::com::sun::star::uno::XInterface
2515 ::com::sun::star::uno::Any
VCLXFixedHyperlink::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2517 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2518 SAL_STATIC_CAST( ::com::sun::star::awt::XFixedHyperlink
*, this ) );
2519 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
2522 void VCLXFixedHyperlink::dispose() throw(::com::sun::star::uno::RuntimeException
)
2524 ::vos::OGuard
aGuard( GetMutex() );
2526 ::com::sun::star::lang::EventObject aObj
;
2527 aObj
.Source
= (::cppu::OWeakObject
*)this;
2528 maActionListeners
.disposeAndClear( aObj
);
2529 VCLXWindow::dispose();
2532 // ::com::sun::star::lang::XTypeProvider
2533 IMPL_XTYPEPROVIDER_START( VCLXFixedHyperlink
)
2534 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedHyperlink
>* ) NULL
),
2535 VCLXWindow::getTypes()
2536 IMPL_XTYPEPROVIDER_END
2538 void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
2540 switch ( rVclWindowEvent
.GetId() )
2542 case VCLEVENT_BUTTON_CLICK
:
2544 if ( maActionListeners
.getLength() )
2546 ::com::sun::star::awt::ActionEvent aEvent
;
2547 aEvent
.Source
= (::cppu::OWeakObject
*)this;
2548 maActionListeners
.actionPerformed( aEvent
);
2553 ::rtl::OUString sURL
;
2554 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2556 sURL
= pBase
->GetURL();
2557 Reference
< ::com::sun::star::system::XSystemShellExecute
> xSystemShellExecute(
2558 ::comphelper::getProcessServiceFactory()->createInstance(
2559 ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), uno::UNO_QUERY
);
2560 if ( sURL
.getLength() > 0 && xSystemShellExecute
.is() )
2565 xSystemShellExecute
->execute(
2566 sURL
, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::DEFAULTS
);
2568 catch( uno::Exception
& )
2576 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
2581 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXFixedHyperlink::CreateAccessibleContext()
2583 return getAccessibleFactory().createAccessibleContext( this );
2586 void VCLXFixedHyperlink::setText( const ::rtl::OUString
& Text
) throw(::com::sun::star::uno::RuntimeException
)
2588 ::vos::OGuard
aGuard( GetMutex() );
2590 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2592 pBase
->SetDescription( Text
);
2595 ::rtl::OUString
VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeException
)
2597 ::vos::OGuard
aGuard( GetMutex() );
2599 ::rtl::OUString aText
;
2600 Window
* pWindow
= GetWindow();
2602 aText
= pWindow
->GetText();
2606 void VCLXFixedHyperlink::setURL( const ::rtl::OUString
& URL
) throw(::com::sun::star::uno::RuntimeException
)
2608 ::vos::OGuard
aGuard( GetMutex() );
2610 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2612 pBase
->SetURL( URL
);
2615 ::rtl::OUString
VCLXFixedHyperlink::getURL( ) throw(::com::sun::star::uno::RuntimeException
)
2617 ::vos::OGuard
aGuard( GetMutex() );
2619 ::rtl::OUString aText
;
2620 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2622 aText
= pBase
->GetURL();
2626 void VCLXFixedHyperlink::setAlignment( short nAlign
) throw(::com::sun::star::uno::RuntimeException
)
2628 ::vos::OGuard
aGuard( GetMutex() );
2630 Window
* pWindow
= GetWindow();
2633 WinBits nNewBits
= 0;
2634 if ( nAlign
== ::com::sun::star::awt::TextAlign::LEFT
)
2636 else if ( nAlign
== ::com::sun::star::awt::TextAlign::CENTER
)
2637 nNewBits
= WB_CENTER
;
2639 nNewBits
= WB_RIGHT
;
2641 WinBits nStyle
= pWindow
->GetStyle();
2642 nStyle
&= ~(WB_LEFT
|WB_CENTER
|WB_RIGHT
);
2643 pWindow
->SetStyle( nStyle
| nNewBits
);
2647 short VCLXFixedHyperlink::getAlignment() throw(::com::sun::star::uno::RuntimeException
)
2649 ::vos::OGuard
aGuard( GetMutex() );
2652 Window
* pWindow
= GetWindow();
2655 WinBits nStyle
= pWindow
->GetStyle();
2656 if ( nStyle
& WB_LEFT
)
2657 nAlign
= ::com::sun::star::awt::TextAlign::LEFT
;
2658 else if ( nStyle
& WB_CENTER
)
2659 nAlign
= ::com::sun::star::awt::TextAlign::CENTER
;
2661 nAlign
= ::com::sun::star::awt::TextAlign::RIGHT
;
2666 void VCLXFixedHyperlink::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
)throw(::com::sun::star::uno::RuntimeException
)
2668 ::vos::OGuard
aGuard( GetMutex() );
2669 maActionListeners
.addInterface( l
);
2672 void VCLXFixedHyperlink::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
2674 ::vos::OGuard
aGuard( GetMutex() );
2675 maActionListeners
.removeInterface( l
);
2678 ::com::sun::star::awt::Size
VCLXFixedHyperlink::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
2680 ::vos::OGuard
aGuard( GetMutex() );
2683 FixedText
* pFixedText
= (FixedText
*)GetWindow();
2685 aSz
= pFixedText
->CalcMinimumSize();
2686 return AWTSize(aSz
);
2689 ::com::sun::star::awt::Size
VCLXFixedHyperlink::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
2691 return getMinimumSize();
2694 ::com::sun::star::awt::Size
VCLXFixedHyperlink::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
2696 ::vos::OGuard
aGuard( GetMutex() );
2698 ::com::sun::star::awt::Size aSz
= rNewSize
;
2699 ::com::sun::star::awt::Size aMinSz
= getMinimumSize();
2700 if ( aSz
.Height
!= aMinSz
.Height
)
2701 aSz
.Height
= aMinSz
.Height
;
2706 void VCLXFixedHyperlink::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
2708 ::vos::OGuard
aGuard( GetMutex() );
2710 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2713 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2714 switch ( nPropType
)
2716 case BASEPROPERTY_LABEL
:
2718 ::rtl::OUString sNewLabel
;
2719 if ( Value
>>= sNewLabel
)
2720 pBase
->SetDescription( sNewLabel
);
2724 case BASEPROPERTY_URL
:
2726 ::rtl::OUString sNewURL
;
2727 if ( Value
>>= sNewURL
)
2728 pBase
->SetURL( sNewURL
);
2734 VCLXWindow::setProperty( PropertyName
, Value
);
2740 ::com::sun::star::uno::Any
VCLXFixedHyperlink::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
2742 ::vos::OGuard
aGuard( GetMutex() );
2744 ::com::sun::star::uno::Any aProp
;
2745 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2748 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2749 switch ( nPropType
)
2751 case BASEPROPERTY_URL
:
2753 aProp
= makeAny( ::rtl::OUString( pBase
->GetURL() ) );
2759 aProp
<<= VCLXWindow::getProperty( PropertyName
);
2766 void VCLXFixedHyperlink::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2768 PushPropertyIds( rIds
,
2770 BASEPROPERTY_BACKGROUNDCOLOR
,
2771 BASEPROPERTY_BORDER
,
2772 BASEPROPERTY_BORDERCOLOR
,
2773 BASEPROPERTY_DEFAULTCONTROL
,
2774 BASEPROPERTY_ENABLED
,
2775 BASEPROPERTY_ENABLEVISIBLE
,
2776 BASEPROPERTY_FONTDESCRIPTOR
,
2777 BASEPROPERTY_HELPTEXT
,
2778 BASEPROPERTY_HELPURL
,
2780 BASEPROPERTY_MULTILINE
,
2781 BASEPROPERTY_NOLABEL
,
2782 BASEPROPERTY_PRINTABLE
,
2783 BASEPROPERTY_TABSTOP
,
2784 BASEPROPERTY_VERTICALALIGN
,
2786 BASEPROPERTY_WRITING_MODE
,
2787 BASEPROPERTY_CONTEXT_WRITING_MODE
,
2789 VCLXWindow::ImplGetPropertyIds( rIds
);
2792 // ----------------------------------------------------
2793 // class VCLXFixedText
2794 // ----------------------------------------------------
2795 void VCLXFixedText::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2797 PushPropertyIds( rIds
,
2799 BASEPROPERTY_BACKGROUNDCOLOR
,
2800 BASEPROPERTY_BORDER
,
2801 BASEPROPERTY_BORDERCOLOR
,
2802 BASEPROPERTY_DEFAULTCONTROL
,
2803 BASEPROPERTY_ENABLED
,
2804 BASEPROPERTY_ENABLEVISIBLE
,
2805 BASEPROPERTY_FONTDESCRIPTOR
,
2806 BASEPROPERTY_HELPTEXT
,
2807 BASEPROPERTY_HELPURL
,
2809 BASEPROPERTY_MULTILINE
,
2810 BASEPROPERTY_NOLABEL
,
2811 BASEPROPERTY_PRINTABLE
,
2812 BASEPROPERTY_TABSTOP
,
2813 BASEPROPERTY_VERTICALALIGN
,
2814 BASEPROPERTY_WRITING_MODE
,
2815 BASEPROPERTY_CONTEXT_WRITING_MODE
,
2817 VCLXWindow::ImplGetPropertyIds( rIds
);
2820 VCLXFixedText::VCLXFixedText()
2824 VCLXFixedText::~VCLXFixedText()
2828 // ::com::sun::star::uno::XInterface
2829 ::com::sun::star::uno::Any
VCLXFixedText::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2831 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2832 SAL_STATIC_CAST( ::com::sun::star::awt::XFixedText
*, this ) );
2833 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
2836 // ::com::sun::star::lang::XTypeProvider
2837 IMPL_XTYPEPROVIDER_START( VCLXFixedText
)
2838 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
>* ) NULL
),
2839 VCLXWindow::getTypes()
2840 IMPL_XTYPEPROVIDER_END
2842 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXFixedText::CreateAccessibleContext()
2844 return getAccessibleFactory().createAccessibleContext( this );
2847 void VCLXFixedText::setText( const ::rtl::OUString
& Text
) throw(::com::sun::star::uno::RuntimeException
)
2849 ::vos::OGuard
aGuard( GetMutex() );
2851 Window
* pWindow
= GetWindow();
2853 pWindow
->SetText( Text
);
2856 ::rtl::OUString
VCLXFixedText::getText() throw(::com::sun::star::uno::RuntimeException
)
2858 ::vos::OGuard
aGuard( GetMutex() );
2860 ::rtl::OUString aText
;
2861 Window
* pWindow
= GetWindow();
2863 aText
= pWindow
->GetText();
2867 void VCLXFixedText::setAlignment( short nAlign
) throw(::com::sun::star::uno::RuntimeException
)
2869 ::vos::OGuard
aGuard( GetMutex() );
2871 Window
* pWindow
= GetWindow();
2874 WinBits nNewBits
= 0;
2875 if ( nAlign
== ::com::sun::star::awt::TextAlign::LEFT
)
2877 else if ( nAlign
== ::com::sun::star::awt::TextAlign::CENTER
)
2878 nNewBits
= WB_CENTER
;
2880 nNewBits
= WB_RIGHT
;
2882 WinBits nStyle
= pWindow
->GetStyle();
2883 nStyle
&= ~(WB_LEFT
|WB_CENTER
|WB_RIGHT
);
2884 pWindow
->SetStyle( nStyle
| nNewBits
);
2888 short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeException
)
2890 ::vos::OGuard
aGuard( GetMutex() );
2893 Window
* pWindow
= GetWindow();
2896 WinBits nStyle
= pWindow
->GetStyle();
2897 if ( nStyle
& WB_LEFT
)
2898 nAlign
= ::com::sun::star::awt::TextAlign::LEFT
;
2899 else if ( nStyle
& WB_CENTER
)
2900 nAlign
= ::com::sun::star::awt::TextAlign::CENTER
;
2902 nAlign
= ::com::sun::star::awt::TextAlign::RIGHT
;
2907 ::com::sun::star::awt::Size
VCLXFixedText::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
2909 ::vos::OGuard
aGuard( GetMutex() );
2912 FixedText
* pFixedText
= (FixedText
*)GetWindow();
2914 aSz
= pFixedText
->CalcMinimumSize();
2915 return AWTSize(aSz
);
2918 ::com::sun::star::awt::Size
VCLXFixedText::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
2920 return getMinimumSize();
2923 ::com::sun::star::awt::Size
VCLXFixedText::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
2925 ::vos::OGuard
aGuard( GetMutex() );
2927 ::com::sun::star::awt::Size aSz
= rNewSize
;
2928 ::com::sun::star::awt::Size aMinSz
= getMinimumSize();
2929 if ( aSz
.Height
!= aMinSz
.Height
)
2930 aSz
.Height
= aMinSz
.Height
;
2935 // ----------------------------------------------------
2936 // class VCLXScrollBar
2937 // ----------------------------------------------------
2938 void VCLXScrollBar::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2940 PushPropertyIds( rIds
,
2941 BASEPROPERTY_BACKGROUNDCOLOR
,
2942 BASEPROPERTY_BLOCKINCREMENT
,
2943 BASEPROPERTY_BORDER
,
2944 BASEPROPERTY_BORDERCOLOR
,
2945 BASEPROPERTY_DEFAULTCONTROL
,
2946 BASEPROPERTY_ENABLED
,
2947 BASEPROPERTY_ENABLEVISIBLE
,
2948 BASEPROPERTY_HELPTEXT
,
2949 BASEPROPERTY_HELPURL
,
2950 BASEPROPERTY_LINEINCREMENT
,
2951 BASEPROPERTY_LIVE_SCROLL
,
2952 BASEPROPERTY_ORIENTATION
,
2953 BASEPROPERTY_PRINTABLE
,
2954 BASEPROPERTY_REPEAT_DELAY
,
2955 BASEPROPERTY_SCROLLVALUE
,
2956 BASEPROPERTY_SCROLLVALUE_MAX
,
2957 BASEPROPERTY_SCROLLVALUE_MIN
,
2958 BASEPROPERTY_SYMBOL_COLOR
,
2959 BASEPROPERTY_TABSTOP
,
2960 BASEPROPERTY_VISIBLESIZE
,
2961 BASEPROPERTY_WRITING_MODE
,
2962 BASEPROPERTY_CONTEXT_WRITING_MODE
,
2964 VCLXWindow::ImplGetPropertyIds( rIds
);
2967 VCLXScrollBar::VCLXScrollBar() : maAdjustmentListeners( *this )
2971 // ::com::sun::star::uno::XInterface
2972 ::com::sun::star::uno::Any
VCLXScrollBar::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2974 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2975 SAL_STATIC_CAST( ::com::sun::star::awt::XScrollBar
*, this ) );
2976 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
2979 // ::com::sun::star::lang::XTypeProvider
2980 IMPL_XTYPEPROVIDER_START( VCLXScrollBar
)
2981 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XScrollBar
>* ) NULL
),
2982 VCLXWindow::getTypes()
2983 IMPL_XTYPEPROVIDER_END
2985 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXScrollBar::CreateAccessibleContext()
2987 return getAccessibleFactory().createAccessibleContext( this );
2990 // ::com::sun::star::lang::XComponent
2991 void VCLXScrollBar::dispose() throw(::com::sun::star::uno::RuntimeException
)
2993 ::vos::OGuard
aGuard( GetMutex() );
2995 ::com::sun::star::lang::EventObject aObj
;
2996 aObj
.Source
= (::cppu::OWeakObject
*)this;
2997 maAdjustmentListeners
.disposeAndClear( aObj
);
2998 VCLXWindow::dispose();
3001 // ::com::sun::star::awt::XScrollbar
3002 void VCLXScrollBar::addAdjustmentListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XAdjustmentListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3004 ::vos::OGuard
aGuard( GetMutex() );
3005 maAdjustmentListeners
.addInterface( l
);
3008 void VCLXScrollBar::removeAdjustmentListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XAdjustmentListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3010 ::vos::OGuard
aGuard( GetMutex() );
3011 maAdjustmentListeners
.removeInterface( l
);
3014 void VCLXScrollBar::setValue( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3016 ::vos::OGuard
aGuard( GetMutex() );
3018 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3020 pScrollBar
->DoScroll( n
);
3023 void VCLXScrollBar::setValues( sal_Int32 nValue
, sal_Int32 nVisible
, sal_Int32 nMax
) throw(::com::sun::star::uno::RuntimeException
)
3025 ::vos::OGuard
aGuard( GetMutex() );
3027 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3030 pScrollBar
->SetVisibleSize( nVisible
);
3031 pScrollBar
->SetRangeMax( nMax
);
3032 pScrollBar
->DoScroll( nValue
);
3036 sal_Int32
VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeException
)
3038 ::vos::OGuard
aGuard( GetMutex() );
3040 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3041 return pScrollBar
? pScrollBar
->GetThumbPos() : 0;
3044 void VCLXScrollBar::setMaximum( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3046 ::vos::OGuard
aGuard( GetMutex() );
3048 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3050 pScrollBar
->SetRangeMax( n
);
3053 sal_Int32
VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeException
)
3055 ::vos::OGuard
aGuard( GetMutex() );
3057 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3058 return pScrollBar
? pScrollBar
->GetRangeMax() : 0;
3061 void VCLXScrollBar::setMinimum( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3063 ::vos::OGuard
aGuard( GetMutex() );
3065 ScrollBar
* pScrollBar
= static_cast< ScrollBar
* >( GetWindow() );
3067 pScrollBar
->SetRangeMin( n
);
3070 sal_Int32
VCLXScrollBar::getMinimum() throw(::com::sun::star::uno::RuntimeException
)
3072 ::vos::OGuard
aGuard( GetMutex() );
3074 ScrollBar
* pScrollBar
= static_cast< ScrollBar
* >( GetWindow() );
3075 return pScrollBar
? pScrollBar
->GetRangeMin() : 0;
3078 void VCLXScrollBar::setLineIncrement( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3080 ::vos::OGuard
aGuard( GetMutex() );
3082 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3084 pScrollBar
->SetLineSize( n
);
3087 sal_Int32
VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::RuntimeException
)
3089 ::vos::OGuard
aGuard( GetMutex() );
3091 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3092 return pScrollBar
? pScrollBar
->GetLineSize() : 0;
3095 void VCLXScrollBar::setBlockIncrement( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3097 ::vos::OGuard
aGuard( GetMutex() );
3099 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3101 pScrollBar
->SetPageSize( n
);
3104 sal_Int32
VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException
)
3106 ::vos::OGuard
aGuard( GetMutex() );
3108 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3109 return pScrollBar
? pScrollBar
->GetPageSize() : 0;
3112 void VCLXScrollBar::setVisibleSize( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3114 ::vos::OGuard
aGuard( GetMutex() );
3116 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3118 pScrollBar
->SetVisibleSize( n
);
3121 sal_Int32
VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeException
)
3123 ::vos::OGuard
aGuard( GetMutex() );
3125 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3126 return pScrollBar
? pScrollBar
->GetVisibleSize() : 0;
3129 void VCLXScrollBar::setOrientation( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3131 ::vos::OGuard
aGuard( GetMutex() );
3133 Window
* pWindow
= GetWindow();
3136 WinBits nStyle
= pWindow
->GetStyle();
3137 nStyle
&= ~(WB_HORZ
|WB_VERT
);
3138 if ( n
== ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL
)
3143 pWindow
->SetStyle( nStyle
);
3148 sal_Int32
VCLXScrollBar::getOrientation() throw(::com::sun::star::uno::RuntimeException
)
3150 ::vos::OGuard
aGuard( GetMutex() );
3153 Window
* pWindow
= GetWindow();
3156 WinBits nStyle
= pWindow
->GetStyle();
3157 if ( nStyle
& WB_HORZ
)
3158 n
= ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL
;
3160 n
= ::com::sun::star::awt::ScrollBarOrientation::VERTICAL
;
3166 // ::com::sun::star::awt::VclWindowPeer
3167 void VCLXScrollBar::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
3169 ::vos::OGuard
aGuard( GetMutex() );
3171 ScrollBar
* pScrollBar
= (ScrollBar
*)GetWindow();
3174 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
3176 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3177 switch ( nPropType
)
3179 case BASEPROPERTY_LIVE_SCROLL
:
3181 sal_Bool bDo
= sal_False
;
3184 OSL_VERIFY( Value
>>= bDo
);
3186 AllSettings
aSettings( pScrollBar
->GetSettings() );
3187 StyleSettings
aStyle( aSettings
.GetStyleSettings() );
3188 ULONG nDragOptions
= aStyle
.GetDragFullOptions();
3190 nDragOptions
|= DRAGFULL_OPTION_SCROLL
;
3192 nDragOptions
&= ~DRAGFULL_OPTION_SCROLL
;
3193 aStyle
.SetDragFullOptions( nDragOptions
);
3194 aSettings
.SetStyleSettings( aStyle
);
3195 pScrollBar
->SetSettings( aSettings
);
3199 case BASEPROPERTY_SCROLLVALUE
:
3209 case BASEPROPERTY_SCROLLVALUE_MAX
:
3210 case BASEPROPERTY_SCROLLVALUE_MIN
:
3217 if ( nPropType
== BASEPROPERTY_SCROLLVALUE_MAX
)
3225 case BASEPROPERTY_LINEINCREMENT
:
3231 setLineIncrement( n
);
3235 case BASEPROPERTY_BLOCKINCREMENT
:
3241 setBlockIncrement( n
);
3245 case BASEPROPERTY_VISIBLESIZE
:
3251 setVisibleSize( n
);
3255 case BASEPROPERTY_ORIENTATION
:
3261 setOrientation( n
);
3266 case BASEPROPERTY_BACKGROUNDCOLOR
:
3268 // the default implementation of the base class doesn't work here, since our
3269 // interpretation for this property is slightly different
3270 ::toolkit::setButtonLikeFaceColor( pScrollBar
, Value
);
3276 VCLXWindow::setProperty( PropertyName
, Value
);
3282 ::com::sun::star::uno::Any
VCLXScrollBar::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
3284 ::vos::OGuard
aGuard( GetMutex() );
3286 ::com::sun::star::uno::Any aProp
;
3287 ScrollBar
* pScrollBar
= (ScrollBar
*)GetWindow();
3290 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3292 switch ( nPropType
)
3294 case BASEPROPERTY_LIVE_SCROLL
:
3296 aProp
<<= (sal_Bool
)( 0 != ( pScrollBar
->GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SCROLL
) );
3299 case BASEPROPERTY_SCROLLVALUE
:
3301 aProp
<<= (sal_Int32
) getValue();
3304 case BASEPROPERTY_SCROLLVALUE_MAX
:
3306 aProp
<<= (sal_Int32
) getMaximum();
3309 case BASEPROPERTY_SCROLLVALUE_MIN
:
3311 aProp
<<= (sal_Int32
) getMinimum();
3314 case BASEPROPERTY_LINEINCREMENT
:
3316 aProp
<<= (sal_Int32
) getLineIncrement();
3319 case BASEPROPERTY_BLOCKINCREMENT
:
3321 aProp
<<= (sal_Int32
) getBlockIncrement();
3324 case BASEPROPERTY_VISIBLESIZE
:
3326 aProp
<<= (sal_Int32
) getVisibleSize();
3329 case BASEPROPERTY_ORIENTATION
:
3331 aProp
<<= (sal_Int32
) getOrientation();
3334 case BASEPROPERTY_BACKGROUNDCOLOR
:
3336 // the default implementation of the base class doesn't work here, since our
3337 // interpretation for this property is slightly different
3338 aProp
= ::toolkit::getButtonLikeFaceColor( pScrollBar
);
3344 aProp
<<= VCLXWindow::getProperty( PropertyName
);
3351 void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
3353 switch ( rVclWindowEvent
.GetId() )
3355 case VCLEVENT_SCROLLBAR_SCROLL
:
3357 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
3358 // since we call listeners below, there is a potential that we will be destroyed
3359 // in during the listener call. To prevent the resulting crashs, we keep us
3360 // alive as long as we're here
3361 // #20178# - 2003-10-01 - fs@openoffice.org
3363 if ( maAdjustmentListeners
.getLength() )
3365 ScrollBar
* pScrollBar
= (ScrollBar
*)GetWindow();
3369 ::com::sun::star::awt::AdjustmentEvent aEvent
;
3370 aEvent
.Source
= (::cppu::OWeakObject
*)this;
3371 aEvent
.Value
= pScrollBar
->GetThumbPos();
3373 // set adjustment type
3374 ScrollType aType
= pScrollBar
->GetType();
3375 if ( aType
== SCROLL_LINEUP
|| aType
== SCROLL_LINEDOWN
)
3377 aEvent
.Type
= ::com::sun::star::awt::AdjustmentType_ADJUST_LINE
;
3379 else if ( aType
== SCROLL_PAGEUP
|| aType
== SCROLL_PAGEDOWN
)
3381 aEvent
.Type
= ::com::sun::star::awt::AdjustmentType_ADJUST_PAGE
;
3383 else if ( aType
== SCROLL_DRAG
)
3385 aEvent
.Type
= ::com::sun::star::awt::AdjustmentType_ADJUST_ABS
;
3388 maAdjustmentListeners
.adjustmentValueChanged( aEvent
);
3395 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
3400 ::com::sun::star::awt::Size SAL_CALL
VCLXScrollBar::implGetMinimumSize( Window
* p
) throw(::com::sun::star::uno::RuntimeException
)
3402 long n
= p
->GetSettings().GetStyleSettings().GetScrollBarSize();
3403 return ::com::sun::star::awt::Size( n
, n
);
3406 ::com::sun::star::awt::Size SAL_CALL
VCLXScrollBar::getMinimumSize() throw(::com::sun::star::uno::RuntimeException
)
3408 ::vos::OGuard
aGuard( GetMutex() );
3409 return implGetMinimumSize( GetWindow() );
3413 // ----------------------------------------------------
3415 // ----------------------------------------------------
3417 void VCLXEdit::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
3419 PushPropertyIds( rIds
,
3421 BASEPROPERTY_BACKGROUNDCOLOR
,
3422 BASEPROPERTY_BORDER
,
3423 BASEPROPERTY_BORDERCOLOR
,
3424 BASEPROPERTY_DEFAULTCONTROL
,
3425 BASEPROPERTY_ECHOCHAR
,
3426 BASEPROPERTY_ENABLED
,
3427 BASEPROPERTY_ENABLEVISIBLE
,
3428 BASEPROPERTY_FONTDESCRIPTOR
,
3429 BASEPROPERTY_HARDLINEBREAKS
,
3430 BASEPROPERTY_HELPTEXT
,
3431 BASEPROPERTY_HELPURL
,
3432 BASEPROPERTY_HSCROLL
,
3433 BASEPROPERTY_LINE_END_FORMAT
,
3434 BASEPROPERTY_MAXTEXTLEN
,
3435 BASEPROPERTY_MULTILINE
,
3436 BASEPROPERTY_PRINTABLE
,
3437 BASEPROPERTY_READONLY
,
3438 BASEPROPERTY_TABSTOP
,
3440 BASEPROPERTY_VSCROLL
,
3441 BASEPROPERTY_HIDEINACTIVESELECTION
,
3442 BASEPROPERTY_PAINTTRANSPARENT
,
3443 BASEPROPERTY_AUTOHSCROLL
,
3444 BASEPROPERTY_AUTOVSCROLL
,
3445 BASEPROPERTY_WRITING_MODE
,
3446 BASEPROPERTY_CONTEXT_WRITING_MODE
,
3448 VCLXWindow::ImplGetPropertyIds( rIds
);
3451 VCLXEdit::VCLXEdit() : maTextListeners( *this )
3455 // ::com::sun::star::uno::XInterface
3456 ::com::sun::star::uno::Any
VCLXEdit::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
3458 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
3459 SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent
*, this ),
3460 SAL_STATIC_CAST( ::com::sun::star::awt::XTextEditField
*, this ),
3461 SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains
*, this ) );
3462 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
3465 // ::com::sun::star::lang::XTypeProvider
3466 IMPL_XTYPEPROVIDER_START( VCLXEdit
)
3467 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextComponent
>* ) NULL
),
3468 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextEditField
>* ) NULL
),
3469 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextLayoutConstrains
>* ) NULL
),
3470 VCLXWindow::getTypes()
3471 IMPL_XTYPEPROVIDER_END
3473 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXEdit::CreateAccessibleContext()
3475 return getAccessibleFactory().createAccessibleContext( this );
3478 void VCLXEdit::dispose() throw(::com::sun::star::uno::RuntimeException
)
3480 ::vos::OGuard
aGuard( GetMutex() );
3482 ::com::sun::star::lang::EventObject aObj
;
3483 aObj
.Source
= (::cppu::OWeakObject
*)this;
3484 maTextListeners
.disposeAndClear( aObj
);
3485 VCLXWindow::dispose();
3488 void VCLXEdit::addTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3490 ::vos::OGuard
aGuard( GetMutex() );
3491 GetTextListeners().addInterface( l
);
3494 void VCLXEdit::removeTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3496 ::vos::OGuard
aGuard( GetMutex() );
3497 GetTextListeners().removeInterface( l
);
3500 void VCLXEdit::setText( const ::rtl::OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
)
3502 ::vos::OGuard
aGuard( GetMutex() );
3504 Edit
* pEdit
= (Edit
*)GetWindow();
3507 pEdit
->SetText( aText
);
3509 // #107218# Call same listeners like VCL would do after user interaction
3510 SetSynthesizingVCLEvent( sal_True
);
3511 pEdit
->SetModifyFlag();
3513 SetSynthesizingVCLEvent( sal_False
);
3517 void VCLXEdit::insertText( const ::com::sun::star::awt::Selection
& rSel
, const ::rtl::OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
)
3519 ::vos::OGuard
aGuard( GetMutex() );
3521 Edit
* pEdit
= (Edit
*)GetWindow();
3524 pEdit
->SetSelection( Selection( rSel
.Min
, rSel
.Max
) );
3525 pEdit
->ReplaceSelected( aText
);
3527 // #107218# Call same listeners like VCL would do after user interaction
3528 SetSynthesizingVCLEvent( sal_True
);
3529 pEdit
->SetModifyFlag();
3531 SetSynthesizingVCLEvent( sal_False
);
3535 ::rtl::OUString
VCLXEdit::getText() throw(::com::sun::star::uno::RuntimeException
)
3537 ::vos::OGuard
aGuard( GetMutex() );
3539 ::rtl::OUString aText
;
3540 Window
* pWindow
= GetWindow();
3542 aText
= pWindow
->GetText();
3546 ::rtl::OUString
VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException
)
3548 ::vos::OGuard
aGuard( GetMutex() );
3550 ::rtl::OUString aText
;
3551 Edit
* pEdit
= (Edit
*) GetWindow();
3553 aText
= pEdit
->GetSelected();
3558 void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection
& aSelection
) throw(::com::sun::star::uno::RuntimeException
)
3560 ::vos::OGuard
aGuard( GetMutex() );
3562 Edit
* pEdit
= (Edit
*) GetWindow();
3564 pEdit
->SetSelection( Selection( aSelection
.Min
, aSelection
.Max
) );
3567 ::com::sun::star::awt::Selection
VCLXEdit::getSelection() throw(::com::sun::star::uno::RuntimeException
)
3569 ::vos::OGuard
aGuard( GetMutex() );
3572 Edit
* pEdit
= (Edit
*) GetWindow();
3574 aSel
= pEdit
->GetSelection();
3575 return ::com::sun::star::awt::Selection( aSel
.Min(), aSel
.Max() );
3578 sal_Bool
VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException
)
3580 ::vos::OGuard
aGuard( GetMutex() );
3582 Edit
* pEdit
= (Edit
*) GetWindow();
3583 return ( pEdit
&& !pEdit
->IsReadOnly() && pEdit
->IsEnabled() ) ? sal_True
: sal_False
;
3586 void VCLXEdit::setEditable( sal_Bool bEditable
) throw(::com::sun::star::uno::RuntimeException
)
3588 ::vos::OGuard
aGuard( GetMutex() );
3590 Edit
* pEdit
= (Edit
*) GetWindow();
3592 pEdit
->SetReadOnly( !bEditable
);
3596 void VCLXEdit::setMaxTextLen( sal_Int16 nLen
) throw(::com::sun::star::uno::RuntimeException
)
3598 ::vos::OGuard
aGuard( GetMutex() );
3600 Edit
* pEdit
= (Edit
*) GetWindow();
3602 pEdit
->SetMaxTextLen( nLen
);
3605 sal_Int16
VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException
)
3607 ::vos::OGuard
aGuard( GetMutex() );
3609 Edit
* pEdit
= (Edit
*) GetWindow();
3610 return pEdit
? pEdit
->GetMaxTextLen() : 0;
3613 void VCLXEdit::setEchoChar( sal_Unicode cEcho
) throw(::com::sun::star::uno::RuntimeException
)
3615 ::vos::OGuard
aGuard( GetMutex() );
3617 Edit
* pEdit
= (Edit
*) GetWindow();
3619 pEdit
->SetEchoChar( cEcho
);
3622 void VCLXEdit::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
3624 ::vos::OGuard
aGuard( GetMutex() );
3626 Edit
* pEdit
= (Edit
*)GetWindow();
3629 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3630 switch ( nPropType
)
3632 case BASEPROPERTY_HIDEINACTIVESELECTION
:
3633 ::toolkit::adjustBooleanWindowStyle( Value
, pEdit
, WB_NOHIDESELECTION
, sal_True
);
3634 if ( pEdit
->GetSubEdit() )
3635 ::toolkit::adjustBooleanWindowStyle( Value
, pEdit
->GetSubEdit(), WB_NOHIDESELECTION
, sal_True
);
3638 case BASEPROPERTY_READONLY
:
3640 sal_Bool b
= sal_Bool();
3642 pEdit
->SetReadOnly( b
);
3645 case BASEPROPERTY_ECHOCHAR
:
3647 sal_Int16 n
= sal_Int16();
3649 pEdit
->SetEchoChar( n
);
3652 case BASEPROPERTY_MAXTEXTLEN
:
3654 sal_Int16 n
= sal_Int16();
3656 pEdit
->SetMaxTextLen( n
);
3661 VCLXWindow::setProperty( PropertyName
, Value
);
3667 ::com::sun::star::uno::Any
VCLXEdit::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
3669 ::vos::OGuard
aGuard( GetMutex() );
3671 ::com::sun::star::uno::Any aProp
;
3672 Edit
* pEdit
= (Edit
*)GetWindow();
3675 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3676 switch ( nPropType
)
3678 case BASEPROPERTY_HIDEINACTIVESELECTION
:
3679 aProp
<<= (sal_Bool
)( ( pEdit
->GetStyle() & WB_NOHIDESELECTION
) == 0 );
3681 case BASEPROPERTY_READONLY
:
3682 aProp
<<= (sal_Bool
) pEdit
->IsReadOnly();
3684 case BASEPROPERTY_ECHOCHAR
:
3685 aProp
<<= (sal_Int16
) pEdit
->GetEchoChar();
3687 case BASEPROPERTY_MAXTEXTLEN
:
3688 aProp
<<= (sal_Int16
) pEdit
->GetMaxTextLen();
3692 aProp
= VCLXWindow::getProperty( PropertyName
);
3699 ::com::sun::star::awt::Size
VCLXEdit::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
3701 ::vos::OGuard
aGuard( GetMutex() );
3704 Edit
* pEdit
= (Edit
*) GetWindow();
3706 aSz
= pEdit
->CalcMinimumSize();
3707 return AWTSize(aSz
);
3710 ::com::sun::star::awt::Size
VCLXEdit::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
3712 ::vos::OGuard
aGuard( GetMutex() );
3715 Edit
* pEdit
= (Edit
*) GetWindow();
3718 aSz
= pEdit
->CalcMinimumSize();
3721 return AWTSize(aSz
);
3724 ::com::sun::star::awt::Size
VCLXEdit::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
3726 ::vos::OGuard
aGuard( GetMutex() );
3728 ::com::sun::star::awt::Size aSz
= rNewSize
;
3729 ::com::sun::star::awt::Size aMinSz
= getMinimumSize();
3730 if ( aSz
.Height
!= aMinSz
.Height
)
3731 aSz
.Height
= aMinSz
.Height
;
3736 ::com::sun::star::awt::Size
VCLXEdit::getMinimumSize( sal_Int16 nCols
, sal_Int16
) throw(::com::sun::star::uno::RuntimeException
)
3738 ::vos::OGuard
aGuard( GetMutex() );
3741 Edit
* pEdit
= (Edit
*) GetWindow();
3745 aSz
= pEdit
->CalcSize( nCols
);
3747 aSz
= pEdit
->CalcMinimumSize();
3749 return AWTSize(aSz
);
3752 void VCLXEdit::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
) throw(::com::sun::star::uno::RuntimeException
)
3754 ::vos::OGuard
aGuard( GetMutex() );
3758 Edit
* pEdit
= (Edit
*) GetWindow();
3760 nCols
= pEdit
->GetMaxVisChars();
3763 void VCLXEdit::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
3765 switch ( rVclWindowEvent
.GetId() )
3767 case VCLEVENT_EDIT_MODIFY
:
3769 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
3770 // since we call listeners below, there is a potential that we will be destroyed
3771 // during the listener call. To prevent the resulting crashs, we keep us
3772 // alive as long as we're here
3773 // #20178# - 2003-10-01 - fs@openoffice.org
3775 if ( GetTextListeners().getLength() )
3777 ::com::sun::star::awt::TextEvent aEvent
;
3778 aEvent
.Source
= (::cppu::OWeakObject
*)this;
3779 GetTextListeners().textChanged( aEvent
);
3785 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
3790 // ----------------------------------------------------
3791 // class VCLXComboBox
3792 // ----------------------------------------------------
3794 void VCLXComboBox::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
3796 PushPropertyIds( rIds
,
3797 BASEPROPERTY_AUTOCOMPLETE
,
3798 BASEPROPERTY_BACKGROUNDCOLOR
,
3799 BASEPROPERTY_BORDER
,
3800 BASEPROPERTY_BORDERCOLOR
,
3801 BASEPROPERTY_DEFAULTCONTROL
,
3802 BASEPROPERTY_DROPDOWN
,
3803 BASEPROPERTY_ENABLED
,
3804 BASEPROPERTY_ENABLEVISIBLE
,
3805 BASEPROPERTY_FONTDESCRIPTOR
,
3806 BASEPROPERTY_HELPTEXT
,
3807 BASEPROPERTY_HELPURL
,
3808 BASEPROPERTY_LINECOUNT
,
3809 BASEPROPERTY_MAXTEXTLEN
,
3810 BASEPROPERTY_PRINTABLE
,
3811 BASEPROPERTY_READONLY
,
3812 BASEPROPERTY_STRINGITEMLIST
,
3813 BASEPROPERTY_TABSTOP
,
3815 BASEPROPERTY_HIDEINACTIVESELECTION
,
3817 BASEPROPERTY_WRITING_MODE
,
3818 BASEPROPERTY_CONTEXT_WRITING_MODE
,
3819 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
3821 // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box
3822 // #i92690# / 2008-08-12 / frank.schoenheit@sun.com
3823 // VCLXEdit::ImplGetPropertyIds( rIds );
3824 VCLXWindow::ImplGetPropertyIds( rIds
);
3827 VCLXComboBox::VCLXComboBox()
3828 : maActionListeners( *this ), maItemListeners( *this )
3832 VCLXComboBox::~VCLXComboBox()
3835 OSL_TRACE ("%s", __FUNCTION__
);
3839 // ::com::sun::star::uno::XInterface
3840 ::com::sun::star::uno::Any
VCLXComboBox::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
3842 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
3843 SAL_STATIC_CAST( ::com::sun::star::awt::XComboBox
*, this ) );
3844 return (aRet
.hasValue() ? aRet
: VCLXEdit::queryInterface( rType
));
3847 // ::com::sun::star::lang::XTypeProvider
3848 IMPL_XTYPEPROVIDER_START( VCLXComboBox
)
3849 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XComboBox
>* ) NULL
),
3850 VCLXEdit::getTypes()
3851 IMPL_XTYPEPROVIDER_END
3853 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXComboBox::CreateAccessibleContext()
3855 ::vos::OGuard
aGuard( GetMutex() );
3857 return getAccessibleFactory().createAccessibleContext( this );
3860 void VCLXComboBox::dispose() throw(::com::sun::star::uno::RuntimeException
)
3862 ::vos::OGuard
aGuard( GetMutex() );
3864 ::com::sun::star::lang::EventObject aObj
;
3865 aObj
.Source
= (::cppu::OWeakObject
*)this;
3866 maItemListeners
.disposeAndClear( aObj
);
3867 maActionListeners
.disposeAndClear( aObj
);
3868 VCLXEdit::dispose();
3872 void VCLXComboBox::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3874 ::vos::OGuard
aGuard( GetMutex() );
3875 maItemListeners
.addInterface( l
);
3878 void VCLXComboBox::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3880 ::vos::OGuard
aGuard( GetMutex() );
3881 maItemListeners
.removeInterface( l
);
3884 void VCLXComboBox::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3886 ::vos::OGuard
aGuard( GetMutex() );
3887 maActionListeners
.addInterface( l
);
3890 void VCLXComboBox::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3892 ::vos::OGuard
aGuard( GetMutex() );
3893 maActionListeners
.removeInterface( l
);
3896 void VCLXComboBox::addItem( const ::rtl::OUString
& aItem
, sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
3898 ::vos::OGuard
aGuard( GetMutex() );
3900 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3902 pBox
->InsertEntry( aItem
, nPos
);
3905 void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aItems
, sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
3907 ::vos::OGuard
aGuard( GetMutex() );
3909 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3912 sal_uInt16 nP
= nPos
;
3913 for ( sal_uInt16 n
= 0; n
< aItems
.getLength(); n
++ )
3915 pBox
->InsertEntry( aItems
.getConstArray()[n
], nP
);
3916 if ( (sal_uInt16
)nPos
< 0xFFFF ) // Nicht wenn 0xFFFF, weil LIST_APPEND
3922 void VCLXComboBox::removeItems( sal_Int16 nPos
, sal_Int16 nCount
) throw(::com::sun::star::uno::RuntimeException
)
3924 ::vos::OGuard
aGuard( GetMutex() );
3926 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3929 for ( sal_uInt16 n
= nCount
; n
; )
3930 pBox
->RemoveEntry( nPos
+ (--n
) );
3934 sal_Int16
VCLXComboBox::getItemCount() throw(::com::sun::star::uno::RuntimeException
)
3936 ::vos::OGuard
aGuard( GetMutex() );
3938 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3939 return pBox
? pBox
->GetEntryCount() : 0;
3942 ::rtl::OUString
VCLXComboBox::getItem( sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
3944 ::vos::OGuard
aGuard( GetMutex() );
3946 ::rtl::OUString aItem
;
3947 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3949 aItem
= pBox
->GetEntry( nPos
);
3953 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> VCLXComboBox::getItems() throw(::com::sun::star::uno::RuntimeException
)
3955 ::vos::OGuard
aGuard( GetMutex() );
3957 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSeq
;
3958 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3961 sal_uInt16 nEntries
= pBox
->GetEntryCount();
3962 aSeq
= ::com::sun::star::uno::Sequence
< ::rtl::OUString
>( nEntries
);
3963 for ( sal_uInt16 n
= nEntries
; n
; )
3966 aSeq
.getArray()[n
] = pBox
->GetEntry( n
);
3972 void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines
) throw(::com::sun::star::uno::RuntimeException
)
3974 ::vos::OGuard
aGuard( GetMutex() );
3976 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3978 pBox
->SetDropDownLineCount( nLines
);
3981 sal_Int16
VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException
)
3983 ::vos::OGuard
aGuard( GetMutex() );
3985 sal_Int16 nLines
= 0;
3986 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3988 nLines
= pBox
->GetDropDownLineCount();
3992 void VCLXComboBox::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
3994 ::vos::OGuard
aGuard( GetMutex() );
3996 ComboBox
* pComboBox
= (ComboBox
*)GetWindow();
3999 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4000 switch ( nPropType
)
4002 case BASEPROPERTY_LINECOUNT
:
4004 sal_Int16 n
= sal_Int16();
4006 pComboBox
->SetDropDownLineCount( n
);
4009 case BASEPROPERTY_AUTOCOMPLETE
:
4011 sal_Int16 n
= sal_Int16();
4013 pComboBox
->EnableAutocomplete( n
!= 0 );
4016 case BASEPROPERTY_STRINGITEMLIST
:
4018 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aItems
;
4019 if ( Value
>>= aItems
)
4021 sal_Bool bUpdate
= pComboBox
->IsUpdateMode();
4022 pComboBox
->SetUpdateMode( sal_False
);
4024 const ::rtl::OUString
* pStrings
= aItems
.getConstArray();
4025 sal_Int32 nItems
= aItems
.getLength();
4026 for ( sal_Int32 n
= 0; n
< nItems
; n
++ )
4027 pComboBox
->InsertEntry( pStrings
[n
], LISTBOX_APPEND
);
4028 pComboBox
->SetUpdateMode( bUpdate
);
4034 VCLXEdit::setProperty( PropertyName
, Value
);
4036 // #109385# SetBorderStyle is not virtual
4037 if ( nPropType
== BASEPROPERTY_BORDER
)
4039 sal_uInt16 nBorder
= sal_uInt16();
4040 if ( (Value
>>= nBorder
) && nBorder
!= 0 )
4041 pComboBox
->SetBorderStyle( nBorder
);
4048 ::com::sun::star::uno::Any
VCLXComboBox::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
4050 ::vos::OGuard
aGuard( GetMutex() );
4052 ::com::sun::star::uno::Any aProp
;
4053 ComboBox
* pComboBox
= (ComboBox
*)GetWindow();
4056 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4057 switch ( nPropType
)
4059 case BASEPROPERTY_LINECOUNT
:
4061 aProp
<<= (sal_Int16
) pComboBox
->GetDropDownLineCount();
4064 case BASEPROPERTY_AUTOCOMPLETE
:
4066 aProp
<<= (sal_Bool
) pComboBox
->IsAutocompleteEnabled();
4069 case BASEPROPERTY_STRINGITEMLIST
:
4071 sal_uInt16 nItems
= pComboBox
->GetEntryCount();
4072 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSeq( nItems
);
4073 ::rtl::OUString
* pStrings
= aSeq
.getArray();
4074 for ( sal_uInt16 n
= 0; n
< nItems
; n
++ )
4075 pStrings
[n
] = pComboBox
->GetEntry( n
);
4082 aProp
<<= VCLXEdit::getProperty( PropertyName
);
4089 void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
4091 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
4092 // since we call listeners below, there is a potential that we will be destroyed
4093 // during the listener call. To prevent the resulting crashs, we keep us
4094 // alive as long as we're here
4095 // #20178# - 2003-10-01 - fs@openoffice.org
4097 switch ( rVclWindowEvent
.GetId() )
4099 case VCLEVENT_COMBOBOX_SELECT
:
4100 if ( maItemListeners
.getLength() )
4102 ComboBox
* pComboBox
= (ComboBox
*)GetWindow();
4105 if ( !pComboBox
->IsTravelSelect() )
4107 ::com::sun::star::awt::ItemEvent aEvent
;
4108 aEvent
.Source
= (::cppu::OWeakObject
*)this;
4109 aEvent
.Highlighted
= sal_False
;
4111 // Bei Mehrfachselektion 0xFFFF, sonst die ID
4112 aEvent
.Selected
= pComboBox
->GetEntryPos( pComboBox
->GetText() );
4114 maItemListeners
.itemStateChanged( aEvent
);
4120 case VCLEVENT_COMBOBOX_DOUBLECLICK
:
4121 if ( maActionListeners
.getLength() )
4123 ::com::sun::star::awt::ActionEvent aEvent
;
4124 aEvent
.Source
= (::cppu::OWeakObject
*)this;
4125 // aEvent.ActionCommand = ...;
4126 maActionListeners
.actionPerformed( aEvent
);
4131 VCLXEdit::ProcessWindowEvent( rVclWindowEvent
);
4136 ::com::sun::star::awt::Size
VCLXComboBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
4138 ::vos::OGuard
aGuard( GetMutex() );
4141 ComboBox
* pComboBox
= (ComboBox
*) GetWindow();
4143 aSz
= pComboBox
->CalcMinimumSize();
4144 return AWTSize(aSz
);
4147 ::com::sun::star::awt::Size
VCLXComboBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
4149 ::vos::OGuard
aGuard( GetMutex() );
4152 ComboBox
* pComboBox
= (ComboBox
*) GetWindow();
4155 aSz
= pComboBox
->CalcMinimumSize();
4156 if ( pComboBox
->GetStyle() & WB_DROPDOWN
)
4159 return AWTSize(aSz
);
4162 ::com::sun::star::awt::Size
VCLXComboBox::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
4164 ::vos::OGuard
aGuard( GetMutex() );
4166 Size aSz
= VCLSize(rNewSize
);
4167 ComboBox
* pComboBox
= (ComboBox
*) GetWindow();
4169 aSz
= pComboBox
->CalcAdjustedSize( aSz
);
4170 return AWTSize(aSz
);
4173 ::com::sun::star::awt::Size
VCLXComboBox::getMinimumSize( sal_Int16 nCols
, sal_Int16 nLines
) throw(::com::sun::star::uno::RuntimeException
)
4175 ::vos::OGuard
aGuard( GetMutex() );
4178 ComboBox
* pComboBox
= (ComboBox
*) GetWindow();
4180 aSz
= pComboBox
->CalcSize( nCols
, nLines
);
4181 return AWTSize(aSz
);
4184 void VCLXComboBox::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
) throw(::com::sun::star::uno::RuntimeException
)
4186 ::vos::OGuard
aGuard( GetMutex() );
4189 ComboBox
* pComboBox
= (ComboBox
*) GetWindow();
4193 pComboBox
->GetMaxVisColumnsAndLines( nC
, nL
);
4199 // ----------------------------------------------------
4200 // class VCLXFormattedSpinField
4201 // ----------------------------------------------------
4202 void VCLXFormattedSpinField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
4204 // Interestingly in the UnoControl API this is
4205 // - not derived from XEdit ultimately, (correct ?) - so cut this here ...
4206 // VCLXSpinField::ImplGetPropertyIds( rIds );
4207 VCLXWindow::ImplGetPropertyIds( rIds
);
4210 VCLXFormattedSpinField::VCLXFormattedSpinField()
4214 VCLXFormattedSpinField::~VCLXFormattedSpinField()
4218 void VCLXFormattedSpinField::setStrictFormat( sal_Bool bStrict
)
4220 ::vos::OGuard
aGuard( GetMutex() );
4222 FormatterBase
* pFormatter
= GetFormatter();
4224 pFormatter
->SetStrictFormat( bStrict
);
4227 sal_Bool
VCLXFormattedSpinField::isStrictFormat()
4229 FormatterBase
* pFormatter
= GetFormatter();
4230 return pFormatter
? pFormatter
->IsStrictFormat() : sal_False
;
4234 void VCLXFormattedSpinField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
4236 ::vos::OGuard
aGuard( GetMutex() );
4238 FormatterBase
* pFormatter
= GetFormatter();
4241 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4242 switch ( nPropType
)
4244 case BASEPROPERTY_SPIN
:
4246 sal_Bool b
= sal_Bool();
4249 WinBits nStyle
= GetWindow()->GetStyle() | WB_SPIN
;
4252 GetWindow()->SetStyle( nStyle
);
4256 case BASEPROPERTY_STRICTFORMAT
:
4258 sal_Bool b
= sal_Bool();
4261 pFormatter
->SetStrictFormat( b
);
4267 VCLXSpinField::setProperty( PropertyName
, Value
);
4273 ::com::sun::star::uno::Any
VCLXFormattedSpinField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
4275 ::vos::OGuard
aGuard( GetMutex() );
4277 ::com::sun::star::uno::Any aProp
;
4278 FormatterBase
* pFormatter
= GetFormatter();
4281 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4282 switch ( nPropType
)
4284 case BASEPROPERTY_TABSTOP
:
4286 aProp
<<= (sal_Bool
) ( ( GetWindow()->GetStyle() & WB_SPIN
) ? sal_True
: sal_False
);
4289 case BASEPROPERTY_STRICTFORMAT
:
4291 aProp
<<= (sal_Bool
) pFormatter
->IsStrictFormat();
4296 aProp
<<= VCLXSpinField::getProperty( PropertyName
);
4304 // ----------------------------------------------------
4305 // class VCLXDateField
4306 // ----------------------------------------------------
4308 void VCLXDateField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
4310 PushPropertyIds( rIds
,
4312 BASEPROPERTY_BACKGROUNDCOLOR
,
4313 BASEPROPERTY_BORDER
,
4314 BASEPROPERTY_BORDERCOLOR
,
4316 BASEPROPERTY_DATEMAX
,
4317 BASEPROPERTY_DATEMIN
,
4318 BASEPROPERTY_DATESHOWCENTURY
,
4319 BASEPROPERTY_DEFAULTCONTROL
,
4320 BASEPROPERTY_DROPDOWN
,
4321 BASEPROPERTY_ENABLED
,
4322 BASEPROPERTY_ENABLEVISIBLE
,
4323 BASEPROPERTY_EXTDATEFORMAT
,
4324 BASEPROPERTY_FONTDESCRIPTOR
,
4325 BASEPROPERTY_HELPTEXT
,
4326 BASEPROPERTY_HELPURL
,
4327 BASEPROPERTY_PRINTABLE
,
4328 BASEPROPERTY_READONLY
,
4329 BASEPROPERTY_REPEAT
,
4330 BASEPROPERTY_REPEAT_DELAY
,
4332 BASEPROPERTY_STRICTFORMAT
,
4333 BASEPROPERTY_TABSTOP
,
4334 BASEPROPERTY_ENFORCE_FORMAT
,
4336 BASEPROPERTY_HIDEINACTIVESELECTION
,
4337 BASEPROPERTY_WRITING_MODE
,
4338 BASEPROPERTY_CONTEXT_WRITING_MODE
,
4339 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
4341 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
4344 VCLXDateField::VCLXDateField()
4348 VCLXDateField::~VCLXDateField()
4352 // ::com::sun::star::uno::XInterface
4353 ::com::sun::star::uno::Any
VCLXDateField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
4355 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
4356 SAL_STATIC_CAST( ::com::sun::star::awt::XDateField
*, this ) );
4357 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
4360 // ::com::sun::star::lang::XTypeProvider
4361 IMPL_XTYPEPROVIDER_START( VCLXDateField
)
4362 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDateField
>* ) NULL
),
4363 VCLXFormattedSpinField::getTypes()
4364 IMPL_XTYPEPROVIDER_END
4366 void VCLXDateField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
4368 ::vos::OGuard
aGuard( GetMutex() );
4372 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
4374 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4375 switch ( nPropType
)
4377 case BASEPROPERTY_DATE
:
4381 ((DateField
*)GetWindow())->EnableEmptyFieldValue( sal_True
);
4382 ((DateField
*)GetWindow())->SetEmptyFieldValue();
4392 case BASEPROPERTY_DATEMIN
:
4399 case BASEPROPERTY_DATEMAX
:
4406 case BASEPROPERTY_EXTDATEFORMAT
:
4408 sal_Int16 n
= sal_Int16();
4410 ((DateField
*)GetWindow())->SetExtDateFormat( (ExtDateFieldFormat
) n
);
4413 case BASEPROPERTY_DATESHOWCENTURY
:
4415 sal_Bool b
= sal_Bool();
4417 ((DateField
*)GetWindow())->SetShowDateCentury( b
);
4420 case BASEPROPERTY_ENFORCE_FORMAT
:
4422 sal_Bool
bEnforce( sal_True
);
4423 OSL_VERIFY( Value
>>= bEnforce
);
4424 static_cast< DateField
* >( GetWindow() )->EnforceValidValue( bEnforce
);
4429 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
4435 ::com::sun::star::uno::Any
VCLXDateField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
4437 ::vos::OGuard
aGuard( GetMutex() );
4439 ::com::sun::star::uno::Any aProp
;
4440 FormatterBase
* pFormatter
= GetFormatter();
4443 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4444 switch ( nPropType
)
4446 case BASEPROPERTY_DATE
:
4448 aProp
<<= (sal_Int32
) getDate();
4451 case BASEPROPERTY_DATEMIN
:
4453 aProp
<<= (sal_Int32
) getMin();
4456 case BASEPROPERTY_DATEMAX
:
4458 aProp
<<= (sal_Int32
) getMax();
4461 case BASEPROPERTY_DATESHOWCENTURY
:
4463 aProp
<<= ((DateField
*)GetWindow())->IsShowDateCentury();
4466 case BASEPROPERTY_ENFORCE_FORMAT
:
4468 aProp
<<= (sal_Bool
)static_cast< DateField
* >( GetWindow() )->IsEnforceValidValue( );
4473 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
4481 void VCLXDateField::setDate( sal_Int32 nDate
) throw(::com::sun::star::uno::RuntimeException
)
4483 ::vos::OGuard
aGuard( GetMutex() );
4485 DateField
* pDateField
= (DateField
*) GetWindow();
4488 pDateField
->SetDate( nDate
);
4490 // #107218# Call same listeners like VCL would do after user interaction
4491 SetSynthesizingVCLEvent( sal_True
);
4492 pDateField
->SetModifyFlag();
4493 pDateField
->Modify();
4494 SetSynthesizingVCLEvent( sal_False
);
4498 sal_Int32
VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException
)
4500 ::vos::OGuard
aGuard( GetMutex() );
4502 sal_Int32 nDate
= 0;
4503 DateField
* pDateField
= (DateField
*) GetWindow();
4505 nDate
= pDateField
->GetDate().GetDate();
4510 void VCLXDateField::setMin( sal_Int32 nDate
) throw(::com::sun::star::uno::RuntimeException
)
4512 ::vos::OGuard
aGuard( GetMutex() );
4514 DateField
* pDateField
= (DateField
*) GetWindow();
4516 pDateField
->SetMin( nDate
);
4519 sal_Int32
VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException
)
4521 ::vos::OGuard
aGuard( GetMutex() );
4523 sal_Int32 nDate
= 0;
4524 DateField
* pDateField
= (DateField
*) GetWindow();
4526 nDate
= pDateField
->GetMin().GetDate();
4531 void VCLXDateField::setMax( sal_Int32 nDate
) throw(::com::sun::star::uno::RuntimeException
)
4533 ::vos::OGuard
aGuard( GetMutex() );
4535 DateField
* pDateField
= (DateField
*) GetWindow();
4537 pDateField
->SetMax( nDate
);
4540 sal_Int32
VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException
)
4542 ::vos::OGuard
aGuard( GetMutex() );
4544 sal_Int32 nDate
= 0;
4545 DateField
* pDateField
= (DateField
*) GetWindow();
4547 nDate
= pDateField
->GetMax().GetDate();
4552 void VCLXDateField::setFirst( sal_Int32 nDate
) throw(::com::sun::star::uno::RuntimeException
)
4554 ::vos::OGuard
aGuard( GetMutex() );
4556 DateField
* pDateField
= (DateField
*) GetWindow();
4558 pDateField
->SetFirst( nDate
);
4561 sal_Int32
VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
4563 ::vos::OGuard
aGuard( GetMutex() );
4565 sal_Int32 nDate
= 0;
4566 DateField
* pDateField
= (DateField
*) GetWindow();
4568 nDate
= pDateField
->GetFirst().GetDate();
4573 void VCLXDateField::setLast( sal_Int32 nDate
) throw(::com::sun::star::uno::RuntimeException
)
4575 ::vos::OGuard
aGuard( GetMutex() );
4577 DateField
* pDateField
= (DateField
*) GetWindow();
4579 pDateField
->SetLast( nDate
);
4582 sal_Int32
VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException
)
4584 ::vos::OGuard
aGuard( GetMutex() );
4586 sal_Int32 nDate
= 0;
4587 DateField
* pDateField
= (DateField
*) GetWindow();
4589 nDate
= pDateField
->GetLast().GetDate();
4594 void VCLXDateField::setLongFormat( sal_Bool bLong
) throw(::com::sun::star::uno::RuntimeException
)
4596 ::vos::OGuard
aGuard( GetMutex() );
4598 DateField
* pDateField
= (DateField
*) GetWindow();
4600 pDateField
->SetLongFormat( bLong
);
4603 sal_Bool
VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeException
)
4605 ::vos::OGuard
aGuard( GetMutex() );
4607 DateField
* pDateField
= (DateField
*) GetWindow();
4608 return pDateField
? pDateField
->IsLongFormat() : sal_False
;
4611 void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException
)
4613 ::vos::OGuard
aGuard( GetMutex() );
4615 DateField
* pDateField
= (DateField
*) GetWindow();
4618 pDateField
->SetEmptyDate();
4620 // #107218# Call same listeners like VCL would do after user interaction
4621 SetSynthesizingVCLEvent( sal_True
);
4622 pDateField
->SetModifyFlag();
4623 pDateField
->Modify();
4624 SetSynthesizingVCLEvent( sal_False
);
4628 sal_Bool
VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException
)
4630 ::vos::OGuard
aGuard( GetMutex() );
4632 DateField
* pDateField
= (DateField
*) GetWindow();
4633 return pDateField
? pDateField
->IsEmptyDate() : sal_False
;
4636 void VCLXDateField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
4638 VCLXFormattedSpinField::setStrictFormat( bStrict
);
4641 sal_Bool
VCLXDateField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
4643 return VCLXFormattedSpinField::isStrictFormat();
4647 // ----------------------------------------------------
4648 // class VCLXTimeField
4649 // ----------------------------------------------------
4651 void VCLXTimeField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
4653 PushPropertyIds( rIds
,
4655 BASEPROPERTY_BACKGROUNDCOLOR
,
4656 BASEPROPERTY_BORDER
,
4657 BASEPROPERTY_BORDERCOLOR
,
4658 BASEPROPERTY_DEFAULTCONTROL
,
4659 BASEPROPERTY_ENABLED
,
4660 BASEPROPERTY_ENABLEVISIBLE
,
4661 BASEPROPERTY_EXTTIMEFORMAT
,
4662 BASEPROPERTY_FONTDESCRIPTOR
,
4663 BASEPROPERTY_HELPTEXT
,
4664 BASEPROPERTY_HELPURL
,
4665 BASEPROPERTY_PRINTABLE
,
4666 BASEPROPERTY_READONLY
,
4667 BASEPROPERTY_REPEAT
,
4668 BASEPROPERTY_REPEAT_DELAY
,
4670 BASEPROPERTY_STRICTFORMAT
,
4671 BASEPROPERTY_TABSTOP
,
4673 BASEPROPERTY_TIMEMAX
,
4674 BASEPROPERTY_TIMEMIN
,
4675 BASEPROPERTY_ENFORCE_FORMAT
,
4677 BASEPROPERTY_HIDEINACTIVESELECTION
,
4678 BASEPROPERTY_WRITING_MODE
,
4679 BASEPROPERTY_CONTEXT_WRITING_MODE
,
4680 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
4682 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
4685 VCLXTimeField::VCLXTimeField()
4689 VCLXTimeField::~VCLXTimeField()
4693 // ::com::sun::star::uno::XInterface
4694 ::com::sun::star::uno::Any
VCLXTimeField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
4696 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
4697 SAL_STATIC_CAST( ::com::sun::star::awt::XTimeField
*, this ) );
4698 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
4701 // ::com::sun::star::lang::XTypeProvider
4702 IMPL_XTYPEPROVIDER_START( VCLXTimeField
)
4703 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTimeField
>* ) NULL
),
4704 VCLXFormattedSpinField::getTypes()
4705 IMPL_XTYPEPROVIDER_END
4707 void VCLXTimeField::setTime( sal_Int32 nTime
) throw(::com::sun::star::uno::RuntimeException
)
4709 ::vos::OGuard
aGuard( GetMutex() );
4711 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4714 pTimeField
->SetTime( nTime
);
4716 // #107218# Call same listeners like VCL would do after user interaction
4717 SetSynthesizingVCLEvent( sal_True
);
4718 pTimeField
->SetModifyFlag();
4719 pTimeField
->Modify();
4720 SetSynthesizingVCLEvent( sal_False
);
4724 sal_Int32
VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException
)
4726 ::vos::OGuard
aGuard( GetMutex() );
4728 sal_Int32 nTime
= 0;
4729 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4731 nTime
= pTimeField
->GetTime().GetTime();
4736 void VCLXTimeField::setMin( sal_Int32 nTime
) throw(::com::sun::star::uno::RuntimeException
)
4738 ::vos::OGuard
aGuard( GetMutex() );
4740 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4742 pTimeField
->SetMin( nTime
);
4745 sal_Int32
VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException
)
4747 ::vos::OGuard
aGuard( GetMutex() );
4749 sal_Int32 nTime
= 0;
4750 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4752 nTime
= pTimeField
->GetMin().GetTime();
4757 void VCLXTimeField::setMax( sal_Int32 nTime
) throw(::com::sun::star::uno::RuntimeException
)
4759 ::vos::OGuard
aGuard( GetMutex() );
4761 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4763 pTimeField
->SetMax( nTime
);
4766 sal_Int32
VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException
)
4768 ::vos::OGuard
aGuard( GetMutex() );
4770 sal_Int32 nTime
= 0;
4771 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4773 nTime
= pTimeField
->GetMax().GetTime();
4778 void VCLXTimeField::setFirst( sal_Int32 nTime
) throw(::com::sun::star::uno::RuntimeException
)
4780 ::vos::OGuard
aGuard( GetMutex() );
4782 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4784 pTimeField
->SetFirst( nTime
);
4787 sal_Int32
VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
4789 ::vos::OGuard
aGuard( GetMutex() );
4791 sal_Int32 nTime
= 0;
4792 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4794 nTime
= pTimeField
->GetFirst().GetTime();
4799 void VCLXTimeField::setLast( sal_Int32 nTime
) throw(::com::sun::star::uno::RuntimeException
)
4801 ::vos::OGuard
aGuard( GetMutex() );
4803 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4805 pTimeField
->SetLast( nTime
);
4808 sal_Int32
VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException
)
4810 ::vos::OGuard
aGuard( GetMutex() );
4812 sal_Int32 nTime
= 0;
4813 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4815 nTime
= pTimeField
->GetLast().GetTime();
4820 void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException
)
4822 ::vos::OGuard
aGuard( GetMutex() );
4824 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4826 pTimeField
->SetEmptyTime();
4829 sal_Bool
VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException
)
4831 ::vos::OGuard
aGuard( GetMutex() );
4833 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4834 return pTimeField
? pTimeField
->IsEmptyTime() : sal_False
;
4837 void VCLXTimeField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
4839 VCLXFormattedSpinField::setStrictFormat( bStrict
);
4842 sal_Bool
VCLXTimeField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
4844 return VCLXFormattedSpinField::isStrictFormat();
4848 void VCLXTimeField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
4850 ::vos::OGuard
aGuard( GetMutex() );
4854 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
4856 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4857 switch ( nPropType
)
4859 case BASEPROPERTY_TIME
:
4863 ((TimeField
*)GetWindow())->EnableEmptyFieldValue( sal_True
);
4864 ((TimeField
*)GetWindow())->SetEmptyFieldValue();
4874 case BASEPROPERTY_TIMEMIN
:
4881 case BASEPROPERTY_TIMEMAX
:
4888 case BASEPROPERTY_EXTTIMEFORMAT
:
4890 sal_Int16 n
= sal_Int16();
4892 ((TimeField
*)GetWindow())->SetExtFormat( (ExtTimeFieldFormat
) n
);
4895 case BASEPROPERTY_ENFORCE_FORMAT
:
4897 sal_Bool
bEnforce( sal_True
);
4898 OSL_VERIFY( Value
>>= bEnforce
);
4899 static_cast< TimeField
* >( GetWindow() )->EnforceValidValue( bEnforce
);
4904 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
4910 ::com::sun::star::uno::Any
VCLXTimeField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
4912 ::vos::OGuard
aGuard( GetMutex() );
4914 ::com::sun::star::uno::Any aProp
;
4917 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4918 switch ( nPropType
)
4920 case BASEPROPERTY_TIME
:
4922 aProp
<<= (sal_Int32
) getTime();
4925 case BASEPROPERTY_TIMEMIN
:
4927 aProp
<<= (sal_Int32
) getMin();
4930 case BASEPROPERTY_TIMEMAX
:
4932 aProp
<<= (sal_Int32
) getMax();
4935 case BASEPROPERTY_ENFORCE_FORMAT
:
4937 aProp
<<= (sal_Bool
)static_cast< TimeField
* >( GetWindow() )->IsEnforceValidValue( );
4942 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
4949 // ----------------------------------------------------
4950 // class VCLXNumericField
4951 // ----------------------------------------------------
4953 void VCLXNumericField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
4955 PushPropertyIds( rIds
,
4957 BASEPROPERTY_BACKGROUNDCOLOR
,
4958 BASEPROPERTY_BORDER
,
4959 BASEPROPERTY_BORDERCOLOR
,
4960 BASEPROPERTY_DECIMALACCURACY
,
4961 BASEPROPERTY_DEFAULTCONTROL
,
4962 BASEPROPERTY_ENABLED
,
4963 BASEPROPERTY_ENABLEVISIBLE
,
4964 BASEPROPERTY_FONTDESCRIPTOR
,
4965 BASEPROPERTY_HELPTEXT
,
4966 BASEPROPERTY_HELPURL
,
4967 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
4968 BASEPROPERTY_PRINTABLE
,
4969 BASEPROPERTY_READONLY
,
4970 BASEPROPERTY_REPEAT
,
4971 BASEPROPERTY_REPEAT_DELAY
,
4973 BASEPROPERTY_STRICTFORMAT
,
4974 BASEPROPERTY_TABSTOP
,
4975 BASEPROPERTY_VALUEMAX_DOUBLE
,
4976 BASEPROPERTY_VALUEMIN_DOUBLE
,
4977 BASEPROPERTY_VALUESTEP_DOUBLE
,
4978 BASEPROPERTY_VALUE_DOUBLE
,
4979 BASEPROPERTY_ENFORCE_FORMAT
,
4980 BASEPROPERTY_HIDEINACTIVESELECTION
,
4981 BASEPROPERTY_WRITING_MODE
,
4982 BASEPROPERTY_CONTEXT_WRITING_MODE
,
4983 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
4985 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
4988 VCLXNumericField::VCLXNumericField()
4992 VCLXNumericField::~VCLXNumericField()
4996 // ::com::sun::star::uno::XInterface
4997 ::com::sun::star::uno::Any
VCLXNumericField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
4999 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
5000 SAL_STATIC_CAST( ::com::sun::star::awt::XNumericField
*, this ) );
5001 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
5004 // ::com::sun::star::lang::XTypeProvider
5005 IMPL_XTYPEPROVIDER_START( VCLXNumericField
)
5006 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XNumericField
>* ) NULL
),
5007 VCLXFormattedSpinField::getTypes()
5008 IMPL_XTYPEPROVIDER_END
5010 void VCLXNumericField::setValue( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5012 ::vos::OGuard
aGuard( GetMutex() );
5014 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5015 if ( pNumericFormatter
)
5017 // z.B. 105, 2 Digits => 1,05
5018 // ein float 1,05 muss also eine 105 einstellen...
5019 pNumericFormatter
->SetValue(
5020 (long)ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() ) );
5022 // #107218# Call same listeners like VCL would do after user interaction
5023 Edit
* pEdit
= (Edit
*)GetWindow();
5026 SetSynthesizingVCLEvent( sal_True
);
5027 pEdit
->SetModifyFlag();
5029 SetSynthesizingVCLEvent( sal_False
);
5034 double VCLXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException
)
5036 ::vos::OGuard
aGuard( GetMutex() );
5038 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5039 return pNumericFormatter
5040 ? ImplCalcDoubleValue( (double)pNumericFormatter
->GetValue(), pNumericFormatter
->GetDecimalDigits() )
5044 void VCLXNumericField::setMin( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5046 ::vos::OGuard
aGuard( GetMutex() );
5048 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5049 if ( pNumericFormatter
)
5050 pNumericFormatter
->SetMin(
5051 (long)ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() ) );
5054 double VCLXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException
)
5056 ::vos::OGuard
aGuard( GetMutex() );
5058 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5059 return pNumericFormatter
5060 ? ImplCalcDoubleValue( (double)pNumericFormatter
->GetMin(), pNumericFormatter
->GetDecimalDigits() )
5064 void VCLXNumericField::setMax( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5066 ::vos::OGuard
aGuard( GetMutex() );
5068 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5069 if ( pNumericFormatter
)
5070 pNumericFormatter
->SetMax(
5071 (long)ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() ) );
5074 double VCLXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException
)
5076 ::vos::OGuard
aGuard( GetMutex() );
5078 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5079 return pNumericFormatter
5080 ? ImplCalcDoubleValue( (double)pNumericFormatter
->GetMax(), pNumericFormatter
->GetDecimalDigits() )
5084 void VCLXNumericField::setFirst( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5086 ::vos::OGuard
aGuard( GetMutex() );
5088 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5089 if ( pNumericField
)
5090 pNumericField
->SetFirst(
5091 (long)ImplCalcLongValue( Value
, pNumericField
->GetDecimalDigits() ) );
5094 double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
5096 ::vos::OGuard
aGuard( GetMutex() );
5098 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5099 return pNumericField
5100 ? ImplCalcDoubleValue( (double)pNumericField
->GetFirst(), pNumericField
->GetDecimalDigits() )
5104 void VCLXNumericField::setLast( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5106 ::vos::OGuard
aGuard( GetMutex() );
5108 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5109 if ( pNumericField
)
5110 pNumericField
->SetLast(
5111 (long)ImplCalcLongValue( Value
, pNumericField
->GetDecimalDigits() ) );
5114 double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
)
5116 ::vos::OGuard
aGuard( GetMutex() );
5118 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5119 return pNumericField
5120 ? ImplCalcDoubleValue( (double)pNumericField
->GetLast(), pNumericField
->GetDecimalDigits() )
5124 void VCLXNumericField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
5126 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5129 sal_Bool
VCLXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
5131 return VCLXFormattedSpinField::isStrictFormat();
5135 void VCLXNumericField::setSpinSize( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5137 ::vos::OGuard
aGuard( GetMutex() );
5139 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5140 if ( pNumericField
)
5141 pNumericField
->SetSpinSize(
5142 (long)ImplCalcLongValue( Value
, pNumericField
->GetDecimalDigits() ) );
5145 double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
)
5147 ::vos::OGuard
aGuard( GetMutex() );
5149 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5150 return pNumericField
5151 ? ImplCalcDoubleValue( (double)pNumericField
->GetSpinSize(), pNumericField
->GetDecimalDigits() )
5155 void VCLXNumericField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
)
5157 ::vos::OGuard
aGuard( GetMutex() );
5159 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5160 if ( pNumericFormatter
)
5162 double n
= getValue();
5163 pNumericFormatter
->SetDecimalDigits( Value
);
5168 sal_Int16
VCLXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
)
5170 ::vos::OGuard
aGuard( GetMutex() );
5172 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5173 return pNumericFormatter
? pNumericFormatter
->GetDecimalDigits() : 0;
5176 void VCLXNumericField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
5178 ::vos::OGuard
aGuard( GetMutex() );
5182 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
5184 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5185 switch ( nPropType
)
5187 case BASEPROPERTY_VALUE_DOUBLE
:
5191 ((NumericField
*)GetWindow())->EnableEmptyFieldValue( sal_True
);
5192 ((NumericField
*)GetWindow())->SetEmptyFieldValue();
5202 case BASEPROPERTY_VALUEMIN_DOUBLE
:
5209 case BASEPROPERTY_VALUEMAX_DOUBLE
:
5216 case BASEPROPERTY_VALUESTEP_DOUBLE
:
5223 case BASEPROPERTY_DECIMALACCURACY
:
5225 sal_Int16 n
= sal_Int16();
5227 setDecimalDigits( n
);
5230 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5232 sal_Bool b
= sal_Bool();
5234 ((NumericField
*)GetWindow())->SetUseThousandSep( b
);
5239 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5245 ::com::sun::star::uno::Any
VCLXNumericField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
5247 ::vos::OGuard
aGuard( GetMutex() );
5249 ::com::sun::star::uno::Any aProp
;
5250 FormatterBase
* pFormatter
= GetFormatter();
5253 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5254 switch ( nPropType
)
5256 case BASEPROPERTY_VALUE_DOUBLE
:
5258 aProp
<<= (double) getValue();
5261 case BASEPROPERTY_VALUEMIN_DOUBLE
:
5263 aProp
<<= (double) getMin();
5266 case BASEPROPERTY_VALUEMAX_DOUBLE
:
5268 aProp
<<= (double) getMax();
5271 case BASEPROPERTY_VALUESTEP_DOUBLE
:
5273 aProp
<<= (double) getSpinSize();
5276 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5278 aProp
<<= (sal_Bool
) ((NumericField
*)GetWindow())->IsUseThousandSep();
5283 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
5291 // ----------------------------------------------------
5292 // class VCLXMetricField
5293 // ----------------------------------------------------
5295 void VCLXMetricField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
5297 PushPropertyIds( rIds
,
5299 BASEPROPERTY_BACKGROUNDCOLOR
,
5300 BASEPROPERTY_BORDER
,
5301 BASEPROPERTY_BORDERCOLOR
,
5302 BASEPROPERTY_DECIMALACCURACY
,
5303 BASEPROPERTY_DEFAULTCONTROL
,
5304 BASEPROPERTY_ENABLED
,
5305 BASEPROPERTY_ENABLEVISIBLE
,
5306 BASEPROPERTY_FONTDESCRIPTOR
,
5307 BASEPROPERTY_HELPTEXT
,
5308 BASEPROPERTY_HELPURL
,
5309 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
5310 BASEPROPERTY_PRINTABLE
,
5311 BASEPROPERTY_READONLY
,
5312 BASEPROPERTY_REPEAT
,
5313 BASEPROPERTY_REPEAT_DELAY
,
5315 BASEPROPERTY_STRICTFORMAT
,
5316 BASEPROPERTY_TABSTOP
,
5317 BASEPROPERTY_ENFORCE_FORMAT
,
5318 BASEPROPERTY_HIDEINACTIVESELECTION
,
5320 BASEPROPERTY_CUSTOMUNITTEXT
,
5321 BASEPROPERTY_WRITING_MODE
,
5322 BASEPROPERTY_CONTEXT_WRITING_MODE
,
5323 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
5325 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
5328 VCLXMetricField::VCLXMetricField()
5332 VCLXMetricField::~VCLXMetricField()
5336 MetricFormatter
*VCLXMetricField::GetMetricFormatter() throw(::com::sun::star::uno::RuntimeException
)
5338 MetricFormatter
*pFormatter
= (MetricFormatter
*) GetFormatter();
5340 throw ::com::sun::star::uno::RuntimeException();
5344 MetricField
*VCLXMetricField::GetMetricField() throw(::com::sun::star::uno::RuntimeException
)
5346 MetricField
*pField
= (MetricField
*) GetWindow();
5348 throw ::com::sun::star::uno::RuntimeException();
5352 // ::com::sun::star::uno::XInterface
5353 ::com::sun::star::uno::Any
VCLXMetricField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
5355 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
5356 SAL_STATIC_CAST( ::com::sun::star::awt::XMetricField
*, this ) );
5357 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
5360 // ::com::sun::star::lang::XTypeProvider
5361 IMPL_XTYPEPROVIDER_START( VCLXMetricField
)
5362 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMetricField
>* ) NULL
),
5363 VCLXFormattedSpinField::getTypes()
5364 IMPL_XTYPEPROVIDER_END
5367 #define MetricUnitUnoToVcl(a) ((FieldUnit)(a))
5369 #define METRIC_MAP_PAIR(method,parent) \
5370 sal_Int64 VCLXMetricField::get##method( sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
5372 ::vos::OGuard aGuard( GetMutex() ); \
5373 return GetMetric##parent()->Get##method( MetricUnitUnoToVcl( nUnit ) ); \
5375 void VCLXMetricField::set##method( sal_Int64 nValue, sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
5377 ::vos::OGuard aGuard( GetMutex() ); \
5378 GetMetric##parent()->Set##method( nValue, MetricUnitUnoToVcl( nUnit ) ); \
5381 METRIC_MAP_PAIR(Min
, Formatter
)
5382 METRIC_MAP_PAIR(Max
, Formatter
)
5383 METRIC_MAP_PAIR(First
, Field
)
5384 METRIC_MAP_PAIR(Last
, Field
)
5386 #undef METRIC_MAP_PAIR
5388 ::sal_Int64
VCLXMetricField::getValue( ::sal_Int16 nUnit
) throw (::com::sun::star::uno::RuntimeException
)
5390 ::vos::OGuard
aGuard( GetMutex() );
5391 return GetMetricFormatter()->GetValue( MetricUnitUnoToVcl( nUnit
) );
5394 ::sal_Int64
VCLXMetricField::getCorrectedValue( ::sal_Int16 nUnit
) throw (::com::sun::star::uno::RuntimeException
)
5396 ::vos::OGuard
aGuard( GetMutex() );
5397 return GetMetricFormatter()->GetCorrectedValue( MetricUnitUnoToVcl( nUnit
) );
5400 // FIXME: acute cut/paste evilness - move this to the parent Edit class ?
5401 void VCLXMetricField::CallListeners()
5403 // #107218# Call same listeners like VCL would do after user interaction
5404 Edit
* pEdit
= (Edit
*)GetWindow();
5407 SetSynthesizingVCLEvent( sal_True
);
5408 pEdit
->SetModifyFlag();
5410 SetSynthesizingVCLEvent( sal_False
);
5414 void VCLXMetricField::setValue( ::sal_Int64 Value
, ::sal_Int16 Unit
) throw (::com::sun::star::uno::RuntimeException
)
5416 ::vos::OGuard
aGuard( GetMutex() );
5417 GetMetricFormatter()->SetValue( Value
, MetricUnitUnoToVcl( Unit
) );
5421 void VCLXMetricField::setUserValue( ::sal_Int64 Value
, ::sal_Int16 Unit
) throw (::com::sun::star::uno::RuntimeException
)
5423 ::vos::OGuard
aGuard( GetMutex() );
5424 GetMetricFormatter()->SetUserValue( Value
, MetricUnitUnoToVcl( Unit
) );
5428 void VCLXMetricField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
5430 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5433 sal_Bool
VCLXMetricField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
5435 return VCLXFormattedSpinField::isStrictFormat();
5438 void VCLXMetricField::setSpinSize( sal_Int64 Value
) throw(::com::sun::star::uno::RuntimeException
)
5440 ::vos::OGuard
aGuard( GetMutex() );
5441 GetMetricField()->SetSpinSize( Value
);
5444 sal_Int64
VCLXMetricField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
)
5446 ::vos::OGuard
aGuard( GetMutex() );
5447 return GetMetricField()->GetSpinSize();
5450 void VCLXMetricField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
)
5452 ::vos::OGuard
aGuard( GetMutex() );
5453 GetMetricFormatter()->SetDecimalDigits( Value
);
5456 sal_Int16
VCLXMetricField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
)
5458 ::vos::OGuard
aGuard( GetMutex() );
5460 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5461 return pNumericFormatter
? pNumericFormatter
->GetDecimalDigits() : 0;
5464 void VCLXMetricField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
5466 ::vos::OGuard
aGuard( GetMutex() );
5470 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5471 switch ( nPropType
)
5473 case BASEPROPERTY_DECIMALACCURACY
:
5477 setDecimalDigits( n
);
5480 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5482 sal_Bool b
= sal_False
;
5484 ((NumericField
*)GetWindow())->SetUseThousandSep( b
);
5487 case BASEPROPERTY_UNIT
:
5489 sal_uInt16 nVal
= 0;
5490 if ( Value
>>= nVal
)
5491 ((MetricField
*)GetWindow())->SetUnit( (FieldUnit
) nVal
);
5494 case BASEPROPERTY_CUSTOMUNITTEXT
:
5497 if ( Value
>>= aStr
)
5498 ((MetricField
*)GetWindow())->SetCustomUnitText( aStr
);
5503 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5510 ::com::sun::star::uno::Any
VCLXMetricField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
5512 ::vos::OGuard
aGuard( GetMutex() );
5514 ::com::sun::star::uno::Any aProp
;
5515 FormatterBase
* pFormatter
= GetFormatter();
5518 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5519 switch ( nPropType
)
5521 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5522 aProp
<<= (sal_Bool
) ((NumericField
*)GetWindow())->IsUseThousandSep();
5524 case BASEPROPERTY_UNIT
:
5525 aProp
<<= (sal_uInt16
) ((MetricField
*)GetWindow())->GetUnit();
5527 case BASEPROPERTY_CUSTOMUNITTEXT
:
5528 aProp
<<= rtl::OUString (((MetricField
*)GetWindow())->GetCustomUnitText());
5532 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
5541 // ----------------------------------------------------
5542 // class VCLXCurrencyField
5543 // ----------------------------------------------------
5545 void VCLXCurrencyField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
5547 PushPropertyIds( rIds
,
5549 BASEPROPERTY_BACKGROUNDCOLOR
,
5550 BASEPROPERTY_BORDER
,
5551 BASEPROPERTY_BORDERCOLOR
,
5552 BASEPROPERTY_CURRENCYSYMBOL
,
5553 BASEPROPERTY_CURSYM_POSITION
,
5554 BASEPROPERTY_DECIMALACCURACY
,
5555 BASEPROPERTY_DEFAULTCONTROL
,
5556 BASEPROPERTY_ENABLED
,
5557 BASEPROPERTY_ENABLEVISIBLE
,
5558 BASEPROPERTY_FONTDESCRIPTOR
,
5559 BASEPROPERTY_HELPTEXT
,
5560 BASEPROPERTY_HELPURL
,
5561 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
5562 BASEPROPERTY_PRINTABLE
,
5563 BASEPROPERTY_READONLY
,
5564 BASEPROPERTY_REPEAT
,
5565 BASEPROPERTY_REPEAT_DELAY
,
5567 BASEPROPERTY_STRICTFORMAT
,
5568 BASEPROPERTY_TABSTOP
,
5569 BASEPROPERTY_VALUEMAX_DOUBLE
,
5570 BASEPROPERTY_VALUEMIN_DOUBLE
,
5571 BASEPROPERTY_VALUESTEP_DOUBLE
,
5572 BASEPROPERTY_VALUE_DOUBLE
,
5573 BASEPROPERTY_ENFORCE_FORMAT
,
5574 BASEPROPERTY_HIDEINACTIVESELECTION
,
5575 BASEPROPERTY_WRITING_MODE
,
5576 BASEPROPERTY_CONTEXT_WRITING_MODE
,
5577 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
5579 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
5582 VCLXCurrencyField::VCLXCurrencyField()
5586 VCLXCurrencyField::~VCLXCurrencyField()
5590 // ::com::sun::star::uno::XInterface
5591 ::com::sun::star::uno::Any
VCLXCurrencyField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
5593 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
5594 SAL_STATIC_CAST( ::com::sun::star::awt::XCurrencyField
*, this ) );
5595 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
5598 // ::com::sun::star::lang::XTypeProvider
5599 IMPL_XTYPEPROVIDER_START( VCLXCurrencyField
)
5600 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XCurrencyField
>* ) NULL
),
5601 VCLXFormattedSpinField::getTypes()
5602 IMPL_XTYPEPROVIDER_END
5604 void VCLXCurrencyField::setValue( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5606 ::vos::OGuard
aGuard( GetMutex() );
5608 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5609 if ( pCurrencyFormatter
)
5611 // z.B. 105, 2 Digits => 1,05
5612 // ein float 1,05 muss also eine 105 einstellen...
5613 pCurrencyFormatter
->SetValue(
5614 ImplCalcLongValue( Value
, pCurrencyFormatter
->GetDecimalDigits() ) );
5616 // #107218# Call same listeners like VCL would do after user interaction
5617 Edit
* pEdit
= (Edit
*)GetWindow();
5620 SetSynthesizingVCLEvent( sal_True
);
5621 pEdit
->SetModifyFlag();
5623 SetSynthesizingVCLEvent( sal_False
);
5628 double VCLXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException
)
5630 ::vos::OGuard
aGuard( GetMutex() );
5632 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5633 return pCurrencyFormatter
5634 ? ImplCalcDoubleValue( (double)pCurrencyFormatter
->GetValue(), pCurrencyFormatter
->GetDecimalDigits() )
5638 void VCLXCurrencyField::setMin( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5640 ::vos::OGuard
aGuard( GetMutex() );
5642 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5643 if ( pCurrencyFormatter
)
5644 pCurrencyFormatter
->SetMin(
5645 ImplCalcLongValue( Value
, pCurrencyFormatter
->GetDecimalDigits() ) );
5648 double VCLXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException
)
5650 ::vos::OGuard
aGuard( GetMutex() );
5652 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5653 return pCurrencyFormatter
5654 ? ImplCalcDoubleValue( (double)pCurrencyFormatter
->GetMin(), pCurrencyFormatter
->GetDecimalDigits() )
5658 void VCLXCurrencyField::setMax( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5660 ::vos::OGuard
aGuard( GetMutex() );
5662 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5663 if ( pCurrencyFormatter
)
5664 pCurrencyFormatter
->SetMax(
5665 ImplCalcLongValue( Value
, pCurrencyFormatter
->GetDecimalDigits() ) );
5668 double VCLXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException
)
5670 ::vos::OGuard
aGuard( GetMutex() );
5672 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5673 return pCurrencyFormatter
5674 ? ImplCalcDoubleValue( (double)pCurrencyFormatter
->GetMax(), pCurrencyFormatter
->GetDecimalDigits() )
5678 void VCLXCurrencyField::setFirst( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5680 ::vos::OGuard
aGuard( GetMutex() );
5682 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5683 if ( pCurrencyField
)
5684 pCurrencyField
->SetFirst(
5685 ImplCalcLongValue( Value
, pCurrencyField
->GetDecimalDigits() ) );
5688 double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
5690 ::vos::OGuard
aGuard( GetMutex() );
5692 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5693 return pCurrencyField
5694 ? ImplCalcDoubleValue( (double)pCurrencyField
->GetFirst(), pCurrencyField
->GetDecimalDigits() )
5698 void VCLXCurrencyField::setLast( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5700 ::vos::OGuard
aGuard( GetMutex() );
5702 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5703 if ( pCurrencyField
)
5704 pCurrencyField
->SetLast(
5705 ImplCalcLongValue( Value
, pCurrencyField
->GetDecimalDigits() ) );
5708 double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException
)
5710 ::vos::OGuard
aGuard( GetMutex() );
5712 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5713 return pCurrencyField
5714 ? ImplCalcDoubleValue( (double)pCurrencyField
->GetLast(), pCurrencyField
->GetDecimalDigits() )
5718 void VCLXCurrencyField::setSpinSize( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5720 ::vos::OGuard
aGuard( GetMutex() );
5722 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5723 if ( pCurrencyField
)
5724 pCurrencyField
->SetSpinSize(
5725 ImplCalcLongValue( Value
, pCurrencyField
->GetDecimalDigits() ) );
5728 double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
)
5730 ::vos::OGuard
aGuard( GetMutex() );
5732 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5733 return pCurrencyField
5734 ? ImplCalcDoubleValue( (double)pCurrencyField
->GetSpinSize(), pCurrencyField
->GetDecimalDigits() )
5738 void VCLXCurrencyField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
5740 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5743 sal_Bool
VCLXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
5745 return VCLXFormattedSpinField::isStrictFormat();
5749 void VCLXCurrencyField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
)
5751 ::vos::OGuard
aGuard( GetMutex() );
5753 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5754 if ( pCurrencyFormatter
)
5756 double n
= getValue();
5757 pCurrencyFormatter
->SetDecimalDigits( Value
);
5762 sal_Int16
VCLXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
)
5764 ::vos::OGuard
aGuard( GetMutex() );
5766 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5767 return pCurrencyFormatter
? pCurrencyFormatter
->GetDecimalDigits() : 0;
5770 void VCLXCurrencyField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
5772 ::vos::OGuard
aGuard( GetMutex() );
5776 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
5778 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5779 switch ( nPropType
)
5781 case BASEPROPERTY_VALUE_DOUBLE
:
5785 ((LongCurrencyField
*)GetWindow())->EnableEmptyFieldValue( sal_True
);
5786 ((LongCurrencyField
*)GetWindow())->SetEmptyFieldValue();
5796 case BASEPROPERTY_VALUEMIN_DOUBLE
:
5803 case BASEPROPERTY_VALUEMAX_DOUBLE
:
5810 case BASEPROPERTY_VALUESTEP_DOUBLE
:
5817 case BASEPROPERTY_DECIMALACCURACY
:
5819 sal_Int16 n
= sal_Int16();
5821 setDecimalDigits( n
);
5824 case BASEPROPERTY_CURRENCYSYMBOL
:
5826 ::rtl::OUString aString
;
5827 if ( Value
>>= aString
)
5828 ((LongCurrencyField
*)GetWindow())->SetCurrencySymbol( aString
);
5831 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5833 sal_Bool b
= sal_Bool();
5835 ((LongCurrencyField
*)GetWindow())->SetUseThousandSep( b
);
5840 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5846 ::com::sun::star::uno::Any
VCLXCurrencyField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
5848 ::vos::OGuard
aGuard( GetMutex() );
5850 ::com::sun::star::uno::Any aProp
;
5851 FormatterBase
* pFormatter
= GetFormatter();
5854 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5855 switch ( nPropType
)
5857 case BASEPROPERTY_VALUE_DOUBLE
:
5859 aProp
<<= (double) getValue();
5862 case BASEPROPERTY_VALUEMIN_DOUBLE
:
5864 aProp
<<= (double) getMin();
5867 case BASEPROPERTY_VALUEMAX_DOUBLE
:
5869 aProp
<<= (double) getMax();
5872 case BASEPROPERTY_VALUESTEP_DOUBLE
:
5874 aProp
<<= (double) getSpinSize();
5877 case BASEPROPERTY_CURRENCYSYMBOL
:
5879 aProp
<<= ::rtl::OUString( ((LongCurrencyField
*)GetWindow())->GetCurrencySymbol() );
5882 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5884 aProp
<<= (sal_Bool
) ((LongCurrencyField
*)GetWindow())->IsUseThousandSep();
5889 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
5896 // ----------------------------------------------------
5897 // class VCLXPatternField
5898 // ----------------------------------------------------
5900 void VCLXPatternField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
5902 PushPropertyIds( rIds
,
5904 BASEPROPERTY_BACKGROUNDCOLOR
,
5905 BASEPROPERTY_BORDER
,
5906 BASEPROPERTY_BORDERCOLOR
,
5907 BASEPROPERTY_DEFAULTCONTROL
,
5908 BASEPROPERTY_EDITMASK
,
5909 BASEPROPERTY_ENABLED
,
5910 BASEPROPERTY_ENABLEVISIBLE
,
5911 BASEPROPERTY_FONTDESCRIPTOR
,
5912 BASEPROPERTY_HELPTEXT
,
5913 BASEPROPERTY_HELPURL
,
5914 BASEPROPERTY_LITERALMASK
,
5915 BASEPROPERTY_MAXTEXTLEN
,
5916 BASEPROPERTY_PRINTABLE
,
5917 BASEPROPERTY_READONLY
,
5918 BASEPROPERTY_STRICTFORMAT
,
5919 BASEPROPERTY_TABSTOP
,
5921 BASEPROPERTY_HIDEINACTIVESELECTION
,
5922 BASEPROPERTY_WRITING_MODE
,
5923 BASEPROPERTY_CONTEXT_WRITING_MODE
,
5924 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
5926 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
5929 VCLXPatternField::VCLXPatternField()
5933 VCLXPatternField::~VCLXPatternField()
5937 // ::com::sun::star::uno::XInterface
5938 ::com::sun::star::uno::Any
VCLXPatternField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
5940 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
5941 SAL_STATIC_CAST( ::com::sun::star::awt::XPatternField
*, this ) );
5942 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
5945 // ::com::sun::star::lang::XTypeProvider
5946 IMPL_XTYPEPROVIDER_START( VCLXPatternField
)
5947 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPatternField
>* ) NULL
),
5948 VCLXFormattedSpinField::getTypes()
5949 IMPL_XTYPEPROVIDER_END
5951 void VCLXPatternField::setMasks( const ::rtl::OUString
& EditMask
, const ::rtl::OUString
& LiteralMask
) throw(::com::sun::star::uno::RuntimeException
)
5953 ::vos::OGuard
aGuard( GetMutex() );
5955 PatternField
* pPatternField
= (PatternField
*) GetWindow();
5956 if ( pPatternField
)
5958 pPatternField
->SetMask( ByteString( UniString( EditMask
), RTL_TEXTENCODING_ASCII_US
), LiteralMask
);
5962 void VCLXPatternField::getMasks( ::rtl::OUString
& EditMask
, ::rtl::OUString
& LiteralMask
) throw(::com::sun::star::uno::RuntimeException
)
5964 ::vos::OGuard
aGuard( GetMutex() );
5966 PatternField
* pPatternField
= (PatternField
*) GetWindow();
5967 if ( pPatternField
)
5969 EditMask
= String( pPatternField
->GetEditMask(), RTL_TEXTENCODING_ASCII_US
);
5970 LiteralMask
= pPatternField
->GetLiteralMask();
5974 void VCLXPatternField::setString( const ::rtl::OUString
& Str
) throw(::com::sun::star::uno::RuntimeException
)
5976 ::vos::OGuard
aGuard( GetMutex() );
5978 PatternField
* pPatternField
= (PatternField
*) GetWindow();
5979 if ( pPatternField
)
5981 pPatternField
->SetString( Str
);
5985 ::rtl::OUString
VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException
)
5987 ::vos::OGuard
aGuard( GetMutex() );
5989 ::rtl::OUString aString
;
5990 PatternField
* pPatternField
= (PatternField
*) GetWindow();
5991 if ( pPatternField
)
5992 aString
= pPatternField
->GetString();
5996 void VCLXPatternField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
5998 VCLXFormattedSpinField::setStrictFormat( bStrict
);
6001 sal_Bool
VCLXPatternField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
6003 return VCLXFormattedSpinField::isStrictFormat();
6006 void VCLXPatternField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
6008 ::vos::OGuard
aGuard( GetMutex() );
6012 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
6013 switch ( nPropType
)
6015 case BASEPROPERTY_EDITMASK
:
6016 case BASEPROPERTY_LITERALMASK
:
6018 ::rtl::OUString aString
;
6019 if ( Value
>>= aString
)
6021 ::rtl::OUString aEditMask
, aLiteralMask
;
6022 getMasks( aEditMask
, aLiteralMask
);
6023 if ( nPropType
== BASEPROPERTY_EDITMASK
)
6024 aEditMask
= aString
;
6026 aLiteralMask
= aString
;
6027 setMasks( aEditMask
, aLiteralMask
);
6033 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
6039 ::com::sun::star::uno::Any
VCLXPatternField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
6041 ::vos::OGuard
aGuard( GetMutex() );
6043 ::com::sun::star::uno::Any aProp
;
6046 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
6047 switch ( nPropType
)
6049 case BASEPROPERTY_EDITMASK
:
6050 case BASEPROPERTY_LITERALMASK
:
6052 ::rtl::OUString aEditMask
, aLiteralMask
;
6053 getMasks( aEditMask
, aLiteralMask
);
6054 if ( nPropType
== BASEPROPERTY_EDITMASK
)
6055 aProp
<<= aEditMask
;
6057 aProp
<<= aLiteralMask
;
6062 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
6069 // ----------------------------------------------------
6070 // class VCLXToolBox
6071 // ----------------------------------------------------
6072 VCLXToolBox::VCLXToolBox()
6076 VCLXToolBox::~VCLXToolBox()
6080 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXToolBox::CreateAccessibleContext()
6082 return getAccessibleFactory().createAccessibleContext( this );