Update ooo320-m1
[ooovba.git] / svtools / source / numbers / numfmuno.hxx
blob94d36f71c5324b286d64a7afe1b716abae6ea6a5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: numfmuno.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _NUMFMUNO_HXX
32 #define _NUMFMUNO_HXX
34 #include <com/sun/star/util/XNumberFormatter.hpp>
35 #include <com/sun/star/util/XNumberFormatPreviewer.hpp>
36 #include <com/sun/star/util/XNumberFormats.hpp>
37 #include <com/sun/star/util/XNumberFormatTypes.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/beans/XPropertyAccess.hpp>
40 #include <cppuhelper/implbase2.hxx>
41 #include <cppuhelper/implbase3.hxx>
42 #include <comphelper/sharedmutex.hxx>
43 #include <rtl/ref.hxx>
45 class SvNumberformat;
46 class SvNumberFormatter;
47 class SvNumberFormatsSupplierObj;
50 // SvNumberFormatterServiceObj wird global als Service angemeldet
52 class SvNumberFormatterServiceObj : public cppu::WeakImplHelper3<
53 com::sun::star::util::XNumberFormatter,
54 com::sun::star::util::XNumberFormatPreviewer,
55 com::sun::star::lang::XServiceInfo>
57 private:
58 ::rtl::Reference< SvNumberFormatsSupplierObj > xSupplier;
59 mutable ::comphelper::SharedMutex m_aMutex;
61 public:
62 SvNumberFormatterServiceObj();
63 virtual ~SvNumberFormatterServiceObj();
65 // XNumberFormatter
66 virtual void SAL_CALL attachNumberFormatsSupplier(
67 const ::com::sun::star::uno::Reference<
68 ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier )
69 throw(::com::sun::star::uno::RuntimeException);
70 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >
71 SAL_CALL getNumberFormatsSupplier()
72 throw(::com::sun::star::uno::RuntimeException);
73 virtual sal_Int32 SAL_CALL detectNumberFormat( sal_Int32 nKey, const ::rtl::OUString& aString )
74 throw(::com::sun::star::util::NotNumericException,
75 ::com::sun::star::uno::RuntimeException);
76 virtual double SAL_CALL convertStringToNumber( sal_Int32 nKey, const ::rtl::OUString& aString )
77 throw(::com::sun::star::util::NotNumericException,
78 ::com::sun::star::uno::RuntimeException);
79 virtual ::rtl::OUString SAL_CALL convertNumberToString( sal_Int32 nKey, double fValue )
80 throw(::com::sun::star::uno::RuntimeException);
81 virtual ::com::sun::star::util::Color SAL_CALL queryColorForNumber( sal_Int32 nKey,
82 double fValue, ::com::sun::star::util::Color aDefaultColor )
83 throw(::com::sun::star::uno::RuntimeException);
84 virtual ::rtl::OUString SAL_CALL formatString( sal_Int32 nKey, const ::rtl::OUString& aString )
85 throw(::com::sun::star::uno::RuntimeException);
86 virtual ::com::sun::star::util::Color SAL_CALL queryColorForString( sal_Int32 nKey,
87 const ::rtl::OUString& aString,
88 ::com::sun::star::util::Color aDefaultColor )
89 throw(::com::sun::star::uno::RuntimeException);
90 virtual ::rtl::OUString SAL_CALL getInputString( sal_Int32 nKey, double fValue )
91 throw(::com::sun::star::uno::RuntimeException);
93 // XNumberFormatPreviewer
94 virtual ::rtl::OUString SAL_CALL convertNumberToPreviewString(
95 const ::rtl::OUString& aFormat, double fValue,
96 const ::com::sun::star::lang::Locale& nLocale, sal_Bool bAllowEnglish )
97 throw(::com::sun::star::util::MalformedNumberFormatException,
98 ::com::sun::star::uno::RuntimeException);
99 virtual ::com::sun::star::util::Color SAL_CALL queryPreviewColorForNumber(
100 const ::rtl::OUString& aFormat, double fValue,
101 const ::com::sun::star::lang::Locale& nLocale, sal_Bool bAllowEnglish,
102 ::com::sun::star::util::Color aDefaultColor )
103 throw(::com::sun::star::util::MalformedNumberFormatException,
104 ::com::sun::star::uno::RuntimeException);
106 // XServiceInfo
107 virtual ::rtl::OUString SAL_CALL getImplementationName( )
108 throw(::com::sun::star::uno::RuntimeException);
109 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
110 throw(::com::sun::star::uno::RuntimeException);
111 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
112 throw(::com::sun::star::uno::RuntimeException);
116 class SvNumberFormatsObj : public cppu::WeakImplHelper3<
117 com::sun::star::util::XNumberFormats,
118 com::sun::star::util::XNumberFormatTypes,
119 com::sun::star::lang::XServiceInfo>
121 private:
122 SvNumberFormatsSupplierObj& rSupplier;
123 mutable ::comphelper::SharedMutex m_aMutex;
125 public:
126 SvNumberFormatsObj(SvNumberFormatsSupplierObj& pParent, ::comphelper::SharedMutex& _rMutex);
127 virtual ~SvNumberFormatsObj();
130 // XNumberFormats
131 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL
132 getByKey( sal_Int32 nKey ) throw(::com::sun::star::uno::RuntimeException);
133 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL queryKeys( sal_Int16 nType,
134 const ::com::sun::star::lang::Locale& nLocale, sal_Bool bCreate )
135 throw(::com::sun::star::uno::RuntimeException);
136 virtual sal_Int32 SAL_CALL queryKey( const ::rtl::OUString& aFormat,
137 const ::com::sun::star::lang::Locale& nLocale, sal_Bool bScan )
138 throw(::com::sun::star::uno::RuntimeException);
139 virtual sal_Int32 SAL_CALL addNew( const ::rtl::OUString& aFormat,
140 const ::com::sun::star::lang::Locale& nLocale )
141 throw(::com::sun::star::util::MalformedNumberFormatException,
142 ::com::sun::star::uno::RuntimeException);
143 virtual sal_Int32 SAL_CALL addNewConverted( const ::rtl::OUString& aFormat,
144 const ::com::sun::star::lang::Locale& nLocale,
145 const ::com::sun::star::lang::Locale& nNewLocale )
146 throw(::com::sun::star::util::MalformedNumberFormatException,
147 ::com::sun::star::uno::RuntimeException);
148 virtual void SAL_CALL removeByKey( sal_Int32 nKey ) throw(::com::sun::star::uno::RuntimeException);
149 virtual ::rtl::OUString SAL_CALL generateFormat( sal_Int32 nBaseKey,
150 const ::com::sun::star::lang::Locale& nLocale, sal_Bool bThousands,
151 sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading )
152 throw(::com::sun::star::uno::RuntimeException);
154 // XNumberFormatTypes
155 virtual sal_Int32 SAL_CALL getStandardIndex( const ::com::sun::star::lang::Locale& nLocale )
156 throw(::com::sun::star::uno::RuntimeException);
157 virtual sal_Int32 SAL_CALL getStandardFormat( sal_Int16 nType,
158 const ::com::sun::star::lang::Locale& nLocale )
159 throw(::com::sun::star::uno::RuntimeException);
160 virtual sal_Int32 SAL_CALL getFormatIndex( sal_Int16 nIndex,
161 const ::com::sun::star::lang::Locale& nLocale )
162 throw(::com::sun::star::uno::RuntimeException);
163 virtual sal_Bool SAL_CALL isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType )
164 throw(::com::sun::star::uno::RuntimeException);
165 virtual sal_Int32 SAL_CALL getFormatForLocale( sal_Int32 nKey,
166 const ::com::sun::star::lang::Locale& nLocale )
167 throw(::com::sun::star::uno::RuntimeException);
169 // XServiceInfo
170 virtual ::rtl::OUString SAL_CALL getImplementationName( )
171 throw(::com::sun::star::uno::RuntimeException);
172 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
173 throw(::com::sun::star::uno::RuntimeException);
174 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
175 throw(::com::sun::star::uno::RuntimeException);
177 private:
178 SvNumberFormatsObj(); // never implemented
182 class SvNumberFormatObj : public cppu::WeakImplHelper3<
183 com::sun::star::beans::XPropertySet,
184 com::sun::star::beans::XPropertyAccess,
185 com::sun::star::lang::XServiceInfo>
187 private:
188 SvNumberFormatsSupplierObj& rSupplier;
189 ULONG nKey;
190 mutable ::comphelper::SharedMutex m_aMutex;
192 public:
193 SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex );
194 virtual ~SvNumberFormatObj();
196 // XPropertySet
197 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
198 SAL_CALL getPropertySetInfo( )
199 throw(::com::sun::star::uno::RuntimeException);
200 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
201 const ::com::sun::star::uno::Any& aValue )
202 throw(::com::sun::star::beans::UnknownPropertyException,
203 ::com::sun::star::beans::PropertyVetoException,
204 ::com::sun::star::lang::IllegalArgumentException,
205 ::com::sun::star::lang::WrappedTargetException,
206 ::com::sun::star::uno::RuntimeException);
207 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
208 const ::rtl::OUString& PropertyName )
209 throw(::com::sun::star::beans::UnknownPropertyException,
210 ::com::sun::star::lang::WrappedTargetException,
211 ::com::sun::star::uno::RuntimeException);
212 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
213 const ::com::sun::star::uno::Reference<
214 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
215 throw(::com::sun::star::beans::UnknownPropertyException,
216 ::com::sun::star::lang::WrappedTargetException,
217 ::com::sun::star::uno::RuntimeException);
218 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
219 const ::com::sun::star::uno::Reference<
220 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
221 throw(::com::sun::star::beans::UnknownPropertyException,
222 ::com::sun::star::lang::WrappedTargetException,
223 ::com::sun::star::uno::RuntimeException);
224 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
225 const ::com::sun::star::uno::Reference<
226 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
227 throw(::com::sun::star::beans::UnknownPropertyException,
228 ::com::sun::star::lang::WrappedTargetException,
229 ::com::sun::star::uno::RuntimeException);
230 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
231 const ::com::sun::star::uno::Reference<
232 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
233 throw(::com::sun::star::beans::UnknownPropertyException,
234 ::com::sun::star::lang::WrappedTargetException,
235 ::com::sun::star::uno::RuntimeException);
237 // XPropertyAccess
238 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
239 getPropertyValues() throw(::com::sun::star::uno::RuntimeException);
240 virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence<
241 ::com::sun::star::beans::PropertyValue >& aProps )
242 throw(::com::sun::star::beans::UnknownPropertyException,
243 ::com::sun::star::beans::PropertyVetoException,
244 ::com::sun::star::lang::IllegalArgumentException,
245 ::com::sun::star::lang::WrappedTargetException,
246 ::com::sun::star::uno::RuntimeException);
248 // XServiceInfo
249 virtual ::rtl::OUString SAL_CALL getImplementationName( )
250 throw(::com::sun::star::uno::RuntimeException);
251 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
252 throw(::com::sun::star::uno::RuntimeException);
253 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
254 throw(::com::sun::star::uno::RuntimeException);
258 class SvNumberFormatSettingsObj : public cppu::WeakImplHelper2<
259 com::sun::star::beans::XPropertySet,
260 com::sun::star::lang::XServiceInfo>
262 private:
263 SvNumberFormatsSupplierObj& rSupplier;
264 mutable ::comphelper::SharedMutex m_aMutex;
266 public:
267 SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex);
268 virtual ~SvNumberFormatSettingsObj();
271 // XPropertySet
272 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
273 SAL_CALL getPropertySetInfo( )
274 throw(::com::sun::star::uno::RuntimeException);
275 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
276 const ::com::sun::star::uno::Any& aValue )
277 throw(::com::sun::star::beans::UnknownPropertyException,
278 ::com::sun::star::beans::PropertyVetoException,
279 ::com::sun::star::lang::IllegalArgumentException,
280 ::com::sun::star::lang::WrappedTargetException,
281 ::com::sun::star::uno::RuntimeException);
282 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
283 const ::rtl::OUString& PropertyName )
284 throw(::com::sun::star::beans::UnknownPropertyException,
285 ::com::sun::star::lang::WrappedTargetException,
286 ::com::sun::star::uno::RuntimeException);
287 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
288 const ::com::sun::star::uno::Reference<
289 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
290 throw(::com::sun::star::beans::UnknownPropertyException,
291 ::com::sun::star::lang::WrappedTargetException,
292 ::com::sun::star::uno::RuntimeException);
293 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
294 const ::com::sun::star::uno::Reference<
295 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
296 throw(::com::sun::star::beans::UnknownPropertyException,
297 ::com::sun::star::lang::WrappedTargetException,
298 ::com::sun::star::uno::RuntimeException);
299 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
300 const ::com::sun::star::uno::Reference<
301 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
302 throw(::com::sun::star::beans::UnknownPropertyException,
303 ::com::sun::star::lang::WrappedTargetException,
304 ::com::sun::star::uno::RuntimeException);
305 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
306 const ::com::sun::star::uno::Reference<
307 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
308 throw(::com::sun::star::beans::UnknownPropertyException,
309 ::com::sun::star::lang::WrappedTargetException,
310 ::com::sun::star::uno::RuntimeException);
312 // XServiceInfo
313 virtual ::rtl::OUString SAL_CALL getImplementationName( )
314 throw(::com::sun::star::uno::RuntimeException);
315 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
316 throw(::com::sun::star::uno::RuntimeException);
317 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
318 throw(::com::sun::star::uno::RuntimeException);
323 #endif