diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-05-03 03:53:44 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-06-02 03:24:55 +0200 |
commit | 7978c78606608622a5e064f4d95c88393bea426a (patch) | |
tree | c8980b4818d219807e786bfccbb303f1c9fb4a3e /sc | |
parent | 737fbae8e3e62b587e2651be3668d0a39192af18 (diff) |
more String->OUString and early bail outs
Change-Id: Ia573f27962b5fbb48e543a2e2a802e85db36fafd
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 04a09ed4c2b5..e1f551b655fd 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1299,7 +1299,7 @@ void ScInputHandler::PasteFunctionData() // Selektion berechnen und als Tip-Hilfe anzeigen // -static String lcl_Calculate( const OUString& rFormula, ScDocument* pDoc, const ScAddress &rPos ) +static OUString lcl_Calculate( const OUString& rFormula, ScDocument* pDoc, const ScAddress &rPos ) { //! mit ScFormulaDlg::CalcValue zusammenfassen und ans Dokument verschieben !!!! //! (Anfuehrungszeichen bei Strings werden nur hier eingefuegt) @@ -1331,43 +1331,37 @@ static String lcl_Calculate( const OUString& rFormula, ScDocument* pDoc, const S } sal_uInt16 nErrCode = pCell->GetErrCode(); - if ( nErrCode == 0 ) + if ( nErrCode != 0 ) + return ScGlobal::GetErrorString(nErrCode); + + SvNumberFormatter& aFormatter = *(pDoc->GetFormatTable()); + OUString aValue; + if ( pCell->IsValue() ) { - SvNumberFormatter& aFormatter = *(pDoc->GetFormatTable()); - Color* pColor; - if ( pCell->IsValue() ) - { - double n = pCell->GetValue(); - sal_uLong nFormat = aFormatter.GetStandardFormat( n, 0, - pCell->GetFormatType(), ScGlobal::eLnge ); - aFormatter.GetInputLineString( n, nFormat, aValue ); - //! display OutputString but insert InputLineString - } - else + double n = pCell->GetValue(); + sal_uLong nFormat = aFormatter.GetStandardFormat( n, 0, + pCell->GetFormatType(), ScGlobal::eLnge ); + aFormatter.GetInputLineString( n, nFormat, aValue ); + //! display OutputString but insert InputLineString + } + else + { + OUString aStr = pCell->GetString(); + sal_uLong nFormat = aFormatter.GetStandardFormat( + pCell->GetFormatType(), ScGlobal::eLnge); { - String aStr = pCell->GetString(); - sal_uLong nFormat = aFormatter.GetStandardFormat( - pCell->GetFormatType(), ScGlobal::eLnge); - { - OUString sTempIn(aStr); - OUString sTempOut(aValue); - aFormatter.GetOutputString( sTempIn, nFormat, - sTempOut, &pColor ); - aStr = sTempIn; - aValue = sTempOut; - } - - aValue.Insert('"',0); // in Anfuehrungszeichen - aValue+='"'; - //! Anfuehrungszeichen im String escapen ???? + Color* pColor; + aFormatter.GetOutputString( aStr, nFormat, + aValue, &pColor ); } - ScRange aTestRange; - if ( bColRowName || (aTestRange.Parse(rFormula) & SCA_VALID) ) - aValue.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ..." )); // Bereich + aValue = "\"" + aValue + "\""; + //! Anfuehrungszeichen im String escapen ???? } - else - aValue = ScGlobal::GetErrorString(nErrCode); + + ScRange aTestRange; + if ( bColRowName || (aTestRange.Parse(rFormula) & SCA_VALID) ) + aValue = aValue + " ..."; return aValue; } |