summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-10-11 01:08:01 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-10-15 15:29:56 +0000
commit9e958f2f44a63886e44b265c2120020cb0289a1b (patch)
tree69dce05bf971625a90d10f400287ca4c89462704
parent51b71f0a9ca0c7504849ccea8dae9c9896d2eeb1 (diff)
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. (cherry picked from commit 823278dd095d754d0f673ef140c36c9fa7ebeffd) Conflicts: sfx2/source/appl/fileobj.cxx Backported. Change-Id: I5cdc9fe71e35bdb7c511739c7f7728134941649a Reviewed-on: https://gerrit.libreoffice.org/6208 Reviewed-by: Kohei Yoshida <libreoffice@kohei.us> Tested-by: Kohei Yoshida <libreoffice@kohei.us> (cherry picked from commit 4c8e5c2a5cf67661ebf33be5c5c2700a4c389f7c) Reviewed-on: https://gerrit.libreoffice.org/6215 Reviewed-by: Eike Rathke <erack@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-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() );
+ }
}
}
}