diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-05 20:35:37 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-18 19:57:22 -0600 |
commit | 6dbf5f7ea0187aa6c4e1c45fc2d2cd03b2b67b0a (patch) | |
tree | d5c43520cc675e80e08aecf24a73efc94a81b02a | |
parent | 4e6a7df7c53389b043274be37b17679bd456d89d (diff) |
svl: convert Color to OUString
Change-Id: Icaa3e29fbd5674271e69fa17ed9249c65b4a9c40
-rw-r--r-- | svl/inc/svl/zformat.hxx | 8 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 22 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 10 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.hxx | 4 |
4 files changed, 25 insertions, 19 deletions
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx index 2fbadcbfee93..5abec42b9c88 100644 --- a/svl/inc/svl/zformat.hxx +++ b/svl/inc/svl/zformat.hxx @@ -126,7 +126,7 @@ public: void Enlarge(sal_uInt16 nAnz); // Init of arrays to the right size void Load( SvStream& rStream, ImpSvNumberformatScan& rSc, - String& rLoadedColorName); + OUString& rLoadedColorName); void Save( SvStream& rStream ) const; // if pSc is set, it is used to get the Color pointer @@ -140,9 +140,9 @@ public: sal_uInt16 GetCount() const { return nAnzStrings;} Color* GetColor() const { return pColor; } - void SetColor( Color* pCol, String& rName ) + void SetColor( Color* pCol, OUString& rName ) { pColor = pCol; sColorName = rName; } - const String& GetColorName() const { return sColorName; } + const OUString& GetColorName() const { return sColorName; } // new SYMBOLTYPE_CURRENCY in subformat? bool HasNewCurrency() const; @@ -158,7 +158,7 @@ public: private: ImpSvNumberformatInfo aI; // Hilfsstruct fuer die restlichen Infos - String sColorName; // color name + OUString sColorName; // color name Color* pColor; // pointer to color of subformat sal_uInt16 nAnzStrings; // count of symbols SvNumberNatNum aNatNum; // DoubleByteNumber diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index b3f48b226e5d..3272a10fc376 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -369,9 +369,13 @@ void ImpSvNumFor::Copy( const ImpSvNumFor& rNumFor, ImpSvNumberformatScan* pSc ) aI.Copy( rNumFor.aI, nAnzStrings ); sColorName = rNumFor.sColorName; if ( pSc ) + { pColor = pSc->GetColor( sColorName ); // #121103# don't copy pointer between documents + } else + { pColor = rNumFor.pColor; + } aNatNum = rNumFor.aNatNum; } @@ -383,7 +387,7 @@ void ImpSvNumFor::Save(SvStream& rStream) const } void ImpSvNumFor::Load(SvStream& rStream, ImpSvNumberformatScan& rSc, - String& rLoadedColorName ) + OUString& rLoadedColorName ) { sal_uInt16 nAnz; rStream >> nAnz; //! noch nicht direkt nAnzStrings wg. Enlarge @@ -755,8 +759,10 @@ SvNumberformat::SvNumberformat(String& rString, } else { - Color* pColor = pSc->GetColor( sStr); - NumFor[nIndex].SetColor( pColor, sStr); + OUString aStr(sStr); + Color* pColor = pSc->GetColor( aStr); + NumFor[nIndex].SetColor( pColor, aStr); + sStr = aStr; if (pColor == NULL) { // error bCancel = true; // break for @@ -1581,7 +1587,7 @@ NfHackConversion SvNumberformat::Load( SvStream& rStream, eOldTmpLang = rScan.GetTmpLnge(); eOldNewLang = rScan.GetNewLnge(); } - String aLoadedColorName; + OUString aLoadedColorName; for (sal_uInt16 i = 0; i < 4; i++) { NumFor[i].Load( rStream, rScan, aLoadedColorName ); @@ -1593,8 +1599,8 @@ NfHackConversion SvNumberformat::Load( SvStream& rStream, // System-German FARBE nach System-xxx COLOR umsetzen und vice versa, //! geht davon aus, dass onSave nur GERMAN und ENGLISH KeyWords in //! ImpSvNumberformatScan existierten - if ( aLoadedColorName.Len() && !NumFor[i].GetColor() && - OUString(aLoadedColorName) != rScan.GetColorString() ) + if ( !aLoadedColorName.isEmpty() && !NumFor[i].GetColor() && + aLoadedColorName != rScan.GetColorString() ) { if ( rScan.GetColorString() == "FARBE" ) { // English -> German @@ -1608,7 +1614,7 @@ NfHackConversion SvNumberformat::Load( SvStream& rStream, rScan.GetNumberformatter()->ChangeIntl( LANGUAGE_GERMAN ); rScan.SetConvertMode( LANGUAGE_GERMAN, LANGUAGE_ENGLISH_US ); } - String aColorName = NumFor[i].GetColorName(); + OUString aColorName = NumFor[i].GetColorName(); const Color* pColor = rScan.GetColor( aColorName ); if ( !pColor && aLoadedColorName == aColorName ) { @@ -1746,7 +1752,7 @@ void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter, // pColor zeigt noch auf Tabelle in temporaerem Formatter/Scanner for ( sal_uInt16 i = 0; i < 4; i++ ) { - String aColorName = NumFor[i].GetColorName(); + OUString aColorName = NumFor[i].GetColorName(); Color* pColor = rScan.GetColor( aColorName ); NumFor[i].SetColor( pColor, aColorName ); } diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 86e9ba62f066..c81ac8b0897c 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -453,7 +453,7 @@ void ImpSvNumberformatScan::ChangeStandardPrec(sal_uInt16 nPrec) nStandardPrec = nPrec; } -Color* ImpSvNumberformatScan::GetColor(String& sStr) +Color* ImpSvNumberformatScan::GetColor(OUString& sStr) { OUString sString = pFormatter->GetCharClass()->uppercase(sStr); const NfKeywordTable & rKeyword = GetKeywords(); @@ -483,17 +483,17 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) sal_Int32 nPos = sString.startsWith(rColorWord); if (nPos > 0) { - sStr.Erase(0, nPos); + sStr = sStr.copy(nPos); sStr = comphelper::string::strip(sStr, ' '); if (bConvertMode) { pFormatter->ChangeIntl(eNewLnge); - sStr.Insert( GetKeywords()[NF_KEY_COLOR], 0 ); // Color -> FARBE + sStr = GetKeywords()[NF_KEY_COLOR] + sStr; // Color -> FARBE pFormatter->ChangeIntl(eTmpLnge); } else { - sStr.Insert(rColorWord,0); + sStr = rColorWord + sStr; } sString = sString.copy(nPos); sString = comphelper::string::strip(sString, ' '); @@ -510,7 +510,7 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) } else { - sStr.Erase(); + sStr = ""; if (bConvertMode) { pFormatter->ChangeIntl(eNewLnge); diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx index 557bd906e3ea..7773c8a2b9b7 100644 --- a/svl/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -83,7 +83,7 @@ public: const String& GetErrorString() const { return sErrStr; } Date* GetNullDate() const { return pNullDate; } - const String& GetStandardName() const + const OUString& GetStandardName() const { if ( bKeywordsNeedInit ) { @@ -93,7 +93,7 @@ public: } sal_uInt16 GetStandardPrec() const { return nStandardPrec; } const Color& GetRedColor() const { return StandardColor[4]; } - Color* GetColor(String& sStr); // Setzt Hauptfarben oder + Color* GetColor(OUString& sStr); // Setzt Hauptfarben oder // definierte Farben // the compatibility currency symbol for old automatic currency formats |