LibreOffice Module svl (master) 1
Macros | Functions | Variables
zformat.cxx File Reference
#include <string_view>
#include <o3tl/sprintf.hxx>
#include <o3tl/string_view.hxx>
#include <comphelper/string.hxx>
#include <sal/log.hxx>
#include <tools/debug.hxx>
#include <tools/long.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <rtl/math.hxx>
#include <unotools/charclass.hxx>
#include <unotools/calendarwrapper.hxx>
#include <unotools/nativenumberwrapper.hxx>
#include <com/sun/star/i18n/CalendarFieldIndex.hpp>
#include <com/sun/star/i18n/CalendarDisplayIndex.hpp>
#include <com/sun/star/i18n/CalendarDisplayCode.hpp>
#include <com/sun/star/i18n/AmPmValue.hpp>
#include <com/sun/star/i18n/NativeNumberMode.hpp>
#include <com/sun/star/i18n/NativeNumberXmlAttributes2.hpp>
#include <svl/zformat.hxx>
#include "zforscan.hxx"
#include "zforfind.hxx"
#include <svl/zforlist.hxx>
#include <unotools/digitgroupingiterator.hxx>
#include <svl/nfsymbol.hxx>
#include <cmath>
#include <array>
Include dependency graph for zformat.cxx:

Go to the source code of this file.

Macros

#define HAS_MINUTE_SECOND(state)   ((state) == (kMM|kTS|kSS) || (state) == (kLB|kMM|kRB|kTS|kSS))
 

Functions

static tools::Long GetPrecExp (double fAbsVal)
 
static bool lcl_SvNumberformat_IsBracketedPrefix (short nSymbolType)
 
static bool lcl_isNatNum12Currency (const OUString &sParam)
 
static bool lcl_matchKeywordAndGetNumber (std::u16string_view rString, const sal_Int32 nPos, std::u16string_view rKeyword, sal_Int32 &nNumber)
 
static bool lcl_appendStarFillChar (OUStringBuffer &rBuf, std::u16string_view rStr)
 
static bool lcl_insertStarFillChar (OUStringBuffer &rBuf, sal_Int32 nPos, std::u16string_view rStr)
 
static bool lcl_hasEra (const ImpSvNumFor &rNumFor)
 
static bool lcl_isSignedYear (const CalendarWrapper &rCal, const ImpSvNumFor &rNumFor)
 
static bool lcl_getValidDate (const DateTime &rNullDate, const DateTime &rEpochStart, double &fNumber)
 
static void lcl_SvNumberformat_AddLimitStringImpl (OUString &rStr, SvNumberformatLimitOps eOp, double fLimit, std::u16string_view rDecSep)
 
static void lcl_insertLCID (OUStringBuffer &rFormatStr, sal_uInt32 nLCID, sal_Int32 nPosInsertLCID, bool bDBNumInserted)
 
static void lcl_incrementAlphabetWithNatNum (sal_uInt32 &nAlphabetID, sal_uInt32 nNatNum)
 Increment nAlphabetID for CJK numerals +1 for financial numerals [NatNum2] +2 for Arabic fullwidth numerals [NatNum3]. More...
 

Variables

const double D_MAX_U_INT32 = double(0xffffffff)
 
constexpr double D_MAX_INTEGER = (sal_uInt64(1) << 53) - 1
 
const double D_MAX_D_BY_100 = 1.7E306
 
const double D_MIN_M_BY_1000 = 2.3E-305
 
const sal_uInt8 cCharWidths [128-32]
 
const std::map< LanguageType, std::array< sal_uInt8, 4 > > tblDBNumToNatNum
 
const std::map< LanguageType, std::array< sal_uInt8, 9 > > tblNatNumToDBNum
 

Macro Definition Documentation

◆ HAS_MINUTE_SECOND

#define HAS_MINUTE_SECOND (   state)    ((state) == (kMM|kTS|kSS) || (state) == (kLB|kMM|kRB|kTS|kSS))

Function Documentation

◆ GetPrecExp()

static tools::Long GetPrecExp ( double  fAbsVal)
static

Definition at line 102 of file zformat.cxx.

References DBG_ASSERT.

Referenced by SvNumberformat::ImpGetNumberOutput().

◆ lcl_appendStarFillChar()

static bool lcl_appendStarFillChar ( OUStringBuffer &  rBuf,
std::u16string_view  rStr 
)
static

◆ lcl_getValidDate()

static bool lcl_getValidDate ( const DateTime rNullDate,
const DateTime rEpochStart,
double &  fNumber 
)
static

◆ lcl_hasEra()

static bool lcl_hasEra ( const ImpSvNumFor rNumFor)
static

◆ lcl_incrementAlphabetWithNatNum()

static void lcl_incrementAlphabetWithNatNum ( sal_uInt32 &  nAlphabetID,
sal_uInt32  nNatNum 
)
static

Increment nAlphabetID for CJK numerals +1 for financial numerals [NatNum2] +2 for Arabic fullwidth numerals [NatNum3].

Definition at line 5226 of file zformat.cxx.

References nNatNum.

Referenced by SvNumberformat::GetMappedFormatstring().

◆ lcl_insertLCID()

static void lcl_insertLCID ( OUStringBuffer &  rFormatStr,
sal_uInt32  nLCID,
sal_Int32  nPosInsertLCID,
bool  bDBNumInserted 
)
static

Definition at line 5202 of file zformat.cxx.

Referenced by SvNumberformat::GetMappedFormatstring().

◆ lcl_insertStarFillChar()

static bool lcl_insertStarFillChar ( OUStringBuffer &  rBuf,
sal_Int32  nPos,
std::u16string_view  rStr 
)
static

◆ lcl_isNatNum12Currency()

static bool lcl_isNatNum12Currency ( const OUString &  sParam)
static

Definition at line 726 of file zformat.cxx.

References n.

Referenced by SvNumberformat::SvNumberformat().

◆ lcl_isSignedYear()

static bool lcl_isSignedYear ( const CalendarWrapper rCal,
const ImpSvNumFor rNumFor 
)
static

◆ lcl_matchKeywordAndGetNumber()

static bool lcl_matchKeywordAndGetNumber ( std::u16string_view  rString,
const sal_Int32  nPos,
std::u16string_view  rKeyword,
sal_Int32 &  nNumber 
)
static

Definition at line 1643 of file zformat.cxx.

References o3tl::matchIgnoreAsciiCase(), nPos, and o3tl::toInt32().

Referenced by SvNumberformat::ImpNextSymbol().

◆ lcl_SvNumberformat_AddLimitStringImpl()

static void lcl_SvNumberformat_AddLimitStringImpl ( OUString &  rStr,
SvNumberformatLimitOps  eOp,
double  fLimit,
std::u16string_view  rDecSep 
)
static

◆ lcl_SvNumberformat_IsBracketedPrefix()

static bool lcl_SvNumberformat_IsBracketedPrefix ( short  nSymbolType)
static

Definition at line 377 of file zformat.cxx.

Referenced by SvNumberformat::SvNumberformat().

Variable Documentation

◆ cCharWidths

const sal_uInt8 cCharWidths[128-32]
Initial value:
= {
1,1,1,2,2,3,2,1,1,1,1,2,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,
3,2,2,2,2,2,2,3,2,1,2,2,2,3,3,3,
2,3,2,2,2,2,2,3,2,2,2,1,1,1,2,2,
1,2,2,2,2,2,1,2,2,1,1,2,1,3,2,2,
2,2,1,2,1,2,2,2,2,2,2,1,1,1,2,1
}

Definition at line 75 of file zformat.cxx.

Referenced by SvNumberformat::InsertBlanks().

◆ D_MAX_D_BY_100

const double D_MAX_D_BY_100 = 1.7E306

◆ D_MAX_INTEGER

constexpr double D_MAX_INTEGER = (sal_uInt64(1) << 53) - 1
constexpr

Definition at line 70 of file zformat.cxx.

Referenced by SvNumberformat::ImpGetFractionOutput().

◆ D_MAX_U_INT32

const double D_MAX_U_INT32 = double(0xffffffff)

◆ D_MIN_M_BY_1000

const double D_MIN_M_BY_1000 = 2.3E-305

Definition at line 73 of file zformat.cxx.

Referenced by SvNumberformat::ImpGetNumberOutput().

◆ tblDBNumToNatNum

const std::map<LanguageType, std::array<sal_uInt8, 4> > tblDBNumToNatNum
Initial value:
= { { primary(LANGUAGE_CHINESE), { 4, 5, 3, 0 } },
{ primary(LANGUAGE_JAPANESE), { 4, 5, 3, 0 } },
{ primary(LANGUAGE_KOREAN), { 4, 5, 6, 10 } } }
constexpr LanguageType primary(LanguageType lt)

Definition at line 146 of file zformat.cxx.

Referenced by SvNumberNatNum::MapDBNumToNatNum().

◆ tblNatNumToDBNum

const std::map<LanguageType, std::array<sal_uInt8, 9> > tblNatNumToDBNum
Initial value:
= { { primary(LANGUAGE_CHINESE), { 1, 0, 0, 1, 2, 3, 0, 0, 0 } },
{ primary(LANGUAGE_JAPANESE), { 1, 2, 3, 1, 2, 3, 1, 2, 0 } },
{ primary(LANGUAGE_KOREAN), { 1, 2, 3, 1, 2, 3, 1, 2, 4 } } }

Definition at line 181 of file zformat.cxx.

Referenced by SvNumberNatNum::MapNatNumToDBNum().