summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-04-11 21:38:23 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-04-11 21:41:58 +0100
commit6e2df897efe2f4122869b35af16b9bf1487e38e4 (patch)
tree18ea35b65821792b1f50c0dda947df77a74b7a37 /filter
parent6a52e0ced42ac6d92bea1cb1dbdaf442d34a908f (diff)
sort ascii filter detection to end
Diffstat (limited to 'filter')
-rw-r--r--filter/source/config/cache/typedetection.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index 97ad7a9278cd..72b96ddb08e4 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -804,7 +804,21 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP
// <- SAFE ----------------------------------
}
-
+//TO-DO: add a priority entry to filter config, e.g. defaulting to 50 and
+//flag externally that some filters are lower e.g. 25 and are catch-alls
+//to be tried last. Split up writer/calc/etc. filter detection to standalone
+//those problematic formats
+namespace
+{
+ bool sort_catchalls_to_end(const rtl::OUString& rA, const rtl::OUString& rB)
+ {
+ if (rA == rB)
+ return false;
+ if (rA.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.FormatDetector")))
+ return true;
+ return rA < rB;
+ }
+}
::rtl::OUString TypeDetection::impl_detectTypeDeepOnly( ::comphelper::MediaDescriptor& rDescriptor ,
const OUStringList& lOutsideUsedDetectors)
@@ -836,6 +850,7 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP
// SAFE -> ----------------------------------
::osl::ResettableMutexGuard aLock(m_aLock);
OUStringList lDetectors = m_rCache->getItemNames(FilterCache::E_DETECTSERVICE);
+ std::sort(lDetectors.begin(), lDetectors.end(), sort_catchalls_to_end);
aLock.clear();
// <- SAFE ----------------------------------