1*46dbaceeSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*46dbaceeSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*46dbaceeSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*46dbaceeSAndrew Rist * distributed with this work for additional information 6*46dbaceeSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*46dbaceeSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*46dbaceeSAndrew Rist * "License"); you may not use this file except in compliance 9*46dbaceeSAndrew Rist * with the License. You may obtain a copy of the License at 10*46dbaceeSAndrew Rist * 11*46dbaceeSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*46dbaceeSAndrew Rist * 13*46dbaceeSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*46dbaceeSAndrew Rist * software distributed under the License is distributed on an 15*46dbaceeSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*46dbaceeSAndrew Rist * KIND, either express or implied. See the License for the 17*46dbaceeSAndrew Rist * specific language governing permissions and limitations 18*46dbaceeSAndrew Rist * under the License. 19*46dbaceeSAndrew Rist * 20*46dbaceeSAndrew Rist *************************************************************/ 21*46dbaceeSAndrew Rist 22*46dbaceeSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_ 25cdf0e10cSrcweir #define _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "commoncontrol.hxx" 28cdf0e10cSrcweir #define _ZFORLIST_DECLARE_TABLE 29cdf0e10cSrcweir #include <svtools/fmtfield.hxx> 30cdf0e10cSrcweir #include <svtools/fileurlbox.hxx> 31cdf0e10cSrcweir #include "standardcontrol.hxx" 32cdf0e10cSrcweir 33cdf0e10cSrcweir class SvNumberFormatsSupplierObj; 34cdf0e10cSrcweir 35cdf0e10cSrcweir //............................................................................ 36cdf0e10cSrcweir namespace pcr 37cdf0e10cSrcweir { 38cdf0e10cSrcweir //............................................................................ 39cdf0e10cSrcweir 40cdf0e10cSrcweir //======================================================================== 41cdf0e10cSrcweir //= NumberFormatSampleField 42cdf0e10cSrcweir //======================================================================== 43cdf0e10cSrcweir class NumberFormatSampleField : public ControlWindow< FormattedField > 44cdf0e10cSrcweir { 45cdf0e10cSrcweir private: 46cdf0e10cSrcweir typedef ControlWindow< FormattedField > BaseClass; 47cdf0e10cSrcweir 48cdf0e10cSrcweir public: NumberFormatSampleField(Window * _pParent,WinBits _nStyle)49cdf0e10cSrcweir NumberFormatSampleField( Window* _pParent, WinBits _nStyle ) 50cdf0e10cSrcweir :BaseClass( _pParent, _nStyle ) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir } 53cdf0e10cSrcweir 54cdf0e10cSrcweir void SetFormatSupplier( const SvNumberFormatsSupplierObj* pSupplier ); 55cdf0e10cSrcweir 56cdf0e10cSrcweir protected: 57cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 58cdf0e10cSrcweir }; 59cdf0e10cSrcweir 60cdf0e10cSrcweir //======================================================================== 61cdf0e10cSrcweir //= OFormatSampleControl 62cdf0e10cSrcweir //======================================================================== 63cdf0e10cSrcweir typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, NumberFormatSampleField > OFormatSampleControl_Base; 64cdf0e10cSrcweir class OFormatSampleControl : public OFormatSampleControl_Base 65cdf0e10cSrcweir { 66cdf0e10cSrcweir public: 67cdf0e10cSrcweir OFormatSampleControl( Window* pParent, WinBits nWinStyle ); 68cdf0e10cSrcweir 69cdf0e10cSrcweir // XPropertyControl 70cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); 71cdf0e10cSrcweir virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); 72cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); 73cdf0e10cSrcweir SetFormatSupplier(const SvNumberFormatsSupplierObj * _pSupplier)74cdf0e10cSrcweir inline void SetFormatSupplier( const SvNumberFormatsSupplierObj* _pSupplier ) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir getTypedControlWindow()->SetFormatSupplier( _pSupplier ); 77cdf0e10cSrcweir } 78cdf0e10cSrcweir 79cdf0e10cSrcweir /** returns the default preview value for the given format key 80cdf0e10cSrcweir * 81cdf0e10cSrcweir * \param _pNF the number formatter 82cdf0e10cSrcweir * \param _nFormatKey the format key 83cdf0e10cSrcweir * \return current date or time or the value 1234.56789 84cdf0e10cSrcweir */ 85cdf0e10cSrcweir static double getPreviewValue(SvNumberFormatter* _pNF,sal_Int32 _nFormatKey); 86cdf0e10cSrcweir 87cdf0e10cSrcweir private: 88cdf0e10cSrcweir static double getPreviewValue( const SvNumberformat& i_rEntry ); 89cdf0e10cSrcweir }; 90cdf0e10cSrcweir 91cdf0e10cSrcweir //======================================================================== 92cdf0e10cSrcweir //= FormatDescription 93cdf0e10cSrcweir //======================================================================== 94cdf0e10cSrcweir struct FormatDescription 95cdf0e10cSrcweir { 96cdf0e10cSrcweir SvNumberFormatsSupplierObj* pSupplier; 97cdf0e10cSrcweir sal_Int32 nKey; 98cdf0e10cSrcweir }; 99cdf0e10cSrcweir 100cdf0e10cSrcweir //======================================================================== 101cdf0e10cSrcweir //= OFormattedNumericControl 102cdf0e10cSrcweir //======================================================================== 103cdf0e10cSrcweir typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< FormattedField > > OFormattedNumericControl_Base; 104cdf0e10cSrcweir class OFormattedNumericControl : public OFormattedNumericControl_Base 105cdf0e10cSrcweir { 106cdf0e10cSrcweir private: 107cdf0e10cSrcweir sal_Int32 m_nLastDecimalDigits; 108cdf0e10cSrcweir 109cdf0e10cSrcweir public: 110cdf0e10cSrcweir OFormattedNumericControl( Window* pParent, WinBits nWinStyle = WB_TABSTOP); 111cdf0e10cSrcweir 112cdf0e10cSrcweir // XPropertyControl 113cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); 114cdf0e10cSrcweir virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); 115cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); 116cdf0e10cSrcweir 117cdf0e10cSrcweir void SetFormatDescription( const FormatDescription& rDesc ); 118cdf0e10cSrcweir 119cdf0e10cSrcweir // make some FormattedField methods available SetDecimalDigits(sal_uInt16 nPrecision)120cdf0e10cSrcweir void SetDecimalDigits(sal_uInt16 nPrecision) { getTypedControlWindow()->SetDecimalDigits(nPrecision); m_nLastDecimalDigits = nPrecision; } SetDefaultValue(double dDef)121cdf0e10cSrcweir void SetDefaultValue(double dDef) { getTypedControlWindow()->SetDefaultValue(dDef); } EnableEmptyField(sal_Bool bEnable)122cdf0e10cSrcweir void EnableEmptyField(sal_Bool bEnable) { getTypedControlWindow()->EnableEmptyField(bEnable); } SetThousandsSep(sal_Bool bEnable)123cdf0e10cSrcweir void SetThousandsSep(sal_Bool bEnable) { getTypedControlWindow()->SetThousandsSep(bEnable); } 124cdf0e10cSrcweir 125cdf0e10cSrcweir protected: 126cdf0e10cSrcweir ~OFormattedNumericControl(); 127cdf0e10cSrcweir }; 128cdf0e10cSrcweir 129cdf0e10cSrcweir //======================================================================== 130cdf0e10cSrcweir //= OFileUrlControl 131cdf0e10cSrcweir //======================================================================== 132cdf0e10cSrcweir typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< ::svt::FileURLBox > > OFileUrlControl_Base; 133cdf0e10cSrcweir class OFileUrlControl : public OFileUrlControl_Base 134cdf0e10cSrcweir { 135cdf0e10cSrcweir public: 136cdf0e10cSrcweir OFileUrlControl( Window* pParent, WinBits nWinStyle ); 137cdf0e10cSrcweir 138cdf0e10cSrcweir // XPropertyControl 139cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); 140cdf0e10cSrcweir virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); 141cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); 142cdf0e10cSrcweir 143cdf0e10cSrcweir protected: 144cdf0e10cSrcweir ~OFileUrlControl(); 145cdf0e10cSrcweir }; 146cdf0e10cSrcweir 147cdf0e10cSrcweir //======================================================================== 148cdf0e10cSrcweir //= OTimeDurationControl 149cdf0e10cSrcweir //======================================================================== 150cdf0e10cSrcweir class OTimeDurationControl : public ONumericControl 151cdf0e10cSrcweir { 152cdf0e10cSrcweir public: 153cdf0e10cSrcweir OTimeDurationControl( ::Window* pParent, WinBits nWinStyle ); 154cdf0e10cSrcweir ~OTimeDurationControl(); 155cdf0e10cSrcweir 156cdf0e10cSrcweir // XPropertyControl 157cdf0e10cSrcweir ::sal_Int16 SAL_CALL getControlType() throw (::com::sun::star::uno::RuntimeException); 158cdf0e10cSrcweir 159cdf0e10cSrcweir private: 160cdf0e10cSrcweir DECL_LINK( OnCustomConvert, MetricField* ); 161cdf0e10cSrcweir }; 162cdf0e10cSrcweir 163cdf0e10cSrcweir //............................................................................ 164cdf0e10cSrcweir } // namespace pcr 165cdf0e10cSrcweir //............................................................................ 166cdf0e10cSrcweir 167cdf0e10cSrcweir #endif // _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_ 168cdf0e10cSrcweir 169