build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / toolkit / controls / formattedcontrol.hxx
blobed993d1911c2a25f52ec6752166d65f4dfc640e6
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>
25 #include <toolkit/helper/servicenames.hxx>
27 #include <com/sun/star/util/XNumberFormatter.hpp>
30 namespace toolkit
34 // = UnoControlFormattedFieldModel
36 class UnoControlFormattedFieldModel : public UnoControlModel
38 protected:
39 css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
40 ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
41 css::uno::Any m_aCachedFormat;
42 bool m_bRevokedAsClient;
43 bool m_bSettingValueAndText;
44 css::uno::Reference< css::util::XNumberFormatter >
45 m_xCachedFormatter;
47 protected:
48 sal_Bool SAL_CALL convertFastPropertyValue(
49 css::uno::Any& rConvertedValue,
50 css::uno::Any& rOldValue,
51 sal_Int32 nPropId,
52 const css::uno::Any& rValue
53 ) throw (css::lang::IllegalArgumentException, std::exception) override;
55 void SAL_CALL setFastPropertyValue_NoBroadcast(
56 sal_Int32 nHandle,
57 const css::uno::Any& rValue
58 ) throw (css::uno::Exception, std::exception) override;
60 public:
61 UnoControlFormattedFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
62 UnoControlFormattedFieldModel( const UnoControlFormattedFieldModel& rModel )
63 : UnoControlModel(rModel)
64 , m_bRevokedAsClient(false)
65 , m_bSettingValueAndText(false)
69 UnoControlModel* Clone() const override { return new UnoControlFormattedFieldModel( *this ); }
71 // css::io::XPersistObject
72 OUString SAL_CALL getServiceName() throw(css::uno::RuntimeException, std::exception) override;
74 // css::beans::XMultiPropertySet
75 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException, std::exception) override;
78 // css::lang::XServiceInfo
79 OUString SAL_CALL getImplementationName()
80 throw (css::uno::RuntimeException, std::exception) override;
82 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
83 throw (css::uno::RuntimeException, std::exception) override;
85 protected:
86 virtual ~UnoControlFormattedFieldModel() override;
88 // XComponent
89 void SAL_CALL dispose( ) throw(css::uno::RuntimeException, std::exception) override;
91 // XPropertySet
92 void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& PropertyNames, const css::uno::Sequence< css::uno::Any >& Values ) throw(css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override;
94 // UnoControlModel
95 virtual void ImplNormalizePropertySequence(
96 const sal_Int32 _nCount, /// the number of entries in the arrays
97 sal_Int32* _pHandles, /// the handles of the properties to set
98 css::uno::Any* _pValues, /// the values of the properties to set
99 sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted
100 ) const override;
101 private:
102 void impl_updateTextFromValue_nothrow();
103 void impl_updateCachedFormatter_nothrow();
104 void impl_updateCachedFormatKey_nothrow();
108 // = UnoFormattedFieldControl
110 class UnoFormattedFieldControl : public UnoSpinFieldControl
112 public:
113 UnoFormattedFieldControl();
114 OUString GetComponentServiceName() override;
116 // css::awt::XTextListener
117 void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) throw(css::uno::RuntimeException, std::exception) override;
119 // css::lang::XServiceInfo
120 OUString SAL_CALL getImplementationName()
121 throw (css::uno::RuntimeException, std::exception) override;
123 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
124 throw (css::uno::RuntimeException, std::exception) override;
128 } // namespace toolkit
131 #endif // INCLUDED_TOOLKIT_CONTROLS_FORMATTEDCONTROL_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */