22#include <com/sun/star/i18n/XNumberFormatCode.hpp>
23#include <com/sun/star/uno/XComponentContext.hpp>
57 SvNumberFormatter(
const css::uno::Reference<css::uno::XComponentContext>& rxContext,
65 Color* GetUserDefColor(sal_uInt16 nIndex);
70 void ChangeNullDate(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear);
72 void ChangeStandardPrec(
short nPrec);
74 void SetNoZero(
bool bNZ);
101 void DeleteEntry(sal_uInt32 nKey);
116 bool PutEntry(OUString& rString, sal_Int32& nCheckPos,
SvNumFormatType& nType, sal_uInt32& nKey,
117 LanguageType eLnge = LANGUAGE_DONTKNOW,
bool bReplaceBooleanEquivalent =
true);
122 bool PutandConvertEntry(OUString& rString, sal_Int32& nCheckPos,
SvNumFormatType& nType,
124 bool bConvertDateOrder,
bool bReplaceBooleanEquivalent =
true);
130 bool PutandConvertEntrySystem(OUString& rString, sal_Int32& nCheckPos,
SvNumFormatType& nType,
170 sal_uInt32 GetIndexPuttingAndConverting(OUString& rString,
LanguageType eLnge,
172 bool& rNewInserted, sal_Int32& rCheckPos);
176 OUString GenerateFormat(sal_uInt32 nIndex,
LanguageType eLnge = LANGUAGE_DONTKNOW,
177 bool bThousand =
false,
bool IsRed =
false, sal_uInt16 nPrecision = 0,
178 sal_uInt16 nLeadingCnt = 1);
187 bool IsNumberFormat(
const OUString& sString, sal_uInt32& F_Index,
double& fOutNumber,
191 void GetOutputString(
const double& fOutNumber, sal_uInt32 nFIndex, OUString& sOutString,
192 const Color** ppColor,
bool bUseStarFormat =
false);
197 void GetOutputString(
const OUString& sString, sal_uInt32 nFIndex, OUString& sOutString,
198 const Color** ppColor,
bool bUseStarFormat =
false);
205 void GetInputLineString(
const double& fOutNumber, sal_uInt32 nFIndex, OUString& rOutString,
206 bool bFiltering =
false,
bool bForceSystemLocale =
false);
213 bool GetPreviewString(
const OUString& sFormatString,
double fPreviewNumber,
215 bool bUseStarFormat =
false);
219 bool GetPreviewStringGuess(
const OUString& sFormatString,
double fPreviewNumber,
220 OUString& sOutString,
const Color** ppColor,
228 bool GetPreviewString(
const OUString& sFormatString,
const OUString& sPreviewString,
229 OUString& sOutString,
const Color** ppColor,
236 sal_uInt32 TestNewString(
const OUString& sFormatString,
LanguageType eLnge = LANGUAGE_DONTKNOW);
239 bool IsTextFormat(sal_uInt32 nFIndex)
const;
242 bool IsNatNum12(sal_uInt32 nFIndex)
const;
245 void GetFormatSpecialInfo(sal_uInt32 nFormat,
bool& bThousand,
bool& IsRed,
246 sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt);
249 sal_uInt16 GetFormatPrecision(sal_uInt32 nFormat)
const;
252 sal_uInt16 GetFormatIntegerDigits(sal_uInt32 nFormat)
const;
261 sal_uInt32 GetFormatSpecialInfo(
const OUString&,
bool& bThousand,
bool& IsRed,
262 sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt,
266 OUString GetCalcCellReturn(sal_uInt32 nFormat)
const;
268 bool IsUserDefined(sal_uInt32 F_Index)
const;
271 bool IsUserDefined(std::u16string_view sStr,
LanguageType eLnge = LANGUAGE_DONTKNOW);
275 sal_uInt32 GetEntryKey(std::u16string_view sStr,
LanguageType eLnge = LANGUAGE_DONTKNOW);
281 const SvNumberformat* GetSubstitutedEntry(sal_uInt32 nKey, sal_uInt32& o_rNewKey)
const;
284 sal_uInt32 GetStandardIndex(
LanguageType eLnge = LANGUAGE_DONTKNOW);
297 sal_uInt32 GetStandardFormat(
double fNumber, sal_uInt32 nFIndex,
SvNumFormatType eType,
301 bool IsSpecialStandardFormat(sal_uInt32 nFIndex,
LanguageType eLnge);
304 sal_uInt32 GetTimeFormat(
double fNumber,
LanguageType eLnge,
bool bForceDuration);
319 sal_uInt32 GetEditFormat(
double fNumber, sal_uInt32 nFIndex,
SvNumFormatType eType,
326 sal_uInt16 GetStandardPrec()
const;
328 bool GetNoZero()
const;
334 void ClearMergeTable();
339 bool HasMergeFormatTable()
const;
341 sal_uInt32 GetMergeFormatIndex(sal_uInt32 nOldFmt)
const;
350 sal_uInt32 GetFormatForLanguageIfBuiltIn(sal_uInt32 nFormat,
379 void SetYear2000(sal_uInt16 nVal);
380 sal_uInt16 GetYear2000()
const;
381 static sal_uInt16 GetYear2000Default();
383 sal_uInt16 ExpandTwoDigitYear(sal_uInt16 nYear)
const;
384 static sal_uInt16 ExpandTwoDigitYear(sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart);
387 OUString GetFormatDecimalSep(sal_uInt32 nFormat)
const;
392 static void resetTheCurrencyTable();
403 static const NfCurrencyEntry* MatchSystemCurrency();
410 static const NfCurrencyEntry& GetCurrencyEntry(
LanguageType);
419 static const NfCurrencyEntry* GetCurrencyEntry(std::u16string_view rAbbrev,
LanguageType eLang);
430 static const NfCurrencyEntry* GetLegacyOnlyCurrencyEntry(std::u16string_view rSymbol,
431 std::u16string_view rAbbrev);
438 static void SetDefaultSystemCurrency(std::u16string_view rAbbrev,
LanguageType eLang);
448 sal_uInt16 GetCurrencyFormatStrings(
NfWSStringsDtor&,
const NfCurrencyEntry&,
bool bBank)
const;
455 bool GetNewCurrencySymbolString(sal_uInt32 nFormat, OUString& rSymbol,
456 const NfCurrencyEntry** ppEntry,
bool* pBank =
nullptr)
const;
494 static const NfCurrencyEntry* GetCurrencyEntry(
bool& bFoundBank, std::u16string_view rSymbol,
495 std::u16string_view rExtension,
497 bool bOnlyStringLanguage =
false);
500 void GetCompatibilityCurrency(OUString& rSymbol, OUString& rAbbrev)
const;
503 void GetUsedLanguages(std::vector<LanguageType>& rList);
519 OUString GetFormatStringForExcel(sal_uInt32 nKey,
const NfKeywordTable& rKeywords,
524 OUString GetKeyword(
LanguageType eLnge, sal_uInt16 nIndex);
555 const std::vector<Color>& GetStandardColors()
const;
558 size_t GetMaxDefaultColors()
const;
577 std::map<sal_uInt32, std::unique_ptr<SvNumberformat>>
582 std::unique_ptr<SvNumberFormatterIndexTable>
617 SVL_DLLPRIVATE void ImpGenerateFormats(sal_uInt32 CLOffset,
bool bNoAdditionalFormats);
622 css::uno::Reference<css::i18n::XNumberFormatCode>
const& rNumberFormatCode,
623 bool bAfterChangingSystemCL);
627 bool bAfterChangingSystemCL =
false,
628 sal_Int16 nOrgIndex = 0);
635 SVL_DLLPRIVATE sal_uInt32 ImpIsEntry(std::u16string_view rString, sal_uInt32 CLOffset,
660 css::uno::Sequence<css::i18n::NumberFormatCode>& rSeq,
const NfIndexTableOffset nTabOff);
667 SVL_DLLPRIVATE void ImpAdjustFormatCodeDefault(css::i18n::NumberFormatCode* pFormatArr,
675 static bool ImpLookupCurrencyEntryLoopBody(
const NfCurrencyEntry*& pFoundEntry,
676 bool& bFoundBank,
const NfCurrencyEntry* pData,
677 sal_uInt16 nPos, std::u16string_view rSymbol);
683 sal_Int32 ImpPosToken(
const OUStringBuffer& sFormat,
sal_Unicode token,
684 sal_Int32 nStartPos = 0)
const;
690 static ::osl::Mutex& GetGlobalMutex();
695 void ResetDefaultSystemCurrency();
707 const css::uno::Reference<css::uno::XComponentContext>& GetComponentContext()
const;
721 const ::utl::TransliterationWrapper* GetTransliteration()
const;
733 const NativeNumberWrapper* GetNatNum()
const;
738 const OUString& GetNumDecimalSep()
const;
741 const OUString& GetNumDecimalSepAlt()
const;
744 const OUString& GetNumThousandSep()
const;
747 const OUString& GetDateSep()
const;
750 bool IsDecimalSep(std::u16string_view rStr)
const;
Load a calendar only if it's needed.
SvNumberformatter uses it upon switching locales.
Switch between LANGUAGE_SYSTEM and LANGUAGE_ENGLISH_US and any other LocaleDataWrapper.
Load a native number service wrapper only if it's needed.
Load a transliteration only if it's needed.
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
const LocaleDataWrapper & GetLocaleData()
::std::array< OUString, NF_KEYWORD_ENTRIES_COUNT > NfKeywordTable
std::vector< OUString > NfWSStringsDtor
std::unordered_map< sal_uInt16, sal_uInt32 > SvNumberFormatterIndexTable
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.
std::unordered_map< sal_uInt32, sal_uInt32 > SvNumberFormatterMergeMap
NfEvalDateFormat
enum values for <method>SvNumberFormatter::SetEvalDateFormat</method>
NfIndexTableOffset
enum values for <method>SvNumberFormatter::GetFormatIndex</method>
SvNumInputOptions
Input options to be used with IsNumberFormat()