summaryrefslogtreecommitdiff
path: root/filter/source/textfilterdetect/filterdetect.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/textfilterdetect/filterdetect.cxx')
-rw-r--r--filter/source/textfilterdetect/filterdetect.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
index 1f5080ad0951..08944fad0e5f 100644
--- a/filter/source/textfilterdetect/filterdetect.cxx
+++ b/filter/source/textfilterdetect/filterdetect.cxx
@@ -149,10 +149,19 @@ bool HandleEmptyFileUrlByExtension(MediaDescriptor& rMediaDesc, const OUString&
return false;
}
- std::shared_ptr<const SfxFilter> pFilter(SfxFilterMatcher().GetFilter4Extension(rExt));
+ // Requiring the export+preferred flags helps to find the relevant filter, e.g. .doc -> WW8 (and
+ // not WW6 or Mac_Word).
+ SfxFilterFlags nMust
+ = SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::PREFERED;
+ std::shared_ptr<const SfxFilter> pFilter(SfxFilterMatcher().GetFilter4Extension(rExt, nMust));
if (!pFilter)
{
- return false;
+ // retry without PREFFERED so we can find at least something for 0-byte *.ods
+ nMust = SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT;
+ pFilter = SfxFilterMatcher().GetFilter4Extension(rExt, nMust);
+
+ if (!pFilter)
+ return false;
}
rMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= pFilter->GetFilterName();