summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-07-22 00:35:14 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-07-22 10:43:59 -0400
commit2384b0e2571020560574a27257c6b79f60bcbd5d (patch)
treeacd835fa40c37e584b8a329c91f708ca751e8c80 /filter
parent88e2bf5341228bac9d36aa88b07b090afd7e2e2c (diff)
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.
Diffstat (limited to 'filter')
-rw-r--r--filter/source/config/cache/typedetection.cxx7
-rw-r--r--filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu2
2 files changed, 5 insertions, 4 deletions
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index 02a46837bcc5..b26bd40d3889 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 8808adc140a1..cd9e4349aea7 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>