diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-21 09:50:13 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-21 13:50:19 -0600 |
commit | 1c31558e9739ea6cf0cfa58d5cbda8d808eb0527 (patch) | |
tree | 8492fb2bffa4845de2373e644b50c3b4f5f114e4 /svl | |
parent | ed9a361801ccebbcb945199c366663a24d3121bc (diff) |
svl: convert SvNumberformat constructor to OUString
Change-Id: I4031e0a89737687ff167360b987961e8b0e362fe
Diffstat (limited to 'svl')
-rw-r--r-- | svl/inc/svl/zformat.hxx | 28 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 321 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 269 |
3 files changed, 324 insertions, 294 deletions
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx index 430af3367892..33dcbbab19f3 100644 --- a/svl/inc/svl/zformat.hxx +++ b/svl/inc/svl/zformat.hxx @@ -184,10 +184,10 @@ public: SvNumberformat( ImpSvNumberformatScan& rSc, LanguageType eLge ); // Normal ctor - SvNumberformat( String& rString, + SvNumberformat( OUString& rString, ImpSvNumberformatScan* pSc, ImpSvNumberInputScan* pISc, - xub_StrLen& nCheckPos, + sal_Int32& nCheckPos, LanguageType& eLan, bool bStand = false ); @@ -487,7 +487,7 @@ private: double& fOrgDateTime, const ImpSvNumFor& rNumFor ) const; #endif - /** Whether to use possessive genitive case month name, or partitive case + /** Whether to use possessive genitive case month name, or partitive case month name, instead of nominative name (noun). @param io_nState @@ -502,7 +502,7 @@ private: @param eCodeType a NfKeywordIndex, must designate a month type code - @returns one of com::sun::star::i18n::CalendarDisplayCode values + @returns one of com::sun::star::i18n::CalendarDisplayCode values according to eCodeType and the check executed (or passed). */ SVL_DLLPRIVATE sal_Int32 ImpUseMonthCase( int & io_nState, const ImpSvNumFor& rNumFor, NfKeywordIndex eCodeType ) const; @@ -518,14 +518,14 @@ private: const SvNumberFormatter& GetFormatter() const { return *rScan.GetNumberformatter(); } // divide in substrings and color conditions - SVL_DLLPRIVATE short ImpNextSymbol( String& rString, - xub_StrLen& nPos, - String& sSymbol ); + SVL_DLLPRIVATE short ImpNextSymbol( OUStringBuffer& rString, + sal_Int32& nPos, + OUString& sSymbol ); // read string until ']' and strip blanks (after condition) - SVL_DLLPRIVATE static xub_StrLen ImpGetNumber( String& rString, - xub_StrLen& nPos, - String& sSymbol ); + SVL_DLLPRIVATE static sal_Int32 ImpGetNumber( OUStringBuffer& rString, + sal_Int32& nPos, + OUString& sSymbol ); /** * Parse the content of '[$-xxx] or '[$-xxxxxxxx]' and extract the locale @@ -549,7 +549,7 @@ private: * list of language types. These numbers also correspond with the * numbers used by Microsoft Office. */ - SVL_DLLPRIVATE static LocaleType ImpGetLocaleType( const String& rString, xub_StrLen& nPos ); + SVL_DLLPRIVATE static LocaleType ImpGetLocaleType( const OUString& rString, sal_Int32& nPos ); /** Obtain calendar and numerals from a LocaleType that was parsed from a LCID with ImpGetLocaleType(). @@ -564,8 +564,10 @@ private: calendar code, else an empty string. The calendar string needs to be inserted at a proper positon to rString after all bracketed prefixes. */ - SVL_DLLPRIVATE String ImpObtainCalendarAndNumerals( String & rString, - xub_StrLen & nPos, LanguageType & nLang, const LocaleType & aTmpLocale ); + SVL_DLLPRIVATE OUString ImpObtainCalendarAndNumerals( OUStringBuffer & rString, + sal_Int32 & nPos, + LanguageType & nLang, + const LocaleType & aTmpLocale ); // standard number output SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString ); diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index af30c94595ca..608206795f36 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -415,14 +415,14 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage ) nLastKey = nKey; SvNumberformat* pOldEntry = aOldTable.begin()->second; aOldTable.erase( nKey ); - String aString( pOldEntry->GetFormatstring() ); + OUString aString( pOldEntry->GetFormatstring() ); // Same as PutEntry() but assures key position even if format code is // a duplicate. Also won't mix up any LastInsertKey. ChangeIntl( eOldLanguage ); LanguageType eLge = eOldLanguage; // ConvertMode changes this bool bCheck = false; - xub_StrLen nCheckPos = 0; + sal_Int32 nCheckPos = -1; SvNumberformat* pNewEntry = new SvNumberformat( aString, pFormatScanner, pStringScanner, nCheckPos, eLge ); if ( nCheckPos != 0 ) @@ -473,14 +473,14 @@ bool SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const return pFormat->IsTextFormat(); } -bool SvNumberFormatter::PutEntry(String& rString, - xub_StrLen& nCheckPos, +bool SvNumberFormatter::PutEntry(OUString& rString, + sal_Int32& nCheckPos, short& nType, sal_uInt32& nKey, // format key LanguageType eLnge) { nKey = 0; - if (rString.Len() == 0) // empty string + if (rString.isEmpty()) // empty string { nCheckPos = 1; // -> Error return false; @@ -514,11 +514,12 @@ bool SvNumberFormatter::PutEntry(String& rString, nKey = ImpIsEntry(p_Entry->GetFormatstring(),CLOffset, eLge); if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // already present + { delete p_Entry; + } else { - SvNumberformat* pStdFormat = - GetFormatEntry(CLOffset + ZF_STANDARD); + SvNumberformat* pStdFormat = GetFormatEntry(CLOffset + ZF_STANDARD); sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); if (nPos+1 - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) { @@ -539,20 +540,22 @@ bool SvNumberFormatter::PutEntry(String& rString, } } else + { delete p_Entry; + } return bCheck; } -bool SvNumberFormatter::PutEntry(OUString& rString, sal_Int32& nCheckPos32, +bool SvNumberFormatter::PutEntry(String& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey, LanguageType eLnge) { // Wrapper to allow OUString to be used. - String aStr(rString); - xub_StrLen nCheckPos = nCheckPos32 < 0 ? 0xFFFF : (xub_StrLen)nCheckPos32; - bool bRet = PutEntry(aStr, nCheckPos, nType, nKey, eLnge); + OUString aStr(rString); + sal_Int32 nPos = (nCheckPos == (xub_StrLen)0xFFFF) ? -1 : (sal_Int32)nCheckPos; + bool bRet = PutEntry(aStr, nPos, nType, nKey, eLnge); rString = aStr; - nCheckPos32 = nCheckPos == 0xFFFF ? -1 : nCheckPos; + nCheckPos = nPos < 0 ? (xub_StrLen)0xFFFF : (xub_StrLen)nPos; return bRet; } @@ -1546,13 +1549,15 @@ bool SvNumberFormatter::GetPreviewString(const String& sFormatString, if (sFormatString.Len() == 0) // no empty string return false; - xub_StrLen nCheckPos = STRING_NOTFOUND; sal_uInt32 nKey; if (eLnge == LANGUAGE_DONTKNOW) + { eLnge = IniLnge; + } ChangeIntl(eLnge); // change locale if necessary eLnge = ActLnge; - String sTmpString = sFormatString; + sal_Int32 nCheckPos = -1; + OUString sTmpString = sFormatString; SvNumberformat* p_Entry = new SvNumberformat(sTmpString, pFormatScanner, pStringScanner, @@ -1563,14 +1568,20 @@ bool SvNumberFormatter::GetPreviewString(const String& sFormatString, sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // create new standard formats if necessary nKey = ImpIsEntry(p_Entry->GetFormatstring(),CLOffset, eLnge); if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // already present - GetOutputString(fPreviewNumber,nKey,sOutString,ppColor, bUseStarFormat); + { + GetOutputString(fPreviewNumber, nKey, sOutString, ppColor, bUseStarFormat); + } else { if ( bUseStarFormat ) + { p_Entry->SetStarFormatSupport( true ); - p_Entry->GetOutputString(fPreviewNumber,sOutString, ppColor); + } + p_Entry->GetOutputString(fPreviewNumber, sOutString, ppColor); if ( bUseStarFormat ) + { p_Entry->SetStarFormatSupport( false ); + } } delete p_Entry; return true; @@ -1589,11 +1600,13 @@ bool SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString, LanguageType eLnge ) { if (sFormatString.Len() == 0) // no empty string + { return false; - + } if (eLnge == LANGUAGE_DONTKNOW) + { eLnge = IniLnge; - + } ChangeIntl( eLnge ); eLnge = ActLnge; bool bEnglish = (eLnge == LANGUAGE_ENGLISH_US); @@ -1602,20 +1615,21 @@ bool SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString, sal_uInt32 nCLOffset = ImpGenerateCL( eLnge ); sal_uInt32 nKey = ImpIsEntry( aFormatStringUpper, nCLOffset, eLnge ); if ( nKey != NUMBERFORMAT_ENTRY_NOT_FOUND ) - { // Zielformat vorhanden + { + // Zielformat vorhanden GetOutputString( fPreviewNumber, nKey, sOutString, ppColor ); return true; } SvNumberformat *pEntry = NULL; - xub_StrLen nCheckPos = STRING_NOTFOUND; - String sTmpString; + sal_Int32 nCheckPos = -1; + OUString sTmpString; if ( bEnglish ) { sTmpString = sFormatString; pEntry = new SvNumberformat( sTmpString, pFormatScanner, - pStringScanner, nCheckPos, eLnge ); + pStringScanner, nCheckPos, eLnge ); } else { @@ -1628,38 +1642,41 @@ bool SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString, pFormatScanner->SetConvertMode( LANGUAGE_ENGLISH_US, eLnge ); sTmpString = sFormatString; pEntry = new SvNumberformat( sTmpString, pFormatScanner, - pStringScanner, nCheckPos, eFormatLang ); + pStringScanner, nCheckPos, eFormatLang ); pFormatScanner->SetConvertMode( false ); ChangeIntl( eLnge ); if ( !bEnglishFormat ) { - if ( nCheckPos > 0 || xTransliteration->isEqual( sFormatString, - pEntry->GetFormatstring() ) ) - { // other Format + if ( !(nCheckPos == 0) || xTransliteration->isEqual( sFormatString, + pEntry->GetFormatstring() ) ) + { + // other Format delete pEntry; sTmpString = sFormatString; pEntry = new SvNumberformat( sTmpString, pFormatScanner, - pStringScanner, nCheckPos, eLnge ); + pStringScanner, nCheckPos, eLnge ); } else - { // verify english - xub_StrLen nCheckPos2 = STRING_NOTFOUND; + { + // verify english + sal_Int32 nCheckPos2 = -1; // try other --> english eFormatLang = eLnge; pFormatScanner->SetConvertMode( eLnge, LANGUAGE_ENGLISH_US ); sTmpString = sFormatString; SvNumberformat* pEntry2 = new SvNumberformat( sTmpString, pFormatScanner, - pStringScanner, nCheckPos2, eFormatLang ); + pStringScanner, nCheckPos2, eFormatLang ); pFormatScanner->SetConvertMode( false ); ChangeIntl( eLnge ); if ( nCheckPos2 == 0 && !xTransliteration->isEqual( sFormatString, - pEntry2->GetFormatstring() ) ) - { // other Format + pEntry2->GetFormatstring() ) ) + { + // other Format delete pEntry; sTmpString = sFormatString; pEntry = new SvNumberformat( sTmpString, pFormatScanner, - pStringScanner, nCheckPos, eLnge ); + pStringScanner, nCheckPos, eLnge ); } delete pEntry2; } @@ -1684,15 +1701,18 @@ bool SvNumberFormatter::GetPreviewString( const String& sFormatString, LanguageType eLnge ) { if (sFormatString.Len() == 0) // no empty string + { return false; - - xub_StrLen nCheckPos = STRING_NOTFOUND; + } sal_uInt32 nKey; if (eLnge == LANGUAGE_DONTKNOW) + { eLnge = IniLnge; + } ChangeIntl(eLnge); // switch if needed eLnge = ActLnge; - String sTmpString = sFormatString; + sal_Int32 nCheckPos = -1; + OUString sTmpString = sFormatString; SvNumberformat* p_Entry = new SvNumberformat( sTmpString, pFormatScanner, pStringScanner, @@ -1737,18 +1757,21 @@ bool SvNumberFormatter::GetPreviewString( const String& sFormatString, } sal_uInt32 SvNumberFormatter::TestNewString(const String& sFormatString, - LanguageType eLnge) + LanguageType eLnge) { if (sFormatString.Len() == 0) // no empty string + { return NUMBERFORMAT_ENTRY_NOT_FOUND; - - xub_StrLen nCheckPos = STRING_NOTFOUND; + } if (eLnge == LANGUAGE_DONTKNOW) + { eLnge = IniLnge; + } ChangeIntl(eLnge); // change locale if necessary eLnge = ActLnge; sal_uInt32 nRes; - String sTmpString = sFormatString; + sal_Int32 nCheckPos = -1; + OUString sTmpString = sFormatString; SvNumberformat* pEntry = new SvNumberformat(sTmpString, pFormatScanner, pStringScanner, @@ -1761,14 +1784,16 @@ sal_uInt32 SvNumberFormatter::TestNewString(const String& sFormatString, // already present? } else + { nRes = NUMBERFORMAT_ENTRY_NOT_FOUND; + } delete pEntry; return nRes; } -SvNumberformat* SvNumberFormatter::ImpInsertFormat( - const ::com::sun::star::i18n::NumberFormatCode& rCode, - sal_uInt32 nPos, bool bAfterChangingSystemCL, sal_Int16 nOrgIndex ) +SvNumberformat* SvNumberFormatter::ImpInsertFormat( const ::com::sun::star::i18n::NumberFormatCode& rCode, + sal_uInt32 nPos, bool bAfterChangingSystemCL, + sal_Int16 nOrgIndex ) { String aCodeStr( rCode.Code ); if ( rCode.Index < NF_INDEX_TABLE_ENTRIES && @@ -1790,13 +1815,15 @@ SvNumberformat* SvNumberFormatter::ImpInsertFormat( } } } - xub_StrLen nCheckPos = 0; - SvNumberformat* pFormat = new SvNumberformat(aCodeStr, + sal_Int32 nCheckPos = 0; + OUString sTempIn(aCodeStr); + SvNumberformat* pFormat = new SvNumberformat(sTempIn, pFormatScanner, pStringScanner, nCheckPos, ActLnge); - if ( !pFormat || nCheckPos > 0 ) + aCodeStr = sTempIn; + if ( !pFormat || !(nCheckPos == 0) ) { if (LocaleDataWrapper::areChecksEnabled()) { @@ -1951,16 +1978,20 @@ sal_uInt32 SvNumberFormatter::GetFormatSpecialInfo( const String& rFormatString, sal_uInt16& nAnzLeading, LanguageType eLnge ) { - xub_StrLen nCheckPos = 0; if (eLnge == LANGUAGE_DONTKNOW) + { eLnge = IniLnge; + } ChangeIntl(eLnge); // change locale if necessary eLnge = ActLnge; - String aTmpStr( rFormatString ); - SvNumberformat* pFormat = new SvNumberformat( aTmpStr, - pFormatScanner, pStringScanner, nCheckPos, eLnge ); + OUString aTmpStr( rFormatString ); + sal_Int32 nCheckPos = 0; + SvNumberformat* pFormat = new SvNumberformat( aTmpStr, pFormatScanner, + pStringScanner, nCheckPos, eLnge ); if ( nCheckPos == 0 ) + { pFormat->GetFormatSpecialInfo( bThousand, IsRed, nPrecision, nAnzLeading ); + } else { bThousand = false; @@ -2179,13 +2210,12 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio } bool bOldConvertMode = pFormatScanner->GetConvertMode(); if (bOldConvertMode) + { pFormatScanner->SetConvertMode(false); // switch off for this function + } NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), GetLocale() ); - - xub_StrLen nCheckPos = 0; SvNumberformat* pNewFormat = NULL; - String aFormatCode; sal_Int32 nIdx; bool bDefault; @@ -2196,8 +2226,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio sal_uInt16 nNewExtended = ZF_STANDARD_NEWEXTENDED; // Number - uno::Sequence< i18n::NumberFormatCode > aFormatSeq - = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::FIXED_NUMBER ); + uno::Sequence< i18n::NumberFormatCode > aFormatSeq = + aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::FIXED_NUMBER ); ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); // General @@ -2208,9 +2238,10 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio { // This is _the_ standard format. if (LocaleDataWrapper::areChecksEnabled() && pStdFormat->GetType() != NUMBERFORMAT_NUMBER) - LocaleDataWrapper::outputCheckMessage( xLocaleData-> - appendLocaleInfo( "SvNumberFormatter::ImpGenerateFormats: General format not NUMBER")); - + { + LocaleDataWrapper::outputCheckMessage( xLocaleData-> + appendLocaleInfo( "SvNumberFormatter::ImpGenerateFormats: General format not NUMBER")); + } pStdFormat->SetType( NUMBERFORMAT_NUMBER ); pStdFormat->SetStandard(); pStdFormat->SetLastInsertKey( SV_MAX_ANZ_STANDARD_FORMATE ); @@ -2218,33 +2249,37 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio else { if (LocaleDataWrapper::areChecksEnabled()) - LocaleDataWrapper::outputCheckMessage( xLocaleData-> - appendLocaleInfo( "SvNumberFormatter::ImpGenerateFormats: General format not insertable, nothing will work")); + { + LocaleDataWrapper::outputCheckMessage( xLocaleData-> + appendLocaleInfo( "SvNumberFormatter::ImpGenerateFormats: General format not insertable, nothing will work")); + } } // Boolean - aFormatCode = pFormatScanner->GetBooleanString(); - pNewFormat = new SvNumberformat( aFormatCode, - pFormatScanner, pStringScanner, nCheckPos, ActLnge ); + OUString aFormatCode = pFormatScanner->GetBooleanString(); + sal_Int32 nCheckPos = 0; + + pNewFormat = new SvNumberformat( aFormatCode, pFormatScanner, + pStringScanner, nCheckPos, ActLnge ); pNewFormat->SetType(NUMBERFORMAT_LOGICAL); pNewFormat->SetStandard(); if ( !aFTable.insert(make_pair( - CLOffset + SetIndexTable( NF_BOOLEAN, ZF_STANDARD_LOGICAL ), - pNewFormat)).second) + CLOffset + SetIndexTable( NF_BOOLEAN, ZF_STANDARD_LOGICAL ), + pNewFormat)).second) { SAL_WARN( "svl.numbers", "SvNumberFormatter::ImpGenerateFormats: dup position Boolean"); delete pNewFormat; } // Text - aFormatCode = '@'; - pNewFormat = new SvNumberformat( aFormatCode, - pFormatScanner, pStringScanner, nCheckPos, ActLnge ); + aFormatCode = "@"; + pNewFormat = new SvNumberformat( aFormatCode, pFormatScanner, + pStringScanner, nCheckPos, ActLnge ); pNewFormat->SetType(NUMBERFORMAT_TEXT); pNewFormat->SetStandard(); if ( !aFTable.insert(make_pair( - CLOffset + SetIndexTable( NF_TEXT, ZF_STANDARD_TEXT ), - pNewFormat)).second) + CLOffset + SetIndexTable( NF_TEXT, ZF_STANDARD_TEXT ), + pNewFormat)).second) { SAL_WARN( "svl.numbers", "SvNumberFormatter::ImpGenerateFormats: dup position Text"); delete pNewFormat; @@ -2255,28 +2290,28 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // 0 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_INT ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_INT, ZF_STANDARD+1 )); + CLOffset + SetIndexTable( NF_NUMBER_INT, ZF_STANDARD+1 )); // 0.00 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_DEC2 ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_DEC2, ZF_STANDARD+2 )); + CLOffset + SetIndexTable( NF_NUMBER_DEC2, ZF_STANDARD+2 )); // #,##0 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_1000INT ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_1000INT, ZF_STANDARD+3 )); + CLOffset + SetIndexTable( NF_NUMBER_1000INT, ZF_STANDARD+3 )); // #,##0.00 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_1000DEC2 ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_1000DEC2, ZF_STANDARD+4 )); + CLOffset + SetIndexTable( NF_NUMBER_1000DEC2, ZF_STANDARD+4 )); // #.##0,00 System country/language dependent since number formatter version 6 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_SYSTEM ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_SYSTEM, ZF_STANDARD+5 ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_NUMBER_SYSTEM, ZF_STANDARD+5 ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // Percent number @@ -2286,12 +2321,12 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // 0% nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_PERCENT_INT ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_PERCENT_INT, ZF_STANDARD_PERCENT )); + CLOffset + SetIndexTable( NF_PERCENT_INT, ZF_STANDARD_PERCENT )); // 0.00% nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_PERCENT_DEC2 ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_PERCENT_DEC2, ZF_STANDARD_PERCENT+1 )); + CLOffset + SetIndexTable( NF_PERCENT_DEC2, ZF_STANDARD_PERCENT+1 )); @@ -2309,7 +2344,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio bDefault = aFormatSeq[nIdx].Default; aFormatSeq[nIdx].Default = false; ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000INT, ZF_STANDARD_CURRENCY )); + CLOffset + SetIndexTable( NF_CURRENCY_1000INT, ZF_STANDARD_CURRENCY )); aFormatSeq[nIdx].Default = bDefault; // #,##0.00 @@ -2317,7 +2352,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio bDefault = aFormatSeq[nIdx].Default; aFormatSeq[nIdx].Default = false; ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2, ZF_STANDARD_CURRENCY+1 )); + CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2, ZF_STANDARD_CURRENCY+1 )); aFormatSeq[nIdx].Default = bDefault; // #,##0 negative red @@ -2325,7 +2360,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio bDefault = aFormatSeq[nIdx].Default; aFormatSeq[nIdx].Default = false; ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000INT_RED, ZF_STANDARD_CURRENCY+2 )); + CLOffset + SetIndexTable( NF_CURRENCY_1000INT_RED, ZF_STANDARD_CURRENCY+2 )); aFormatSeq[nIdx].Default = bDefault; // #,##0.00 negative red @@ -2333,7 +2368,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio bDefault = aFormatSeq[nIdx].Default; aFormatSeq[nIdx].Default = false; ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_RED, ZF_STANDARD_CURRENCY+3 )); + CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_RED, ZF_STANDARD_CURRENCY+3 )); aFormatSeq[nIdx].Default = bDefault; // #,##0.00 USD since number formatter version 3 @@ -2341,7 +2376,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio bDefault = aFormatSeq[nIdx].Default; aFormatSeq[nIdx].Default = false; pNewFormat = ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_CCC, ZF_STANDARD_CURRENCY+4 )); + CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_CCC, ZF_STANDARD_CURRENCY+4 )); if ( pNewFormat ) pNewFormat->SetUsed(true); // must be saved for older versions aFormatSeq[nIdx].Default = bDefault; @@ -2351,8 +2386,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio bDefault = aFormatSeq[nIdx].Default; aFormatSeq[nIdx].Default = false; ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_DASHED, ZF_STANDARD_CURRENCY+5 ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_DASHED, ZF_STANDARD_CURRENCY+5 ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); aFormatSeq[nIdx].Default = bDefault; @@ -2364,52 +2399,53 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // DD.MM.YY System nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYSTEM_SHORT ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYSTEM_SHORT, ZF_STANDARD_DATE )); + CLOffset + SetIndexTable( NF_DATE_SYSTEM_SHORT, ZF_STANDARD_DATE )); // NN DD.MMM YY nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DEF_NNDDMMMYY ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DEF_NNDDMMMYY, ZF_STANDARD_DATE+1 )); + CLOffset + SetIndexTable( NF_DATE_DEF_NNDDMMMYY, ZF_STANDARD_DATE+1 )); // DD.MM.YY def/System nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_MMYY ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_MMYY, ZF_STANDARD_DATE+2 )); + CLOffset + SetIndexTable( NF_DATE_SYS_MMYY, ZF_STANDARD_DATE+2 )); // DD MMM nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMM ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DDMMM, ZF_STANDARD_DATE+3 )); + CLOffset + SetIndexTable( NF_DATE_SYS_DDMMM, ZF_STANDARD_DATE+3 )); // MMMM nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_MMMM ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_MMMM, ZF_STANDARD_DATE+4 )); + CLOffset + SetIndexTable( NF_DATE_MMMM, ZF_STANDARD_DATE+4 )); // QQ YY nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_QQJJ ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_QQJJ, ZF_STANDARD_DATE+5 )); + CLOffset + SetIndexTable( NF_DATE_QQJJ, ZF_STANDARD_DATE+5 )); // DD.MM.YYYY since number formatter version 2, was DD.MM.[YY]YY nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMYYYY ); pNewFormat = ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYYYY, ZF_STANDARD_DATE+6 )); + CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYYYY, ZF_STANDARD_DATE+6 )); if ( pNewFormat ) + { pNewFormat->SetUsed(true); // must be saved for older versions - + } // DD.MM.YY def/System, since number formatter version 6 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMYY ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYY, ZF_STANDARD_DATE+7 ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYY, ZF_STANDARD_DATE+7 ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // NNN, D. MMMM YYYY System // Long day of week: "NNNN" instead of "NNN," because of compatibility nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYSTEM_LONG ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYSTEM_LONG, ZF_STANDARD_DATE+8 ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_SYSTEM_LONG, ZF_STANDARD_DATE+8 ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // Hard coded but system (regional settings) delimiters dependent long date formats // since numberformatter version 6 @@ -2417,8 +2453,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // D. MMM YY def/System nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMYY ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYY, ZF_STANDARD_DATE+9 ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYY, ZF_STANDARD_DATE+9 ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); //! Unfortunally TLOT intended only 10 builtin formats per category, more //! would overwrite the next category (ZF_STANDARD_TIME) :-(( @@ -2427,64 +2463,64 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // D. MMM YYYY def/System nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMYYYY ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // D. MMMM YYYY def/System nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMMYYYY ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DMMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_SYS_DMMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // NN, D. MMM YY def/System nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNDMMMYY ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // NN, D. MMMM YYYY def/System nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNDMMMMYYYY ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // NNN, D. MMMM YYYY def/System nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNNNDMMMMYYYY ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_NNNNDMMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_SYS_NNNNDMMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // Hard coded DIN (Deutsche Industrie Norm) and EN (European Norm) date formats // D. MMM. YYYY DIN/EN nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_DMMMYYYY ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DIN_DMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_DIN_DMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // D. MMMM YYYY DIN/EN nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_DMMMMYYYY ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DIN_DMMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_DIN_DMMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // MM-DD DIN/EN nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_MMDD ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DIN_MMDD, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_DIN_MMDD, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // YY-MM-DD DIN/EN nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_YYMMDD ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DIN_YYMMDD, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_DIN_YYMMDD, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); // YYYY-MM-DD DIN/EN nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_YYYYMMDD ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DIN_YYYYMMDD, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + CLOffset + SetIndexTable( NF_DATE_DIN_YYYYMMDD, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); @@ -2495,38 +2531,38 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // HH:MM nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMM ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HHMM, ZF_STANDARD_TIME )); + CLOffset + SetIndexTable( NF_TIME_HHMM, ZF_STANDARD_TIME )); // HH:MM:SS nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMSS ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HHMMSS, ZF_STANDARD_TIME+1 )); + CLOffset + SetIndexTable( NF_TIME_HHMMSS, ZF_STANDARD_TIME+1 )); // HH:MM AM/PM nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMAMPM ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HHMMAMPM, ZF_STANDARD_TIME+2 )); + CLOffset + SetIndexTable( NF_TIME_HHMMAMPM, ZF_STANDARD_TIME+2 )); // HH:MM:SS AM/PM nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMSSAMPM ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HHMMSSAMPM, ZF_STANDARD_TIME+3 )); + CLOffset + SetIndexTable( NF_TIME_HHMMSSAMPM, ZF_STANDARD_TIME+3 )); // [HH]:MM:SS nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HH_MMSS ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HH_MMSS, ZF_STANDARD_TIME+4 )); + CLOffset + SetIndexTable( NF_TIME_HH_MMSS, ZF_STANDARD_TIME+4 )); // MM:SS,00 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_MMSS00 ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_MMSS00, ZF_STANDARD_TIME+5 )); + CLOffset + SetIndexTable( NF_TIME_MMSS00, ZF_STANDARD_TIME+5 )); // [HH]:MM:SS,00 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HH_MMSS00 ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HH_MMSS00, ZF_STANDARD_TIME+6 ), - SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 ); + CLOffset + SetIndexTable( NF_TIME_HH_MMSS00, ZF_STANDARD_TIME+6 ), + SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 ); @@ -2537,13 +2573,13 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // DD.MM.YY HH:MM System nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATETIME_SYSTEM_SHORT_HHMM ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATETIME_SYSTEM_SHORT_HHMM, ZF_STANDARD_DATETIME )); + CLOffset + SetIndexTable( NF_DATETIME_SYSTEM_SHORT_HHMM, ZF_STANDARD_DATETIME )); // DD.MM.YYYY HH:MM:SS System nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATETIME_SYS_DDMMYYYY_HHMMSS ); ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, ZF_STANDARD_DATETIME+1 ), - SV_NUMBERFORMATTER_VERSION_NF_DATETIME_SYS_DDMMYYYY_HHMMSS ); + CLOffset + SetIndexTable( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, ZF_STANDARD_DATETIME+1 ), + SV_NUMBERFORMATTER_VERSION_NF_DATETIME_SYS_DDMMYYYY_HHMMSS ); @@ -2554,12 +2590,12 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // 0.00E+000 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_SCIENTIFIC_000E000 ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_SCIENTIFIC_000E000, ZF_STANDARD_SCIENTIFIC )); + CLOffset + SetIndexTable( NF_SCIENTIFIC_000E000, ZF_STANDARD_SCIENTIFIC )); // 0.00E+00 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_SCIENTIFIC_000E00 ); ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_SCIENTIFIC_000E00, ZF_STANDARD_SCIENTIFIC+1 )); + CLOffset + SetIndexTable( NF_SCIENTIFIC_000E00, ZF_STANDARD_SCIENTIFIC+1 )); @@ -2570,25 +2606,25 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // # ?/? aSingleFormatCode.Code = "# ?/?"; ImpInsertFormat( aSingleFormatCode, - CLOffset + SetIndexTable( NF_FRACTION_1, ZF_STANDARD_FRACTION )); + CLOffset + SetIndexTable( NF_FRACTION_1, ZF_STANDARD_FRACTION )); // # ??/?? //! "??/" would be interpreted by the compiler as a trigraph for '\' aSingleFormatCode.Code = "# ?\?/?\?"; ImpInsertFormat( aSingleFormatCode, - CLOffset + SetIndexTable( NF_FRACTION_2, ZF_STANDARD_FRACTION+1 )); + CLOffset + SetIndexTable( NF_FRACTION_2, ZF_STANDARD_FRACTION+1 )); // # ?/4 aSingleFormatCode.Code = "# ?/4"; ImpInsertNewStandardFormat( aSingleFormatCode, - CLOffset + SetIndexTable( NF_FRACTION_3, ZF_STANDARD_FRACTION+2 ), - SV_NUMBERFORMATTER_VERSION_FIXED_FRACTION ); + CLOffset + SetIndexTable( NF_FRACTION_3, ZF_STANDARD_FRACTION+2 ), + SV_NUMBERFORMATTER_VERSION_FIXED_FRACTION ); // # ??/100 aSingleFormatCode.Code = "# ?\?/100"; ImpInsertNewStandardFormat( aSingleFormatCode, - CLOffset + SetIndexTable( NF_FRACTION_4, ZF_STANDARD_FRACTION+3 ), - SV_NUMBERFORMATTER_VERSION_FIXED_FRACTION ); + CLOffset + SetIndexTable( NF_FRACTION_4, ZF_STANDARD_FRACTION+3 ), + SV_NUMBERFORMATTER_VERSION_FIXED_FRACTION ); @@ -2596,8 +2632,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio const NfKeywordTable & rKeyword = pFormatScanner->GetKeywords(); aSingleFormatCode.Code = rKeyword[NF_KEY_WW]; ImpInsertNewStandardFormat( aSingleFormatCode, - CLOffset + SetIndexTable( NF_DATE_WW, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NF_DATE_WW ); + CLOffset + SetIndexTable( NF_DATE_WW, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NF_DATE_WW ); bIndexTableInitialized = true; @@ -2607,10 +2643,13 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // Now all additional format codes provided by I18N, but only if not // changing SystemCL, then they are appended last after user defined. if ( !bNoAdditionalFormats ) + { ImpGenerateAdditionalFormats( CLOffset, aNumberFormatCode, false ); - + } if (bOldConvertMode) + { pFormatScanner->SetConvertMode(true); + } } diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 8a171eae004d..b7facc031d44 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -686,10 +686,10 @@ static bool lcl_SvNumberformat_IsBracketedPrefix( short nSymbolType ) } -String SvNumberformat::ImpObtainCalendarAndNumerals( String & rString, - xub_StrLen & nPos, LanguageType & nLang, const LocaleType & aTmpLocale ) +OUString SvNumberformat::ImpObtainCalendarAndNumerals( OUStringBuffer & rString, sal_Int32 & nPos, + LanguageType & nLang, const LocaleType & aTmpLocale ) { - String sCalendar; + OUString sCalendar; /* TODO: this could be enhanced to allow other possible locale dependent * calendars and numerals. BUT only if our locale data allows it! For LCID * numerals and calendars see @@ -699,7 +699,7 @@ String SvNumberformat::ImpObtainCalendarAndNumerals( String & rString, // Numeral shape code "D" = Thai digits. if (aTmpLocale.mnNumeralShape == 0xD) { - rString.InsertAscii( "[NatNum1]", nPos); + rString.insert( nPos, "[NatNum1]"); } // Calendar type code "07" = Thai Buddhist calendar, insert this after // all prefixes have been consumed as it is actually a format modifier @@ -719,23 +719,25 @@ String SvNumberformat::ImpObtainCalendarAndNumerals( String & rString, maLocale = aTmpLocale; nLang = maLocale.meLanguage = LANGUAGE_THAI; } - sCalendar.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "[~buddhist]")); + sCalendar="[~buddhist]"; } } return sCalendar; } -SvNumberformat::SvNumberformat(String& rString, +SvNumberformat::SvNumberformat(OUString& rString, ImpSvNumberformatScan* pSc, ImpSvNumberInputScan* pISc, - xub_StrLen& nCheckPos, + sal_Int32& nCheckPos, LanguageType& eLan, bool bStan) : rScan(*pSc) , nNewStandardDefined(0) , bStarFlag( false ) { + OUStringBuffer sBuff(rString); + // If the group (AKA thousand) separator is a Non-Breaking Space (French) // replace all occurrences by a simple space. // The tokens will be changed to the LocaleData separator again later on. @@ -743,12 +745,7 @@ SvNumberformat::SvNumberformat(String& rString, const String& rThSep = GetFormatter().GetNumThousandSep(); if ( rThSep.GetChar(0) == cNBSp && rThSep.Len() == 1 ) { - xub_StrLen nIndex = 0; - do - { - nIndex = rString.SearchAndReplace( cNBSp, ' ', nIndex ); - } - while ( nIndex != STRING_NOTFOUND ); + sBuff.replace( cNBSp, ' '); } if (rScan.GetConvertMode()) @@ -771,8 +768,8 @@ SvNumberformat::SvNumberformat(String& rString, bool bCancel = false; bool bCondition = false; short eSymbolType; - xub_StrLen nPos = 0; - xub_StrLen nPosOld; + sal_Int32 nPos = 0; + sal_Int32 nPosOld; nCheckPos = 0; // Split into 4 sub formats @@ -784,13 +781,13 @@ SvNumberformat::SvNumberformat(String& rString, { (rScan.GetNumberformatter())->ChangeIntl(rScan.GetTmpLnge()); } - String sInsertCalendar; // a calendar resulting from parsing LCID - String sStr; + OUString sInsertCalendar; // a calendar resulting from parsing LCID + OUString sStr; nPosOld = nPos; // Start position of substring // first get bracketed prefixes; e.g. conditions, color do { - eSymbolType = ImpNextSymbol(rString, nPos, sStr); + eSymbolType = ImpNextSymbol(sBuff, nPos, sStr); if (eSymbolType > 0) // condition { if ( nIndex == 0 && !bCondition ) @@ -810,7 +807,7 @@ SvNumberformat::SvNumberformat(String& rString, if (!bCancel) { double fNumber; - xub_StrLen nAnzChars = ImpGetNumber(rString, nPos, sStr); + sal_Int32 nAnzChars = ImpGetNumber(sBuff, nPos, sStr); if (nAnzChars > 0) { short F_Type = NUMBERFORMAT_UNDEFINED; @@ -820,15 +817,15 @@ SvNumberformat::SvNumberformat(String& rString, { fNumber = 0.0; nPos = nPos - nAnzChars; - rString.Erase(nPos, nAnzChars); - rString.Insert('0',nPos); + sBuff.remove(nPos, nAnzChars); + sBuff.insert(nPos, (sal_Unicode)'0'); nPos++; } } else { fNumber = 0.0; - rString.Insert('0',nPos++); + sBuff.insert(nPos++,(sal_Unicode)'0'); } if (nIndex == 0) { @@ -838,7 +835,7 @@ SvNumberformat::SvNumberformat(String& rString, { fLimit2 = fNumber; } - if ( rString.GetChar(nPos) == ']' ) + if ( sBuff[nPos] == ']' ) { nPos++; } @@ -852,7 +849,7 @@ SvNumberformat::SvNumberformat(String& rString, } else if ( lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) ) { - String sSymbol( sStr); + OUString sSymbol( sStr); switch ( eSymbolType ) { case BRACKET_SYMBOLTYPE_COLOR : @@ -863,10 +860,8 @@ SvNumberformat::SvNumberformat(String& rString, } else { - OUString aStr(sStr); - Color* pColor = pSc->GetColor( aStr); - NumFor[nIndex].SetColor( pColor, aStr); - sStr = aStr; + Color* pColor = pSc->GetColor( sStr); + NumFor[nIndex].SetColor( pColor, sStr); if (pColor == NULL) { // error bCancel = true; // break for @@ -901,10 +896,10 @@ SvNumberformat::SvNumberformat(String& rString, } else { - sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NatNum" ) ); + sStr = "NatNum"; //! eSymbolType is negative - sal_uInt8 nNum = sal::static_int_cast< sal_uInt8 >(0 - (eSymbolType - BRACKET_SYMBOLTYPE_NATNUM0)); - sStr += String::CreateFromInt32( nNum ); + sal_uInt8 nNum = (sal_uInt8)(0 - (eSymbolType - BRACKET_SYMBOLTYPE_NATNUM0)); + sStr += OUString::valueOf( (sal_Int32)nNum ); NumFor[nIndex].SetNatNumNum( nNum, false ); } break; @@ -924,16 +919,16 @@ SvNumberformat::SvNumberformat(String& rString, } else { - sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DBNum" ) ); + sStr = "DBNum"; //! eSymbolType is negative - sal_uInt8 nNum = sal::static_int_cast< sal_uInt8 >(1 - (eSymbolType - BRACKET_SYMBOLTYPE_DBNUM1)); - sStr += static_cast< sal_Unicode >('0' + nNum); + sal_uInt8 nNum = (sal_uInt8)(1 - (eSymbolType - BRACKET_SYMBOLTYPE_DBNUM1)); + sStr += OUString((sal_Unicode)('0' + nNum)); NumFor[nIndex].SetNatNumNum( nNum, true ); } break; case BRACKET_SYMBOLTYPE_LOCALE : if ( NumFor[nIndex].GetNatNum().GetLang() != LANGUAGE_DONTKNOW || - rString.GetChar(nPos-1) != ']' ) + sBuff[nPos-1] != ']' ) // Check also for ']' to avoid pulling in // locale data for the preview string for not // yet completed LCIDs in the dialog. @@ -943,7 +938,7 @@ SvNumberformat::SvNumberformat(String& rString, } else { - xub_StrLen nTmp = 2; + sal_Int32 nTmp = 2; LocaleType aTmpLocale( ImpGetLocaleType( sStr, nTmp)); if (aTmpLocale.meLanguage == LANGUAGE_DONTKNOW) { @@ -976,14 +971,13 @@ SvNumberformat::SvNumberformat(String& rString, * the case. * */ } - sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM("$-") ); - sStr += String( aTmpLocale.generateCode()); + sStr = "$-" + aTmpLocale.generateCode(); NumFor[nIndex].SetNatNumLang( MsLangId::getRealLanguage( aTmpLocale.meLanguage)); // "$-NNCCLLLL" Numerals and Calendar - if (sSymbol.Len() > 6) + if (sSymbol.getLength() > 6) { - sInsertCalendar = ImpObtainCalendarAndNumerals( rString, nPos, eLan, aTmpLocale); + sInsertCalendar = ImpObtainCalendarAndNumerals( sBuff, nPos, eLan, aTmpLocale); } /* NOTE: there can be only one calendar * inserted so the last one wins, though @@ -1002,13 +996,13 @@ SvNumberformat::SvNumberformat(String& rString, } else { - rString.Erase(nPosOld,nPos-nPosOld); - if (sStr.Len()) + sBuff.remove(nPosOld, nPos - nPosOld); + if (!sStr.isEmpty()) { - rString.Insert(sStr,nPosOld); - nPos = nPosOld + sStr.Len(); - rString.Insert(']', nPos); - rString.Insert('[', nPosOld); + sBuff.insert(nPosOld, sStr); + nPos = nPosOld + sStr.getLength(); + sBuff.insert(nPos, "]"); + sBuff.insert(nPosOld, "["); nPos += 2; nPosOld = nPos; // position before string } @@ -1035,19 +1029,17 @@ SvNumberformat::SvNumberformat(String& rString, { eOp2 = NUMBERFORMAT_OP_LT; // undefined condition, default: < 0 } - if (sStr.Len() == 0) + if (sStr.isEmpty()) { // empty sub format } else { - if (sInsertCalendar.Len()) + if (!sInsertCalendar.isEmpty()) { - sStr.Insert( sInsertCalendar, 0); + sStr = sInsertCalendar + sStr; } - OUString aStr(sStr); - sal_Int32 nStrPos = pSc->ScanFormat( aStr); - sStr = aStr; + sal_Int32 nStrPos = pSc->ScanFormat( sStr); sal_uInt16 nAnz = pSc->GetAnzResStrings(); if (nAnz == 0) // error { @@ -1058,10 +1050,7 @@ SvNumberformat::SvNumberformat(String& rString, // e.g. Thai T speciality if (pSc->GetNatNumModifier() && !NumFor[nIndex].GetNatNum().IsSet()) { - rtl::OUString aNat( "[NatNum"); - aNat += rtl::OUString::valueOf( sal_Int32(pSc->GetNatNumModifier())); - aNat += "]"; - sStr.Insert( aNat, 0); + sStr = "[NatNum" + OUString::valueOf( sal_Int32(pSc->GetNatNumModifier())) + "]" + sStr; NumFor[nIndex].SetNatNumNum( pSc->GetNatNumModifier(), false ); } // #i53826# #i42727# For the Thai T speciality we need @@ -1081,18 +1070,15 @@ SvNumberformat::SvNumberformat(String& rString, ((eLanguage = MsLangId::getRealLanguage( eLan)) == LANGUAGE_THAI) && NumFor[nIndex].GetNatNum().GetLang() == LANGUAGE_DONTKNOW) { - rtl::OUString aLID("[$-"); - aLID += rtl::OUString::valueOf( sal_Int32(eLanguage), 16 ).toAsciiUpperCase(); - aLID += "]"; - sStr.Insert( aLID, 0); + sStr = "[$-" + OUString::valueOf( sal_Int32(eLanguage), 16 ).toAsciiUpperCase() + "]" + sStr; NumFor[nIndex].SetNatNumLang( eLanguage); } - rString.Erase(nPosOld,nPos-nPosOld); - rString.Insert(sStr,nPosOld); - nPos = nPosOld + sStr.Len(); - if (nPos < rString.Len()) + sBuff.remove(nPosOld, nPos - nPosOld); + sBuff.insert(nPosOld, sStr); + nPos = nPosOld + sStr.getLength(); + if (nPos < sBuff.getLength()) { - rString.Insert(';',nPos); + sBuff.insert(nPos, ";"); nPos++; } NumFor[nIndex].Enlarge(nAnz); @@ -1125,7 +1111,7 @@ SvNumberformat::SvNumberformat(String& rString, } else if ( lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) ) { - nCheckPos = nPosOld+1; // error, prefix in string + nCheckPos = nPosOld + 1; // error, prefix in string bCancel = true; // break for } } @@ -1141,10 +1127,10 @@ SvNumberformat::SvNumberformat(String& rString, NumFor[nIndex].SetNatNumLang( eLan ); } } - if (rString.Len() == nPos) + if (sBuff.getLength() == nPos) { if ( nIndex == 2 && eSymbolType == BRACKET_SYMBOLTYPE_FORMAT && - rString.GetChar(nPos-1) == ';' ) + sBuff[nPos - 1] == ';' ) { // #83510# A 4th subformat explicitly specified to be empty // hides any text. Need the type here for HasTextFormat() @@ -1161,7 +1147,7 @@ SvNumberformat::SvNumberformat(String& rString, if ( bCondition && !nCheckPos ) { if ( nIndex == 1 && NumFor[0].GetCount() == 0 && - rString.GetChar(rString.Len()-1) != ';' ) + sBuff[sBuff.getLength() - 1] != ';' ) { // No format code => GENERAL but not if specified empty OUString aAdd( pSc->GetStandardName() ); @@ -1172,12 +1158,12 @@ SvNumberformat::SvNumberformat(String& rString, { NumFor[0].Enlarge(nAnz); pSc->CopyInfo( &(NumFor[0].Info()), nAnz ); - rString += aAdd; + sBuff.append(aAdd); } } } else if ( nIndex == 1 && NumFor[nIndex].GetCount() == 0 && - rString.GetChar(rString.Len()-1) != ';' && + sBuff[sBuff.getLength() - 1] != ';' && (NumFor[0].GetCount() > 1 || (NumFor[0].GetCount() == 1 && NumFor[0].Info().nTypeArray[0] != NF_KEY_GENERAL)) ) @@ -1192,13 +1178,13 @@ SvNumberformat::SvNumberformat(String& rString, { NumFor[nIndex].Enlarge(nAnz); pSc->CopyInfo( &(NumFor[nIndex].Info()), nAnz ); - rString += ';'; - rString += aAdd; + sBuff.append(";"); + sBuff.append(aAdd); } } } else if ( nIndex == 2 && NumFor[nIndex].GetCount() == 0 && - rString.GetChar(rString.Len()-1) != ';' && + sBuff[sBuff.getLength() - 1] != ';' && eOp2 != NUMBERFORMAT_OP_NO ) { // No trailing third subformat => GENERAL but not if specified empty @@ -1210,12 +1196,13 @@ SvNumberformat::SvNumberformat(String& rString, { NumFor[nIndex].Enlarge(nAnz); pSc->CopyInfo( &(NumFor[nIndex].Info()), nAnz ); - rString += ';'; - rString += aAdd; + sBuff.append(";"); + sBuff.append(aAdd); } } } } + rString = sBuff.makeStringAndClear(); sFormatstring = rString; if (NumFor[2].GetCount() == 0 && // kein 3. Teilstring @@ -1283,27 +1270,28 @@ enum ScanState // read a string until ']' and delete spaces in input // static -xub_StrLen SvNumberformat::ImpGetNumber(String& rString, - xub_StrLen& nPos, - String& sSymbol) +sal_Int32 SvNumberformat::ImpGetNumber(OUStringBuffer& rString, + sal_Int32& nPos, + OUString& sSymbol) { - xub_StrLen nStartPos = nPos; + sal_Int32 nStartPos = nPos; sal_Unicode cToken; - xub_StrLen nLen = rString.Len(); - sSymbol.Erase(); - while ( nPos < nLen && ((cToken = rString.GetChar(nPos)) != ']') ) + sal_Int32 nLen = rString.getLength(); + OUStringBuffer sBuffSymbol; + while ( nPos < nLen && ((cToken = rString[nPos]) != ']') ) { if (cToken == ' ') { // delete spaces - rString.Erase(nPos,1); + rString.remove(nPos,1); nLen--; } else { nPos++; - sSymbol += cToken; + sBuffSymbol.append(cToken); } } + sSymbol = sBuffSymbol.makeStringAndClear(); return nPos - nStartPos; } @@ -1394,13 +1382,13 @@ SvNumberformat::LocaleType::LocaleType(sal_uInt32 nRawNum) } // static -SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(const String& rString, xub_StrLen& nPos ) +SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(const OUString& rString, sal_Int32& nPos ) { sal_uInt32 nNum = 0; sal_Unicode cToken = 0; - xub_StrLen nStart = nPos; - xub_StrLen nLen = rString.Len(); - while ( nPos < nLen && (nPos - nStart < 8) && ((cToken = rString.GetChar(nPos)) != ']') ) + sal_Int32 nStart = nPos; + sal_Int32 nLen = rString.getLength(); + while ( nPos < nLen && (nPos - nStart < 8) && ((cToken = rString[nPos]) != ']') ) { if ( '0' <= cToken && cToken <= '9' ) { @@ -1427,20 +1415,21 @@ SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(const String& rStrin return (cToken == ']' || nPos == nLen) ? LocaleType(nNum) : LocaleType(); } -short SvNumberformat::ImpNextSymbol(String& rString, - xub_StrLen& nPos, - String& sSymbol) +short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, + sal_Int32& nPos, + OUString& sSymbol) { short eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; sal_Unicode cToken; sal_Unicode cLetter = ' '; // Zwischenergebnis - xub_StrLen nLen = rString.Len(); + sal_Int32 nLen = rString.getLength(); ScanState eState = SsStart; - sSymbol.Erase(); + OUStringBuffer sBuffSymbol; + const NfKeywordTable & rKeywords = rScan.GetKeywords(); while (nPos < nLen && eState != SsStop) { - cToken = rString.GetChar(nPos); + cToken = rString[nPos]; nPos++; switch (eState) { @@ -1448,7 +1437,7 @@ short SvNumberformat::ImpNextSymbol(String& rString, if (cToken == '[') { eState = SsGetBracketed; - sSymbol += cToken; + sBuffSymbol.append(cToken); } else if (cToken == ';') { @@ -1463,13 +1452,13 @@ short SvNumberformat::ImpNextSymbol(String& rString, } else if (cToken == ' ') // Skip Blanks { - rString.Erase(nPos-1,1); nPos--; + rString.remove(nPos, 1); nLen--; } else { - sSymbol += cToken; + sBuffSymbol.append(cToken); eState = SsGetString; eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; } @@ -1480,8 +1469,8 @@ short SvNumberformat::ImpNextSymbol(String& rString, case '<': case '>': case '=': - sSymbol = comphelper::string::remove(sSymbol, '['); - sSymbol += cToken; + sBuffSymbol.stripStart((sal_Unicode)'['); + sBuffSymbol.append(cToken); cLetter = cToken; eState = SsGetCon; switch (cToken) @@ -1499,14 +1488,15 @@ short SvNumberformat::ImpNextSymbol(String& rString, } break; case ' ': - rString.Erase(nPos-1,1); nPos--; + rString.remove(nPos, 1); nLen--; break; case '$' : - if ( rString.GetChar(nPos) == '-' ) - { // [$-xxx] locale - sSymbol = comphelper::string::remove(sSymbol, '['); + if ( rString[nPos] == '-' ) + { + // [$-xxx] locale + sBuffSymbol.stripStart((sal_Unicode)'['); eSymbolType = BRACKET_SYMBOLTYPE_LOCALE; eState = SsGetPrefix; } @@ -1515,54 +1505,53 @@ short SvNumberformat::ImpNextSymbol(String& rString, eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; eState = SsGetString; } - sSymbol += cToken; + sBuffSymbol.append(cToken); break; case '~' : // calendarID as of SV_NUMBERFORMATTER_VERSION_CALENDAR eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; - sSymbol += cToken; + sBuffSymbol.append(cToken); eState = SsGetString; break; default: { - const String aNatNum(RTL_CONSTASCII_USTRINGPARAM("NATNUM")); - const String aDBNum(RTL_CONSTASCII_USTRINGPARAM("DBNUM")); - String aUpperNatNum( rChrCls().uppercase( rString, nPos-1, aNatNum.Len() ) ); - String aUpperDBNum( rChrCls().uppercase( rString, nPos-1, aDBNum.Len() ) ); - sal_Unicode cUpper = aUpperNatNum.GetChar(0); - sal_Int32 nNatNumNum = rString.Copy( nPos-1+aNatNum.Len() ).ToInt32(); - sal_Unicode cDBNum = rString.GetChar( nPos-1+aDBNum.Len() ); + const OUString aNatNum("NATNUM"); + const OUString aDBNum("DBNUM"); + OUString aUpperNatNum( rChrCls().uppercase( rString.toString(), nPos-1, aNatNum.getLength() ) ); + OUString aUpperDBNum( rChrCls().uppercase( rString.toString(), nPos-1, aDBNum.getLength() ) ); + sal_Unicode cUpper = aUpperNatNum[0]; + sal_Int32 nNatNumNum = rString.toString().copy( nPos - 1 + aNatNum.getLength() ).toInt32(); + sal_Unicode cDBNum = rString[ nPos - 1 + aDBNum.getLength()]; if ( aUpperNatNum == aNatNum && 0 <= nNatNumNum && nNatNumNum <= 19 ) { - sSymbol = comphelper::string::remove(sSymbol, '['); - sSymbol += rString.Copy( --nPos, aNatNum.Len()+1 ); - nPos += aNatNum.Len()+1; + sBuffSymbol.stripStart((sal_Unicode)'['); + sBuffSymbol.append( rString.toString().copy( --nPos, aNatNum.getLength()+1 )); + nPos += aNatNum.getLength()+1; //! SymbolType is negative eSymbolType = (short) (BRACKET_SYMBOLTYPE_NATNUM0 - nNatNumNum); eState = SsGetPrefix; } else if ( aUpperDBNum == aDBNum && '1' <= cDBNum && cDBNum <= '9' ) { - sSymbol = comphelper::string::remove(sSymbol, '['); - sSymbol += rString.Copy( --nPos, aDBNum.Len()+1 ); - nPos += aDBNum.Len()+1; + sBuffSymbol.stripStart((sal_Unicode)'['); + sBuffSymbol.append(rString.toString().copy( --nPos, aDBNum.getLength()+1 )); + nPos += aDBNum.getLength()+1; //! SymbolType is negative - eSymbolType = sal::static_int_cast< short >( - BRACKET_SYMBOLTYPE_DBNUM1 - (cDBNum - '1')); + eSymbolType = sal::static_int_cast< short >( BRACKET_SYMBOLTYPE_DBNUM1 - (cDBNum - '1')); eState = SsGetPrefix; } else if (cUpper == rKeywords[NF_KEY_H][0] || // H cUpper == rKeywords[NF_KEY_MI][0] || // M cUpper == rKeywords[NF_KEY_S][0] ) // S { - sSymbol += cToken; + sBuffSymbol.append(cToken); eState = SsGetTime; cLetter = cToken; } else { - sSymbol = comphelper::string::remove(sSymbol, '['); - sSymbol += cToken; + sBuffSymbol.stripStart((sal_Unicode)'['); + sBuffSymbol.append(cToken); eSymbolType = BRACKET_SYMBOLTYPE_COLOR; eState = SsGetPrefix; } @@ -1576,39 +1565,39 @@ short SvNumberformat::ImpNextSymbol(String& rString, } else { - sSymbol += cToken; + sBuffSymbol.append(cToken); } break; case SsGetTime: if (cToken == ']') { - sSymbol += cToken; + sBuffSymbol.append(cToken); eState = SsGetString; eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; } else { - sal_Unicode cUpper = rChrCls().uppercase(rString, nPos-1, 1)[0]; + sal_Unicode cUpper = rChrCls().uppercase(rString.toString(), nPos-1, 1)[0]; if (cUpper == rKeywords[NF_KEY_H][0] || // H cUpper == rKeywords[NF_KEY_MI][0] || // M cUpper == rKeywords[NF_KEY_S][0] ) // S { if (cLetter == cToken) { - sSymbol += cToken; + sBuffSymbol.append(cToken); cLetter = ' '; } else { - sSymbol = comphelper::string::remove(sSymbol, '['); - sSymbol += cToken; + sBuffSymbol.stripStart((sal_Unicode)'['); + sBuffSymbol.append(cToken); eState = SsGetPrefix; } } else { - sSymbol = comphelper::string::remove(sSymbol, '['); - sSymbol += cToken; + sBuffSymbol.stripStart((sal_Unicode)'['); + sBuffSymbol.append(cToken); eSymbolType = BRACKET_SYMBOLTYPE_COLOR; eState = SsGetPrefix; } @@ -1624,7 +1613,7 @@ short SvNumberformat::ImpNextSymbol(String& rString, case '>': if (cLetter == '<') { - sSymbol += cToken; + sBuffSymbol.append(cToken); cLetter = ' '; eState = SsStop; eSymbolType = NUMBERFORMAT_OP_NE; @@ -1638,13 +1627,13 @@ short SvNumberformat::ImpNextSymbol(String& rString, case '=': if (cLetter == '<') { - sSymbol += cToken; + sBuffSymbol.append(cToken); cLetter = ' '; eSymbolType = NUMBERFORMAT_OP_LE; } else if (cLetter == '>') { - sSymbol += cToken; + sBuffSymbol.append(cToken); cLetter = ' '; eSymbolType = NUMBERFORMAT_OP_GE; } @@ -1655,8 +1644,8 @@ short SvNumberformat::ImpNextSymbol(String& rString, } break; case ' ': - rString.Erase(nPos-1,1); nPos--; + rString.remove(nPos,1); nLen--; break; default: @@ -1672,14 +1661,14 @@ short SvNumberformat::ImpNextSymbol(String& rString, } else { - sSymbol += cToken; + sBuffSymbol.append(cToken); } break; default: break; } // of switch } // of while - + sSymbol = sBuffSymbol.makeStringAndClear(); return eSymbolType; } @@ -1815,8 +1804,8 @@ NfHackConversion SvNumberformat::Load( SvStream& rStream, short nDefined = ( eType & NUMBERFORMAT_DEFINED ); sal_uInt16 nNewStandard = nNewStandardDefined; // neu parsen etc. - String aStr( sFormatstring ); - xub_StrLen nCheckPos = 0; + OUString aStr( sFormatstring ); + sal_Int32 nCheckPos = 0; SvNumberformat* pFormat = new SvNumberformat( aStr, &rScan, &rISc, nCheckPos, maLocale.meLanguage, bStandard ); DBG_ASSERT( !nCheckPos, "SvNumberformat::Load: NewCurrencyRescan nCheckPos" ); |