22#include <osl/mutex.hxx>
23#include <osl/diagnose.h>
24#include <rtl/character.hxx>
25#include <rtl/ustring.hxx>
27#include <com/sun/star/util/Date.hpp>
28#include <com/sun/star/util/MalformedNumberFormatException.hpp>
29#include <com/sun/star/util/NotNumericException.hpp>
30#include <com/sun/star/beans/PropertyAttribute.hpp>
83 return aNumberFormatPropertyMap_Impl;
95 return aNumberSettingsPropertyMap_Impl;
123 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
127 throw uno::RuntimeException();
139 ::osl::MutexGuard aGuard(
m_aMutex );
145 ::osl::MutexGuard aGuard(
m_aMutex );
149 throw uno::RuntimeException();
151 sal_uInt32 nUKey = nKey;
154 throw util::NotNumericException();
161 ::osl::MutexGuard aGuard(
m_aMutex );
165 throw uno::RuntimeException();
167 sal_uInt32 nUKey = nKey;
170 throw util::NotNumericException();
177 ::osl::MutexGuard aGuard(
m_aMutex );
182 throw uno::RuntimeException();
184 const Color* pColor =
nullptr;
192 sal_Int32 aDefaultColor )
194 ::osl::MutexGuard aGuard(
m_aMutex );
196 util::Color nRet = aDefaultColor;
199 throw uno::RuntimeException();
202 const Color* pColor =
nullptr;
205 nRet = sal_uInt32(*pColor);
212 const OUString& aString )
214 ::osl::MutexGuard aGuard(
m_aMutex );
220 throw uno::RuntimeException();
223 const Color* pColor =
nullptr;
230 const OUString& aString,
231 sal_Int32 aDefaultColor )
233 ::osl::MutexGuard aGuard(
m_aMutex );
235 util::Color nRet = aDefaultColor;
239 throw uno::RuntimeException();
243 const Color* pColor =
nullptr;
247 nRet = sal_uInt32(*pColor);
256 ::osl::MutexGuard aGuard(
m_aMutex );
261 throw uno::RuntimeException();
272 const lang::Locale& nLocale,
275 ::osl::MutexGuard aGuard(
m_aMutex );
280 throw uno::RuntimeException();
283 const Color* pColor =
nullptr;
289 bOk = pFormatter->
GetPreviewString( aFormat, fValue, aRet, &pColor, eLang );
292 throw util::MalformedNumberFormatException();
299 const lang::Locale& nLocale,
301 sal_Int32 aDefaultColor )
303 ::osl::MutexGuard aGuard(
m_aMutex );
305 util::Color nRet = aDefaultColor;
308 throw uno::RuntimeException();
312 const Color* pColor =
nullptr;
318 bOk = pFormatter->
GetPreviewString( aFormat, fValue, aOutString, &pColor, eLang );
321 throw util::MalformedNumberFormatException();
324 nRet = sal_uInt32(*pColor);
334 return "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject";
344 return {
"com.sun.star.util.NumberFormatter" };
348 :m_xSupplier( &_rParent )
361 ::osl::MutexGuard aGuard(
m_aMutex );
366 throw uno::RuntimeException();
372 const lang::Locale& nLocale,
375 ::osl::MutexGuard aGuard(
m_aMutex );
379 throw uno::RuntimeException();
386 sal_uInt32
nCount = rTable.size();
388 sal_Int32* pAry =
aSeq.getArray();
390 for (
const auto& rEntry : rTable)
392 pAry[
i] = rEntry.first;
399 const lang::Locale& nLocale,
402 ::osl::MutexGuard aGuard(
m_aMutex );
406 throw uno::RuntimeException();
413 sal_uInt32 nRet = pFormatter->
GetEntryKey( aFormat, eLang );
432 const sal_Int32 nLen = aFormat.getLength();
433 OUStringBuffer
aBuf(0);
435 memcpy(
p, aFormat.getStr(), (nLen + 1) *
sizeof(
sal_Unicode));
436 aBuf.setLength( nLen);
437 assert(
p ==
aBuf.getStr());
439 bool bQuoted =
false;
440 for ( ;
p < pStop; ++
p)
451 else if (rtl::isAsciiLowerCase(*
p))
452 *
p = rtl::toAsciiUpperCase(*
p);
461 return static_cast<sal_Int32
>(nRet);
465 const lang::Locale& nLocale )
467 ::osl::MutexGuard aGuard(
m_aMutex );
472 throw uno::RuntimeException();
474 OUString aFormStr = aFormat;
477 sal_Int32 nCheckPos = 0;
479 bool bOk = pFormatter->
PutEntry( aFormStr, nCheckPos,
nType, nKey, eLang );
484 throw util::MalformedNumberFormatException();
486 else if (aFormStr != aFormat)
495 throw uno::RuntimeException();
501 const lang::Locale& nLocale,
502 const lang::Locale& nNewLocale )
504 ::osl::MutexGuard aGuard(
m_aMutex );
509 throw uno::RuntimeException();
511 OUString aFormStr = aFormat;
515 sal_Int32 nCheckPos = 0;
524 throw util::MalformedNumberFormatException();
527 throw uno::RuntimeException();
534 ::osl::MutexGuard aGuard(
m_aMutex );
544 const lang::Locale& nLocale,
549 ::osl::MutexGuard aGuard(
m_aMutex );
553 throw uno::RuntimeException();
556 OUString aRet = pFormatter->
GenerateFormat(nBaseKey, eLang, bThousands, bRed, nDecimals, nLeading);
564 ::osl::MutexGuard aGuard(
m_aMutex );
568 throw uno::RuntimeException();
577 ::osl::MutexGuard aGuard(
m_aMutex );
581 throw uno::RuntimeException();
594 ::osl::MutexGuard aGuard(
m_aMutex );
598 throw uno::RuntimeException();
607 ::osl::MutexGuard aGuard(
m_aMutex );
614 ::osl::MutexGuard aGuard(
m_aMutex );
618 throw uno::RuntimeException();
629 return "SvNumberFormatsObj";
639 return {
"com.sun.star.util.NumberFormats" };
643 :m_xSupplier( &rParent )
657 static uno::Reference<beans::XPropertySetInfo> aRef =
665 throw beans::UnknownPropertyException();
670 ::osl::MutexGuard aGuard(
m_aMutex );
676 throw uno::RuntimeException();
678 bool bThousand, bRed;
679 sal_uInt16 nDecimals, nLeading;
692 aRet <<= static_cast<sal_Int16>( pFormat->
GetType() );
710 aRet <<= static_cast<sal_Int16>(nDecimals);
715 aRet <<= static_cast<sal_Int16>(nLeading);
729 OUString aSymbol, aExt;
735 OUString aSymbol, aExt;
741 OUString aSymbol, aExt;
747 aRet <<= pCurr->GetBankSymbol();
752 throw beans::UnknownPropertyException(aPropertyName);
758 const uno::Reference<beans::XPropertyChangeListener>&)
760 OSL_FAIL(
"not implemented");
764 const uno::Reference<beans::XPropertyChangeListener>&)
766 OSL_FAIL(
"not implemented");
770 const uno::Reference<beans::XVetoableChangeListener>&)
772 OSL_FAIL(
"not implemented");
776 const uno::Reference<beans::XVetoableChangeListener>&)
778 OSL_FAIL(
"not implemented");
785 ::osl::MutexGuard aGuard(
m_aMutex );
790 throw uno::RuntimeException();
792 OUString aSymbol, aExt;
799 aAbb = pCurr->GetBankSymbol();
806 bool bThousand, bRed;
807 sal_uInt16 nDecimals, nLeading;
832 throw beans::UnknownPropertyException();
839 return "SvNumberFormatObj";
849 return {
"com.sun.star.util.NumberFormatProperties" };
853 :m_xSupplier( &rParent )
866 static uno::Reference<beans::XPropertySetInfo> aRef =
874 ::osl::MutexGuard aGuard(
m_aMutex );
878 throw uno::RuntimeException();
889 if ( aValue >>= aDate )
894 sal_Int16 nInt16 = sal_Int16();
895 if ( aValue >>= nInt16 )
900 sal_Int16 nInt16 = sal_Int16();
901 if ( aValue >>= nInt16 )
905 throw beans::UnknownPropertyException(aPropertyName);
911 ::osl::MutexGuard aGuard(
m_aMutex );
916 throw uno::RuntimeException();
930 aRet <<= static_cast<sal_Int16>( pFormatter->
GetYear2000() );
932 throw beans::UnknownPropertyException(aPropertyName);
938 const uno::Reference<beans::XPropertyChangeListener>&)
940 OSL_FAIL(
"not implemented");
944 const uno::Reference<beans::XPropertyChangeListener>&)
946 OSL_FAIL(
"not implemented");
950 const uno::Reference<beans::XVetoableChangeListener>&)
952 OSL_FAIL(
"not implemented");
956 const uno::Reference<beans::XVetoableChangeListener>&)
958 OSL_FAIL(
"not implemented");
965 return "SvNumberFormatSettingsObj";
975 return {
"com.sun.star.util.NumberFormatSettings" };
979extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
981 css::uno::Sequence<css::uno::Any>
const &)
css::util::Date GetUNODate() const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
css::uno::Type const & get()
Sequence< sal_Int8 > aSeq
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_uno_util_numbers_SvNumberFormatterServiceObject_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
constexpr OUStringLiteral PROPERTYNAME_TYPE
constexpr OUStringLiteral PROPERTYNAME_COMMENT
constexpr OUStringLiteral PROPERTYNAME_CURRABB
static o3tl::span< const SfxItemPropertyMapEntry > lcl_GetNumberFormatPropertyMap()
constexpr OUStringLiteral PROPERTYNAME_FMTSTR
constexpr OUStringLiteral PROPERTYNAME_STDFORM
constexpr OUStringLiteral PROPERTYNAME_LEADING
constexpr OUStringLiteral PROPERTYNAME_STDDEC
constexpr OUStringLiteral PROPERTYNAME_CURRSYM
static o3tl::span< const SfxItemPropertyMapEntry > lcl_GetNumberSettingsPropertyMap()
constexpr OUStringLiteral PROPERTYNAME_NOZERO
constexpr OUStringLiteral PROPERTYNAME_DECIMALS
constexpr OUStringLiteral PROPERTYNAME_USERDEF
constexpr OUStringLiteral PROPERTYNAME_CURREXT
constexpr OUStringLiteral PROPERTYNAME_TWODIGIT
constexpr OUStringLiteral PROPERTYNAME_NULLDATE
constexpr OUStringLiteral PROPERTYNAME_THOUS
constexpr OUStringLiteral PROPERTYNAME_LOCALE
constexpr OUStringLiteral PROPERTYNAME_NEGRED
static LanguageType lcl_GetLanguage(const lang::Locale &rLocale)
map a property between beans::XPropertySet and SfxPoolItem
std::map< sal_uInt32, SvNumberformat * > SvNumberFormatTable
This table is std::map because it needs to preserve insertion order, because the formats are roughly ...
SvNumFormatType
MAX_ULONG.
@ ALL
selects all number formats.
@ DEFINED
selects only user-defined number formats.
#define SV_COUNTRY_LANGUAGE_OFFSET
NfIndexTableOffset
enum values for <method>SvNumberFormatter::GetFormatIndex</method>
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND