[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sfx2/source

Eike Rathke erack at redhat.com
Fri Oct 11 06:12:21 PDT 2013


 sfx2/source/appl/fileobj.cxx |   31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

New commits:
commit c42edd592e158d85a2231703552fdac6f13d7425
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Oct 11 01:08:01 2013 +0200

    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)
    
    Backported.
    
    Change-Id: I5cdc9fe71e35bdb7c511739c7f7728134941649a
    Reviewed-on: https://gerrit.libreoffice.org/6207
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx
index 1083a85..553b2cd 100644
--- a/sfx2/source/appl/fileobj.cxx
+++ b/sfx2/source/appl/fileobj.cxx
@@ -392,13 +392,32 @@ String impl_getFilter( const String& _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")
+                    {
+                        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(
+                                OUString("PreferredFilter"), OUString() );
+                    }
                 }
             }
         }


More information about the Libreoffice-commits mailing list