summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-02-21 17:53:07 +0000
committerMichael Meeks <michael.meeks@suse.com>2013-02-21 17:53:55 +0000
commit6b300173343e74531c516e24cd931e35d747b84d (patch)
tree33a2a8417c7e59c2c44b7d17dbd285a756d3411b
parent4e7949974f44e9b1c7b6bae5e8f78234ff860e45 (diff)
parse html filter options more legibly.
Change-Id: I951d26df9c99f47b3e1415b96efaa050adf82892
-rw-r--r--sc/source/ui/docshell/docsh.cxx21
1 files changed, 10 insertions, 11 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 08cfe0019f14..917c88b62c54 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -122,8 +122,6 @@ using namespace com::sun::star;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::lang::XMultiServiceFactory;
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
using ::boost::shared_ptr;
using ::std::vector;
@@ -947,30 +945,31 @@ sal_Bool ScDocShell::LoadFrom( SfxMedium& rMedium )
static void lcl_parseHtmlFilterOption(const OUString& rOption, LanguageType& rLang, bool& rDateConvert)
{
OUStringBuffer aBuf;
- OUString aTokens[2];
+ std::vector< OUString > aTokens;
sal_Int32 n = rOption.getLength();
const sal_Unicode* p = rOption.getStr();
- sal_Int32 nTokenId = 0;
for (sal_Int32 i = 0; i < n; ++i)
{
const sal_Unicode c = p[i];
if (c == sal_Unicode(' '))
{
if (aBuf.getLength())
- aTokens[nTokenId++] = aBuf.makeStringAndClear();
+ aTokens.push_back( aBuf.makeStringAndClear() );
}
else
aBuf.append(c);
-
- if (nTokenId >= 2)
- break;
}
if (aBuf.getLength())
- aTokens[nTokenId] = aBuf.makeStringAndClear();
+ aTokens.push_back( aBuf.makeStringAndClear() );
+
+ rLang = LanguageType( 0 );
+ rDateConvert = false;
- rLang = static_cast<LanguageType>(aTokens[0].toInt32());
- rDateConvert = static_cast<bool>(aTokens[1].toInt32());
+ if (aTokens.size() > 0)
+ rLang = static_cast<LanguageType>(aTokens[0].toInt32());
+ if (aTokens.size() > 1)
+ rDateConvert = static_cast<bool>(aTokens[1].toInt32());
}
sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium )