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