Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / include / toolkit / controls / formattedcontrol.hxx
blobdb75811b2cf7968f7c75170929f6159f975d7279
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_TOOLKIT_CONTROLS_FORMATTEDCONTROL_HXX
21 #define INCLUDED_TOOLKIT_CONTROLS_FORMATTEDCONTROL_HXX
23 #include <toolkit/controls/unocontrols.hxx>
24 #include <toolkit/controls/unocontrolmodel.hxx>
26 namespace com { namespace sun { namespace star { namespace util { class XNumberFormatter; } } } }
29 namespace toolkit
33 // = UnoControlFormattedFieldModel
35 class UnoControlFormattedFieldModel final : public UnoControlModel
37 public:
38 UnoControlFormattedFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
39 UnoControlFormattedFieldModel( const UnoControlFormattedFieldModel& rModel )
40 : UnoControlModel(rModel)
41 , m_bRevokedAsClient(false)
42 , m_bSettingValueAndText(false)
46 rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFormattedFieldModel( *this ); }
48 // css::io::XPersistObject
49 OUString SAL_CALL getServiceName() override;
51 // css::beans::XMultiPropertySet
52 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
55 // css::lang::XServiceInfo
56 OUString SAL_CALL getImplementationName() override;
58 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
60 private:
61 virtual ~UnoControlFormattedFieldModel() override;
63 // XComponent
64 void SAL_CALL dispose() override;
66 // XPropertySet
67 void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& PropertyNames, const css::uno::Sequence< css::uno::Any >& Values ) override;
69 // UnoControlModel
70 virtual void ImplNormalizePropertySequence(
71 const sal_Int32 _nCount, /// the number of entries in the arrays
72 sal_Int32* _pHandles, /// the handles of the properties to set
73 css::uno::Any* _pValues, /// the values of the properties to set
74 sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted
75 ) const override;
76 void impl_updateTextFromValue_nothrow();
77 void impl_updateCachedFormatter_nothrow();
78 void impl_updateCachedFormatKey_nothrow();
80 css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
81 ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
82 sal_Bool SAL_CALL convertFastPropertyValue(
83 css::uno::Any& rConvertedValue,
84 css::uno::Any& rOldValue,
85 sal_Int32 nPropId,
86 const css::uno::Any& rValue
87 ) override;
89 void SAL_CALL setFastPropertyValue_NoBroadcast(
90 sal_Int32 nHandle,
91 const css::uno::Any& rValue
92 ) override;
94 css::uno::Any m_aCachedFormat;
95 bool m_bRevokedAsClient;
96 bool m_bSettingValueAndText;
97 css::uno::Reference< css::util::XNumberFormatter >
98 m_xCachedFormatter;
102 // = UnoFormattedFieldControl
104 class UnoFormattedFieldControl final : public UnoSpinFieldControl
106 public:
107 UnoFormattedFieldControl();
108 OUString GetComponentServiceName() override;
110 // css::awt::XTextListener
111 void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override;
113 // css::lang::XServiceInfo
114 OUString SAL_CALL getImplementationName() override;
116 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
120 } // namespace toolkit
123 #endif // INCLUDED_TOOLKIT_CONTROLS_FORMATTEDCONTROL_HXX
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */