masterfix DEV300: #i10000# build fix
[LibreOffice.git] / extensions / source / propctrlr / usercontrol.hxx
blob82835d1df16e4f3e93c510890cbc8bc4e4112218
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_
29 #define _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_
31 #include "commoncontrol.hxx"
32 #define _ZFORLIST_DECLARE_TABLE
33 #include <svtools/fmtfield.hxx>
34 #include <svtools/fileurlbox.hxx>
35 #include "standardcontrol.hxx"
37 class SvNumberFormatsSupplierObj;
39 //............................................................................
40 namespace pcr
42 //............................................................................
44 //========================================================================
45 //= NumberFormatSampleField
46 //========================================================================
47 class NumberFormatSampleField : public ControlWindow< FormattedField >
49 private:
50 typedef ControlWindow< FormattedField > BaseClass;
52 public:
53 NumberFormatSampleField( Window* _pParent, WinBits _nStyle )
54 :BaseClass( _pParent, _nStyle )
58 void SetFormatSupplier( const SvNumberFormatsSupplierObj* pSupplier );
60 protected:
61 virtual long PreNotify( NotifyEvent& rNEvt );
64 //========================================================================
65 //= OFormatSampleControl
66 //========================================================================
67 typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, NumberFormatSampleField > OFormatSampleControl_Base;
68 class OFormatSampleControl : public OFormatSampleControl_Base
70 public:
71 OFormatSampleControl( Window* pParent, WinBits nWinStyle );
73 // XPropertyControl
74 virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
75 virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
76 virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
78 inline void SetFormatSupplier( const SvNumberFormatsSupplierObj* _pSupplier )
80 getTypedControlWindow()->SetFormatSupplier( _pSupplier );
83 /** returns the default preview value for the given format key
85 * \param _pNF the number formatter
86 * \param _nFormatKey the format key
87 * \return current date or time or the value 1234.56789
89 static double getPreviewValue(SvNumberFormatter* _pNF,sal_Int32 _nFormatKey);
91 private:
92 static double getPreviewValue( const SvNumberformat& i_rEntry );
95 //========================================================================
96 //= FormatDescription
97 //========================================================================
98 struct FormatDescription
100 SvNumberFormatsSupplierObj* pSupplier;
101 sal_Int32 nKey;
104 //========================================================================
105 //= OFormattedNumericControl
106 //========================================================================
107 typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< FormattedField > > OFormattedNumericControl_Base;
108 class OFormattedNumericControl : public OFormattedNumericControl_Base
110 private:
111 sal_Int32 m_nLastDecimalDigits;
113 public:
114 OFormattedNumericControl( Window* pParent, WinBits nWinStyle = WB_TABSTOP);
116 // XPropertyControl
117 virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
118 virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
119 virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
121 void SetFormatDescription( const FormatDescription& rDesc );
123 // make some FormattedField methods available
124 void SetDecimalDigits(sal_uInt16 nPrecision) { getTypedControlWindow()->SetDecimalDigits(nPrecision); m_nLastDecimalDigits = nPrecision; }
125 void SetDefaultValue(double dDef) { getTypedControlWindow()->SetDefaultValue(dDef); }
126 void EnableEmptyField(sal_Bool bEnable) { getTypedControlWindow()->EnableEmptyField(bEnable); }
127 void SetThousandsSep(sal_Bool bEnable) { getTypedControlWindow()->SetThousandsSep(bEnable); }
129 protected:
130 ~OFormattedNumericControl();
133 //========================================================================
134 //= OFileUrlControl
135 //========================================================================
136 typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< ::svt::FileURLBox > > OFileUrlControl_Base;
137 class OFileUrlControl : public OFileUrlControl_Base
139 public:
140 OFileUrlControl( Window* pParent, WinBits nWinStyle );
142 // XPropertyControl
143 virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
144 virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
145 virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
147 protected:
148 ~OFileUrlControl();
151 //========================================================================
152 //= OTimeDurationControl
153 //========================================================================
154 class OTimeDurationControl : public ONumericControl
156 public:
157 OTimeDurationControl( ::Window* pParent, WinBits nWinStyle );
158 ~OTimeDurationControl();
160 // XPropertyControl
161 ::sal_Int16 SAL_CALL getControlType() throw (::com::sun::star::uno::RuntimeException);
163 private:
164 DECL_LINK( OnCustomConvert, MetricField* );
167 //............................................................................
168 } // namespace pcr
169 //............................................................................
171 #endif // _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_