Kaydet (Commit) 823278dd authored tarafından Eike Rathke's avatar Eike Rathke

resolved fdo#69948 honor a detected FilterName

TypeDetection::queryTypeByDescriptor() adds the FilterName property to
the MediaDescriptor, use that if present.

Strangely enough the sequence returned by XNameAccess::getByName(sType)
of the type detection contains an empty PreferredFilter value so that is
useless in this scenario.

Change-Id: I5cdc9fe71e35bdb7c511739c7f7728134941649a
üst 4192ac4a
......@@ -399,13 +399,28 @@ OUString impl_getFilter( const OUString& _rURL )
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(
OUString("PreferredFilter"), OUString() );
if (aDescrList[i].Name == "FilterName")
{
if (aDescrList[i].Value >>= sFilter)
break;
}
}
if (sFilter.isEmpty())
{
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(
OUString("PreferredFilter"), OUString() );
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment