diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-03-05 21:31:06 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-03-05 22:12:31 +0100 |
commit | 3f78f26aa8db1d3ae56d9e509e0a8e5b4518821b (patch) | |
tree | 7576b0bf7738fbb0cc0de191993907a1b571107e /svl | |
parent | Remove unused SbxMemoryStream (diff) | |
download | core-3f78f26aa8db1d3ae56d9e509e0a8e5b4518821b.tar.gz core-3f78f26aa8db1d3ae56d9e509e0a8e5b4518821b.zip |
String to OUString in cell.[ch]xx and follow up
Diffstat (limited to 'svl')
-rw-r--r-- | svl/inc/svl/zforlist.hxx | 11 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 43 |
2 files changed, 54 insertions, 0 deletions
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index 69645e110c41..30d192941dd8 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -481,12 +481,23 @@ public: void GetOutputString( const double& fOutNumber, sal_uInt32 nFIndex, String& sOutString, Color** ppColor ); + /// Format a number according to a format index, return string and color + void GetOutputString( const double& fOutNumber, sal_uInt32 nFIndex, + rtl::OUString& sOutString, Color** ppColor ); + /** Format a string according to a format index, return string and color. Formats only if the format code is of type text or the 4th subcode of a format code is specified, otherwise sOutString will be == "" */ void GetOutputString( String& sString, sal_uInt32 nFIndex, String& sOutString, Color** ppColor ); + + /** Format a string according to a format index, return string and color. + Formats only if the format code is of type text or the 4th subcode + of a format code is specified, otherwise sOutString will be == "" */ + void GetOutputString( rtl::OUString& sString, sal_uInt32 nFIndex, + rtl::OUString& sOutString, Color** ppColor ); + /** Format a number according to the standard default format matching the given format index */ void GetInputLineString( const double& fOutNumber, diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index c454843ff018..475551e4965b 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -1568,6 +1568,49 @@ void SvNumberFormatter::GetOutputString(String& sString, } } +void SvNumberFormatter::GetOutputString(const double& fOutNumber, + sal_uInt32 nFIndex, + rtl::OUString& sOutString, + Color** ppColor) +{ + if (bNoZero && fOutNumber == 0.0) + { + sOutString = rtl::OUString(); + return; + } + SvNumberformat* pFormat = GetFormatEntry( nFIndex ); + if (!pFormat) + pFormat = GetFormatEntry(ZF_STANDARD); + ChangeIntl(pFormat->GetLanguage()); + String aOutString; + pFormat->GetOutputString(fOutNumber, aOutString, ppColor); + sOutString = aOutString; +} + +void SvNumberFormatter::GetOutputString(rtl::OUString& sString, + sal_uInt32 nFIndex, + rtl::OUString& sOutString, + Color** ppColor) +{ + SvNumberformat* pFormat = GetFormatEntry( nFIndex ); + if (!pFormat) + pFormat = GetFormatEntry(ZF_STANDARD_TEXT); + if (!pFormat->IsTextFormat() && !pFormat->HasTextFormat()) + { + *ppColor = NULL; + sOutString = sString; + } + else + { + ChangeIntl(pFormat->GetLanguage()); + String aString = sString; + String aOutString = sOutString; + pFormat->GetOutputString(aString, aOutString, ppColor); + sString = aString; + sOutString = aOutString; + } +} + bool SvNumberFormatter::GetPreviewString(const String& sFormatString, double fPreviewNumber, String& sOutString, |