summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/source/appl/fileobj.cxx31
1 files changed, 25 insertions, 6 deletions
diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx
index 385b8b00e99b..abda2a58fa63 100644
--- a/sfx2/source/appl/fileobj.cxx
+++ b/sfx2/source/appl/fileobj.cxx
@@ -397,13 +397,32 @@ String impl_getFilter( const String& _rURL )
::rtl::OUString sType = xTypeDetection->queryTypeByDescriptor( aDescrList, sal_True );
if ( !sType.isEmpty() )
{
- css::uno::Reference< css::container::XNameAccess > xTypeCont( xTypeDetection,
- css::uno::UNO_QUERY );
- if ( xTypeCont.is() )
+ // Honor a selected/detected filter.
+ for (sal_Int32 i=0; i < aDescrList.getLength(); ++i)
{
- ::comphelper::SequenceAsHashMap lTypeProps( xTypeCont->getByName( sType ) );
- sFilter = lTypeProps.getUnpackedValueOrDefault(
- ::rtl::OUString("PreferredFilter"), ::rtl::OUString() );
+ if (aDescrList[i].Name == "FilterName")
+ {
+ OUString aFilterName;
+ if (aDescrList[i].Value >>= aFilterName)
+ {
+ sFilter = aFilterName;
+ break;
+ }
+ }
+ }
+ if (!sFilter.Len())
+ {
+ css::uno::Reference< css::container::XNameAccess > xTypeCont( xTypeDetection,
+ css::uno::UNO_QUERY );
+ if ( xTypeCont.is() )
+ {
+ /* XXX: for fdo#69948 scenario the sequence returned by
+ * getByName() contains an empty PreferredFilter
+ * property value (since? expected?) */
+ ::comphelper::SequenceAsHashMap lTypeProps( xTypeCont->getByName( sType ) );
+ sFilter = lTypeProps.getUnpackedValueOrDefault(
+ ::rtl::OUString("PreferredFilter"), ::rtl::OUString() );
+ }
}
}
}