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_extensions.hxx" 30*cdf0e10cSrcweir #include "usercontrol.hxx" 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir /** === begin UNO includes === **/ 33*cdf0e10cSrcweir #include <com/sun/star/inspection/PropertyControlType.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/inspection/PropertyControlType.hpp> 35*cdf0e10cSrcweir /** === end UNO includes === **/ 36*cdf0e10cSrcweir #include <svl/numuno.hxx> 37*cdf0e10cSrcweir #include <rtl/math.hxx> 38*cdf0e10cSrcweir #include <tools/debug.hxx> 39*cdf0e10cSrcweir #include <svl/zformat.hxx> 40*cdf0e10cSrcweir #include <connectivity/dbconversion.hxx> 41*cdf0e10cSrcweir #include <com/sun/star/util/Time.hpp> 42*cdf0e10cSrcweir #include "modulepcr.hxx" 43*cdf0e10cSrcweir #include "propresid.hrc" 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir //............................................................................ 46*cdf0e10cSrcweir namespace pcr 47*cdf0e10cSrcweir { 48*cdf0e10cSrcweir //............................................................................ 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir /** === begin UNO using === **/ 51*cdf0e10cSrcweir using ::com::sun::star::uno::Any; 52*cdf0e10cSrcweir using ::com::sun::star::uno::Type; 53*cdf0e10cSrcweir using ::com::sun::star::beans::IllegalTypeException; 54*cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException; 55*cdf0e10cSrcweir /** === end UNO using === **/ 56*cdf0e10cSrcweir namespace PropertyControlType = ::com::sun::star::inspection::PropertyControlType; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir //================================================================== 59*cdf0e10cSrcweir // NumberFormatSampleField 60*cdf0e10cSrcweir //================================================================== 61*cdf0e10cSrcweir //------------------------------------------------------------------ 62*cdf0e10cSrcweir long NumberFormatSampleField::PreNotify( NotifyEvent& rNEvt ) 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir // want to handle two keys myself : Del/Backspace should empty the window (setting my prop to "standard" this way) 65*cdf0e10cSrcweir if (EVENT_KEYINPUT == rNEvt.GetType()) 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir sal_uInt16 nKey = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir if ((KEY_DELETE == nKey) || (KEY_BACKSPACE == nKey)) 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir SetText( String() ); 72*cdf0e10cSrcweir if ( m_pHelper ) 73*cdf0e10cSrcweir m_pHelper->ModifiedHdl( this ); 74*cdf0e10cSrcweir return 1; 75*cdf0e10cSrcweir } 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir return BaseClass::PreNotify( rNEvt ); 79*cdf0e10cSrcweir } 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir //------------------------------------------------------------------ 82*cdf0e10cSrcweir void NumberFormatSampleField::SetFormatSupplier( const SvNumberFormatsSupplierObj* pSupplier ) 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir if ( pSupplier ) 85*cdf0e10cSrcweir { 86*cdf0e10cSrcweir TreatAsNumber( sal_True ); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir SvNumberFormatter* pFormatter = pSupplier->GetNumberFormatter(); 89*cdf0e10cSrcweir SetFormatter( pFormatter, sal_True ); 90*cdf0e10cSrcweir SetValue( 1234.56789 ); 91*cdf0e10cSrcweir } 92*cdf0e10cSrcweir else 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir TreatAsNumber( sal_False ); 95*cdf0e10cSrcweir SetFormatter( NULL, sal_True ); 96*cdf0e10cSrcweir SetText( String() ); 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir } 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir //================================================================== 101*cdf0e10cSrcweir // OFormatSampleControl 102*cdf0e10cSrcweir //================================================================== 103*cdf0e10cSrcweir //------------------------------------------------------------------ 104*cdf0e10cSrcweir OFormatSampleControl::OFormatSampleControl( Window* pParent, WinBits nWinStyle ) 105*cdf0e10cSrcweir :OFormatSampleControl_Base( PropertyControlType::Unknown, pParent, nWinStyle ) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir //------------------------------------------------------------------ 110*cdf0e10cSrcweir void SAL_CALL OFormatSampleControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir sal_Int32 nFormatKey = 0; 113*cdf0e10cSrcweir if ( _rValue >>= nFormatKey ) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir // else set the new format key, the text will be reformatted 116*cdf0e10cSrcweir getTypedControlWindow()->SetFormatKey( nFormatKey ); 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir SvNumberFormatter* pNF = getTypedControlWindow()->GetFormatter(); 119*cdf0e10cSrcweir const SvNumberformat* pEntry = pNF->GetEntry( nFormatKey ); 120*cdf0e10cSrcweir OSL_ENSURE( pEntry, "OFormatSampleControl::setValue: invalid format entry!" ); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir const bool bIsTextFormat = ( pEntry && pEntry->IsTextFormat() ); 123*cdf0e10cSrcweir if ( bIsTextFormat ) 124*cdf0e10cSrcweir getTypedControlWindow()->SetText( String( PcrRes( RID_STR_TEXT_FORMAT ) ) ); 125*cdf0e10cSrcweir else 126*cdf0e10cSrcweir getTypedControlWindow()->SetValue( pEntry ? getPreviewValue( *pEntry ) : 1234.56789 ); 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir else 129*cdf0e10cSrcweir getTypedControlWindow()->SetText( String() ); 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir //------------------------------------------------------------------ 132*cdf0e10cSrcweir double OFormatSampleControl::getPreviewValue( const SvNumberformat& i_rEntry ) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir double nValue = 1234.56789; 135*cdf0e10cSrcweir switch ( i_rEntry.GetType() & ~NUMBERFORMAT_DEFINED ) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir case NUMBERFORMAT_DATE: 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir Date aCurrentDate; 140*cdf0e10cSrcweir static ::com::sun::star::util::Date STANDARD_DB_DATE(30,12,1899); 141*cdf0e10cSrcweir nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(static_cast<sal_Int32>(aCurrentDate.GetDate())),STANDARD_DB_DATE); 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir break; 144*cdf0e10cSrcweir case NUMBERFORMAT_TIME: 145*cdf0e10cSrcweir case NUMBERFORMAT_DATETIME: 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir Time aCurrentTime; 148*cdf0e10cSrcweir nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(aCurrentTime.GetTime())); 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir break; 151*cdf0e10cSrcweir default: 152*cdf0e10cSrcweir break; 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir return nValue; 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir //------------------------------------------------------------------ 158*cdf0e10cSrcweir double OFormatSampleControl::getPreviewValue(SvNumberFormatter* _pNF,sal_Int32 _nFormatKey) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir const SvNumberformat* pEntry = _pNF->GetEntry(_nFormatKey); 161*cdf0e10cSrcweir DBG_ASSERT( pEntry, "OFormattedNumericControl::SetFormatDescription: invalid format key!" ); 162*cdf0e10cSrcweir double nValue = 1234.56789; 163*cdf0e10cSrcweir if ( pEntry ) 164*cdf0e10cSrcweir nValue = getPreviewValue( *pEntry ); 165*cdf0e10cSrcweir return nValue; 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir //------------------------------------------------------------------ 168*cdf0e10cSrcweir Any SAL_CALL OFormatSampleControl::getValue() throw (RuntimeException) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir Any aPropValue; 171*cdf0e10cSrcweir if ( getTypedControlWindow()->GetText().Len() ) 172*cdf0e10cSrcweir aPropValue <<= (sal_Int32)getTypedControlWindow()->GetFormatKey(); 173*cdf0e10cSrcweir return aPropValue; 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir //------------------------------------------------------------------ 177*cdf0e10cSrcweir Type SAL_CALL OFormatSampleControl::getValueType() throw (RuntimeException) 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir return ::getCppuType( static_cast< sal_Int32* >( NULL ) ); 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir //================================================================== 183*cdf0e10cSrcweir // class OFormattedNumericControl 184*cdf0e10cSrcweir //================================================================== 185*cdf0e10cSrcweir DBG_NAME(OFormattedNumericControl); 186*cdf0e10cSrcweir //------------------------------------------------------------------ 187*cdf0e10cSrcweir OFormattedNumericControl::OFormattedNumericControl( Window* pParent, WinBits nWinStyle ) 188*cdf0e10cSrcweir :OFormattedNumericControl_Base( PropertyControlType::Unknown, pParent, nWinStyle ) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir DBG_CTOR(OFormattedNumericControl,NULL); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir getTypedControlWindow()->TreatAsNumber(sal_True); 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir m_nLastDecimalDigits = getTypedControlWindow()->GetDecimalDigits(); 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir //------------------------------------------------------------------ 198*cdf0e10cSrcweir OFormattedNumericControl::~OFormattedNumericControl() 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir DBG_DTOR(OFormattedNumericControl,NULL); 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir //------------------------------------------------------------------ 204*cdf0e10cSrcweir void SAL_CALL OFormattedNumericControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir double nValue( 0 ); 207*cdf0e10cSrcweir if ( _rValue >>= nValue ) 208*cdf0e10cSrcweir getTypedControlWindow()->SetValue( nValue ); 209*cdf0e10cSrcweir else 210*cdf0e10cSrcweir getTypedControlWindow()->SetText(String()); 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir //------------------------------------------------------------------ 214*cdf0e10cSrcweir Any SAL_CALL OFormattedNumericControl::getValue() throw (RuntimeException) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir Any aPropValue; 217*cdf0e10cSrcweir if ( getTypedControlWindow()->GetText().Len() ) 218*cdf0e10cSrcweir aPropValue <<= (double)getTypedControlWindow()->GetValue(); 219*cdf0e10cSrcweir return aPropValue; 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir //------------------------------------------------------------------ 223*cdf0e10cSrcweir Type SAL_CALL OFormattedNumericControl::getValueType() throw (RuntimeException) 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir return ::getCppuType( static_cast< double* >( NULL ) ); 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir //------------------------------------------------------------------ 229*cdf0e10cSrcweir void OFormattedNumericControl::SetFormatDescription(const FormatDescription& rDesc) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir sal_Bool bFallback = sal_True; 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir if (rDesc.pSupplier) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir getTypedControlWindow()->TreatAsNumber(sal_True); 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir SvNumberFormatter* pFormatter = rDesc.pSupplier->GetNumberFormatter(); 238*cdf0e10cSrcweir if (pFormatter != getTypedControlWindow()->GetFormatter()) 239*cdf0e10cSrcweir getTypedControlWindow()->SetFormatter(pFormatter, sal_True); 240*cdf0e10cSrcweir getTypedControlWindow()->SetFormatKey(rDesc.nKey); 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir const SvNumberformat* pEntry = getTypedControlWindow()->GetFormatter()->GetEntry(getTypedControlWindow()->GetFormatKey()); 243*cdf0e10cSrcweir DBG_ASSERT( pEntry, "OFormattedNumericControl::SetFormatDescription: invalid format key!" ); 244*cdf0e10cSrcweir if ( pEntry ) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir switch (pEntry->GetType() & ~NUMBERFORMAT_DEFINED) 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir case NUMBERFORMAT_NUMBER: 249*cdf0e10cSrcweir case NUMBERFORMAT_CURRENCY: 250*cdf0e10cSrcweir case NUMBERFORMAT_SCIENTIFIC: 251*cdf0e10cSrcweir case NUMBERFORMAT_FRACTION: 252*cdf0e10cSrcweir case NUMBERFORMAT_PERCENT: 253*cdf0e10cSrcweir m_nLastDecimalDigits = getTypedControlWindow()->GetDecimalDigits(); 254*cdf0e10cSrcweir break; 255*cdf0e10cSrcweir case NUMBERFORMAT_DATETIME: 256*cdf0e10cSrcweir case NUMBERFORMAT_DATE: 257*cdf0e10cSrcweir case NUMBERFORMAT_TIME: 258*cdf0e10cSrcweir m_nLastDecimalDigits = 7; 259*cdf0e10cSrcweir break; 260*cdf0e10cSrcweir default: 261*cdf0e10cSrcweir m_nLastDecimalDigits = 0; 262*cdf0e10cSrcweir break; 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir bFallback = sal_False; 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir if ( bFallback ) 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir getTypedControlWindow()->TreatAsNumber(sal_False); 272*cdf0e10cSrcweir getTypedControlWindow()->SetFormatter(NULL, sal_True); 273*cdf0e10cSrcweir getTypedControlWindow()->SetText(String()); 274*cdf0e10cSrcweir m_nLastDecimalDigits = 0; 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir //======================================================================== 279*cdf0e10cSrcweir //= OFileUrlControl 280*cdf0e10cSrcweir //======================================================================== 281*cdf0e10cSrcweir //------------------------------------------------------------------ 282*cdf0e10cSrcweir OFileUrlControl::OFileUrlControl( Window* pParent, WinBits nWinStyle ) 283*cdf0e10cSrcweir :OFileUrlControl_Base( PropertyControlType::Unknown, pParent, nWinStyle | WB_DROPDOWN ) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir getTypedControlWindow()->SetDropDownLineCount( 10 ); 286*cdf0e10cSrcweir getTypedControlWindow()->SetPlaceHolder( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) ; 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir //------------------------------------------------------------------ 290*cdf0e10cSrcweir OFileUrlControl::~OFileUrlControl() 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir //------------------------------------------------------------------ 295*cdf0e10cSrcweir void SAL_CALL OFileUrlControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir ::rtl::OUString sURL; 298*cdf0e10cSrcweir if ( ( _rValue >>= sURL ) ) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 ) 301*cdf0e10cSrcweir getTypedControlWindow()->DisplayURL( getTypedControlWindow()->GetPlaceHolder() ); 302*cdf0e10cSrcweir else 303*cdf0e10cSrcweir getTypedControlWindow()->DisplayURL( sURL ); 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir else 306*cdf0e10cSrcweir getTypedControlWindow()->SetText( String() ); 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir //------------------------------------------------------------------ 310*cdf0e10cSrcweir Any SAL_CALL OFileUrlControl::getValue() throw (RuntimeException) 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir Any aPropValue; 313*cdf0e10cSrcweir if ( getTypedControlWindow()->GetText().Len() ) 314*cdf0e10cSrcweir aPropValue <<= (::rtl::OUString)getTypedControlWindow()->GetURL(); 315*cdf0e10cSrcweir return aPropValue; 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir //------------------------------------------------------------------ 319*cdf0e10cSrcweir Type SAL_CALL OFileUrlControl::getValueType() throw (RuntimeException) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir return ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ); 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir //======================================================================== 325*cdf0e10cSrcweir //= OTimeDurationControl 326*cdf0e10cSrcweir //======================================================================== 327*cdf0e10cSrcweir //------------------------------------------------------------------ 328*cdf0e10cSrcweir OTimeDurationControl::OTimeDurationControl( ::Window* pParent, WinBits nWinStyle ) 329*cdf0e10cSrcweir :ONumericControl( pParent, nWinStyle ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir getTypedControlWindow()->SetUnit( FUNIT_CUSTOM ); 332*cdf0e10cSrcweir getTypedControlWindow()->SetCustomUnitText( String::CreateFromAscii( " ms" ) ); 333*cdf0e10cSrcweir getTypedControlWindow()->SetCustomConvertHdl( LINK( this, OTimeDurationControl, OnCustomConvert ) ); 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir //------------------------------------------------------------------ 337*cdf0e10cSrcweir OTimeDurationControl::~OTimeDurationControl() 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir //------------------------------------------------------------------ 342*cdf0e10cSrcweir ::sal_Int16 SAL_CALL OTimeDurationControl::getControlType() throw (::com::sun::star::uno::RuntimeException) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir // don't use the base class'es method, it would claim we're a standard control, which 345*cdf0e10cSrcweir // we in fact aren't 346*cdf0e10cSrcweir return PropertyControlType::Unknown; 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir //------------------------------------------------------------------ 350*cdf0e10cSrcweir IMPL_LINK( OTimeDurationControl, OnCustomConvert, MetricField*, /*pField*/ ) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir long nMultiplier = 1; 353*cdf0e10cSrcweir if ( getTypedControlWindow()->GetCurUnitText().EqualsIgnoreCaseAscii( "ms" ) ) 354*cdf0e10cSrcweir nMultiplier = 1; 355*cdf0e10cSrcweir if ( getTypedControlWindow()->GetCurUnitText().EqualsIgnoreCaseAscii( "s" ) ) 356*cdf0e10cSrcweir nMultiplier = 1000; 357*cdf0e10cSrcweir else if ( getTypedControlWindow()->GetCurUnitText().EqualsIgnoreCaseAscii( "m" ) ) 358*cdf0e10cSrcweir nMultiplier = 1000 * 60; 359*cdf0e10cSrcweir else if ( getTypedControlWindow()->GetCurUnitText().EqualsIgnoreCaseAscii( "h" ) ) 360*cdf0e10cSrcweir nMultiplier = 1000 * 60 * 60; 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir getTypedControlWindow()->SetValue( getTypedControlWindow()->GetLastValue() * nMultiplier ); 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir return 0L; 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir //............................................................................ 368*cdf0e10cSrcweir } // namespace pcr 369*cdf0e10cSrcweir //............................................................................ 370*cdf0e10cSrcweir 371