Version 24.2.2.2, tag libreoffice-24.2.2.2
[LibreOffice.git] / toolkit / inc / controls / formattedcontrol.hxx
blobc614b42c74d36d22a05a210b5b888a57daabea2d
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 #pragma once
22 #include <toolkit/controls/unocontrols.hxx>
23 #include <toolkit/controls/unocontrolmodel.hxx>
25 namespace com::sun::star::util { class XNumberFormatter; }
28 namespace toolkit
32 // = UnoControlFormattedFieldModel
34 class UnoControlFormattedFieldModel final : public UnoControlModel
36 public:
37 UnoControlFormattedFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
38 UnoControlFormattedFieldModel( const UnoControlFormattedFieldModel& rModel )
39 : UnoControlModel(rModel)
40 , m_bRevokedAsClient(false)
41 , m_bSettingValueAndText(false)
45 rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFormattedFieldModel( *this ); }
47 // css::io::XPersistObject
48 OUString SAL_CALL getServiceName() override;
50 // css::beans::XMultiPropertySet
51 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
54 // css::lang::XServiceInfo
55 OUString SAL_CALL getImplementationName() override;
57 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
59 private:
60 virtual ~UnoControlFormattedFieldModel() override;
62 // XComponent
63 void SAL_CALL dispose() override;
65 // XPropertySet
66 void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& PropertyNames, const css::uno::Sequence< css::uno::Any >& Values ) override;
68 // UnoControlModel
69 virtual void ImplNormalizePropertySequence(
70 const sal_Int32 _nCount, /// the number of entries in the arrays
71 sal_Int32* _pHandles, /// the handles of the properties to set
72 css::uno::Any* _pValues, /// the values of the properties to set
73 sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted
74 ) const override;
75 void impl_updateTextFromValue_nothrow(std::unique_lock<std::mutex>& rGuard);
76 void impl_updateCachedFormatter_nothrow(std::unique_lock<std::mutex>& rGuard);
77 void impl_updateCachedFormatKey_nothrow(std::unique_lock<std::mutex>& rGuard);
79 css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
80 ::cppu::IPropertyArrayHelper& getInfoHelper() override;
81 bool convertFastPropertyValue(
82 std::unique_lock<std::mutex>& rGuard,
83 css::uno::Any& rConvertedValue,
84 css::uno::Any& rOldValue,
85 sal_Int32 nPropId,
86 const css::uno::Any& rValue
87 ) override;
89 void setFastPropertyValue_NoBroadcast(
90 std::unique_lock<std::mutex>& rGuard,
91 sal_Int32 nHandle,
92 const css::uno::Any& rValue
93 ) override;
95 css::uno::Any m_aCachedFormat;
96 bool m_bRevokedAsClient;
97 bool m_bSettingValueAndText;
98 css::uno::Reference< css::util::XNumberFormatter >
99 m_xCachedFormatter;
103 // = UnoFormattedFieldControl
105 class UnoFormattedFieldControl final : public UnoSpinFieldControl
107 public:
108 UnoFormattedFieldControl();
109 OUString GetComponentServiceName() const override;
111 // css::awt::XTextListener
112 void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override;
114 // css::lang::XServiceInfo
115 OUString SAL_CALL getImplementationName() override;
117 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
121 } // namespace toolkit
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */