[Libreoffice-commits] .: filter/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Jul 22 07:48:27 PDT 2011


 filter/source/config/cache/typedetection.cxx                  |    7 ++++---
 filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 973a3e9e22ae3c65cf220158b616d4e64f67f5ba
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Jul 22 00:35:14 2011 -0400

    Pick the first PREFERRED IMPORT filter.
    
    And prefer the calc_HTML_WebQuery filter over the old and unreliable
    'HTML (StarCalc)' filter to import HTML files into Calc.  The web query
    filter arranges the incoming data in a more tabular fashion, which
    actually works better for Calc's sheet format.  Also, the current
    filter matching algorithm actually relies on unpredictable random
    selection since it iterates through the filters stored in *unordered*
    map container and picking the first match.  Making use of the
    PREFERRED flag in case of multiple qualifying filters for the given
    type is much more tractable than the current scheme.

diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index a33b62c..eb9859c 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -289,9 +289,8 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(::comphelper::MediaDescrip
             aLock.clear();
             // <- SAFE
 
-            for (  OUStringList::const_iterator pIt  = lFilters.begin();
-                   pIt != lFilters.end() && sFilter.getLength() == 0 ;
-                 ++pIt                    )
+            for (OUStringList::const_iterator pIt  = lFilters.begin();
+                  pIt != lFilters.end(); ++pIt)
             {
                 // SAFE ->
                 aLock.reset();
@@ -303,6 +302,8 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(::comphelper::MediaDescrip
 
                     if ((nFlags & FLAGVAL_IMPORT) == FLAGVAL_IMPORT)
                         sFilter = *pIt;
+                    if ((nFlags & FLAGVAL_PREFERRED) == FLAGVAL_PREFERRED)
+                        break;
                 }
                 catch(const css::uno::Exception&) {}
                 aLock.clear();
diff --git a/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu b/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu
index 8808adc..cd9e434 100644
--- a/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu
+++ b/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu
@@ -1,5 +1,5 @@
     <node oor:name="calc_HTML_WebQuery" oor:op="replace">
-        <prop oor:name="Flags"><value>IMPORT ALIEN USEOPTIONS</value></prop>
+        <prop oor:name="Flags"><value>IMPORT ALIEN USEOPTIONS PREFERRED</value></prop>
         <prop oor:name="UIComponent"><value>com.sun.star.comp.Calc.FilterOptionsDialog</value></prop>
         <prop oor:name="FilterService"/>
         <prop oor:name="UserData"><value></value></prop>


More information about the Libreoffice-commits mailing list