diff options
-rw-r--r-- | include/svl/zformat.hxx | 16 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 2 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 20 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 104 | ||||
-rw-r--r-- | sw/source/uibase/utlui/numfmtlb.cxx | 2 |
5 files changed, 76 insertions, 68 deletions
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx index ed13abfcb63c..2b50daf944ac 100644 --- a/include/svl/zformat.hxx +++ b/include/svl/zformat.hxx @@ -247,7 +247,7 @@ public: bool GetOutputString( double fNumber, sal_uInt16 nCharCount, OUString& rOutString, const NativeNumberWrapper* pNatNum ) const; // bStarFlag: Take *n format as ESC n - bool GetOutputString( double fNumber, OUString& OutString, const Color** ppColor, const NativeNumberWrapper* pNatNum, bool bStarFlag = false) const; + bool GetOutputString( double fNumber, OUString& OutString, const Color** ppColor, const NativeNumberWrapper* pNatNum, const SvNFLanguageData& rCurrentLang, bool bStarFlag = false) const; void GetOutputString( std::u16string_view sString, OUString& OutString, const Color** ppColor, bool bStarFlag = false) const; // True if type text @@ -471,13 +471,13 @@ public: /** Switches to the first non-"gregorian" calendar, but only if the current calendar is "gregorian"; original calendar name and date/time returned, but only if calendar switched and rOrgCalendar was empty. */ - void SwitchToOtherCalendar( OUString& rOrgCalendar, double& fOrgDateTime ) const; + void SwitchToOtherCalendar( OUString& rOrgCalendar, double& fOrgDateTime, CalendarWrapper& rCal ) const; /** Switches to the "gregorian" calendar, but only if the current calendar is non-"gregorian" and rOrgCalendar is not empty. Thus a preceding ImpSwitchToOtherCalendar() call should have been placed prior to calling this method. */ - void SwitchToGregorianCalendar( std::u16string_view rOrgCalendar, double fOrgDateTime ) const; + void SwitchToGregorianCalendar( std::u16string_view rOrgCalendar, double fOrgDateTime, CalendarWrapper& rCal ) const; #ifdef THE_FUTURE /** Switches to the first specified calendar, if any, in subformat nNumFor @@ -523,8 +523,6 @@ private: SVL_DLLPRIVATE sal_uInt16 ImpGetNumForStringElementCount( sal_uInt16 nNumFor ) const; - SVL_DLLPRIVATE bool ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const; - #ifdef THE_FUTURE SVL_DLLPRIVATE bool ImpSwitchToSpecifiedCalendar( OUString& rOrgCalendar, double& fOrgDateTime, @@ -556,7 +554,6 @@ private: const CharClass& rChrCls() const; const LocaleDataWrapper& rLoc() const; - CalendarWrapper& GetCal() const; const SvNFLanguageData& GetCurrentLanguageData() const; // divide in substrings and color conditions @@ -699,16 +696,19 @@ private: sal_uInt16 nIx, bool bStarFlag, const NativeNumberWrapper* pNatNum, + const SvNFLanguageData& rCurrentLang, OUStringBuffer& OutString ) const; SVL_DLLPRIVATE bool ImpGetTimeOutput( double fNumber, sal_uInt16 nIx, bool bStarFlag, const NativeNumberWrapper* pNatNum, + const SvNFLanguageData& rCurrentLang, OUStringBuffer& OutString ) const; SVL_DLLPRIVATE bool ImpGetDateTimeOutput( double fNumber, sal_uInt16 nIx, bool bStarFlag, const NativeNumberWrapper* pNatNum, + const SvNFLanguageData& rCurrentLang, OUStringBuffer& OutString ) const; // Switches to the "gregorian" calendar if the current calendar is @@ -716,7 +716,9 @@ private: // know a "before" era (like zh_TW ROC or ja_JP Gengou). If switched and // rOrgCalendar was "gregorian" the string is emptied. If rOrgCalendar was // empty the previous calendar name and date/time are returned. - SVL_DLLPRIVATE bool ImpFallBackToGregorianCalendar(OUString& rOrgCalendar, double& fOrgDateTime) const; + SVL_DLLPRIVATE bool ImpFallBackToGregorianCalendar(OUString& rOrgCalendar, + double& fOrgDateTime, + CalendarWrapper& rCal) const; // Append a "G" short era string of the given calendar. In the case of a // Gengou calendar this is a one character abbreviation, for other diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 76e575886ced..35d7ac557b92 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2991,7 +2991,7 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement ) // the ways of the Numberformatters are unfathomable, so try: OUString aOut; const Color* pCol; - pOldEntry->GetOutputString( nVal, aOut, &pCol, pFormatter->GetNatNum() ); + pOldEntry->GetOutputString( nVal, aOut, &pCol, pFormatter->GetNatNum(), pFormatter->GetROLanguageData() ); nPrecision = 0; // 'E' for exponential is fixed in Numberformatter diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 7d6edf766dd1..826d3b725616 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -958,15 +958,15 @@ void SvNumberFormatter::FillKeywordTableForExcel( NfKeywordTable& rKeywords ) } -static OUString lcl_buildBooleanStringFormat( SvNumberformat* pEntry, const NativeNumberWrapper* pNatNum ) +static OUString lcl_buildBooleanStringFormat( SvNumberformat* pEntry, const NativeNumberWrapper* pNatNum, const SvNFLanguageData& rCurrentLang ) { // Build Boolean number format, which needs non-zero and zero subformat // codes with TRUE and FALSE strings. const Color* pColor = nullptr; OUString aFormatStr, aTemp; - pEntry->GetOutputString( 1.0, aTemp, &pColor, pNatNum ); + pEntry->GetOutputString( 1.0, aTemp, &pColor, pNatNum, rCurrentLang ); aFormatStr += "\"" + aTemp + "\";\"" + aTemp + "\";\""; - pEntry->GetOutputString( 0.0, aTemp, &pColor, pNatNum ); + pEntry->GetOutputString( 0.0, aTemp, &pColor, pNatNum, rCurrentLang ); aFormatStr += aTemp + "\""; return aFormatStr; } @@ -987,7 +987,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( sal_uInt32 nKey, const NfKe // locales. You can't have both. We could force to English for all // locales like below, but Excel would display English strings then // even for the system locale matching this locale. YMMV. - aFormatStr = lcl_buildBooleanStringFormat( const_cast< SvNumberformat* >(pEntry), GetNatNum() ); + aFormatStr = lcl_buildBooleanStringFormat( const_cast< SvNumberformat* >(pEntry), GetNatNum(), m_aCurrentLanguage ); } else { @@ -1023,7 +1023,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( sal_uInt32 nKey, const NfKe // >"VRAI";"VRAI";"FAUX"< recognized as real boolean and // properly converted. Then written as // >"TRUE";"TRUE";"FALSE"< - aFormatStr = lcl_buildBooleanStringFormat( const_cast< SvNumberformat* >(pEntry), GetNatNum() ); + aFormatStr = lcl_buildBooleanStringFormat( const_cast< SvNumberformat* >(pEntry), GetNatNum(), m_aCurrentLanguage ); } else { @@ -2006,7 +2006,7 @@ void SvNFEngine::GetInputLineString(SvNFLanguageData& rCurrentLanguage, rCurrentLanguage.ChangeStandardPrec(SvNumberFormatter::INPUTSTRING_PRECISION); bPrecChanged = true; } - pFormat->GetOutputString(fOutNumber, sOutString, &pColor, pNatNum); + pFormat->GetOutputString(fOutNumber, sOutString, &pColor, pNatNum, rCurrentLanguage); // The #FMT error string must not be used for input as it would lead to // data loss. This can happen for at least date(+time). Fall back to a @@ -2020,7 +2020,7 @@ void SvNFEngine::GetInputLineString(SvNFLanguageData& rCurrentLanguage, { rCurrentLanguage.ChangeStandardPrec(SvNumberFormatter::INPUTSTRING_PRECISION); bPrecChanged = true; - pFormat->GetOutputString(fOutNumber, sOutString, &pColor, pNatNum); + pFormat->GetOutputString(fOutNumber, sOutString, &pColor, pNatNum, rCurrentLanguage); } } assert(sOutString != ImpSvNumberformatScan::sErrStr); @@ -2096,7 +2096,7 @@ void SvNFEngine::GetOutputString(SvNFLanguageData& rCurrentLanguage, if (!pFormat) pFormat = rFormatData.GetFormatEntry(ZF_STANDARD); rCurrentLanguage.ChangeIntl(pFormat->GetLanguage()); - pFormat->GetOutputString(fOutNumber, sOutString, ppColor, pNatNum, bUseStarFormat); + pFormat->GetOutputString(fOutNumber, sOutString, ppColor, pNatNum, rCurrentLanguage, bUseStarFormat); } void SvNumberFormatter::GetOutputString(const double& fOutNumber, @@ -2145,7 +2145,7 @@ bool SvNFEngine::GetPreviewString(SvNFLanguageData& rCurrentLanguage, } else { - aEntry.GetOutputString(fPreviewNumber, sOutString, ppColor, pNatNum, bUseStarFormat); + aEntry.GetOutputString(fPreviewNumber, sOutString, ppColor, pNatNum, rCurrentLanguage, bUseStarFormat); } return true; } @@ -2264,7 +2264,7 @@ bool SvNFEngine::GetPreviewStringGuess(SvNFLanguageData& rCurrentLanguage, if (nCheckPos == 0) // String ok { rFuncs.mGetCLOffset(rCurrentLanguage, pNatNum, eLnge); // create new standard formats if necessary - pEntry->GetOutputString( fPreviewNumber, sOutString, ppColor, pNatNum ); + pEntry->GetOutputString( fPreviewNumber, sOutString, ppColor, pNatNum, rCurrentLanguage ); return true; } return false; diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 5e1bbf6cd9b0..ca34bd235aad 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -2512,6 +2512,7 @@ bool SvNumberformat::GetOutputString(double fNumber, OUString& OutString, const Color** ppColor, const NativeNumberWrapper* pNatNum, + const SvNFLanguageData& rCurrentLang, bool bStarFlag) const { bool bRes = false; @@ -2600,15 +2601,15 @@ bool SvNumberformat::GetOutputString(double fNumber, bHadStandard = true; break; case SvNumFormatType::DATE: - bRes |= ImpGetDateOutput(fNumber, 0, bStarFlag, pNatNum, sBuff); + bRes |= ImpGetDateOutput(fNumber, 0, bStarFlag, pNatNum, rCurrentLang, sBuff); bHadStandard = true; break; case SvNumFormatType::TIME: - bRes |= ImpGetTimeOutput(fNumber, 0, bStarFlag, pNatNum, sBuff); + bRes |= ImpGetTimeOutput(fNumber, 0, bStarFlag, pNatNum, rCurrentLang, sBuff); bHadStandard = true; break; case SvNumFormatType::DATETIME: - bRes |= ImpGetDateTimeOutput(fNumber, 0, bStarFlag, pNatNum, sBuff); + bRes |= ImpGetDateTimeOutput(fNumber, 0, bStarFlag, pNatNum, rCurrentLang, sBuff); bHadStandard = true; break; default: break; @@ -2670,13 +2671,13 @@ bool SvNumberformat::GetOutputString(double fNumber, } break; case SvNumFormatType::DATE: - bRes |= ImpGetDateOutput(fNumber, nIx, bStarFlag, pNatNum, sBuff); + bRes |= ImpGetDateOutput(fNumber, nIx, bStarFlag, pNatNum, rCurrentLang, sBuff); break; case SvNumFormatType::TIME: - bRes |= ImpGetTimeOutput(fNumber, nIx, bStarFlag, pNatNum, sBuff); + bRes |= ImpGetTimeOutput(fNumber, nIx, bStarFlag, pNatNum, rCurrentLang, sBuff); break; case SvNumFormatType::DATETIME: - bRes |= ImpGetDateTimeOutput(fNumber, nIx, bStarFlag, pNatNum, sBuff); + bRes |= ImpGetDateTimeOutput(fNumber, nIx, bStarFlag, pNatNum, rCurrentLang, sBuff); break; case SvNumFormatType::NUMBER: case SvNumFormatType::PERCENT: @@ -3129,6 +3130,7 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber, sal_uInt16 nIx, bool bStarFlag, const NativeNumberWrapper* pNatNum, + const SvNFLanguageData& rCurrentLang, OUStringBuffer& sBuff) const { using namespace ::com::sun::star::i18n; @@ -3273,24 +3275,27 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber, } break; case NF_KEY_AMPM: // AM/PM + { + CalendarWrapper& rCal = *rCurrentLang.GetCalendar(); if ( !bCalendarSet ) { - double fDiff = DateTime::Sub( DateTime(rScan.GetNullDate()), GetCal().getEpochStart()); + double fDiff = DateTime::Sub( DateTime(rScan.GetNullDate()), rCal.getEpochStart()); fDiff += fNumberOrig; - GetCal().setLocalDateTime( fDiff ); + rCal.setLocalDateTime( fDiff ); bCalendarSet = true; } if (cAmPm == 'a') { - sBuff.append(GetCal().getDisplayName( + sBuff.append(rCal.getDisplayName( CalendarDisplayIndex::AM_PM, AmPmValue::AM, 0 )); } else { - sBuff.append(GetCal().getDisplayName( + sBuff.append(rCal.getDisplayName( CalendarDisplayIndex::AM_PM, AmPmValue::PM, 0 )); } break; + } case NF_KEY_AP: // A/P if (cAmPm == 'a') { @@ -3449,10 +3454,11 @@ sal_Int32 SvNumberformat::ImpUseMonthCase( int & io_nState, const ImpSvNumFor& r return CalendarDisplayCode::LONG_MONTH_NAME; } +namespace { -bool SvNumberformat::ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const +bool ImpIsOtherCalendar( const ImpSvNumFor& rNumFor, const CalendarWrapper& rCal ) { - if ( GetCal().getUniqueID() != GREGORIAN ) + if ( rCal.getUniqueID() != GREGORIAN ) { return false; } @@ -3480,10 +3486,12 @@ bool SvNumberformat::ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const return false; } +} + void SvNumberformat::SwitchToOtherCalendar( OUString& rOrgCalendar, - double& fOrgDateTime ) const + double& fOrgDateTime, + CalendarWrapper& rCal ) const { - CalendarWrapper& rCal = GetCal(); if ( rCal.getUniqueID() != GREGORIAN ) return; @@ -3509,9 +3517,9 @@ void SvNumberformat::SwitchToOtherCalendar( OUString& rOrgCalendar, } void SvNumberformat::SwitchToGregorianCalendar( std::u16string_view rOrgCalendar, - double fOrgDateTime ) const + double fOrgDateTime, + CalendarWrapper& rCal ) const { - CalendarWrapper& rCal = GetCal(); if ( rOrgCalendar.size() && rCal.getUniqueID() != GREGORIAN ) { rCal.loadCalendar( GREGORIAN, rLoc().getLanguageTag().getLocale() ); @@ -3519,10 +3527,11 @@ void SvNumberformat::SwitchToGregorianCalendar( std::u16string_view rOrgCalendar } } -bool SvNumberformat::ImpFallBackToGregorianCalendar( OUString& rOrgCalendar, double& fOrgDateTime ) const +bool SvNumberformat::ImpFallBackToGregorianCalendar( OUString& rOrgCalendar, + double& fOrgDateTime, + CalendarWrapper& rCal ) const { using namespace ::com::sun::star::i18n; - CalendarWrapper& rCal = GetCal(); if ( rCal.getUniqueID() != GREGORIAN ) { sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::ERA ); @@ -3750,12 +3759,13 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, sal_uInt16 nIx, bool bStarFlag, const NativeNumberWrapper* pNatNum, + const SvNFLanguageData& rCurrentLang, OUStringBuffer& sBuff) const { using namespace ::com::sun::star::i18n; bool bRes = false; - CalendarWrapper& rCal = GetCal(); + CalendarWrapper& rCal = *rCurrentLang.GetCalendar(); if (!lcl_getValidDate( rScan.GetNullDate(), rCal.getEpochStart(), fNumber)) { sBuff = ImpSvNumberformatScan::sErrStr; @@ -3766,12 +3776,12 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, OUString aOrgCalendar; // empty => not changed yet double fOrgDateTime(0.0); - bool bOtherCalendar = ImpIsOtherCalendar( NumFor[nIx] ); + bool bOtherCalendar = ImpIsOtherCalendar( NumFor[nIx], *rCurrentLang.GetCalendar() ); if ( bOtherCalendar ) { - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } - if ( ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ) ) + if ( ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ) ) { bOtherCalendar = false; } @@ -3810,7 +3820,7 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, } rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLanguageTag().getLocale() ); rCal.setDateTime( fOrgDateTime ); - ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); break; case NF_SYMBOLTYPE_STAR: if( bStarFlag ) @@ -3881,7 +3891,7 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, case NF_KEY_DDD: // DDD if ( bOtherCalendar ) { - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } aStr = rCal.getDisplayString( CalendarDisplayCode::SHORT_DAY_NAME, nNatNum ); // NatNum12: support at least capitalize, upper, lower, title @@ -3892,13 +3902,13 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, sBuff.append(aStr); if ( bOtherCalendar ) { - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } break; case NF_KEY_DDDD: // DDDD if ( bOtherCalendar ) { - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } aStr = rCal.getDisplayString( CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); // NatNum12: support variants of preposition, suffixation or article @@ -3909,13 +3919,13 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, sBuff.append(aStr); if ( bOtherCalendar ) { - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } break; case NF_KEY_YY: // YY if ( bOtherCalendar ) { - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } // Prepend a minus sign if Gregorian BCE and era is not displayed. if (lcl_isSignedYear( rCal, NumFor[nIx] )) @@ -3925,13 +3935,13 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, sBuff.append(rCal.getDisplayString( CalendarDisplayCode::SHORT_YEAR, nNatNum )); if ( bOtherCalendar ) { - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } break; case NF_KEY_YYYY: // YYYY if ( bOtherCalendar ) { - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } // Prepend a minus sign if Gregorian BCE and era is not displayed. if (lcl_isSignedYear( rCal, NumFor[nIx] )) @@ -3959,7 +3969,7 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, sBuff.append(aStr); if ( bOtherCalendar ) { - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } break; case NF_KEY_EC: // E @@ -4022,12 +4032,13 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, sal_uInt16 nIx, bool bStarFlag, const NativeNumberWrapper* pNatNum, + const SvNFLanguageData& rCurrentLang, OUStringBuffer& sBuff) const { using namespace ::com::sun::star::i18n; bool bRes = false; - CalendarWrapper& rCal = GetCal(); + CalendarWrapper& rCal = *rCurrentLang.GetCalendar(); if (!lcl_getValidDate( rScan.GetNullDate(), rCal.getEpochStart(), fNumber)) { sBuff = ImpSvNumberformatScan::sErrStr; @@ -4063,12 +4074,12 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, int nUseMonthCase = 0; // Not decided yet OUString aOrgCalendar; // empty => not changed yet double fOrgDateTime(0.0); - bool bOtherCalendar = ImpIsOtherCalendar( NumFor[nIx] ); + bool bOtherCalendar = ImpIsOtherCalendar( NumFor[nIx], *rCurrentLang.GetCalendar() ); if ( bOtherCalendar ) { - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } - if ( ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ) ) + if ( ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ) ) { bOtherCalendar = false; } @@ -4156,7 +4167,7 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, } rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLanguageTag().getLocale() ); rCal.setDateTime( fOrgDateTime ); - ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); break; case NF_SYMBOLTYPE_STAR: if( bStarFlag ) @@ -4264,29 +4275,29 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, case NF_KEY_DDD: // DDD if ( bOtherCalendar ) { - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } sBuff.append(rCal.getDisplayString( CalendarDisplayCode::SHORT_DAY_NAME, nNatNum )); if ( bOtherCalendar ) { - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } break; case NF_KEY_DDDD: // DDDD if ( bOtherCalendar ) { - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } sBuff.append(rCal.getDisplayString( CalendarDisplayCode::LONG_DAY_NAME, nNatNum )); if ( bOtherCalendar ) { - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } break; case NF_KEY_YY: // YY if ( bOtherCalendar ) { - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } // Prepend a minus sign if Gregorian BCE and era is not displayed. if (lcl_isSignedYear( rCal, NumFor[nIx] )) @@ -4296,13 +4307,13 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, sBuff.append(rCal.getDisplayString( CalendarDisplayCode::SHORT_YEAR, nNatNum )); if ( bOtherCalendar ) { - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } break; case NF_KEY_YYYY: // YYYY if ( bOtherCalendar ) { - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } // Prepend a minus sign if Gregorian BCE and era is not displayed. if (lcl_isSignedYear( rCal, NumFor[nIx] )) @@ -4328,7 +4339,7 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, } if ( bOtherCalendar ) { - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime, *rCurrentLang.GetCalendar() ); } break; case NF_KEY_EC: // E @@ -6116,11 +6127,6 @@ const LocaleDataWrapper& SvNumberformat::rLoc() const return rScan.GetLoc(); } -CalendarWrapper& SvNumberformat::GetCal() const -{ - return rScan.GetCal(); -} - const SvNFLanguageData& SvNumberformat::GetCurrentLanguageData() const { return rScan.GetCurrentLanguageData(); diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx index 491eeaa88a9a..87f03d234048 100644 --- a/sw/source/uibase/utlui/numfmtlb.cxx +++ b/sw/source/uibase/utlui/numfmtlb.cxx @@ -263,7 +263,7 @@ void SwNumFormatBase::SetFormatType(const SvNumFormatType nFormatType) if( nFormat == pFormatter->GetFormatIndex( NF_NUMBER_STANDARD, m_eCurLanguage ) - || pFormat->GetOutputString( fVal, sValue, &pCol, pFormatter->GetNatNum() ) + || pFormat->GetOutputString( fVal, sValue, &pCol, pFormatter->GetNatNum(), pFormatter->GetROLanguageData() ) || nFormatType == SvNumFormatType::UNDEFINED ) { sValue = pFormat->GetFormatstring(); |