[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sdext/source

Ariel Constenla-Haile arielch at apache.org
Wed Mar 6 16:51:23 PST 2013


 sdext/source/minimizer/fileopendialog.cxx    |   21 ++++++++++
 sdext/source/minimizer/informationdialog.cxx |   53 +++++++--------------------
 sdext/source/minimizer/informationdialog.hxx |    1 
 3 files changed, 34 insertions(+), 41 deletions(-)

New commits:
commit 8fd66eeb883676c095c8360ef609e56b9bc055a3
Author: Ariel Constenla-Haile <arielch at apache.org>
Date:   Wed Mar 6 12:45:15 2013 +0000

    i82852 - Presentation Minimizer: missing icon in information dialog

diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx
index 7535e1a..7074adf 100644
--- a/sdext/source/minimizer/informationdialog.cxx
+++ b/sdext/source/minimizer/informationdialog.cxx
@@ -92,8 +92,15 @@ rtl::OUString InsertFixedText( InformationDialog& rInformationDialog, const rtl:
     return rControlName;
 }
 
-rtl::OUString InsertImage( InformationDialog& rInformationDialog, const OUString& rControlName, const OUString& rURL,
-                        sal_Int32 nPosX, sal_Int32 nPosY, sal_Int32 nWidth, sal_Int32 nHeight )
+rtl::OUString InsertImage(
+    InformationDialog& rInformationDialog,
+    const OUString& rControlName,
+    const OUString& rURL,
+    sal_Int32 nPosX,
+    sal_Int32 nPosY,
+    sal_Int32 nWidth,
+    sal_Int32 nHeight,
+    sal_Bool bScale )
 {
     OUString pNames[] = {
         TKGet( TK_Border ),
@@ -110,7 +117,7 @@ rtl::OUString InsertImage( InformationDialog& rInformationDialog, const OUString
         Any( rURL ),
         Any( nPosX ),
         Any( nPosY ),
-        Any( sal_True ),
+        Any( bScale ),
         Any( nWidth ) };
     sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
 
@@ -204,41 +211,6 @@ static OUString ImpValueOfInMB( const sal_Int64& rVal )
     return aVal.makeStringAndClear();
 }
 
-OUString InformationDialog::ImpGetStandardImage( const OUString& sPrivateURL )
-{
-    rtl::OUString sURL;
-    try
-    {
-        mxTempFile = Reference< XStream >( mxMSF->getServiceManager()->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.io.TempFile" ), mxMSF ), UNO_QUERY_THROW );
-        Reference< XPropertySet > xPropSet( mxTempFile, UNO_QUERY );
-        Reference< XOutputStream > xOutputStream( mxTempFile->getOutputStream() );
-        if ( xOutputStream.is() && xPropSet.is() )
-        {
-            Reference< graphic::XGraphicProvider > xGraphicProvider( mxMSF->getServiceManager()->createInstanceWithContext(
-                        OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ), mxMSF ), UNO_QUERY_THROW );
-            Sequence< PropertyValue > aArgs( 1 );
-            aArgs[ 0 ].Name = OUString::createFromAscii( "URL" );
-            aArgs[ 0 ].Value <<= sPrivateURL;
-            Reference< graphic::XGraphic > xGraphic( xGraphicProvider->queryGraphic( aArgs ) );
-            if ( xGraphic.is() )
-            {
-                OUString aDestMimeType( RTL_CONSTASCII_USTRINGPARAM( "image/png" ) );
-                Sequence< PropertyValue > aArgs2( 2 );
-                aArgs2[ 0 ].Name = TKGet( TK_MimeType );                // the GraphicProvider is using "MimeType", the GraphicExporter "MediaType"...
-                aArgs2[ 0 ].Value <<= aDestMimeType;
-                aArgs2[ 1 ].Name = TKGet( TK_OutputStream );
-                aArgs2[ 1 ].Value <<= xOutputStream;
-                xGraphicProvider->storeGraphic( xGraphic, aArgs2 );
-            }
-            xPropSet->getPropertyValue( OUString::createFromAscii( "Uri" ) ) >>= sURL;
-        }
-    }
-    catch( Exception& )
-    {
-    }
-    return sURL;
-}
-
 void InformationDialog::InitDialog()
 {
     sal_Int32 nDialogHeight = DIALOG_HEIGHT;
@@ -331,7 +303,10 @@ void InformationDialog::InitDialog()
         aInfoString = aInfoString.replaceAt( k, aTitlePlaceholder.getLength(), aTitle );
 
     com::sun::star::uno::Reference< com::sun::star::awt::XItemListener > xItemListener;
-    InsertImage( *this, rtl::OUString( rtl::OUString::createFromAscii( "aboutimage" ) ), ImpGetStandardImage( rtl::OUString::createFromAscii( "private:standardimage/query" ) ), 5, 5, 25, 25 );
+    InsertImage( *this,
+                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "aboutimage" ) ),
+                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:standardimage/query" ) ),
+                 5, 5, 25, 25, sal_False );
     InsertFixedText( *this, rtl::OUString( rtl::OUString::createFromAscii( "fixedtext" ) ), aInfoString, PAGE_POS_X, 6, PAGE_WIDTH, 24, sal_True, 0 );
     if ( maSaveAsURL.getLength() )
         InsertCheckBox(  *this, TKGet( TK_OpenNewDocument ), xItemListener, getString( STR_AUTOMATICALLY_OPEN ), PAGE_POS_X, 42, PAGE_WIDTH, 8, 1 );
diff --git a/sdext/source/minimizer/informationdialog.hxx b/sdext/source/minimizer/informationdialog.hxx
index 033baeb6..0edafc1 100644
--- a/sdext/source/minimizer/informationdialog.hxx
+++ b/sdext/source/minimizer/informationdialog.hxx
@@ -65,7 +65,6 @@ private :
 
     com::sun::star::uno::Reference< com::sun::star::awt::XActionListener >  mxActionListener;
 
-    rtl::OUString ImpGetStandardImage( const rtl::OUString& rPrivateURL );
     void InitDialog();
 
     sal_Int64 mnSourceSize;
commit 75833fdb6ede664fdcef38a16ecf1f8d3f3adc7d
Author: Ariel Constenla-Haile <arielch at apache.org>
Date:   Wed Mar 6 12:15:24 2013 +0000

    i121857 - Presentation Minimizer: fix filter naming

diff --git a/sdext/source/minimizer/fileopendialog.cxx b/sdext/source/minimizer/fileopendialog.cxx
index df1ecb6..f074640 100644
--- a/sdext/source/minimizer/fileopendialog.cxx
+++ b/sdext/source/minimizer/fileopendialog.cxx
@@ -55,6 +55,7 @@
 #include <com/sun/star/view/XControlAccess.hpp>
 #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
 
+#include <rtl/ustrbuf.hxx>
 
 using namespace ::rtl;
 using namespace ::com::sun::star::uno;
@@ -138,6 +139,13 @@ FileOpenDialog::FileOpenDialog( const Reference< XComponentContext >& rxMSF ) :
 
 //  mxFilePicker->setDefaultName( );
 
+    const char filter[] = "*.";
+    // the filter title must be formed in the same it is currently done
+    // in the internal implementation: "UIName (.<extension>)"
+    rtl::OUStringBuffer aUIName;
+    // the filter must be in the form "*.<extension>"
+    rtl::OUStringBuffer aFilter;
+    rtl::OUString aExtension;
     Reference< XFilterManager > xFilterManager( mxFilePicker, UNO_QUERY_THROW );
     std::vector< FilterEntry >::iterator aIter( aFilterEntryList.begin() );
     while( aIter != aFilterEntryList.end() )
@@ -158,7 +166,18 @@ FileOpenDialog::FileOpenDialog( const Reference< XComponentContext >& rxMSF ) :
                 }
                 if ( aExtensions.getLength() )
                 {
-                    xFilterManager->appendFilter( aIter->maUIName, aExtensions[ 0 ] );
+                    aExtension = aExtensions[0];
+                    // form the title: "<UIName> (.<extension)"
+                    aUIName.append( aIter->maUIName );
+                    aUIName.appendAscii( RTL_CONSTASCII_STRINGPARAM( " (." ));
+                    aUIName.append( aExtension );
+                    aUIName.append( sal_Unicode( ')' ) );
+                    // form the filter: "(*.<extension>)"
+                    aFilter.appendAscii( RTL_CONSTASCII_STRINGPARAM( filter ) );
+                    aFilter.append( aExtensions[0] );
+
+                    xFilterManager->appendFilter( aUIName.makeStringAndClear(),
+                                                  aFilter.makeStringAndClear() );
                     if ( aIter->maFlags & 0x100 )
                         xFilterManager->setCurrentFilter( aIter->maUIName );
                 }


More information about the Libreoffice-commits mailing list