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 <vcl/fmtfield.hxx>
25 #include <svtools/fileurlbox.hxx>
26 #include <svl/zforlist.hxx>
27 #include "standardcontrol.hxx"
29 class SvNumberFormatsSupplierObj
;
36 //= NumberFormatSampleField
38 class NumberFormatSampleField
: public FormattedField
41 NumberFormatSampleField( vcl::Window
* _pParent
, WinBits _nStyle
)
42 : FormattedField(_pParent
, _nStyle
)
47 void SetFormatSupplier( const SvNumberFormatsSupplierObj
* pSupplier
);
48 void setControlHelper( CommonBehaviourControlHelper
& _rControlHelper
) { m_pHelper
= &_rControlHelper
; }
51 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
53 CommonBehaviourControlHelper
* m_pHelper
;
57 //= OFormatSampleControl
59 typedef CommonBehaviourControl
< css::inspection::XPropertyControl
, NumberFormatSampleField
> OFormatSampleControl_Base
;
60 class OFormatSampleControl
: public OFormatSampleControl_Base
63 explicit OFormatSampleControl( vcl::Window
* pParent
);
66 virtual css::uno::Any SAL_CALL
getValue() override
;
67 virtual void SAL_CALL
setValue( const css::uno::Any
& _value
) override
;
68 virtual css::uno::Type SAL_CALL
getValueType() override
;
70 void SetFormatSupplier( const SvNumberFormatsSupplierObj
* _pSupplier
)
72 getTypedControlWindow()->SetFormatSupplier( _pSupplier
);
75 /** returns the default preview value for the given format key
77 * \param _pNF the number formatter
78 * \param _nFormatKey the format key
79 * \return current date or time or the value 1234.56789
81 static double getPreviewValue(SvNumberFormatter
const * _pNF
, sal_Int32 _nFormatKey
);
84 static double getPreviewValue( const SvNumberformat
& i_rEntry
);
90 struct FormatDescription
92 SvNumberFormatsSupplierObj
* pSupplier
;
97 //= OFormattedNumericControl
99 typedef CommonBehaviourControl
< css::inspection::XPropertyControl
, FormattedField
> OFormattedNumericControl_Base
;
100 class OFormattedNumericControl
: public OFormattedNumericControl_Base
103 OFormattedNumericControl( vcl::Window
* pParent
, WinBits nWinStyle
);
106 virtual css::uno::Any SAL_CALL
getValue() override
;
107 virtual void SAL_CALL
setValue( const css::uno::Any
& _value
) override
;
108 virtual css::uno::Type SAL_CALL
getValueType() override
;
110 void SetFormatDescription( const FormatDescription
& rDesc
);
112 // make some FormattedField methods available
113 void SetDecimalDigits(sal_uInt16 nPrecision
) { getTypedControlWindow()->SetDecimalDigits(nPrecision
); }
114 void SetDefaultValue(double dDef
) { getTypedControlWindow()->SetDefaultValue(dDef
); }
115 void EnableEmptyField(bool bEnable
) { getTypedControlWindow()->EnableEmptyField(bEnable
); }
116 void SetThousandsSep(bool bEnable
) { getTypedControlWindow()->SetThousandsSep(bEnable
); }
119 virtual ~OFormattedNumericControl() override
;
125 typedef CommonBehaviourControl
< css::inspection::XPropertyControl
, ::svt::FileURLBox
> OFileUrlControl_Base
;
126 class OFileUrlControl
: public OFileUrlControl_Base
129 explicit OFileUrlControl( vcl::Window
* pParent
);
132 virtual css::uno::Any SAL_CALL
getValue() override
;
133 virtual void SAL_CALL
setValue( const css::uno::Any
& _value
) override
;
134 virtual css::uno::Type SAL_CALL
getValueType() override
;
137 virtual ~OFileUrlControl() override
;
141 //= OTimeDurationControl
143 class OTimeDurationControl
: public ONumericControl
146 explicit OTimeDurationControl( vcl::Window
* pParent
);
147 virtual ~OTimeDurationControl() override
;
150 ::sal_Int16 SAL_CALL
getControlType() override
;
153 DECL_LINK( OnCustomConvert
, MetricFormatter
&, void );
160 #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_USERCONTROL_HXX
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */