1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svl.hxx"
26 #ifndef GCC
27 #endif
28
29 #include <tools/color.hxx>
30 #include <tools/debug.hxx>
31 #include <i18npool/mslangid.hxx>
32 #include <vos/mutex.hxx>
33 #include <rtl/ustring.hxx>
34
35 #include <com/sun/star/util/Date.hpp>
36 #include <com/sun/star/beans/PropertyAttribute.hpp>
37
38 #include "numfmuno.hxx"
39 #include <svl/numuno.hxx>
40 #include <svl/zforlist.hxx>
41 #include <svl/zformat.hxx>
42 #include <svl/itemprop.hxx>
43
44 using namespace com::sun::star;
45
46 //------------------------------------------------------------------------
47
48 #define SERVICENAME_NUMBERFORMATTER "com.sun.star.util.NumberFormatter"
49 #define SERVICENAME_NUMBERSETTINGS "com.sun.star.util.NumberFormatSettings"
50 #define SERVICENAME_NUMBERFORMATS "com.sun.star.util.NumberFormats"
51 #define SERVICENAME_NUMBERFORMAT "com.sun.star.util.NumberFormatProperties"
52
53 //------------------------------------------------------------------------
54
55 #define PROPERTYNAME_FMTSTR "FormatString"
56 #define PROPERTYNAME_LOCALE "Locale"
57 #define PROPERTYNAME_TYPE "Type"
58 #define PROPERTYNAME_COMMENT "Comment"
59 #define PROPERTYNAME_CURREXT "CurrencyExtension"
60 #define PROPERTYNAME_CURRSYM "CurrencySymbol"
61 #define PROPERTYNAME_CURRABB "CurrencyAbbreviation"
62 #define PROPERTYNAME_DECIMALS "Decimals"
63 #define PROPERTYNAME_LEADING "LeadingZeros"
64 #define PROPERTYNAME_NEGRED "NegativeRed"
65 #define PROPERTYNAME_STDFORM "StandardFormat"
66 #define PROPERTYNAME_THOUS "ThousandsSeparator"
67 #define PROPERTYNAME_USERDEF "UserDefined"
68
69 #define PROPERTYNAME_NOZERO "NoZero"
70 #define PROPERTYNAME_NULLDATE "NullDate"
71 #define PROPERTYNAME_STDDEC "StandardDecimals"
72 #define PROPERTYNAME_TWODIGIT "TwoDigitDateStart"
73
74 //------------------------------------------------------------------------
75
76 // alles ohne Which-ID, Map nur fuer PropertySetInfo
77
lcl_GetNumberFormatPropertyMap()78 const SfxItemPropertyMapEntry* lcl_GetNumberFormatPropertyMap()
79 {
80 static SfxItemPropertyMapEntry aNumberFormatPropertyMap_Impl[] =
81 {
82 {MAP_CHAR_LEN(PROPERTYNAME_FMTSTR), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
83 {MAP_CHAR_LEN(PROPERTYNAME_LOCALE), 0, &getCppuType((lang::Locale*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
84 {MAP_CHAR_LEN(PROPERTYNAME_TYPE), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
85 {MAP_CHAR_LEN(PROPERTYNAME_COMMENT), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
86 {MAP_CHAR_LEN(PROPERTYNAME_CURREXT), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
87 {MAP_CHAR_LEN(PROPERTYNAME_CURRSYM), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
88 {MAP_CHAR_LEN(PROPERTYNAME_DECIMALS), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
89 {MAP_CHAR_LEN(PROPERTYNAME_LEADING), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
90 {MAP_CHAR_LEN(PROPERTYNAME_NEGRED), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
91 {MAP_CHAR_LEN(PROPERTYNAME_STDFORM), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
92 {MAP_CHAR_LEN(PROPERTYNAME_THOUS), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
93 {MAP_CHAR_LEN(PROPERTYNAME_USERDEF), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
94 {MAP_CHAR_LEN(PROPERTYNAME_CURRABB), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
95 {0,0,0,0,0,0}
96 };
97 return aNumberFormatPropertyMap_Impl;
98 }
99
lcl_GetNumberSettingsPropertyMap()100 const SfxItemPropertyMapEntry* lcl_GetNumberSettingsPropertyMap()
101 {
102 static SfxItemPropertyMapEntry aNumberSettingsPropertyMap_Impl[] =
103 {
104 {MAP_CHAR_LEN(PROPERTYNAME_NOZERO), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND, 0},
105 {MAP_CHAR_LEN(PROPERTYNAME_NULLDATE), 0, &getCppuType((util::Date*)0), beans::PropertyAttribute::BOUND, 0},
106 {MAP_CHAR_LEN(PROPERTYNAME_STDDEC), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0},
107 {MAP_CHAR_LEN(PROPERTYNAME_TWODIGIT), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0},
108 {0,0,0,0,0,0}
109 };
110 return aNumberSettingsPropertyMap_Impl;
111 }
112
113 //----------------------------------------------------------------------------------------
114
lcl_GetLanguage(const lang::Locale & rLocale)115 LanguageType lcl_GetLanguage( const lang::Locale& rLocale )
116 {
117 // empty language -> LANGUAGE_SYSTEM
118 if ( rLocale.Language.getLength() == 0 )
119 return LANGUAGE_SYSTEM;
120
121 LanguageType eRet = MsLangId::convertLocaleToLanguage( rLocale );
122 if ( eRet == LANGUAGE_NONE )
123 eRet = LANGUAGE_SYSTEM; //! or throw an exception?
124
125 return eRet;
126 }
127
128 //----------------------------------------------------------------------------------------
129
SvNumberFormatterServiceObj()130 SvNumberFormatterServiceObj::SvNumberFormatterServiceObj()
131 :m_aMutex()
132 {
133 }
134
~SvNumberFormatterServiceObj()135 SvNumberFormatterServiceObj::~SvNumberFormatterServiceObj()
136 {
137 }
138
SvNumberFormatterServiceObj_CreateInstance(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> &)139 com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvNumberFormatterServiceObj_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
140 {
141 return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new SvNumberFormatterServiceObj );
142 }
143
144 // XNumberFormatter
145
attachNumberFormatsSupplier(const uno::Reference<util::XNumberFormatsSupplier> & _xSupplier)146 void SAL_CALL SvNumberFormatterServiceObj::attachNumberFormatsSupplier(
147 const uno::Reference<util::XNumberFormatsSupplier>& _xSupplier )
148 {
149 ::rtl::Reference< SvNumberFormatsSupplierObj > xAutoReleaseOld;
150
151 // SYNCHRONIZED ->
152 {
153 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
154
155 SvNumberFormatsSupplierObj* pNew = SvNumberFormatsSupplierObj::getImplementation( _xSupplier );
156 if (!pNew)
157 throw uno::RuntimeException(); // wrong object
158
159 xAutoReleaseOld = xSupplier;
160
161 xSupplier = pNew;
162 m_aMutex = xSupplier->getSharedMutex();
163 }
164 // <- SYNCHRONIZED
165 }
166
167 uno::Reference<util::XNumberFormatsSupplier> SAL_CALL
getNumberFormatsSupplier()168 SvNumberFormatterServiceObj::getNumberFormatsSupplier()
169 {
170 ::osl::MutexGuard aGuard( m_aMutex );
171 return xSupplier.get();
172 }
173
detectNumberFormat(sal_Int32 nKey,const rtl::OUString & aString)174 sal_Int32 SAL_CALL SvNumberFormatterServiceObj::detectNumberFormat(
175 sal_Int32 nKey, const rtl::OUString& aString )
176 {
177 ::osl::MutexGuard aGuard( m_aMutex );
178
179 sal_Int32 nRet = 0;
180 SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
181 if (pFormatter)
182 {
183 String aTemp = aString;
184 sal_uInt32 nUKey = nKey;
185 double fValue = 0.0;
186 if ( pFormatter->IsNumberFormat(aTemp, nUKey, fValue) )
187 nRet = nUKey;
188 else
189 throw util::NotNumericException();
190 }
191 else
192 throw uno::RuntimeException();
193
194 return nRet;
195 }
196
convertStringToNumber(sal_Int32 nKey,const rtl::OUString & aString)197 double SAL_CALL SvNumberFormatterServiceObj::convertStringToNumber(
198 sal_Int32 nKey, const rtl::OUString& aString )
199 {
200 ::osl::MutexGuard aGuard( m_aMutex );
201
202 double fRet = 0.0;
203 SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
204 if (pFormatter)
205 {
206 String aTemp = aString;
207 sal_uInt32 nUKey = nKey;
208 double fValue = 0.0;
209 if ( pFormatter->IsNumberFormat(aTemp, nUKey, fValue) )
210 fRet = fValue;
211 else
212 throw util::NotNumericException();
213 }
214 else
215 throw uno::RuntimeException();
216
217 return fRet;
218 }
219
convertNumberToString(sal_Int32 nKey,double fValue)220 rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToString(
221 sal_Int32 nKey, double fValue )
222 {
223 ::osl::MutexGuard aGuard( m_aMutex );
224
225 String aRet;
226 SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
227 if (pFormatter)
228 {
229 Color* pColor = NULL;
230 pFormatter->GetOutputString(fValue, nKey, aRet, &pColor);
231 }
232 else
233 throw uno::RuntimeException();
234
235 return aRet;
236 }
237
queryColorForNumber(sal_Int32 nKey,double fValue,util::Color aDefaultColor)238 util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32 nKey,
239 double fValue, util::Color aDefaultColor )
240 {
241 ::osl::MutexGuard aGuard( m_aMutex );
242
243 util::Color nRet = aDefaultColor; // color = sal_Int32
244 SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
245 if (pFormatter)
246 {
247 String aStr;
248 Color* pColor = NULL;
249 pFormatter->GetOutputString(fValue, nKey, aStr, &pColor);
250 if (pColor)
251 nRet = pColor->GetColor();
252 // sonst Default behalten
253 }
254 else
255 throw uno::RuntimeException();
256
257 return nRet;
258 }
259
formatString(sal_Int32 nKey,const rtl::OUString & aString)260 rtl::OUString SAL_CALL SvNumberFormatterServiceObj::formatString( sal_Int32 nKey,
261 const rtl::OUString& aString )
262 {
263 ::osl::MutexGuard aGuard( m_aMutex );
264
265 String aRet;
266 SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
267 if (pFormatter)
268 {
269 String aTemp = aString;
270 Color* pColor = NULL;
271 pFormatter->GetOutputString(aTemp, nKey, aRet, &pColor);
272 }
273 else
274 throw uno::RuntimeException();
275
276 return aRet;
277 }
278
queryColorForString(sal_Int32 nKey,const rtl::OUString & aString,util::Color aDefaultColor)279 util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32 nKey,
280 const rtl::OUString& aString,util::Color aDefaultColor )
281 {
282 ::osl::MutexGuard aGuard( m_aMutex );
283
284 util::Color nRet = aDefaultColor; // color = sal_Int32
285 SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
286 if (pFormatter)
287 {
288 String aTemp = aString;
289 String aStr;
290 Color* pColor = NULL;
291 pFormatter->GetOutputString(aTemp, nKey, aStr, &pColor);
292 if (pColor)
293 nRet = pColor->GetColor();
294 // sonst Default behalten
295 }
296 else
297 throw uno::RuntimeException();
298
299 return nRet;
300 }
301
getInputString(sal_Int32 nKey,double fValue)302 rtl::OUString SAL_CALL SvNumberFormatterServiceObj::getInputString( sal_Int32 nKey, double fValue )
303 {
304 ::osl::MutexGuard aGuard( m_aMutex );
305
306 String aRet;
307 SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
308 if (pFormatter)
309 pFormatter->GetInputLineString(fValue, nKey, aRet);
310 else
311 throw uno::RuntimeException();
312
313 return aRet;
314 }
315
316 // XNumberFormatPreviewer
317
convertNumberToPreviewString(const rtl::OUString & aFormat,double fValue,const lang::Locale & nLocale,sal_Bool bAllowEnglish)318 rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToPreviewString(
319 const rtl::OUString& aFormat, double fValue,
320 const lang::Locale& nLocale, sal_Bool bAllowEnglish )
321 {
322 ::osl::MutexGuard aGuard( m_aMutex );
323
324 String aRet;
325 SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
326 if (pFormatter)
327 {
328 String aOutString;
329 String aFormString = aFormat;
330 LanguageType eLang = lcl_GetLanguage( nLocale );
331 Color* pColor = NULL;
332
333 sal_Bool bOk;
334 if ( bAllowEnglish )
335 bOk = pFormatter->GetPreviewStringGuess(
336 aFormString, fValue, aOutString, &pColor, eLang );
337 else
338 bOk = pFormatter->GetPreviewString(
339 aFormString, fValue, aOutString, &pColor, eLang );
340
341 if (bOk)
342 aRet = aOutString;
343 else
344 throw util::MalformedNumberFormatException();
345 }
346 else
347 throw uno::RuntimeException();
348
349 return aRet;
350 }
351
queryPreviewColorForNumber(const rtl::OUString & aFormat,double fValue,const lang::Locale & nLocale,sal_Bool bAllowEnglish,util::Color aDefaultColor)352 util::Color SAL_CALL SvNumberFormatterServiceObj::queryPreviewColorForNumber(
353 const rtl::OUString& aFormat, double fValue,
354 const lang::Locale& nLocale, sal_Bool bAllowEnglish,
355 util::Color aDefaultColor )
356 {
357 ::osl::MutexGuard aGuard( m_aMutex );
358
359 util::Color nRet = aDefaultColor; // color = sal_Int32
360 SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
361 if (pFormatter)
362 {
363 String aOutString;
364 String aFormString = aFormat;
365 LanguageType eLang = lcl_GetLanguage( nLocale );
366 Color* pColor = NULL;
367
368 sal_Bool bOk;
369 if ( bAllowEnglish )
370 bOk = pFormatter->GetPreviewStringGuess(
371 aFormString, fValue, aOutString, &pColor, eLang );
372 else
373 bOk = pFormatter->GetPreviewString(
374 aFormString, fValue, aOutString, &pColor, eLang );
375
376 if (bOk)
377 {
378 if (pColor)
379 nRet = pColor->GetColor();
380 // sonst Default behalten
381 }
382 else
383 throw util::MalformedNumberFormatException();
384 }
385 else
386 throw uno::RuntimeException();
387
388 return nRet;
389 }
390
391 // XServiceInfo
392
getImplementationName()393 rtl::OUString SAL_CALL SvNumberFormatterServiceObj::getImplementationName()
394 {
395 return rtl::OUString::createFromAscii("com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject");
396 }
397
supportsService(const rtl::OUString & ServiceName)398 sal_Bool SAL_CALL SvNumberFormatterServiceObj::supportsService( const rtl::OUString& ServiceName )
399 {
400 return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMATTER) == 0 );
401 }
402
getSupportedServiceNames()403 uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatterServiceObj::getSupportedServiceNames()
404 {
405 uno::Sequence<rtl::OUString> aRet(1);
406 rtl::OUString* pArray = aRet.getArray();
407 pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMATTER);
408 return aRet;
409 }
410
411 //------------------------------------------------------------------------
412
SvNumberFormatsObj(SvNumberFormatsSupplierObj & _rParent,::comphelper::SharedMutex & _rMutex)413 SvNumberFormatsObj::SvNumberFormatsObj( SvNumberFormatsSupplierObj& _rParent, ::comphelper::SharedMutex& _rMutex )
414 :rSupplier( _rParent )
415 ,m_aMutex( _rMutex )
416 {
417 rSupplier.acquire();
418 }
419
~SvNumberFormatsObj()420 SvNumberFormatsObj::~SvNumberFormatsObj()
421 {
422 rSupplier.release();
423 }
424
425 // XNumberFormats
426
getByKey(sal_Int32 nKey)427 uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsObj::getByKey( sal_Int32 nKey )
428 {
429 ::osl::MutexGuard aGuard( m_aMutex );
430
431 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
432 const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL;
433 if (pFormat)
434 return new SvNumberFormatObj( rSupplier, nKey, m_aMutex );
435 else
436 throw uno::RuntimeException();
437 }
438
queryKeys(sal_Int16 nType,const lang::Locale & nLocale,sal_Bool bCreate)439 uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType,
440 const lang::Locale& nLocale, sal_Bool bCreate )
441 {
442 ::osl::MutexGuard aGuard( m_aMutex );
443
444 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
445 if ( pFormatter )
446 {
447 sal_uInt32 nIndex = 0;
448 LanguageType eLang = lcl_GetLanguage( nLocale );
449 SvNumberFormatTable& rTable = bCreate ?
450 pFormatter->ChangeCL( nType, nIndex, eLang ) :
451 pFormatter->GetEntryTable( nType, nIndex, eLang );
452 sal_uInt32 nCount = rTable.Count();
453 uno::Sequence<sal_Int32> aSeq(nCount);
454 sal_Int32* pAry = aSeq.getArray();
455 for (sal_uInt32 i=0; i<nCount; i++)
456 pAry[i] = rTable.GetObjectKey( i );
457
458 return aSeq;
459 }
460 else
461 throw uno::RuntimeException();
462 }
463
queryKey(const rtl::OUString & aFormat,const lang::Locale & nLocale,sal_Bool bScan)464 sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const rtl::OUString& aFormat,
465 const lang::Locale& nLocale, sal_Bool bScan )
466 {
467 ::osl::MutexGuard aGuard( m_aMutex );
468
469 sal_Int32 nRet = 0;
470 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
471 if (pFormatter)
472 {
473 String aFormStr = aFormat;
474 LanguageType eLang = lcl_GetLanguage( nLocale );
475 if (bScan)
476 {
477 //! irgendwas muss hier noch passieren...
478 }
479 nRet = pFormatter->GetEntryKey( aFormat, eLang );
480 }
481 else
482 throw uno::RuntimeException();
483
484 return nRet;
485 }
486
addNew(const rtl::OUString & aFormat,const lang::Locale & nLocale)487 sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const rtl::OUString& aFormat,
488 const lang::Locale& nLocale )
489 {
490 ::osl::MutexGuard aGuard( m_aMutex );
491
492 sal_Int32 nRet = 0;
493 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
494 if (pFormatter)
495 {
496 String aFormStr = aFormat;
497 LanguageType eLang = lcl_GetLanguage( nLocale );
498 sal_uInt32 nKey = 0;
499 xub_StrLen nCheckPos = 0;
500 short nType = 0;
501 sal_Bool bOk = pFormatter->PutEntry( aFormStr, nCheckPos, nType, nKey, eLang );
502 if (bOk)
503 nRet = nKey;
504 else if (nCheckPos)
505 {
506 throw util::MalformedNumberFormatException(); // ungueltiges Format
507 }
508 else
509 throw uno::RuntimeException(); // anderer Fehler (z.B. schon vorhanden)
510 }
511 else
512 throw uno::RuntimeException();
513
514 return nRet;
515 }
516
addNewConverted(const rtl::OUString & aFormat,const lang::Locale & nLocale,const lang::Locale & nNewLocale)517 sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const rtl::OUString& aFormat,
518 const lang::Locale& nLocale, const lang::Locale& nNewLocale )
519 {
520 ::osl::MutexGuard aGuard( m_aMutex );
521
522 sal_Int32 nRet = 0;
523 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
524 if (pFormatter)
525 {
526 String aFormStr = aFormat;
527 LanguageType eLang = lcl_GetLanguage( nLocale );
528 LanguageType eNewLang = lcl_GetLanguage( nNewLocale );
529 sal_uInt32 nKey = 0;
530 xub_StrLen nCheckPos = 0;
531 short nType = 0;
532 sal_Bool bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang );
533 if (bOk || nKey > 0)
534 nRet = nKey;
535 else if (nCheckPos)
536 {
537 throw util::MalformedNumberFormatException(); // ungueltiges Format
538 }
539 else
540 throw uno::RuntimeException(); // anderer Fehler (z.B. schon vorhanden)
541 }
542 else
543 throw uno::RuntimeException();
544
545 return nRet;
546 }
547
removeByKey(sal_Int32 nKey)548 void SAL_CALL SvNumberFormatsObj::removeByKey( sal_Int32 nKey )
549 {
550 ::osl::MutexGuard aGuard( m_aMutex );
551 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
552
553 if (pFormatter)
554 {
555 pFormatter->DeleteEntry(nKey);
556 rSupplier.NumberFormatDeleted(nKey); // Benachrichtigung fuers Dokument
557 }
558 }
559
generateFormat(sal_Int32 nBaseKey,const lang::Locale & nLocale,sal_Bool bThousands,sal_Bool bRed,sal_Int16 nDecimals,sal_Int16 nLeading)560 rtl::OUString SAL_CALL SvNumberFormatsObj::generateFormat( sal_Int32 nBaseKey,
561 const lang::Locale& nLocale, sal_Bool bThousands,
562 sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading )
563 {
564 ::osl::MutexGuard aGuard( m_aMutex );
565
566 String aRet;
567 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
568 if (pFormatter)
569 {
570 LanguageType eLang = lcl_GetLanguage( nLocale );
571 pFormatter->GenerateFormat( aRet, nBaseKey, eLang, bThousands, bRed, nDecimals, nLeading );
572 }
573 else
574 throw uno::RuntimeException();
575
576 return aRet;
577 }
578
579 // XNumberFormatTypes
580
getStandardIndex(const lang::Locale & nLocale)581 sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardIndex( const lang::Locale& nLocale )
582 {
583 ::osl::MutexGuard aGuard( m_aMutex );
584
585 sal_Int32 nRet = 0;
586 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
587 if (pFormatter)
588 {
589 LanguageType eLang = lcl_GetLanguage( nLocale );
590 nRet = pFormatter->GetStandardIndex(eLang);
591 }
592 else
593 throw uno::RuntimeException();
594
595 return nRet;
596 }
597
getStandardFormat(sal_Int16 nType,const lang::Locale & nLocale)598 sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const lang::Locale& nLocale )
599 {
600 ::osl::MutexGuard aGuard( m_aMutex );
601
602 sal_Int32 nRet = 0;
603 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
604 if (pFormatter)
605 {
606 LanguageType eLang = lcl_GetLanguage( nLocale );
607 // mask out "defined" bit, so type from an existing number format
608 // can directly be used for getStandardFormat
609 nType &= ~NUMBERFORMAT_DEFINED;
610 nRet = pFormatter->GetStandardFormat(nType, eLang);
611 }
612 else
613 throw uno::RuntimeException();
614
615 return nRet;
616 }
617
getFormatIndex(sal_Int16 nIndex,const lang::Locale & nLocale)618 sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatIndex( sal_Int16 nIndex, const lang::Locale& nLocale )
619 {
620 ::osl::MutexGuard aGuard( m_aMutex );
621
622 sal_Int32 nRet = 0;
623 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
624 if (pFormatter)
625 {
626 LanguageType eLang = lcl_GetLanguage( nLocale );
627 nRet = pFormatter->GetFormatIndex( (NfIndexTableOffset)nIndex, eLang );
628 }
629 else
630 throw uno::RuntimeException();
631
632 return nRet;
633 }
634
isTypeCompatible(sal_Int16 nOldType,sal_Int16 nNewType)635 sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType )
636 {
637 ::osl::MutexGuard aGuard( m_aMutex );
638
639 sal_Bool bRet = sal_False;
640 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
641 if (pFormatter)
642 bRet = pFormatter->IsCompatible( nOldType, nNewType );
643 else
644 throw uno::RuntimeException();
645
646 return bRet;
647 }
648
getFormatForLocale(sal_Int32 nKey,const lang::Locale & nLocale)649 sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const lang::Locale& nLocale )
650 {
651 ::osl::MutexGuard aGuard( m_aMutex );
652
653 sal_Int32 nRet = 0;
654 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
655 if (pFormatter)
656 {
657 LanguageType eLang = lcl_GetLanguage( nLocale );
658 nRet = pFormatter->GetFormatForLanguageIfBuiltIn(nKey, eLang);
659 }
660 else
661 throw uno::RuntimeException();
662
663 return nRet;
664 }
665
666 // XServiceInfo
667
getImplementationName()668 rtl::OUString SAL_CALL SvNumberFormatsObj::getImplementationName()
669 {
670 return rtl::OUString::createFromAscii("SvNumberFormatsObj");
671 }
672
supportsService(const rtl::OUString & ServiceName)673 sal_Bool SAL_CALL SvNumberFormatsObj::supportsService( const rtl::OUString& ServiceName )
674 {
675 return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMATS) == 0 );
676 }
677
getSupportedServiceNames()678 uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatsObj::getSupportedServiceNames()
679 {
680 uno::Sequence<rtl::OUString> aRet(1);
681 rtl::OUString* pArray = aRet.getArray();
682 pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMATS);
683 return aRet;
684 }
685
686 //------------------------------------------------------------------------
687
SvNumberFormatObj(SvNumberFormatsSupplierObj & rParent,sal_uLong nK,const::comphelper::SharedMutex & _rMutex)688 SvNumberFormatObj::SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, sal_uLong nK, const ::comphelper::SharedMutex& _rMutex )
689 :rSupplier( rParent )
690 ,nKey( nK )
691 ,m_aMutex( _rMutex )
692 {
693 rSupplier.acquire();
694 }
695
~SvNumberFormatObj()696 SvNumberFormatObj::~SvNumberFormatObj()
697 {
698 rSupplier.release();
699 }
700
701 // XPropertySet
702
getPropertySetInfo()703 uno::Reference<beans::XPropertySetInfo> SAL_CALL SvNumberFormatObj::getPropertySetInfo()
704 {
705 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
706 static uno::Reference<beans::XPropertySetInfo> aRef =
707 new SfxItemPropertySetInfo( lcl_GetNumberFormatPropertyMap() );
708 return aRef;
709 }
710
setPropertyValue(const rtl::OUString &,const uno::Any &)711 void SAL_CALL SvNumberFormatObj::setPropertyValue( const rtl::OUString&,
712 const uno::Any& )
713 {
714 throw beans::UnknownPropertyException(); // everything is read-only
715 }
716
getPropertyValue(const rtl::OUString & aPropertyName)717 uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const rtl::OUString& aPropertyName )
718 {
719 ::osl::MutexGuard aGuard( m_aMutex );
720
721 uno::Any aRet;
722 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
723 const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL;
724 if (pFormat)
725 {
726 sal_Bool bThousand, bRed;
727 sal_uInt16 nDecimals, nLeading;
728
729 String aString = aPropertyName;
730 if (aString.EqualsAscii( PROPERTYNAME_FMTSTR ))
731 {
732 aRet <<= rtl::OUString( pFormat->GetFormatstring() );
733 }
734 else if (aString.EqualsAscii( PROPERTYNAME_LOCALE ))
735 {
736 lang::Locale aLocale( MsLangId::convertLanguageToLocale(
737 pFormat->GetLanguage()));
738 aRet <<= aLocale;
739 }
740 else if (aString.EqualsAscii( PROPERTYNAME_TYPE ))
741 {
742 aRet <<= (sal_Int16)( pFormat->GetType() );
743 }
744 else if (aString.EqualsAscii( PROPERTYNAME_COMMENT ))
745 {
746 aRet <<= rtl::OUString( pFormat->GetComment() );
747 }
748 else if (aString.EqualsAscii( PROPERTYNAME_STDFORM ))
749 {
750 //! SvNumberformat Member bStandard rausreichen?
751 sal_Bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
752 aRet.setValue( &bStandard, getBooleanCppuType() );
753 }
754 else if (aString.EqualsAscii( PROPERTYNAME_USERDEF ))
755 {
756 sal_Bool bUserDef = ( ( pFormat->GetType() & NUMBERFORMAT_DEFINED ) != 0 );
757 aRet.setValue( &bUserDef, getBooleanCppuType() );
758 }
759 else if (aString.EqualsAscii( PROPERTYNAME_DECIMALS ))
760 {
761 pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
762 aRet <<= (sal_Int16)( nDecimals );
763 }
764 else if (aString.EqualsAscii( PROPERTYNAME_LEADING ))
765 {
766 pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
767 aRet <<= (sal_Int16)( nLeading );
768 }
769 else if (aString.EqualsAscii( PROPERTYNAME_NEGRED ))
770 {
771 pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
772 aRet.setValue( &bRed, getBooleanCppuType() );
773 }
774 else if (aString.EqualsAscii( PROPERTYNAME_THOUS ))
775 {
776 pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
777 aRet.setValue( &bThousand, getBooleanCppuType() );
778 }
779 else if (aString.EqualsAscii( PROPERTYNAME_CURRSYM ))
780 {
781 String aSymbol, aExt;
782 pFormat->GetNewCurrencySymbol( aSymbol, aExt );
783 aRet <<= rtl::OUString( aSymbol );
784 }
785 else if (aString.EqualsAscii( PROPERTYNAME_CURREXT ))
786 {
787 String aSymbol, aExt;
788 pFormat->GetNewCurrencySymbol( aSymbol, aExt );
789 aRet <<= rtl::OUString( aExt );
790 }
791 else if (aString.EqualsAscii( PROPERTYNAME_CURRABB ))
792 {
793 String aSymbol, aExt;
794 sal_Bool bBank = sal_False;
795 pFormat->GetNewCurrencySymbol( aSymbol, aExt );
796 const NfCurrencyEntry* pCurr = pFormatter->GetCurrencyEntry( bBank,
797 aSymbol, aExt, pFormat->GetLanguage() );
798 if ( pCurr )
799 aRet <<= rtl::OUString( pCurr->GetBankSymbol() );
800 else
801 aRet <<= rtl::OUString();
802 }
803 else
804 throw beans::UnknownPropertyException();
805 }
806 else
807 throw uno::RuntimeException();
808
809 return aRet;
810 }
811
addPropertyChangeListener(const rtl::OUString &,const uno::Reference<beans::XPropertyChangeListener> &)812 void SAL_CALL SvNumberFormatObj::addPropertyChangeListener( const rtl::OUString&,
813 const uno::Reference<beans::XPropertyChangeListener>&)
814 {
815 DBG_ERROR("not implemented");
816 }
817
removePropertyChangeListener(const rtl::OUString &,const uno::Reference<beans::XPropertyChangeListener> &)818 void SAL_CALL SvNumberFormatObj::removePropertyChangeListener( const rtl::OUString&,
819 const uno::Reference<beans::XPropertyChangeListener>&)
820 {
821 DBG_ERROR("not implemented");
822 }
823
addVetoableChangeListener(const rtl::OUString &,const uno::Reference<beans::XVetoableChangeListener> &)824 void SAL_CALL SvNumberFormatObj::addVetoableChangeListener( const rtl::OUString&,
825 const uno::Reference<beans::XVetoableChangeListener>&)
826 {
827 DBG_ERROR("not implemented");
828 }
829
removeVetoableChangeListener(const rtl::OUString &,const uno::Reference<beans::XVetoableChangeListener> &)830 void SAL_CALL SvNumberFormatObj::removeVetoableChangeListener( const rtl::OUString&,
831 const uno::Reference<beans::XVetoableChangeListener>&)
832 {
833 DBG_ERROR("not implemented");
834 }
835
836 // XPropertyAccess
837
getPropertyValues()838 uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValues()
839 {
840 ::osl::MutexGuard aGuard( m_aMutex );
841
842 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
843 const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL;
844 if (pFormat)
845 {
846 String aSymbol, aExt, aAbb;
847 sal_Bool bBank = sal_False;
848 pFormat->GetNewCurrencySymbol( aSymbol, aExt );
849 const NfCurrencyEntry* pCurr = pFormatter->GetCurrencyEntry( bBank,
850 aSymbol, aExt, pFormat->GetLanguage() );
851 if ( pCurr )
852 aAbb = pCurr->GetBankSymbol();
853
854 String aFmtStr = pFormat->GetFormatstring();
855 String aComment = pFormat->GetComment();
856 sal_Bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
857 //! SvNumberformat Member bStandard rausreichen?
858 sal_Bool bUserDef = ( ( pFormat->GetType() & NUMBERFORMAT_DEFINED ) != 0 );
859 sal_Bool bThousand, bRed;
860 sal_uInt16 nDecimals, nLeading;
861 pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
862 lang::Locale aLocale( MsLangId::convertLanguageToLocale(
863 pFormat->GetLanguage()));
864
865 uno::Sequence<beans::PropertyValue> aSeq(13);
866 beans::PropertyValue* pArray = aSeq.getArray();
867
868 pArray[0].Name = rtl::OUString::createFromAscii( PROPERTYNAME_FMTSTR );
869 pArray[0].Value <<= rtl::OUString( aFmtStr );
870 pArray[1].Name = rtl::OUString::createFromAscii( PROPERTYNAME_LOCALE );
871 pArray[1].Value <<= aLocale;
872 pArray[2].Name = rtl::OUString::createFromAscii( PROPERTYNAME_TYPE );
873 pArray[2].Value <<= (sal_Int16)( pFormat->GetType() );
874 pArray[3].Name = rtl::OUString::createFromAscii( PROPERTYNAME_COMMENT );
875 pArray[3].Value <<= rtl::OUString( aComment );
876 pArray[4].Name = rtl::OUString::createFromAscii( PROPERTYNAME_STDFORM );
877 pArray[4].Value.setValue( &bStandard, getBooleanCppuType() );
878 pArray[5].Name = rtl::OUString::createFromAscii( PROPERTYNAME_USERDEF );
879 pArray[5].Value.setValue( &bUserDef, getBooleanCppuType() );
880 pArray[6].Name = rtl::OUString::createFromAscii( PROPERTYNAME_DECIMALS );
881 pArray[6].Value <<= (sal_Int16)( nDecimals );
882 pArray[7].Name = rtl::OUString::createFromAscii( PROPERTYNAME_LEADING );
883 pArray[7].Value <<= (sal_Int16)( nLeading );
884 pArray[8].Name = rtl::OUString::createFromAscii( PROPERTYNAME_NEGRED );
885 pArray[8].Value.setValue( &bRed, getBooleanCppuType() );
886 pArray[9].Name = rtl::OUString::createFromAscii( PROPERTYNAME_THOUS );
887 pArray[9].Value.setValue( &bThousand, getBooleanCppuType() );
888 pArray[10].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURRSYM );
889 pArray[10].Value <<= rtl::OUString( aSymbol );
890 pArray[11].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURREXT );
891 pArray[11].Value <<= rtl::OUString( aExt );
892 pArray[12].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURRABB );
893 pArray[12].Value <<= rtl::OUString( aAbb );
894
895 return aSeq;
896 }
897 else
898 throw uno::RuntimeException();
899 }
900
setPropertyValues(const uno::Sequence<beans::PropertyValue> &)901 void SAL_CALL SvNumberFormatObj::setPropertyValues( const uno::Sequence<beans::PropertyValue>& )
902 {
903 throw beans::UnknownPropertyException(); // everything is read-only
904 }
905
906 // XServiceInfo
907
getImplementationName()908 rtl::OUString SAL_CALL SvNumberFormatObj::getImplementationName()
909 {
910 return rtl::OUString::createFromAscii("SvNumberFormatObj");
911 }
912
supportsService(const rtl::OUString & ServiceName)913 sal_Bool SAL_CALL SvNumberFormatObj::supportsService( const rtl::OUString& ServiceName )
914 {
915 return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMAT) == 0 );
916 }
917
getSupportedServiceNames()918 uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatObj::getSupportedServiceNames()
919 {
920 uno::Sequence<rtl::OUString> aRet(1);
921 rtl::OUString* pArray = aRet.getArray();
922 pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMAT);
923 return aRet;
924 }
925
926 //------------------------------------------------------------------------
927
SvNumberFormatSettingsObj(SvNumberFormatsSupplierObj & rParent,const::comphelper::SharedMutex & _rMutex)928 SvNumberFormatSettingsObj::SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex )
929 :rSupplier( rParent )
930 ,m_aMutex( _rMutex )
931 {
932 rSupplier.acquire();
933 }
934
~SvNumberFormatSettingsObj()935 SvNumberFormatSettingsObj::~SvNumberFormatSettingsObj()
936 {
937 rSupplier.release();
938 }
939
940 // XPropertySet
941
getPropertySetInfo()942 uno::Reference<beans::XPropertySetInfo> SAL_CALL SvNumberFormatSettingsObj::getPropertySetInfo()
943 {
944 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
945 static uno::Reference<beans::XPropertySetInfo> aRef =
946 new SfxItemPropertySetInfo( lcl_GetNumberSettingsPropertyMap() );
947 return aRef;
948 }
949
setPropertyValue(const rtl::OUString & aPropertyName,const uno::Any & aValue)950 void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const rtl::OUString& aPropertyName,
951 const uno::Any& aValue )
952 {
953 ::osl::MutexGuard aGuard( m_aMutex );
954
955 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
956 if (pFormatter)
957 {
958 String aString = aPropertyName;
959 if (aString.EqualsAscii( PROPERTYNAME_NOZERO ))
960 {
961 // operator >>= shouldn't be used for bool (?)
962 if ( aValue.getValueTypeClass() == uno::TypeClass_BOOLEAN )
963 pFormatter->SetNoZero( *(sal_Bool*)aValue.getValue() );
964 }
965 else if (aString.EqualsAscii( PROPERTYNAME_NULLDATE ))
966 {
967 util::Date aDate;
968 if ( aValue >>= aDate )
969 pFormatter->ChangeNullDate( aDate.Day, aDate.Month, aDate.Year );
970 }
971 else if (aString.EqualsAscii( PROPERTYNAME_STDDEC ))
972 {
973 sal_Int16 nInt16 = sal_Int16();
974 if ( aValue >>= nInt16 )
975 pFormatter->ChangeStandardPrec( nInt16 );
976 }
977 else if (aString.EqualsAscii( PROPERTYNAME_TWODIGIT ))
978 {
979 sal_Int16 nInt16 = sal_Int16();
980 if ( aValue >>= nInt16 )
981 pFormatter->SetYear2000( nInt16 );
982 }
983 else
984 throw beans::UnknownPropertyException();
985
986 rSupplier.SettingsChanged();
987 }
988 else
989 throw uno::RuntimeException();
990 }
991
getPropertyValue(const rtl::OUString & aPropertyName)992 uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const rtl::OUString& aPropertyName )
993 {
994 ::osl::MutexGuard aGuard( m_aMutex );
995
996 uno::Any aRet;
997 SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
998 if (pFormatter)
999 {
1000 String aString = aPropertyName;
1001 if (aString.EqualsAscii( PROPERTYNAME_NOZERO ))
1002 {
1003 sal_Bool bNoZero = pFormatter->GetNoZero();
1004 aRet.setValue( &bNoZero, getBooleanCppuType() );
1005 }
1006 else if (aString.EqualsAscii( PROPERTYNAME_NULLDATE ))
1007 {
1008 Date* pDate = pFormatter->GetNullDate();
1009 if (pDate)
1010 {
1011 util::Date aUnoDate( pDate->GetDay(), pDate->GetMonth(), pDate->GetYear() );
1012 aRet <<= aUnoDate;
1013 }
1014 }
1015 else if (aString.EqualsAscii( PROPERTYNAME_STDDEC ))
1016 aRet <<= (sal_Int16)( pFormatter->GetStandardPrec() );
1017 else if (aString.EqualsAscii( PROPERTYNAME_TWODIGIT ))
1018 aRet <<= (sal_Int16)( pFormatter->GetYear2000() );
1019 else
1020 throw beans::UnknownPropertyException();
1021 }
1022 else
1023 throw uno::RuntimeException();
1024
1025 return aRet;
1026 }
1027
addPropertyChangeListener(const rtl::OUString &,const uno::Reference<beans::XPropertyChangeListener> &)1028 void SAL_CALL SvNumberFormatSettingsObj::addPropertyChangeListener( const rtl::OUString&,
1029 const uno::Reference<beans::XPropertyChangeListener>&)
1030 {
1031 DBG_ERROR("not implemented");
1032 }
1033
removePropertyChangeListener(const rtl::OUString &,const uno::Reference<beans::XPropertyChangeListener> &)1034 void SAL_CALL SvNumberFormatSettingsObj::removePropertyChangeListener( const rtl::OUString&,
1035 const uno::Reference<beans::XPropertyChangeListener>&)
1036 {
1037 DBG_ERROR("not implemented");
1038 }
1039
addVetoableChangeListener(const rtl::OUString &,const uno::Reference<beans::XVetoableChangeListener> &)1040 void SAL_CALL SvNumberFormatSettingsObj::addVetoableChangeListener( const rtl::OUString&,
1041 const uno::Reference<beans::XVetoableChangeListener>&)
1042 {
1043 DBG_ERROR("not implemented");
1044 }
1045
removeVetoableChangeListener(const rtl::OUString &,const uno::Reference<beans::XVetoableChangeListener> &)1046 void SAL_CALL SvNumberFormatSettingsObj::removeVetoableChangeListener( const rtl::OUString&,
1047 const uno::Reference<beans::XVetoableChangeListener>&)
1048 {
1049 DBG_ERROR("not implemented");
1050 }
1051
1052 // XServiceInfo
1053
getImplementationName()1054 rtl::OUString SAL_CALL SvNumberFormatSettingsObj::getImplementationName()
1055 {
1056 return rtl::OUString::createFromAscii("SvNumberFormatSettingsObj");
1057 }
1058
supportsService(const rtl::OUString & ServiceName)1059 sal_Bool SAL_CALL SvNumberFormatSettingsObj::supportsService( const rtl::OUString& ServiceName )
1060 {
1061 return ( ServiceName.compareToAscii(SERVICENAME_NUMBERSETTINGS) == 0 );
1062 }
1063
getSupportedServiceNames()1064 uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatSettingsObj::getSupportedServiceNames()
1065 {
1066 uno::Sequence<rtl::OUString> aRet(1);
1067 rtl::OUString* pArray = aRet.getArray();
1068 pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERSETTINGS);
1069 return aRet;
1070 }
1071