diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-20 19:18:36 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-22 21:49:18 -0400 |
commit | 05c49983366f3686576d678293c3903a08213907 (patch) | |
tree | e776fb5aecd682e244d89cc3be1e3960fb637de2 /sc/source/core/tool/stringutil.cxx | |
parent | 230f3ea249cd1f045ba30aced35935cdc32ddd87 (diff) |
One less use of PutCell().
Change-Id: I10120476e3bb17c330fa8a59ae51ac7d4573d937
Diffstat (limited to 'sc/source/core/tool/stringutil.cxx')
-rw-r--r-- | sc/source/core/tool/stringutil.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx index 3a997e9d539f..82dfc69d3d5e 100644 --- a/sc/source/core/tool/stringutil.cxx +++ b/sc/source/core/tool/stringutil.cxx @@ -21,6 +21,7 @@ #include "rtl/ustrbuf.hxx" #include "rtl/math.hxx" #include "global.hxx" +#include "svl/zforlist.hxx" ScSetStringParam::ScSetStringParam() : mpNumFormatter(NULL), @@ -333,4 +334,38 @@ bool ScStringUtil::isMultiline( const OUString& rStr ) return false; } +ScInputStringType ScStringUtil::parseInputString( + SvNumberFormatter& rFormatter, const OUString& rStr, LanguageType eLang ) +{ + ScInputStringType aRet; + aRet.meType = ScInputStringType::Unknown; + aRet.maText = rStr; + + if (rStr.getLength() > 1 && rStr[0] == '=') + { + aRet.meType = ScInputStringType::Formula; + } + else if (rStr.getLength() > 1 && rStr[0] == '\'') + { + // for bEnglish, "'" at the beginning is always interpreted as text + // marker and stripped + aRet.maText = rStr.copy(1); + aRet.meType = ScInputStringType::Text; + } + else // (nur) auf englisches Zahlformat testen + { + sal_uInt32 nNumFormat = rFormatter.GetStandardIndex(eLang); + + if (rFormatter.IsNumberFormat(rStr, nNumFormat, aRet.mfValue)) + aRet.mnFormatType = rFormatter.GetType(nNumFormat); + else if (!rStr.isEmpty()) + aRet.meType = ScInputStringType::Text; + + // das (englische) Zahlformat wird nicht gesetzt + //! passendes lokales Format suchen und setzen??? + } + + return aRet; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |