1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_USERCONTROL_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_USERCONTROL_HXX
23 #include "commoncontrol.hxx"
24 #include <svtools/fmtfield.hxx>
25 #include <svtools/fileurlbox.hxx>
26 #include "standardcontrol.hxx"
28 class SvNumberFormatsSupplierObj
;
36 //= NumberFormatSampleField
38 class NumberFormatSampleField
: public ControlWindow
< FormattedField
>
41 typedef ControlWindow
< FormattedField
> BaseClass
;
44 NumberFormatSampleField( vcl::Window
* _pParent
, WinBits _nStyle
)
45 :BaseClass( _pParent
, _nStyle
)
49 void SetFormatSupplier( const SvNumberFormatsSupplierObj
* pSupplier
);
52 virtual bool PreNotify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
56 //= OFormatSampleControl
58 typedef CommonBehaviourControl
< ::com::sun::star::inspection::XPropertyControl
, NumberFormatSampleField
> OFormatSampleControl_Base
;
59 class OFormatSampleControl
: public OFormatSampleControl_Base
62 OFormatSampleControl( vcl::Window
* pParent
, WinBits nWinStyle
);
65 virtual ::com::sun::star::uno::Any SAL_CALL
getValue() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
66 virtual void SAL_CALL
setValue( const ::com::sun::star::uno::Any
& _value
) throw (::com::sun::star::beans::IllegalTypeException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
67 virtual ::com::sun::star::uno::Type SAL_CALL
getValueType() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
69 inline void SetFormatSupplier( const SvNumberFormatsSupplierObj
* _pSupplier
)
71 getTypedControlWindow()->SetFormatSupplier( _pSupplier
);
74 /** returns the default preview value for the given format key
76 * \param _pNF the number formatter
77 * \param _nFormatKey the format key
78 * \return current date or time or the value 1234.56789
80 static double getPreviewValue(SvNumberFormatter
* _pNF
,sal_Int32 _nFormatKey
);
83 static double getPreviewValue( const SvNumberformat
& i_rEntry
);
89 struct FormatDescription
91 SvNumberFormatsSupplierObj
* pSupplier
;
96 //= OFormattedNumericControl
98 typedef CommonBehaviourControl
< ::com::sun::star::inspection::XPropertyControl
, ControlWindow
< FormattedField
> > OFormattedNumericControl_Base
;
99 class OFormattedNumericControl
: public OFormattedNumericControl_Base
102 sal_Int32 m_nLastDecimalDigits
;
105 OFormattedNumericControl( vcl::Window
* pParent
, WinBits nWinStyle
= WB_TABSTOP
);
108 virtual ::com::sun::star::uno::Any SAL_CALL
getValue() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
109 virtual void SAL_CALL
setValue( const ::com::sun::star::uno::Any
& _value
) throw (::com::sun::star::beans::IllegalTypeException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
110 virtual ::com::sun::star::uno::Type SAL_CALL
getValueType() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
112 void SetFormatDescription( const FormatDescription
& rDesc
);
114 // make some FormattedField methods available
115 void SetDecimalDigits(sal_uInt16 nPrecision
) { getTypedControlWindow()->SetDecimalDigits(nPrecision
); m_nLastDecimalDigits
= nPrecision
; }
116 void SetDefaultValue(double dDef
) { getTypedControlWindow()->SetDefaultValue(dDef
); }
117 void EnableEmptyField(bool bEnable
) { getTypedControlWindow()->EnableEmptyField(bEnable
); }
118 void SetThousandsSep(bool bEnable
) { getTypedControlWindow()->SetThousandsSep(bEnable
); }
121 virtual ~OFormattedNumericControl();
127 typedef CommonBehaviourControl
< ::com::sun::star::inspection::XPropertyControl
, ControlWindow
< ::svt::FileURLBox
> > OFileUrlControl_Base
;
128 class OFileUrlControl
: public OFileUrlControl_Base
131 OFileUrlControl( vcl::Window
* pParent
, WinBits nWinStyle
);
134 virtual ::com::sun::star::uno::Any SAL_CALL
getValue() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
135 virtual void SAL_CALL
setValue( const ::com::sun::star::uno::Any
& _value
) throw (::com::sun::star::beans::IllegalTypeException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 virtual ::com::sun::star::uno::Type SAL_CALL
getValueType() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
139 virtual ~OFileUrlControl();
143 //= OTimeDurationControl
145 class OTimeDurationControl
: public ONumericControl
148 OTimeDurationControl( vcl::Window
* pParent
, WinBits nWinStyle
);
149 virtual ~OTimeDurationControl();
152 ::sal_Int16 SAL_CALL
getControlType() throw (::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
155 DECL_LINK( OnCustomConvert
, MetricField
* );
162 #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_USERCONTROL_HXX
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */