Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef TOOLKIT_FORMATTED_CONTROL_HXX
21 : : #define TOOLKIT_FORMATTED_CONTROL_HXX
22 : :
23 : : #include <toolkit/controls/unocontrols.hxx>
24 : : #include <toolkit/controls/unocontrolmodel.hxx>
25 : : #include <toolkit/helper/servicenames.hxx>
26 : :
27 : : #include <com/sun/star/util/XNumberFormatter.hpp>
28 : :
29 : : //........................................................................
30 : : namespace toolkit
31 : : {
32 : : //........................................................................
33 : :
34 : : // ===================================================================
35 : : // = UnoControlFormattedFieldModel
36 : : // ===================================================================
37 : : class UnoControlFormattedFieldModel : public UnoControlModel
38 : : {
39 : : protected:
40 : : ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
41 : : ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
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 >
46 : : m_xCachedFormatter;
47 : :
48 : : protected:
49 : : sal_Bool SAL_CALL convertFastPropertyValue(
50 : : ::com::sun::star::uno::Any& rConvertedValue,
51 : : ::com::sun::star::uno::Any& rOldValue,
52 : : sal_Int32 nPropId,
53 : : const ::com::sun::star::uno::Any& rValue
54 : : ) throw (::com::sun::star::lang::IllegalArgumentException);
55 : :
56 : : void SAL_CALL setFastPropertyValue_NoBroadcast(
57 : : sal_Int32 nHandle,
58 : : const ::com::sun::star::uno::Any& rValue
59 : : ) throw (::com::sun::star::uno::Exception);
60 : :
61 : : public:
62 : : UnoControlFormattedFieldModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
63 : 2 : UnoControlFormattedFieldModel( const UnoControlFormattedFieldModel& rModel )
64 : 2 : :UnoControlModel( rModel )
65 : : {
66 : 2 : }
67 : :
68 [ + - ]: 2 : UnoControlModel* Clone() const { return new UnoControlFormattedFieldModel( *this ); }
69 : :
70 : : // ::com::sun::star::io::XPersistObject
71 : : ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
72 : :
73 : : // ::com::sun::star::beans::XMultiPropertySet
74 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
75 : :
76 : :
77 : : // ::com::sun::star::lang::XServiceInfo
78 [ + - ][ + - ]: 16 : DECLIMPL_SERVICEINFO_DERIVED( UnoControlFormattedFieldModel, UnoControlModel, szServiceName2_UnoControlFormattedFieldModel )
79 : :
80 : : protected:
81 : : ~UnoControlFormattedFieldModel();
82 : :
83 : : // XComponent
84 : : void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
85 : :
86 : : // XPropertySet
87 : : void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::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);
88 : :
89 : : // UnoControlModel
90 : : virtual void ImplNormalizePropertySequence(
91 : : const sal_Int32 _nCount, /// the number of entries in the arrays
92 : : sal_Int32* _pHandles, /// the handles of the properties to set
93 : : ::com::sun::star::uno::Any* _pValues, /// the values of the properties to set
94 : : sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted
95 : : ) const SAL_THROW(());
96 : : private:
97 : : void impl_updateTextFromValue_nothrow();
98 : : void impl_updateCachedFormatter_nothrow();
99 : : void impl_updateCachedFormatKey_nothrow();
100 : : };
101 : :
102 : : // ===================================================================
103 : : // = UnoFormattedFieldControl
104 : : // ===================================================================
105 [ - + ]: 4 : class UnoFormattedFieldControl : public UnoSpinFieldControl
106 : : {
107 : : public:
108 : : UnoFormattedFieldControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
109 : : ::rtl::OUString GetComponentServiceName();
110 : :
111 : : // ::com::sun::star::awt::XTextListener
112 : : void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
113 : :
114 : : // ::com::sun::star::lang::XServiceInfo
115 [ # # ][ # # ]: 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoFormattedFieldControl, UnoEditControl, szServiceName2_UnoControlFormattedField )
116 : : };
117 : :
118 : : //........................................................................
119 : : } // namespace toolkit
120 : : //........................................................................
121 : :
122 : : #endif // TOOLKIT_FORMATTED_CONTROL_HXX
123 : :
124 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|