bump product version to 6.3.0.0.beta1
[LibreOffice.git] / extensions / source / propctrlr / usercontrol.hxx
blobe9e29aa713f2070c0e7d0bffac1142090f4ea73a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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;
32 namespace pcr
36 //= NumberFormatSampleField
38 class NumberFormatSampleField : public FormattedField
40 public:
41 NumberFormatSampleField( vcl::Window* _pParent, WinBits _nStyle )
42 : FormattedField(_pParent, _nStyle)
43 , m_pHelper(nullptr)
47 void SetFormatSupplier( const SvNumberFormatsSupplierObj* pSupplier );
48 void setControlHelper( CommonBehaviourControlHelper& _rControlHelper ) { m_pHelper = &_rControlHelper; }
50 protected:
51 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
52 private:
53 CommonBehaviourControlHelper* m_pHelper;
57 //= OFormatSampleControl
59 typedef CommonBehaviourControl< css::inspection::XPropertyControl, NumberFormatSampleField > OFormatSampleControl_Base;
60 class OFormatSampleControl : public OFormatSampleControl_Base
62 public:
63 explicit OFormatSampleControl( vcl::Window* pParent );
65 // XPropertyControl
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);
83 private:
84 static double getPreviewValue( const SvNumberformat& i_rEntry );
88 //= FormatDescription
90 struct FormatDescription
92 SvNumberFormatsSupplierObj* pSupplier;
93 sal_Int32 nKey;
97 //= OFormattedNumericControl
99 typedef CommonBehaviourControl< css::inspection::XPropertyControl, FormattedField > OFormattedNumericControl_Base;
100 class OFormattedNumericControl : public OFormattedNumericControl_Base
102 public:
103 OFormattedNumericControl( vcl::Window* pParent, WinBits nWinStyle);
105 // XPropertyControl
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); }
118 protected:
119 virtual ~OFormattedNumericControl() override;
123 //= OFileUrlControl
125 typedef CommonBehaviourControl< css::inspection::XPropertyControl, ::svt::FileURLBox > OFileUrlControl_Base;
126 class OFileUrlControl : public OFileUrlControl_Base
128 public:
129 explicit OFileUrlControl( vcl::Window* pParent );
131 // XPropertyControl
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;
136 protected:
137 virtual ~OFileUrlControl() override;
141 //= OTimeDurationControl
143 class OTimeDurationControl : public ONumericControl
145 public:
146 explicit OTimeDurationControl( vcl::Window* pParent );
147 virtual ~OTimeDurationControl() override;
149 // XPropertyControl
150 ::sal_Int16 SAL_CALL getControlType() override;
152 private:
153 DECL_LINK( OnCustomConvert, MetricFormatter&, void );
157 } // namespace pcr
160 #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_USERCONTROL_HXX
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */