/// ctor with service manager and language/country enum
SvNumberFormatter(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
LanguageType eLang);
~SvNumberFormatter();
/// Set CallBack to ColorTable void SetColorLink(const Link<sal_uInt16, Color*>& rColorTableCallBack); /// Do the CallBack to ColorTable
Color* GetUserDefColor(sal_uInt16 nIndex) const;
/// Change language/country, also input and format scanner void ChangeIntl(LanguageType eLnge); /// Change the reference null date void ChangeNullDate(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear); /// Change standard precision void ChangeStandardPrec(short nPrec); /// Set zero value suppression void SetNoZero(bool bNZ);
/** The language with which the formatter was initialized (system setting),
NOT the current language after a ChangeIntl() */
LanguageType GetLanguage() const;
// Determine whether two format types are input compatible or not staticbool IsCompatible(SvNumFormatType eOldType, SvNumFormatType eNewType);
/** Get table of formats of a specific type of a locale. A format FIndex is testedwhetherithasthetypeandlocalerequested,ifitdoesn't matchFIndexreturnsthedefaultformatforthetype/locale.Ifno
specific format is to be selected FIndex may be initialized to 0. */
SvNumberFormatTable& GetEntryTable(SvNumFormatType eType, sal_uInt32& FIndex,
LanguageType eLnge);
/** Get table of formats of a specific type of a language/country. FIndexreturnsthedefaultformatofthattype.
If the language/country was never touched before new entries are generated */
SvNumberFormatTable& ChangeCL(SvNumFormatType eType, sal_uInt32& FIndex, LanguageType eLnge);
/** Get table of formats of the same type as FIndex; eType and rLnge are
set accordingly. An unknown format is set to Standard/General */
SvNumberFormatTable& GetFirstEntryTable(SvNumFormatType& eType, sal_uInt32& FIndex,
LanguageType& rLnge);
/// Delete an entry including the format it is referring to void DeleteEntry(sal_uInt32 nKey);
/** Create new entry of a format code string for language/country. @return <TRUE/>ifstringnewandokandinserted. <FALSE/>ifstringalreadyexistsoranunresolvableparseerror occurred,inwhichcasenCheckPosistheerrorpositionwithinrString. Iftheerroroccursatposition0orrStringisemptynCheckPos willbe1,soanerrorinthestringisalwaysindicatedby nCheckPosnotbeingzero. ThecontentoftherStringvariablecanbechangedandcorrected bythemethod. nTypecontainsthetypeoftheformat. nKeycontainstheindexkeyoftheformat.
*/ bool PutEntry(OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType, sal_uInt32& nKey,
LanguageType eLnge = LANGUAGE_DONTKNOW, bool bReplaceBooleanEquivalent = true);
/** Same as <method>PutEntry</method> but the format code string is consideredtobeoflanguage/countryeLngeandisconvertedto
language/country eNewLnge */ bool PutandConvertEntry(OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType,
sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge, bool bConvertDateOrder, bool bReplaceBooleanEquivalent = true);
/** Same as <method>PutandConvertEntry</method> but the format code string isconsideredtobeoftheSystemlanguage/countryeLngeandis convertedtoanotherSystemlanguage/countryeNewLnge.Inthiscase
the automatic currency is converted too. */ bool PutandConvertEntrySystem(OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType,
sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge);
/** Similar to <method>PutEntry</method> and <method>PutandConvertEntry</method>or <method>PutandConvertEntrySystem</method>,theformatcodestring passedisconsideredtobeoflanguage/countryeLnge.If eLnge==LANGUAGE_SYSTEMtheformatcodehastomatcheSysLnge,andif eSysLngeisnotthecurrentapplicationlocaletheformatcodeis convertedtothecurrentlocale.Additionally,iftheformatcode representsanold"automatic"currencyformat,itisconvertedtothe newdefaultcurrencyformatoftheeLngelocale.TherStringformat codepassedasanargumentmaygetadaptedincaseeLngewasused(or isLANGUAGE_SYSTEMandeSysLngeisidentical);incaseitwasn'tthe methodworksonacopyinstead,otherwisetheresultingstringwould notmatcheSysLngeanymore.
/** Create a format code string using format nIndex as a template and
applying other settings (passed from the dialog) */
OUString GenerateFormat(sal_uInt32 nIndex, LanguageType eLnge = LANGUAGE_DONTKNOW, bool bThousand = false, bool IsRed = false, sal_uInt16 nPrecision = 0,
sal_uInt16 nLeadingCnt = 1);
/// Format a number according to a format index, return string and color void GetOutputString(constdouble& fOutNumber, sal_uInt32 nFIndex, OUString& sOutString, const Color** ppColor, bool bUseStarFormat = false);
/** Format a string according to a format index, return string and color. Formatsonlyiftheformatcodeisoftypetextorthe4thsubcode
of a format code is specified, otherwise sOutString will be == "" */ void GetOutputString(const OUString& sString, sal_uInt32 nFIndex, OUString& sOutString, const Color** ppColor, bool bUseStarFormat = false);
/** Format a number according to the standard default format matching thegivenformatindex.rOutStringwillbetherealcellstring(e.g. anumberroundedbythecellformat,whichroundedvalueisused inthefilteringconditionnow),insteadoftheEditFormatstring
(e.g a not rounded value, which is visible during editing).*/
OUString GetInputLineString(constdouble& fOutNumber, sal_uInt32 nFIndex, bool bFiltering = false, bool bForceSystemLocale = false);
/** Format a number according to a format code string to be scanned. @return <FALSE/>ifformatcodecontainsanerror <TRUE/>else,inwhichcasethestringandcolorarereturned.
*/ bool GetPreviewString(const OUString& sFormatString, double fPreviewNumber,
OUString& sOutString, const Color** ppColor, LanguageType eLnge, bool bUseStarFormat = false);
/** Same as <method>GetPreviewString</method> but the format code string
may be either language/country eLnge or en_US english US */ bool GetPreviewStringGuess(const OUString& sFormatString, double fPreviewNumber,
OUString& sOutString, const Color** ppColor,
LanguageType eLnge = LANGUAGE_DONTKNOW);
/** Format a string according to a format code string to be scanned. @return <FALSE/>ifformatcodecontainsanerror <TRUE/>else,inwhichcasethestringandcolorarereturned.
*/ bool GetPreviewString(const OUString& sFormatString, const OUString& sPreviewString,
OUString& sOutString, const Color** ppColor,
LanguageType eLnge = LANGUAGE_DONTKNOW);
/** Test whether the format code string is already present in container @return NUMBERFORMAT_ENTRY_NOT_FOUNDifnotfound,elsetheformatindex.
*/
sal_uInt32 TestNewString(const OUString& sFormatString, LanguageType eLnge = LANGUAGE_DONTKNOW);
/// Whether format index nFIndex is of type text or not bool IsTextFormat(sal_uInt32 nFIndex) const;
/// Whether format index nFIndex has NatNum12 modifier bool IsNatNum12(sal_uInt32 nFIndex) const;
/// Get additional info of a format index, e.g. for dialog box void GetFormatSpecialInfo(sal_uInt32 nFormat, bool& bThousand, bool& IsRed,
sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt);
/// Count of decimals
sal_uInt16 GetFormatPrecision(sal_uInt32 nFormat);
/// Count of integer digits
sal_uInt16 GetFormatIntegerDigits(sal_uInt32 nFormat) const;
/** Get additional info of a format code string, e.g. for dialog box. Usesatemporaryparse,ifpossibleuseonlyifformatcodeisnot presentincontaineryet,otherwiseineffective. @return 0ifformatcodestringparsedwithouterrors,otherwiseerror position(likenCheckPoson<method>PutEntry</method>)
*/
sal_uInt32 GetFormatSpecialInfo(const OUString&, bool& bThousand, bool& IsRed,
sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt,
LanguageType eLnge = LANGUAGE_DONTKNOW);
/// Get return string for Calc CELL() function, "G", "D1", ...
OUString GetCalcCellReturn(sal_uInt32 nFormat) const;
bool IsUserDefined(sal_uInt32 F_Index) const;
/// Check if format code string may be deleted by user bool IsUserDefined(std::u16string_view sStr, LanguageType eLnge = LANGUAGE_DONTKNOW);
/** Return the format index of the format code string for language/country,
or NUMBERFORMAT_ENTRY_NOT_FOUND */
sal_uInt32 GetEntryKey(std::u16string_view sStr, LanguageType eLnge = LANGUAGE_DONTKNOW);
/// Return the format for a format index const SvNumberformat* GetEntry(sal_uInt32 nKey) const;
/// Obtain substituted GetFormatEntry(), i.e. system formats. const SvNumberformat* GetSubstitutedEntry(sal_uInt32 nKey, sal_uInt32& o_rNewKey);
/// Return the format index of the standard default number format for language/country
sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW);
/// Return the format index of the default format of a type for language/country
sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge = LANGUAGE_DONTKNOW);
/** Return the format index of the default format of a type for language/country. Maybenotthedefaultformatbutaspecialbuiltinformat,e.g.for
NF_TIME_HH_MMSS00, if that format is passed in nFIndex. */
sal_uInt32 GetStandardFormat(sal_uInt32 nFIndex, SvNumFormatType eType, LanguageType eLnge);
/** Return the format index of the default format of a type for language/country. Maybenotthedefaultformatbutaspecialbuiltinformat,e.g.for
NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0 */
sal_uInt32 GetStandardFormat(double fNumber, sal_uInt32 nFIndex, SvNumFormatType eType,
LanguageType eLnge);
/** Return a time format that best matches fNumber. */
sal_uInt32 GetTimeFormat(double fNumber, LanguageType eLnge, bool bForceDuration);
/** Return a format and type that best matches the value of fNumber if fNumberisassumedtobeadate,timeordatetimevalue,butunknown which.OriginallyintroducedforChartdatabrowsereditor,probably
should not be used otherwise. */
sal_uInt32 GuessDateTimeFormat(SvNumFormatType& rType, double fNumber, LanguageType eLnge);
/** Return the corresponding edit format of a format.
/// Return the reference date const Date& GetNullDate() const; /// Return the standard decimal precision
sal_uInt16 GetStandardPrec() const; /// Return whether zero suppression is switched on bool GetNoZero() const; /** Get the type of a format (or css::util::NumberFormat::UNDEFINED if no entry),
but with css::util::NumberFormat::DEFINED masked out */
SvNumFormatType GetType(sal_uInt32 nFIndex) const;
/// As the name says void ClearMergeTable(); /// Merge in all new entries from rNewTable and return a table of resulting new format indices
SvNumberFormatterIndexTable* MergeFormatter(SvNumberFormatter& rNewTable);
/// Whether a merge table is present or not bool HasMergeFormatTable() const; /// Return the new format index for an old format index, if a merge table exists
sal_uInt32 GetMergeFormatIndex(sal_uInt32 nOldFmt) const;
/** Convert the ugly old tools' Table type bloated with new'ed sal_uInt32 entriesmergetableto::std::mapwitholdindexkeyandnewindexkey.
@ATTENTION! Also clears the old table using ClearMergeTable() */
SvNumberFormatterMergeMap ConvertMergeTableToMap();
/** Return the format index of a builtin format for a specific language/country.
If nFormat is not a builtin format nFormat is returned. */
sal_uInt32 GetFormatForLanguageIfBuiltIn(sal_uInt32 nFormat,
LanguageType eLnge = LANGUAGE_DONTKNOW);
/** Return the format index for a builtin format of a specific language @seeNfIndexTableOffset
*/
sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge = LANGUAGE_DONTKNOW);
/** Return enum index of a format index of a builtin format, NF_INDEX_TABLE_ENTRIESifit'snotabuiltinformat. @seeNfIndexTableOffset
*/ static NfIndexTableOffset GetIndexTableOffset(sal_uInt32 nFormat);
/** Set evaluation type and order of input date strings @seeNfEvalDateFormat
*/ void SetEvalDateFormat(NfEvalDateFormat eEDF);
NfEvalDateFormat GetEvalDateFormat() const;
/** Set TwoDigitYearStart, how the input string scanner handles a two digit year. DefaultfromVCL:1930,30-9919xx,00-2920xx
/// Return the decimal separator matching the locale of the given format
OUString GetFormatDecimalSep(sal_uInt32 nFormat);
staticvoid resetTheCurrencyTable();
/// Return a NfCurrencyTable with pointers to <type>NfCurrencyEntry</type> entries staticconst NfCurrencyTable& GetTheCurrencyTable();
/** Searches, according to the default locale currency, an entry of the CurrencyTablewhichis<bold>not</bold>thefirst(LANGUAGE_SYSTEM)entry. @return <NULL/>ifnotfound elsepointertoNfCurrencyEntry
*/ staticconst NfCurrencyEntry* MatchSystemCurrency();
/** Return a NfCurrencyEntry matching a language/country. Iflanguage/countryisLANGUAGE_SYSTEMa<method>MatchSystemCurrency</method> callistriedtogetanentry.Ifthatfailsorthecorresponding language/countryisnotpresenttheentryforLANGUAGE_SYSTEMisreturned.
*/ staticconst NfCurrencyEntry& GetCurrencyEntry(LanguageType);
/** Return a NfCurrencyEntry pointer matching a language/country andcurrencyabbreviation(AKAbankingsymbol). Thismethodismeantfortheconfigurationofthedefaultcurrency. @return <NULL/>ifnotfound elsepointertoNfCurrencyEntry
*/ staticconst NfCurrencyEntry* GetCurrencyEntry(std::u16string_view rAbbrev, LanguageType eLang);
/** Return a NfCurrencyEntry pointer matching the symbol combinationofaLegacyOnlycurrency.Notethatthismeansonlythat thecurrencymatchingbothsymbolswasonceusedintheOffice,butis notofferedindialogsanymore.Itdoesn'tevenmeanthatthecurrency symbolcombinationisvalid,sincethereasonforremovingitmayhave beenjustthat.#i61657# @return Amatchingentry,orelse<NULL/>.
*/ staticconst NfCurrencyEntry* GetLegacyOnlyCurrencyEntry(std::u16string_view rSymbol,
std::u16string_view rAbbrev);
/** Set the default system currency. The combination of abbreviation and languagemustmatchanexistentelementoftheCurrencyTable.Ifnot, theSYSTEM(currentlocale)entrybecomesthedefault. Thismethodismeantfortheconfigurationofthedefaultcurrency.
*/ staticvoid SetDefaultSystemCurrency(std::u16string_view rAbbrev, LanguageType eLang);
/** Get all standard formats for a specific currency, formats are appendedtotheNfWSStringsDtorlist. @parambBank <TRUE/>:generateonlyformatstringswithcurrencyabbreviation <FALSE/>:mixedformatstrings @return positionofdefaultformat
*/
sal_uInt16 GetCurrencyFormatStrings(NfWSStringsDtor&, const NfCurrencyEntry&, bool bBank) const;
/** Whether nFormat is of type css::util::NumberFormat::CURRENCY and the format code containsanewSYMBOLTYPE_CURRENCYandifsowhichone[$xxx-nnn]. IfppEntryisnotNULLandexactlyoneentryisfound,a[$xxx-nnn]is returned,eveniftheformatcodeonlycontains[$xxx]!
*/ bool GetNewCurrencySymbolString(sal_uInt32 nFormat, OUString& rSymbol, const NfCurrencyEntry** ppEntry, bool* pBank = nullptr) const;
/** Look up the corresponding NfCurrencyEntry matching rSymbol(maybeCurrencySymbolorCurrencyAbbreviation)andpossibly arExtension(beingyyyof[$xxx-yyy])oragivenlanguage/country value.TriestomatcharSymbolwithrExtensionfirst,thenwith eFormatLanguage,thenrSymbolonly.Thisisbecauseacurrencyentry mighthavebeenconstructedusingI18Nlocaledatawhereausedlocale ofacurrencyformatcodemustnotnecessarilymatchthelocaleof thelocaledataitself,e.g.[$HK$-40C](being"zh_HK"locale)in zh_CNlocaledata.HeretherExtensionwouldhavethevalue0x40cbut eFormatLanguageofthenumberformatwouldhavethevalueofzh_CN locale,thevaluewithwhichthecorrespondingCurrencyEntryis constructed.
/// Get compatibility ("automatic" old style) currency from I18N locale data void GetCompatibilityCurrency(OUString& rSymbol, OUString& rAbbrev) const;
/// Fill rList with the language/country codes that have been allocated void GetUsedLanguages(std::vector<LanguageType>& rList);
/// Fill a NfKeywordIndex table with keywords of a language/country void FillKeywordTable(NfKeywordTable& rKeywords, LanguageType eLang);
/** Fill a NfKeywordIndex table with keywords usable in Excel export with
GetFormatStringForExcel() or SvNumberformat::GetMappedFormatstring() */ void FillKeywordTableForExcel(NfKeywordTable& rKeywords);
/** Return a format code string suitable for Excel export.
/** Return a keyword for a language/country and NfKeywordIndex
for XML import, to generate number format strings. */
OUString GetKeyword(LanguageType eLnge, sal_uInt16 nIndex);
/** Return the GENERAL keyword in proper case ("General") for a
language/country, used in XML import */
OUString GetStandardName(LanguageType eLnge);
/** Access for unit tests. */ staticconst NfKeywordTable& GetEnglishKeywords();
/** Access for unit tests. */ staticconst std::vector<Color>& GetStandardColors();
/** Access for unit tests. */ static size_t GetMaxDefaultColors();
private: mutable ::osl::Mutex m_aMutex;
css::uno::Reference<css::uno::XComponentContext> m_xContext; const LanguageType IniLnge; // Initialized setting language/country
SvNFFormatData m_aFormatData;
SvNFEngine::Accessor m_aRWPolicy;
std::unique_ptr<SvNumberFormatTable> pFormatTable; // For the UI dialog
std::unique_ptr<SvNumberFormatterIndexTable>
pMergeTable; // List of indices for merging two formatters
SvNFLanguageData m_aCurrentLanguage;
OnDemandNativeNumberWrapper m_xNatNum; // Native number service loaded on demand
Link<sal_uInt16, Color*> aColorLink; // User defined color table CallBack
// Test whether format code already exists, then return index key, // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND
SVL_DLLPRIVATE sal_uInt32 ImpIsEntry(std::u16string_view rString, sal_uInt32 CLOffset,
LanguageType eLnge) const;
// Create theCurrencyTable with all <type>NfCurrencyEntry</type>
SVL_DLLPRIVATE staticvoid ImpInitCurrencyTable();
// used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry() staticbool ImpLookupCurrencyEntryLoopBody(const NfCurrencyEntry*& pFoundEntry, bool& bFoundBank, const NfCurrencyEntry* pData,
sal_uInt16 nPos, std::u16string_view rSymbol);
// called by SvNumberFormatterRegistry_Impl::Notify if the default system currency changes
SVL_DLLPRIVATE void ResetDefaultSystemCurrency();
// link to be set at <method>SvtSysLocaleOptions::SetCurrencyChangeLink()</method>
DECL_DLLPRIVATE_STATIC_LINK(SvNumberFormatter, CurrencyChangeLink, LinkParamNone*, void);
// Substitute a format during GetFormatEntry(), i.e. system formats.
SVL_DLLPRIVATE const SvNumberformat* ImpSubstituteEntry(const SvNumberformat* pFormat,
sal_uInt32* o_pRealKey = nullptr);
// Whether nFIndex is a special builtin format
SVL_DLLPRIVATE bool ImpIsSpecialStandardFormat(sal_uInt32 nFIndex, LanguageType eLnge);
// Replace the SYSTEM language/country format codes. Called upon change of // the user configurable locale. // Old compatibility codes are replaced, user defined are converted, and // new format codes are appended.
SVL_DLLPRIVATE void ReplaceSystemCL(LanguageType eOldLanguage);
// own mutex, may also be used by internal class SvNumberFormatterRegistry_Impl static ::osl::Mutex& GetGlobalMutex();
::osl::Mutex& GetInstanceMutex() const { return m_aMutex; }
public: // Called by SvNumberFormatterRegistry_Impl::Notify if the system locale's // date acceptance patterns change. void InvalidateDateAcceptancePatterns();
//! The following methods are not to be used from outside but must be //! public for the InputScanner and FormatScanner.
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.35Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-09-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.