1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_
30 #define _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_
32 #include "commoncontrol.hxx"
33 #include <svtools/fmtfield.hxx>
34 #include <svtools/fileurlbox.hxx>
35 #include "standardcontrol.hxx"
37 class SvNumberFormatsSupplierObj
;
39 //............................................................................
42 //............................................................................
44 //========================================================================
45 //= NumberFormatSampleField
46 //========================================================================
47 class NumberFormatSampleField
: public ControlWindow
< FormattedField
>
50 typedef ControlWindow
< FormattedField
> BaseClass
;
53 NumberFormatSampleField( Window
* _pParent
, WinBits _nStyle
)
54 :BaseClass( _pParent
, _nStyle
)
58 void SetFormatSupplier( const SvNumberFormatsSupplierObj
* pSupplier
);
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
71 OFormatSampleControl( Window
* pParent
, WinBits nWinStyle
);
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
);
92 static double getPreviewValue( const SvNumberformat
& i_rEntry
);
95 //========================================================================
97 //========================================================================
98 struct FormatDescription
100 SvNumberFormatsSupplierObj
* pSupplier
;
104 //========================================================================
105 //= OFormattedNumericControl
106 //========================================================================
107 typedef CommonBehaviourControl
< ::com::sun::star::inspection::XPropertyControl
, ControlWindow
< FormattedField
> > OFormattedNumericControl_Base
;
108 class OFormattedNumericControl
: public OFormattedNumericControl_Base
111 sal_Int32 m_nLastDecimalDigits
;
114 OFormattedNumericControl( Window
* pParent
, WinBits nWinStyle
= WB_TABSTOP
);
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
); }
130 ~OFormattedNumericControl();
133 //========================================================================
135 //========================================================================
136 typedef CommonBehaviourControl
< ::com::sun::star::inspection::XPropertyControl
, ControlWindow
< ::svt::FileURLBox
> > OFileUrlControl_Base
;
137 class OFileUrlControl
: public OFileUrlControl_Base
140 OFileUrlControl( Window
* pParent
, WinBits nWinStyle
);
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
);
151 //========================================================================
152 //= OTimeDurationControl
153 //========================================================================
154 class OTimeDurationControl
: public ONumericControl
157 OTimeDurationControl( ::Window
* pParent
, WinBits nWinStyle
);
158 ~OTimeDurationControl();
161 ::sal_Int16 SAL_CALL
getControlType() throw (::com::sun::star::uno::RuntimeException
);
164 DECL_LINK( OnCustomConvert
, MetricField
* );
167 //............................................................................
169 //............................................................................
171 #endif // _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */