diff options
author | Eike Rathke <erack@redhat.com> | 2020-04-17 21:20:41 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2020-04-18 03:08:03 +0200 |
commit | dbda099d198a2236bafea2209cb5e3fc58ee8741 (patch) | |
tree | cd6f00cba4dc6ac84976f25797abd3dee8a806b7 /sc/source | |
parent | 5063669a17538ea353e34ab0990363399d34f4f4 (diff) |
Move implementation of CELL("format";...) to SvNumberFormatter, tdf#132106 prep
In preparation of further detailed handling.
Change-Id: I9e4d916de031b742d0af1025b945b7608fed8266
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92462
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 8f54c25d258b..03a8f46731a6 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2202,60 +2202,7 @@ namespace { void getFormatString(SvNumberFormatter* pFormatter, sal_uLong nFormat, OUString& rFmtStr) { - bool bAppendPrec = true; - sal_uInt16 nPrec, nLeading; - bool bThousand, bIsRed; - pFormatter->GetFormatSpecialInfo( nFormat, bThousand, bIsRed, nPrec, nLeading ); - - switch( pFormatter->GetType( nFormat ) ) - { - case SvNumFormatType::NUMBER: - if(bThousand) rFmtStr = ","; else rFmtStr = "F"; - break; - case SvNumFormatType::CURRENCY: - rFmtStr = "C"; - break; - case SvNumFormatType::SCIENTIFIC: - rFmtStr = "S"; - break; - case SvNumFormatType::PERCENT: - rFmtStr = "P"; - break; - default: - { - bAppendPrec = false; - switch( pFormatter->GetIndexTableOffset( nFormat ) ) - { - case NF_DATE_SYSTEM_SHORT: - case NF_DATE_SYS_DMMMYY: - case NF_DATE_SYS_DDMMYY: - case NF_DATE_SYS_DDMMYYYY: - case NF_DATE_SYS_DMMMYYYY: - case NF_DATE_DIN_DMMMYYYY: - case NF_DATE_SYS_DMMMMYYYY: - case NF_DATE_DIN_DMMMMYYYY: rFmtStr = "D1"; break; - case NF_DATE_SYS_DDMMM: rFmtStr = "D2"; break; - case NF_DATE_SYS_MMYY: rFmtStr = "D3"; break; - case NF_DATETIME_SYSTEM_SHORT_HHMM: - case NF_DATETIME_SYS_DDMMYYYY_HHMM: - case NF_DATETIME_SYS_DDMMYYYY_HHMMSS: - rFmtStr = "D4"; break; - case NF_DATE_DIN_MMDD: rFmtStr = "D5"; break; - case NF_TIME_HHMMSSAMPM: rFmtStr = "D6"; break; - case NF_TIME_HHMMAMPM: rFmtStr = "D7"; break; - case NF_TIME_HHMMSS: rFmtStr = "D8"; break; - case NF_TIME_HHMM: rFmtStr = "D9"; break; - default: rFmtStr = "G"; - } - } - } - if( bAppendPrec ) - rFmtStr += OUString::number(nPrec); - const SvNumberformat* pFormat = pFormatter->GetEntry( nFormat ); - if( lcl_FormatHasNegColor( pFormat ) ) - rFmtStr += "-"; - if( lcl_FormatHasOpenPar( pFormat ) ) - rFmtStr += "()"; + rFmtStr = pFormatter->GetCalcCellReturn( nFormat); } } |