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