From fc2e443ab7d48de7d8c0be892b8a17db8c9bf3bd Mon Sep 17 00:00:00 2001 From: Sven Jacobi Date: Tue, 22 May 2007 15:53:24 +0000 Subject: minor changes, added access to standard control icons, some string changes --- sdext/source/minimizer/impoptimizer.cxx | 7 +- sdext/source/minimizer/informationdialog.cxx | 82 ++++++++++++++++++---- sdext/source/minimizer/informationdialog.hxx | 12 +++- sdext/source/minimizer/pppoptimizertoken.cxx | 6 +- sdext/source/minimizer/pppoptimizertoken.hxx | 6 +- .../Office/extension/SunPresentationMinimizer.xcu | 14 +++- .../Office/extension/SunPresentationMinimizer.xcs | 10 ++- 7 files changed, 111 insertions(+), 26 deletions(-) (limited to 'sdext') diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx index e6b40082ec08..6d6f646946ac 100644 --- a/sdext/source/minimizer/impoptimizer.cxx +++ b/sdext/source/minimizer/impoptimizer.cxx @@ -4,9 +4,9 @@ * * $RCSfile: impoptimizer.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: sj $ $Date: 2007-05-11 13:50:53 $ + * last change: $Author: sj $ $Date: 2007-05-22 16:53:24 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -766,7 +766,8 @@ sal_Bool ImpOptimizer::Optimize( const Sequence< PropertyValue >& rArguments ) sal_Bool bInformationDialog = sal_True; if ( bInformationDialog ) { - InformationDialog aInformationDialog( mxMSF, xSelf, mbOpenNewDocument, nSourceSize, nDestSize ); + sal_Int64 nApproxSize = nDestSize; + InformationDialog aInformationDialog( mxMSF, xSelf, mbOpenNewDocument, nSourceSize, nDestSize, nApproxSize ); aInformationDialog.execute(); } if ( mbOpenNewDocument && xSelf.is() ) diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx index 6daa26fdab53..f54edbda7ea0 100644 --- a/sdext/source/minimizer/informationdialog.cxx +++ b/sdext/source/minimizer/informationdialog.cxx @@ -4,9 +4,9 @@ * * $RCSfile: informationdialog.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: sj $ $Date: 2007-05-11 13:56:24 $ + * last change: $Author: sj $ $Date: 2007-05-22 16:53:24 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -42,6 +42,12 @@ #ifndef _COM_SUN_STAR_UI_DIALOGS_EXECUTABLEDIALOGRESULTS_HPP_ #include #endif +#ifndef _COM_SUN_STAR_GRAPHIC_XGRAPHICPROVIDER_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_GRAPHIC_XGRAPHIC_HPP_ +#include +#endif #ifndef _RTL_USTRBUF_HXX_ #include #endif @@ -57,6 +63,8 @@ // --------------------- using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::io; using namespace ::com::sun::star::ui; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::uno; @@ -116,7 +124,7 @@ rtl::OUString InsertImage( InformationDialog& rInformationDialog, const OUString TKGet( TK_Width ) }; Any pValues[] = { - Any( sal_Int16( 1 ) ), + Any( sal_Int16( 0 ) ), Any( nHeight ), Any( rURL ), Any( nPosX ), @@ -241,26 +249,73 @@ void InformationDialog::InitDialog() Sequence< rtl::OUString > aNames( pNames, nCount ); Sequence< Any > aValues( pValues, nCount ); - rtl::OUString sBitmapPath( getPath( TK_BitmapPath ) ); - rtl::OUString sBitmap( rtl::OUString::createFromAscii( "/aboutlogo.png" ) ); - rtl::OUString sURL( sBitmapPath += sBitmap ); + rtl::OUString sURL( rtl::OUString::createFromAscii( "private:standardimage/query" ) ); + 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 <<= sURL; + 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; + } sal_Bool bOpenNewDocument = mrbOpenNewDocument; setControlProperty( TKGet( TK_OpenNewDocument ), TKGet( TK_State ), Any( (sal_Int16)bOpenNewDocument ) ); mxDialogModelMultiPropertySet->setPropertyValues( aNames, aValues ); + sal_Int64 nSource = mnSourceSize; + sal_Int64 nDest = mnDestSize; + + PPPOptimizerTokenEnum eInfoString( STR_INFO_1 ); + if ( mnSourceSize ) + { + if ( mnDestSize ) + eInfoString = STR_INFO_1; + else + eInfoString = STR_INFO_2; + } + else if ( mnDestSize ) + eInfoString = STR_INFO_3; + else + eInfoString = STR_INFO_4; - OUString aInfoString( getString( STR_INFO_1 ) ); + OUString aInfoString( getString( eInfoString ) ); const OUString aOldSizePlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%OLDFILESIZE" ) ); const OUString aNewSizePlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%NEWFILESIZE" ) ); + const OUString aTitlePlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%TITLE" ) ); + const OUString aExtensionPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%EXTENSIONNAME" ) ); + sal_Int32 i = aInfoString.indexOf( aOldSizePlaceholder, 0 ); if ( i >= 0 ) - aInfoString = aInfoString.replaceAt( i, aOldSizePlaceholder.getLength(), ImpValueOfInMB( mnSourceSize ) ); + aInfoString = aInfoString.replaceAt( i, aOldSizePlaceholder.getLength(), ImpValueOfInMB( nSource ) ); sal_Int32 j = aInfoString.indexOf( aNewSizePlaceholder, 0 ); if ( j >= 0 ) - aInfoString = aInfoString.replaceAt( j, aNewSizePlaceholder.getLength(), ImpValueOfInMB( mnDestSize ) ); + aInfoString = aInfoString.replaceAt( j, aNewSizePlaceholder.getLength(), ImpValueOfInMB( nDest ) ); + + sal_Int32 k = aInfoString.indexOf( aTitlePlaceholder, 0 ); + if ( k >= 0 ) + aInfoString = aInfoString.replaceAt( k, aTitlePlaceholder.getLength(), rtl::OUString() ); + + sal_Int32 l = aInfoString.indexOf( aExtensionPlaceholder, 0 ); + if ( l >= 0 ) + aInfoString = aInfoString.replaceAt( l, aExtensionPlaceholder.getLength(), getString( STR_SUN_OPTIMIZATION_WIZARD ) ); com::sun::star::uno::Reference< com::sun::star::awt::XItemListener > xItemListener; InsertImage( *this, rtl::OUString( rtl::OUString::createFromAscii( "aboutimage" ) ), sURL, 5, 5, 25, 25 ); @@ -271,15 +326,16 @@ void InformationDialog::InitDialog() // ----------------------------------------------------------------------------- -InformationDialog::InformationDialog( const Reference< XComponentContext > &rxMSF, Reference< XFrame >& rxFrame, sal_Bool& bOpenNewDocument, sal_Int64 nSourceSize, sal_Int64 nDestSize ) : +InformationDialog::InformationDialog( const Reference< XComponentContext > &rxMSF, Reference< XFrame >& rxFrame, sal_Bool& rbOpenNewDocument, const sal_Int64& rSourceSize, const sal_Int64& rDestSize, const sal_Int64& rApproxSize ) : UnoDialog( rxMSF, rxFrame ), ConfigurationAccess( rxMSF, NULL ), mxMSF( rxMSF ), mxFrame( rxFrame ), mxActionListener( new OKActionListener( *this ) ), - mnSourceSize( nSourceSize ), - mnDestSize( nDestSize ), - mrbOpenNewDocument( bOpenNewDocument ) + mnSourceSize( rSourceSize ), + mnDestSize( rDestSize ), + mnApproxSize( rApproxSize ), + mrbOpenNewDocument( rbOpenNewDocument ) { Reference< XFrame > xFrame( mxController->getFrame() ); Reference< XWindow > xContainerWindow( xFrame->getContainerWindow() ); diff --git a/sdext/source/minimizer/informationdialog.hxx b/sdext/source/minimizer/informationdialog.hxx index 0e343f8d62eb..52ed4ead463e 100644 --- a/sdext/source/minimizer/informationdialog.hxx +++ b/sdext/source/minimizer/informationdialog.hxx @@ -4,9 +4,9 @@ * * $RCSfile: informationdialog.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: sj $ $Date: 2007-05-16 15:19:53 $ + * last change: $Author: sj $ $Date: 2007-05-22 16:53:24 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -87,6 +87,9 @@ #ifndef _COM_SUN_STAR_AWT_PUSHBUTTONTYPE_HPP_ #include #endif +#ifndef _COM_SUN_STAR_IO_XSTREAM_HPP_ +#include +#endif // --------------------- // - InformationDialog - @@ -97,14 +100,16 @@ public : InformationDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxMSF, com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rxFrame, - sal_Bool& bOpenNewDocument, sal_Int64 nSourceSize, sal_Int64 nDestSize ); + sal_Bool& bOpenNewDocument, const sal_Int64& nSourceSize, const sal_Int64& nDestSize, const sal_Int64& nApproxDest ); ~InformationDialog(); sal_Bool execute(); private : + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >mxMSF; com::sun::star::uno::Reference< com::sun::star::frame::XFrame > mxFrame; + com::sun::star::uno::Reference< com::sun::star::io::XStream > mxTempFile; com::sun::star::uno::Reference< com::sun::star::awt::XActionListener > mxActionListener; @@ -112,6 +117,7 @@ private : sal_Int64 mnSourceSize; sal_Int64 mnDestSize; + sal_Int64 mnApproxSize; sal_Bool& mrbOpenNewDocument; public : diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx index e3cbeae45deb..45fb9898afed 100644 --- a/sdext/source/minimizer/pppoptimizertoken.cxx +++ b/sdext/source/minimizer/pppoptimizertoken.cxx @@ -4,9 +4,9 @@ * * $RCSfile: pppoptimizertoken.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: sj $ $Date: 2007-05-11 14:00:09 $ + * last change: $Author: sj $ $Date: 2007-05-22 16:53:24 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -300,6 +300,8 @@ static const TokenTable pTokenTableArray[] = { "STR_OK", STR_OK }, { "STR_INFO_1", STR_INFO_1 }, { "STR_INFO_2", STR_INFO_2 }, + { "STR_INFO_3", STR_INFO_3 }, + { "STR_INFO_4", STR_INFO_4 }, { "STR_DUPLICATING_PRESENTATION",STR_DUPLICATING_PRESENTATION }, { "STR_DELETING_SLIDES", STR_DELETING_SLIDES }, { "STR_OPTIMIZING_GRAPHICS", STR_OPTIMIZING_GRAPHICS }, diff --git a/sdext/source/minimizer/pppoptimizertoken.hxx b/sdext/source/minimizer/pppoptimizertoken.hxx index 7274389db790..ff69c2197c3a 100644 --- a/sdext/source/minimizer/pppoptimizertoken.hxx +++ b/sdext/source/minimizer/pppoptimizertoken.hxx @@ -4,9 +4,9 @@ * * $RCSfile: pppoptimizertoken.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: sj $ $Date: 2007-05-11 14:00:23 $ + * last change: $Author: sj $ $Date: 2007-05-22 16:53:24 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -276,6 +276,8 @@ enum PPPOptimizerTokenEnum STR_OK, STR_INFO_1, STR_INFO_2, + STR_INFO_3, + STR_INFO_4, STR_DUPLICATING_PRESENTATION, STR_DELETING_SLIDES, STR_OPTIMIZING_GRAPHICS, diff --git a/sdext/source/minimizer/registry/data/org/openoffice/Office/extension/SunPresentationMinimizer.xcu b/sdext/source/minimizer/registry/data/org/openoffice/Office/extension/SunPresentationMinimizer.xcu index 172caa198f38..87cdb0459d80 100644 --- a/sdext/source/minimizer/registry/data/org/openoffice/Office/extension/SunPresentationMinimizer.xcu +++ b/sdext/source/minimizer/registry/data/org/openoffice/Office/extension/SunPresentationMinimizer.xcu @@ -15,6 +15,10 @@ + + &ProductName; + &ProductName; + Steps Schritte @@ -264,10 +268,18 @@ Sun, Sun Microsystems, le logo Sun, Java et StarOffice sont des marques de fabri OK + The %EXTENSIONNAME has successfully updated the presentation '%TITLE'. The file size has changed from %OLDFILESIZE MB to %NEWFILESIZE MB. + Das Dokument '%TITLE' wurde erfolgreich vom %EXTENSIONNAME überarbeitet. Die Dateigröße wurde dabei von %OLDFILESIZE MB auf %NEWFILESIZE MB geändert. + + The %EXTENSIONNAME has successfully updated the presentation '%TITLE'. The file size has changed from %OLDFILESIZE MB to approximated %NEWFILESIZE MB. Das Dokument '%TITLE' wurde erfolgreich vom %EXTENSIONNAME überarbeitet. Die Dateigröße wurde dabei von %OLDFILESIZE MB auf in etwa %NEWFILESIZE MB geändert. - + + The %EXTENSIONNAME has successfully updated the presentation '%TITLE'. The file size has changed to %NEWFILESIZE MB. + Das Dokument '%TITLE' wurde erfolgreich vom %EXTENSIONNAME überarbeitet. Die neue Dateigröße beträgt %NEWFILESIZE MB. + + The %EXTENSIONNAME has successfully updated the presentation '%TITLE'. The file size has changed to approximated %NEWFILESIZE MB. Das Dokument '%TITLE' wurde erfolgreich vom %EXTENSIONNAME überarbeitet. Die neue Dateigröße beträgt in etwa %NEWFILESIZE MB. diff --git a/sdext/source/minimizer/registry/schema/org/openoffice/Office/extension/SunPresentationMinimizer.xcs b/sdext/source/minimizer/registry/schema/org/openoffice/Office/extension/SunPresentationMinimizer.xcs index 98ec2216044c..9f35c1c81cd0 100644 --- a/sdext/source/minimizer/registry/schema/org/openoffice/Office/extension/SunPresentationMinimizer.xcs +++ b/sdext/source/minimizer/registry/schema/org/openoffice/Office/extension/SunPresentationMinimizer.xcs @@ -105,7 +105,7 @@ - + Sun Presentation Minimizer @@ -291,9 +291,15 @@ This distribution may include materials developed by third parties. Sun, Sun Mic OK - The %EXTENSIONNAME has successfully updated the presentation '%TITLE'. The file size has changed from %OLDFILESIZE MB to approximated %NEWFILESIZE MB. + The %EXTENSIONNAME has successfully updated the presentation '%TITLE'. The file size has changed from %OLDFILESIZE MB to %NEWFILESIZE MB. + The %EXTENSIONNAME has successfully updated the presentation '%TITLE'. The file size has changed from %OLDFILESIZE MB to approximated %NEWFILESIZE MB. + + + The %EXTENSIONNAME has successfully updated the presentation '%TITLE'. The file size has changed to %NEWFILESIZE MB. + + The %EXTENSIONNAME has successfully updated the presentation '%TITLE'. The file size has changed to approximated %NEWFILESIZE MB. -- cgit