[Libreoffice-commits] core.git: sc/source

Michael Meeks michael.meeks at suse.com
Thu Feb 21 09:54:29 PST 2013


 sc/source/ui/docshell/docsh.cxx |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 6b300173343e74531c516e24cd931e35d747b84d
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Thu Feb 21 17:53:07 2013 +0000

    parse html filter options more legibly.
    
    Change-Id: I951d26df9c99f47b3e1415b96efaa050adf82892

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 08cfe00..917c88b 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 )


More information about the Libreoffice-commits mailing list