[Libreoffice-commits] core.git: 3 commits - svx/source

David Tardon dtardon at redhat.com
Fri Jan 30 05:04:03 PST 2015


 svx/source/core/graphichelper.cxx |   31 ++++---------------------------
 1 file changed, 4 insertions(+), 27 deletions(-)

New commits:
commit 75fa61754122cf44a6bd6ac4a0efb44918b1305b
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Jan 30 13:59:24 2015 +0100

    ensure the default export filter is really available
    
    Change-Id: Ie9b8a25d8d33c6211c43277f4d3b4cdbd79f5783

diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx
index 04b93c0..5cd4e40 100644
--- a/svx/source/core/graphichelper.cxx
+++ b/svx/source/core/graphichelper.cxx
@@ -209,8 +209,6 @@ void GraphicHelper::SaveShapeAsGraphic( const Reference< drawing::XShape >& xSha
         Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
         Reference< XPropertySet > xShapeSet( xShape, UNO_QUERY_THROW );
 
-        OUString aMimeType;
-
         SvtPathOptions aPathOpt;
         OUString sGraphicPath( aPathOpt.GetGraphicPath() );
 
@@ -227,6 +225,7 @@ void GraphicHelper::SaveShapeAsGraphic( const Reference< drawing::XShape >& xSha
 
         GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
         Reference<XFilterManager> xFilterManager( xFilePicker, UNO_QUERY );
+        const OUString aDefaultMimeType("image/png");
         OUString aDefaultFormatName;
         sal_uInt16 nCount = rGraphicFilter.GetExportFormatCount();
 
@@ -238,14 +237,12 @@ void GraphicHelper::SaveShapeAsGraphic( const Reference< drawing::XShape >& xSha
             const OUString aFilterMimeType( rGraphicFilter.GetExportFormatMediaType( i ) );
             xFilterManager->appendFilter( aExportFormatName, rGraphicFilter.GetExportWildcard( i ) );
             aMimeTypeMap[ aExportFormatName ] = aFilterMimeType;
-            if( aMimeType == aFilterMimeType )
+            if( aDefaultMimeType == aFilterMimeType )
                 aDefaultFormatName = aExportFormatName;
         }
 
-        if( aDefaultFormatName.getLength() == 0 )
-            aDefaultFormatName = "PNG - Portable Network Graphic";
-
-        xFilterManager->setCurrentFilter( aDefaultFormatName );
+        if( !aDefaultFormatName.isEmpty() )
+            xFilterManager->setCurrentFilter( aDefaultFormatName );
 
         // execute dialog
 
commit 89321e312b4a1be22becbead67b1d25b058c623b
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Jan 30 14:01:26 2015 +0100

    remove copypasta
    
    Change-Id: If3e33ee0a24e8a4850b2242ab3806d8dc57ddf09

diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx
index 5e3aaa0..04b93c0 100644
--- a/svx/source/core/graphichelper.cxx
+++ b/svx/source/core/graphichelper.cxx
@@ -255,10 +255,6 @@ void GraphicHelper::SaveShapeAsGraphic( const Reference< drawing::XShape >& xSha
             OUString aExportMimeType( aMimeTypeMap[xFilterManager->getCurrentFilter()] );
 
             Reference< XInputStream > xGraphStream;
-            if( aMimeType == aExportMimeType )
-            {
-                xShapeSet->getPropertyValue("GraphicStream") >>= xGraphStream;
-            }
 
             if( xGraphStream.is() )
             {
commit be45f378d5a888efeceed54ba53ac61c4dd3f2b8
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Jan 30 13:45:12 2015 +0100

    tdf#85195 only check export formats for default format
    
    What good would would a pre-selected export filter format to me if I
    cannot save into it?
    
    Change-Id: I9e5d06cec5ffa0ba325b8bfcfadc4fd55d39017a

diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx
index 50dadc2..5e3aaa0 100644
--- a/svx/source/core/graphichelper.cxx
+++ b/svx/source/core/graphichelper.cxx
@@ -243,22 +243,6 @@ void GraphicHelper::SaveShapeAsGraphic( const Reference< drawing::XShape >& xSha
         }
 
         if( aDefaultFormatName.getLength() == 0 )
-        {
-            nCount = rGraphicFilter.GetImportFormatCount();
-            for( sal_uInt16 i = 0; i < nCount; i++ )
-            {
-                const OUString aFilterMimeType( rGraphicFilter.GetImportFormatMediaType( i ) );
-                if( aMimeType == aFilterMimeType )
-                {
-                    aDefaultFormatName = rGraphicFilter.GetImportFormatName( i );
-                    xFilterManager->appendFilter( aDefaultFormatName,  rGraphicFilter.GetImportWildcard( i ) );
-                    aMimeTypeMap[ aDefaultFormatName ] = aFilterMimeType;
-                    break;
-                }
-            }
-        }
-
-        if( aDefaultFormatName.getLength() == 0 )
             aDefaultFormatName = "PNG - Portable Network Graphic";
 
         xFilterManager->setCurrentFilter( aDefaultFormatName );


More information about the Libreoffice-commits mailing list