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_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>
35 // = UnoControlFormattedFieldModel
37 class UnoControlFormattedFieldModel
: public UnoControlModel
40 ::com::sun::star::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const SAL_OVERRIDE
;
41 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
;
42 ::com::sun::star::uno::Any m_aCachedFormat
;
43 bool m_bRevokedAsClient
;
44 bool m_bSettingValueAndText
;
45 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
>
49 sal_Bool SAL_CALL
convertFastPropertyValue(
50 ::com::sun::star::uno::Any
& rConvertedValue
,
51 ::com::sun::star::uno::Any
& rOldValue
,
53 const ::com::sun::star::uno::Any
& rValue
54 ) throw (::com::sun::star::lang::IllegalArgumentException
) SAL_OVERRIDE
;
56 void SAL_CALL
setFastPropertyValue_NoBroadcast(
58 const ::com::sun::star::uno::Any
& rValue
59 ) throw (::com::sun::star::uno::Exception
, std::exception
) SAL_OVERRIDE
;
62 UnoControlFormattedFieldModel( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
63 UnoControlFormattedFieldModel( const UnoControlFormattedFieldModel
& rModel
)
64 : UnoControlModel(rModel
)
65 , m_bRevokedAsClient(false)
66 , m_bSettingValueAndText(false)
70 UnoControlModel
* Clone() const SAL_OVERRIDE
{ return new UnoControlFormattedFieldModel( *this ); }
72 // ::com::sun::star::io::XPersistObject
73 OUString SAL_CALL
getServiceName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
75 // ::com::sun::star::beans::XMultiPropertySet
76 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 // ::com::sun::star::lang::XServiceInfo
80 OUString SAL_CALL
getImplementationName()
81 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
83 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames()
84 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 virtual ~UnoControlFormattedFieldModel();
90 void SAL_CALL
dispose( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 void SAL_CALL
setPropertyValues( const ::com::sun::star::uno::Sequence
< OUString
>& PropertyNames
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& Values
) throw(::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 virtual void ImplNormalizePropertySequence(
97 const sal_Int32 _nCount
, /// the number of entries in the arrays
98 sal_Int32
* _pHandles
, /// the handles of the properties to set
99 ::com::sun::star::uno::Any
* _pValues
, /// the values of the properties to set
100 sal_Int32
* _pValidHandles
/// pointer to the valid handles, allowed to be adjusted
101 ) const SAL_OVERRIDE
;
103 void impl_updateTextFromValue_nothrow();
104 void impl_updateCachedFormatter_nothrow();
105 void impl_updateCachedFormatKey_nothrow();
109 // = UnoFormattedFieldControl
111 class UnoFormattedFieldControl
: public UnoSpinFieldControl
114 UnoFormattedFieldControl();
115 OUString
GetComponentServiceName() SAL_OVERRIDE
;
117 // ::com::sun::star::awt::XTextListener
118 void SAL_CALL
textChanged( const ::com::sun::star::awt::TextEvent
& rEvent
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
120 // ::com::sun::star::lang::XServiceInfo
121 OUString SAL_CALL
getImplementationName()
122 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames()
125 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 } // namespace toolkit
132 #endif // INCLUDED_TOOLKIT_CONTROLS_FORMATTEDCONTROL_HXX
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */