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 #ifndef _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_ 29*cdf0e10cSrcweir #define _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "commoncontrol.hxx" 32*cdf0e10cSrcweir #define _ZFORLIST_DECLARE_TABLE 33*cdf0e10cSrcweir #include <svtools/fmtfield.hxx> 34*cdf0e10cSrcweir #include <svtools/fileurlbox.hxx> 35*cdf0e10cSrcweir #include "standardcontrol.hxx" 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir class SvNumberFormatsSupplierObj; 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir //............................................................................ 40*cdf0e10cSrcweir namespace pcr 41*cdf0e10cSrcweir { 42*cdf0e10cSrcweir //............................................................................ 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir //======================================================================== 45*cdf0e10cSrcweir //= NumberFormatSampleField 46*cdf0e10cSrcweir //======================================================================== 47*cdf0e10cSrcweir class NumberFormatSampleField : public ControlWindow< FormattedField > 48*cdf0e10cSrcweir { 49*cdf0e10cSrcweir private: 50*cdf0e10cSrcweir typedef ControlWindow< FormattedField > BaseClass; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir public: 53*cdf0e10cSrcweir NumberFormatSampleField( Window* _pParent, WinBits _nStyle ) 54*cdf0e10cSrcweir :BaseClass( _pParent, _nStyle ) 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir } 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir void SetFormatSupplier( const SvNumberFormatsSupplierObj* pSupplier ); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir protected: 61*cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 62*cdf0e10cSrcweir }; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir //======================================================================== 65*cdf0e10cSrcweir //= OFormatSampleControl 66*cdf0e10cSrcweir //======================================================================== 67*cdf0e10cSrcweir typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, NumberFormatSampleField > OFormatSampleControl_Base; 68*cdf0e10cSrcweir class OFormatSampleControl : public OFormatSampleControl_Base 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir public: 71*cdf0e10cSrcweir OFormatSampleControl( Window* pParent, WinBits nWinStyle ); 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir // XPropertyControl 74*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); 75*cdf0e10cSrcweir virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); 76*cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir inline void SetFormatSupplier( const SvNumberFormatsSupplierObj* _pSupplier ) 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir getTypedControlWindow()->SetFormatSupplier( _pSupplier ); 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir /** returns the default preview value for the given format key 84*cdf0e10cSrcweir * 85*cdf0e10cSrcweir * \param _pNF the number formatter 86*cdf0e10cSrcweir * \param _nFormatKey the format key 87*cdf0e10cSrcweir * \return current date or time or the value 1234.56789 88*cdf0e10cSrcweir */ 89*cdf0e10cSrcweir static double getPreviewValue(SvNumberFormatter* _pNF,sal_Int32 _nFormatKey); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir private: 92*cdf0e10cSrcweir static double getPreviewValue( const SvNumberformat& i_rEntry ); 93*cdf0e10cSrcweir }; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir //======================================================================== 96*cdf0e10cSrcweir //= FormatDescription 97*cdf0e10cSrcweir //======================================================================== 98*cdf0e10cSrcweir struct FormatDescription 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir SvNumberFormatsSupplierObj* pSupplier; 101*cdf0e10cSrcweir sal_Int32 nKey; 102*cdf0e10cSrcweir }; 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir //======================================================================== 105*cdf0e10cSrcweir //= OFormattedNumericControl 106*cdf0e10cSrcweir //======================================================================== 107*cdf0e10cSrcweir typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< FormattedField > > OFormattedNumericControl_Base; 108*cdf0e10cSrcweir class OFormattedNumericControl : public OFormattedNumericControl_Base 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir private: 111*cdf0e10cSrcweir sal_Int32 m_nLastDecimalDigits; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir public: 114*cdf0e10cSrcweir OFormattedNumericControl( Window* pParent, WinBits nWinStyle = WB_TABSTOP); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir // XPropertyControl 117*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); 118*cdf0e10cSrcweir virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); 119*cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir void SetFormatDescription( const FormatDescription& rDesc ); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir // make some FormattedField methods available 124*cdf0e10cSrcweir void SetDecimalDigits(sal_uInt16 nPrecision) { getTypedControlWindow()->SetDecimalDigits(nPrecision); m_nLastDecimalDigits = nPrecision; } 125*cdf0e10cSrcweir void SetDefaultValue(double dDef) { getTypedControlWindow()->SetDefaultValue(dDef); } 126*cdf0e10cSrcweir void EnableEmptyField(sal_Bool bEnable) { getTypedControlWindow()->EnableEmptyField(bEnable); } 127*cdf0e10cSrcweir void SetThousandsSep(sal_Bool bEnable) { getTypedControlWindow()->SetThousandsSep(bEnable); } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir protected: 130*cdf0e10cSrcweir ~OFormattedNumericControl(); 131*cdf0e10cSrcweir }; 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir //======================================================================== 134*cdf0e10cSrcweir //= OFileUrlControl 135*cdf0e10cSrcweir //======================================================================== 136*cdf0e10cSrcweir typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< ::svt::FileURLBox > > OFileUrlControl_Base; 137*cdf0e10cSrcweir class OFileUrlControl : public OFileUrlControl_Base 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir public: 140*cdf0e10cSrcweir OFileUrlControl( Window* pParent, WinBits nWinStyle ); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir // XPropertyControl 143*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); 144*cdf0e10cSrcweir virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); 145*cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir protected: 148*cdf0e10cSrcweir ~OFileUrlControl(); 149*cdf0e10cSrcweir }; 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir //======================================================================== 152*cdf0e10cSrcweir //= OTimeDurationControl 153*cdf0e10cSrcweir //======================================================================== 154*cdf0e10cSrcweir class OTimeDurationControl : public ONumericControl 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir public: 157*cdf0e10cSrcweir OTimeDurationControl( ::Window* pParent, WinBits nWinStyle ); 158*cdf0e10cSrcweir ~OTimeDurationControl(); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir // XPropertyControl 161*cdf0e10cSrcweir ::sal_Int16 SAL_CALL getControlType() throw (::com::sun::star::uno::RuntimeException); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir private: 164*cdf0e10cSrcweir DECL_LINK( OnCustomConvert, MetricField* ); 165*cdf0e10cSrcweir }; 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir //............................................................................ 168*cdf0e10cSrcweir } // namespace pcr 169*cdf0e10cSrcweir //............................................................................ 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir #endif // _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_ 172*cdf0e10cSrcweir 173