diff -ru filter.orig/source/config/cache/typedetection.cxx filter/source/config/cache/typedetection.cxx --- filter.orig/source/config/cache/typedetection.cxx 2010-01-14 16:09:44.000000000 +0000 +++ filter/source/config/cache/typedetection.cxx 2010-01-14 16:10:31.000000000 +0000 @@ -609,6 +609,36 @@ return sal_False; } +namespace +{ + bool CSVAtStart(const rtl::OUString &rLHS, const rtl::OUString &rRHS) + { + sal_Int32 nCompare = rLHS.compareTo(rRHS); + if (nCompare != 0) + { + if (rRHS.equalsAscii("Text - txt - csv (StarCalc)")) + return false; + else if (rLHS.equalsAscii("Text - txt - csv (StarCalc)")) + return true; + } + return nCompare < 0; + } + + bool TextFormatDetectorAtEnd(const rtl::OUString &rLHS, const rtl::OUString &rRHS) + { + sal_Int32 nCompare = rLHS.compareTo(rRHS); + if (nCompare != 0) + { + if (rRHS.equalsAscii("com.sun.star.text.FormatDetector")) + return true; + else if (rLHS.equalsAscii("com.sun.star.text.FormatDetector")) + return false; + } + return nCompare < 0; + } + +} + /*----------------------------------------------- 14.11.2003 12:11 -----------------------------------------------*/ @@ -632,6 +662,9 @@ lIProps[PROPNAME_DOCUMENTSERVICE] <<= sPreSelDocumentService; lFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps); + //#i96362#, place Filters into some deterministic order, ideally with CSV at the start + std::sort(lFilters.begin(), lFilters.end(), CSVAtStart); + aLock.clear(); // <- SAFE -------------------------- } @@ -864,6 +897,8 @@ // SAFE -> ---------------------------------- ::osl::ResettableMutexGuard aLock(m_aLock); OUStringList lDetectors = m_rCache->getItemNames(FilterCache::E_DETECTSERVICE); + //#i96362#, place Detectors into some deterministic order, ideally with Writer's detect at the end + std::sort(lDetectors.begin(), lDetectors.end(), TextFormatDetectorAtEnd); aLock.clear(); // <- SAFE ----------------------------------