summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorSven Jacobi <sj@openoffice.org>2007-05-24 09:08:36 +0000
committerSven Jacobi <sj@openoffice.org>2007-05-24 09:08:36 +0000
commit7c3d3785d1c6b14a0d94a084ae4524a42c211df9 (patch)
tree610f3115e5db55102dfa21f8c9f2b1733848aef9 /sdext
parentfc2e443ab7d48de7d8c0be892b8a17db8c9bf3bd (diff)
some minor changes
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/minimizer/configurationaccess.cxx10
-rw-r--r--sdext/source/minimizer/configurationaccess.hxx8
-rw-r--r--sdext/source/minimizer/impoptimizer.cxx28
-rw-r--r--sdext/source/minimizer/impoptimizer.hxx7
-rw-r--r--sdext/source/minimizer/informationdialog.cxx127
-rw-r--r--sdext/source/minimizer/informationdialog.hxx10
-rw-r--r--sdext/source/minimizer/optimizerdialog.cxx8
-rw-r--r--sdext/source/minimizer/optimizerdialog.hxx8
-rw-r--r--sdext/source/minimizer/optimizerdialogcontrols.cxx80
-rw-r--r--sdext/source/minimizer/pppoptimizertoken.cxx5
-rw-r--r--sdext/source/minimizer/pppoptimizertoken.hxx5
11 files changed, 186 insertions, 110 deletions
diff --git a/sdext/source/minimizer/configurationaccess.cxx b/sdext/source/minimizer/configurationaccess.cxx
index 8426fc868520..599c59a8cd85 100644
--- a/sdext/source/minimizer/configurationaccess.cxx
+++ b/sdext/source/minimizer/configurationaccess.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: configurationaccess.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sj $ $Date: 2007-05-16 15:07:46 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:35 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -438,6 +438,7 @@ com::sun::star::uno::Any ConfigurationAccess::GetConfigProperty( const PPPOptimi
case TK_SaveAsURL : aRetValue <<= rSettings.maSaveAsURL; break;
case TK_FilterName : aRetValue <<= rSettings.maFilterName; break;
case TK_OpenNewDocument : aRetValue <<= rSettings.mbOpenNewDocument; break;
+ case TK_EstimatedFileSize : aRetValue <<= rSettings.mnEstimatedFileSize; break;
default:
break;
}
@@ -471,6 +472,7 @@ void ConfigurationAccess::SetConfigProperty( const PPPOptimizerTokenEnum eProper
case TK_SaveAsURL : rValue >>= rSettings.maSaveAsURL; break;
case TK_FilterName : rValue >>= rSettings.maFilterName; break;
case TK_OpenNewDocument : rValue >>= rSettings.mbOpenNewDocument; break;
+ case TK_EstimatedFileSize : rValue >>= rSettings.mnEstimatedFileSize; break;
default:
break;
}
@@ -506,7 +508,7 @@ sal_Int32 ConfigurationAccess::GetConfigProperty( const PPPOptimizerTokenEnum eP
Sequence< PropertyValue > ConfigurationAccess::GetConfigurationSequence()
{
- Sequence< PropertyValue > aRet( 14 );
+ Sequence< PropertyValue > aRet( 15 );
OptimizerSettings& rSettings( maSettings.front() );
aRet[ 0 ].Name = TKGet( TK_JPEGCompression );
aRet[ 0 ].Value= Any( rSettings.mbJPEGCompression );
@@ -536,6 +538,8 @@ Sequence< PropertyValue > ConfigurationAccess::GetConfigurationSequence()
aRet[ 12].Value= Any( rSettings.maFilterName );
aRet[ 13].Name = TKGet( TK_OpenNewDocument );
aRet[ 13].Value= Any( rSettings.mbOpenNewDocument );
+ aRet[ 14].Name = TKGet( TK_EstimatedFileSize );
+ aRet[ 14].Value= Any( rSettings.mnEstimatedFileSize );
return aRet;
}
diff --git a/sdext/source/minimizer/configurationaccess.hxx b/sdext/source/minimizer/configurationaccess.hxx
index 8b674edcba78..72c8b7be60f6 100644
--- a/sdext/source/minimizer/configurationaccess.hxx
+++ b/sdext/source/minimizer/configurationaccess.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: configurationaccess.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: sj $ $Date: 2007-05-11 13:49:50 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:35 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -90,6 +90,7 @@ struct OptimizerSettings
rtl::OUString maSaveAsURL;
rtl::OUString maFilterName;
sal_Bool mbOpenNewDocument;
+ sal_Int64 mnEstimatedFileSize;
OptimizerSettings() :
mbJPEGCompression( sal_False ),
@@ -103,7 +104,8 @@ struct OptimizerSettings
mbDeleteHiddenSlides( sal_False ),
mbDeleteNotesPages( sal_False ),
mbSaveAs( sal_True ),
- mbOpenNewDocument( sal_True ){};
+ mbOpenNewDocument( sal_True ),
+ mnEstimatedFileSize( 0 ){};
~OptimizerSettings(){};
void LoadSettingsFromConfiguration( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& rSettings );
diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx
index 6d6f646946ac..9e4816c26acb 100644
--- a/sdext/source/minimizer/impoptimizer.cxx
+++ b/sdext/source/minimizer/impoptimizer.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: impoptimizer.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sj $ $Date: 2007-05-22 16:53:24 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:35 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -578,8 +578,7 @@ ImpOptimizer::ImpOptimizer( const Reference< XComponentContext >& rxMSF, const R
mbDeleteUnusedMasterPages ( sal_False ),
mbDeleteHiddenSlides ( sal_False ),
mbDeleteNotesPages ( sal_False ),
- mbOpenNewDocument ( sal_False ),
- mbInformationDialog ( sal_False )
+ mbOpenNewDocument ( sal_False )
{
}
@@ -665,6 +664,7 @@ sal_Bool ImpOptimizer::Optimize( const Sequence< PropertyValue >& rArguments )
if ( mxModel.is() )
{
+ sal_Int64 nEstimatedFileSize = 0;
SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 0 ) ) );
DispatchStatus();
@@ -674,7 +674,7 @@ sal_Bool ImpOptimizer::Optimize( const Sequence< PropertyValue >& rArguments )
switch( TKGet( rArguments[ i ].Name ) )
{
case TK_StatusDispatcher : rArguments[ i ].Value >>= mxStatusDispatcher; break;
- case TK_InformationDialog: rArguments[ i ].Value >>= mbInformationDialog; break;
+ case TK_InformationDialog: rArguments[ i ].Value >>= mxInformationDialog; break;
case TK_Settings :
{
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aSettings;
@@ -698,6 +698,7 @@ sal_Bool ImpOptimizer::Optimize( const Sequence< PropertyValue >& rArguments )
case TK_SaveAsURL : aSettings[ j ].Value >>= maSaveAsURL; break;
case TK_FilterName : aSettings[ j ].Value >>= maFilterName; break;
case TK_OpenNewDocument : aSettings[ j ].Value >>= mbOpenNewDocument; break;
+ case TK_EstimatedFileSize : aSettings[ j ].Value >>= nEstimatedFileSize; break;
default: break;
}
}
@@ -763,13 +764,16 @@ sal_Bool ImpOptimizer::Optimize( const Sequence< PropertyValue >& rArguments )
xStorable->store();
nDestSize = PPPOptimizer::GetFileSize( maSaveAsURL );
}
- sal_Bool bInformationDialog = sal_True;
- if ( bInformationDialog )
- {
- sal_Int64 nApproxSize = nDestSize;
- InformationDialog aInformationDialog( mxMSF, xSelf, mbOpenNewDocument, nSourceSize, nDestSize, nApproxSize );
- aInformationDialog.execute();
- }
+ }
+
+ if ( mxInformationDialog.is() )
+ {
+ InformationDialog aInformationDialog( mxMSF, mxInformationDialog, maSaveAsURL, mbOpenNewDocument, nSourceSize, nDestSize, nEstimatedFileSize );
+ aInformationDialog.execute();
+ }
+
+ if ( maSaveAsURL.getLength() )
+ {
if ( mbOpenNewDocument && xSelf.is() )
{
Reference< awt::XWindow > xContainerWindow( xSelf->getContainerWindow() );
diff --git a/sdext/source/minimizer/impoptimizer.hxx b/sdext/source/minimizer/impoptimizer.hxx
index 3e61dd90a239..9c2140dd50f9 100644
--- a/sdext/source/minimizer/impoptimizer.hxx
+++ b/sdext/source/minimizer/impoptimizer.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: impoptimizer.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: sj $ $Date: 2007-05-11 13:51:02 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:35 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -93,7 +93,8 @@ private:
rtl::OUString maSaveAsURL;
rtl::OUString maFilterName;
sal_Bool mbOpenNewDocument;
- sal_Bool mbInformationDialog;
+
+ com::sun::star::uno::Reference< com::sun::star::frame::XFrame > mxInformationDialog;
sal_Bool Optimize();
diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx
index f54edbda7ea0..b7a3ff3cbaf5 100644
--- a/sdext/source/minimizer/informationdialog.cxx
+++ b/sdext/source/minimizer/informationdialog.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: informationdialog.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sj $ $Date: 2007-05-22 16:53:24 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:35 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -51,9 +51,11 @@
#ifndef _RTL_USTRBUF_HXX_
#include <rtl/ustrbuf.hxx>
#endif
+#include "com/sun/star/util/URL.hpp"
+#include "com/sun/star/util/XURLTransformer.hpp"
#define DIALOG_WIDTH 240
-#define DIALOG_HEIGHT 84
+#define DIALOG_HEIGHT 80
#define PAGE_POS_X 35
#define PAGE_WIDTH ( DIALOG_WIDTH - PAGE_POS_X ) - 6
@@ -223,8 +225,47 @@ 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;
+ if ( !maSaveAsURL.getLength() )
+ nDialogHeight -= 22;
+
// setting the dialog properties
OUString pNames[] = {
TKGet( TK_Closeable ),
@@ -237,10 +278,10 @@ void InformationDialog::InitDialog()
Any pValues[] = {
Any( sal_True ),
- Any( sal_Int32( DIALOG_HEIGHT ) ),
+ Any( nDialogHeight ),
Any( sal_True ),
- Any( sal_Int32( 113 ) ),
- Any( sal_Int32( 42 ) ),
+ Any( sal_Int32( 245 ) ),
+ Any( sal_Int32( 115 ) ),
Any( getString( STR_ABOUT ) ),
Any( sal_Int32( DIALOG_WIDTH ) ) };
@@ -249,31 +290,6 @@ void InformationDialog::InitDialog()
Sequence< rtl::OUString > aNames( pNames, nCount );
Sequence< Any > aValues( pValues, nCount );
-
- 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 ) );
@@ -288,17 +304,37 @@ void InformationDialog::InitDialog()
if ( mnDestSize )
eInfoString = STR_INFO_1;
else
+ {
eInfoString = STR_INFO_2;
+ nDest = mnApproxSize;
+ }
}
else if ( mnDestSize )
eInfoString = STR_INFO_3;
else
+ {
eInfoString = STR_INFO_4;
+ nDest = mnApproxSize;
+ }
+
+ rtl::OUString aTitle;
+ if ( maSaveAsURL.getLength() )
+ {
+ Reference< XURLTransformer > xURLTransformer( mxMSF->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ), mxMSF ), UNO_QUERY );
+ if ( xURLTransformer.is() )
+ {
+ util::URL aURL;
+ aURL.Complete = maSaveAsURL;
+ xURLTransformer->parseSmart( aURL, rtl::OUString() );
+ aTitle = aURL.Name;
+ }
+ }
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 aTitlePlaceholder( aTitle.getLength() ? OUString::createFromAscii( "%TITLE" ) : OUString::createFromAscii( "'%TITLE'" ) );
const OUString aExtensionPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%EXTENSIONNAME" ) );
sal_Int32 i = aInfoString.indexOf( aOldSizePlaceholder, 0 );
@@ -311,22 +347,23 @@ void InformationDialog::InitDialog()
sal_Int32 k = aInfoString.indexOf( aTitlePlaceholder, 0 );
if ( k >= 0 )
- aInfoString = aInfoString.replaceAt( k, aTitlePlaceholder.getLength(), rtl::OUString() );
+ aInfoString = aInfoString.replaceAt( k, aTitlePlaceholder.getLength(), aTitle );
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 );
+ InsertImage( *this, rtl::OUString( rtl::OUString::createFromAscii( "aboutimage" ) ), ImpGetStandardImage( rtl::OUString::createFromAscii( "private:standardimage/query" ) ), 5, 5, 25, 25 );
InsertFixedText( *this, rtl::OUString( rtl::OUString::createFromAscii( "fixedtext" ) ), aInfoString, PAGE_POS_X, 6, PAGE_WIDTH, 24, sal_True, 0 );
- InsertCheckBox( *this, TKGet( TK_OpenNewDocument ), xItemListener, getString( STR_AUTOMATICALLY_OPEN ), PAGE_POS_X, 42, PAGE_WIDTH, 8, 1 );
- InsertButton( *this, rtl::OUString( rtl::OUString::createFromAscii( "button" ) ), mxActionListener, DIALOG_WIDTH / 2 - 25, DIALOG_HEIGHT - 20, 50, 14, 2, STR_OK );
+ if ( maSaveAsURL.getLength() )
+ InsertCheckBox( *this, TKGet( TK_OpenNewDocument ), xItemListener, getString( STR_AUTOMATICALLY_OPEN ), PAGE_POS_X, 42, PAGE_WIDTH, 8, 1 );
+ InsertButton( *this, rtl::OUString( rtl::OUString::createFromAscii( "button" ) ), mxActionListener, DIALOG_WIDTH / 2 - 25, nDialogHeight - 20, 50, 14, 2, STR_OK );
}
// -----------------------------------------------------------------------------
-InformationDialog::InformationDialog( const Reference< XComponentContext > &rxMSF, Reference< XFrame >& rxFrame, sal_Bool& rbOpenNewDocument, const sal_Int64& rSourceSize, const sal_Int64& rDestSize, const sal_Int64& rApproxSize ) :
+InformationDialog::InformationDialog( const Reference< XComponentContext > &rxMSF, Reference< XFrame >& rxFrame, const rtl::OUString& rSaveAsURL, sal_Bool& rbOpenNewDocument, const sal_Int64& rSourceSize, const sal_Int64& rDestSize, const sal_Int64& rApproxSize ) :
UnoDialog( rxMSF, rxFrame ),
ConfigurationAccess( rxMSF, NULL ),
mxMSF( rxMSF ),
@@ -335,7 +372,8 @@ InformationDialog::InformationDialog( const Reference< XComponentContext > &rxMS
mnSourceSize( rSourceSize ),
mnDestSize( rDestSize ),
mnApproxSize( rApproxSize ),
- mrbOpenNewDocument( rbOpenNewDocument )
+ mrbOpenNewDocument( rbOpenNewDocument ),
+ maSaveAsURL( rSaveAsURL )
{
Reference< XFrame > xFrame( mxController->getFrame() );
Reference< XWindow > xContainerWindow( xFrame->getContainerWindow() );
@@ -357,12 +395,15 @@ sal_Bool InformationDialog::execute()
{
UnoDialog::execute();
- sal_Int16 nInt16;
- Any aAny( getControlProperty( TKGet( TK_OpenNewDocument ), TKGet( TK_State ) ) );
- if ( aAny >>= nInt16 )
+ if ( maSaveAsURL.getLength() )
{
- sal_Bool bOpenNewDocument = static_cast< sal_Bool >( nInt16 );
- mrbOpenNewDocument = bOpenNewDocument;
+ sal_Int16 nInt16;
+ Any aAny( getControlProperty( TKGet( TK_OpenNewDocument ), TKGet( TK_State ) ) );
+ if ( aAny >>= nInt16 )
+ {
+ sal_Bool bOpenNewDocument = static_cast< sal_Bool >( nInt16 );
+ mrbOpenNewDocument = bOpenNewDocument;
+ }
}
return mbStatus;
}
diff --git a/sdext/source/minimizer/informationdialog.hxx b/sdext/source/minimizer/informationdialog.hxx
index 52ed4ead463e..ff5849f4bbd1 100644
--- a/sdext/source/minimizer/informationdialog.hxx
+++ b/sdext/source/minimizer/informationdialog.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: informationdialog.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: sj $ $Date: 2007-05-22 16:53:24 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:36 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -99,8 +99,8 @@ class InformationDialog : public UnoDialog, public ConfigurationAccess
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, const sal_Int64& nSourceSize, const sal_Int64& nDestSize, const sal_Int64& nApproxDest );
+ com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rxFrame, const rtl::OUString& rSaveAsURL,
+ sal_Bool& bOpenNewDocument, const sal_Int64& nSourceSize, const sal_Int64& nDestSize, const sal_Int64& nApproxDest );
~InformationDialog();
sal_Bool execute();
@@ -113,12 +113,14 @@ private :
com::sun::star::uno::Reference< com::sun::star::awt::XActionListener > mxActionListener;
+ rtl::OUString ImpGetStandardImage( const rtl::OUString& rPrivateURL );
void InitDialog();
sal_Int64 mnSourceSize;
sal_Int64 mnDestSize;
sal_Int64 mnApproxSize;
sal_Bool& mrbOpenNewDocument;
+ const rtl::OUString& maSaveAsURL;
public :
diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx
index facf83c6f945..ac0d9c06bf18 100644
--- a/sdext/source/minimizer/optimizerdialog.cxx
+++ b/sdext/source/minimizer/optimizerdialog.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: optimizerdialog.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: sj $ $Date: 2007-05-11 13:57:22 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:36 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -100,7 +100,7 @@ void OptimizerDialog::InitDialog()
Any( sal_Int32( 200 ) ),
Any( sal_Int32( 52 ) ),
Any( getString( STR_SUN_OPTIMIZATION_WIZARD ) ),
- Any( sal_Int32( DIALOG_WIDTH ) ) };
+ Any( sal_Int32( OD_DIALOG_WIDTH ) ) };
sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
@@ -740,7 +740,7 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent )
lArguments[ 1 ].Name = TKGet( TK_StatusDispatcher );
lArguments[ 1 ].Value <<= mrOptimizerDialog.GetStatusDispatcher();
lArguments[ 2 ].Name = TKGet( TK_InformationDialog );
- lArguments[ 2 ].Value <<= sal_True;
+ lArguments[ 2 ].Value <<= mrOptimizerDialog.GetFrame();
if( xDispatch.is() )
xDispatch->dispatch( aURL, lArguments );
diff --git a/sdext/source/minimizer/optimizerdialog.hxx b/sdext/source/minimizer/optimizerdialog.hxx
index 063dd14095e5..6a23cee54543 100644
--- a/sdext/source/minimizer/optimizerdialog.hxx
+++ b/sdext/source/minimizer/optimizerdialog.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: optimizerdialog.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: sj $ $Date: 2007-05-11 13:57:39 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:36 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -101,7 +101,7 @@
#endif
#define MAX_STEP 4
-#define DIALOG_WIDTH 310
+#define OD_DIALOG_WIDTH 330
#define DIALOG_HEIGHT 210
#define BUTTON_WIDTH 50
#define BUTTON_HEIGHT 14
@@ -109,7 +109,7 @@
#define PAGE_POS_X 91
#define PAGE_POS_Y 8
-#define PAGE_WIDTH DIALOG_WIDTH - PAGE_POS_X
+#define PAGE_WIDTH OD_DIALOG_WIDTH - PAGE_POS_X
// -------------------
// - OPTIMIZERDIALOG -
diff --git a/sdext/source/minimizer/optimizerdialogcontrols.cxx b/sdext/source/minimizer/optimizerdialogcontrols.cxx
index 85da320283a1..75c343d94263 100644
--- a/sdext/source/minimizer/optimizerdialogcontrols.cxx
+++ b/sdext/source/minimizer/optimizerdialogcontrols.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: optimizerdialogcontrols.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: sj $ $Date: 2007-05-16 15:29:31 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:36 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -398,12 +398,12 @@ rtl::OUString InsertListBox( OptimizerDialog& rOptimizerDialog, const OUString&
void OptimizerDialog::InitNavigationBar()
{
- sal_Int32 nCancelPosX = DIALOG_WIDTH - BUTTON_WIDTH - 6;
+ sal_Int32 nCancelPosX = OD_DIALOG_WIDTH - BUTTON_WIDTH - 6;
sal_Int32 nFinishPosX = nCancelPosX - 6 - BUTTON_WIDTH;
sal_Int32 nNextPosX = nFinishPosX - 6 - BUTTON_WIDTH;
sal_Int32 nBackPosX = nNextPosX - 3 - BUTTON_WIDTH;
- InsertSeparator( *this, TKGet( TK_lnNavSep1 ), 0, 0, DIALOG_HEIGHT - 26, DIALOG_WIDTH, 1 );
+ InsertSeparator( *this, TKGet( TK_lnNavSep1 ), 0, 0, DIALOG_HEIGHT - 26, OD_DIALOG_WIDTH, 1 );
InsertSeparator( *this, TKGet( TK_lnNavSep2 ), 1, 85, 0, 1, BUTTON_POS_Y - 6 );
InsertButton( *this, TKGet( TK_btnNavHelp ), mxActionListener, 8, BUTTON_POS_Y, BUTTON_WIDTH, BUTTON_HEIGHT, mnTabIndex++, sal_True, STR_HELP, PushButtonType_STANDARD );
@@ -457,8 +457,8 @@ void OptimizerDialog::InitPage0()
aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText1Pg0 ), getString( STR_INTRODUCTION_T ), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, 100, sal_True, sal_False, mnTabIndex++ ) );
aControlList.push_back( InsertSeparator( *this, TKGet( TK_Separator1Pg0 ), 0, PAGE_POS_X + 6, DIALOG_HEIGHT - 66, PAGE_WIDTH - 12, 1 ) );
aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText2Pg0 ), getString( STR_CHOSE_SETTINGS ), PAGE_POS_X + 6, DIALOG_HEIGHT - 60, PAGE_WIDTH - 12, 8, sal_True, sal_False, mnTabIndex++ ) );
- aControlList.push_back( InsertListBox( *this, TKGet( TK_ListBox0Pg0 ), mxActionListenerListBox0Pg0, sal_True, aItemList, PAGE_POS_X + 6, DIALOG_HEIGHT - 48, ( DIALOG_WIDTH - 50 ) - ( PAGE_POS_X + 6 ), 12, mnTabIndex++ ) );
- aControlList.push_back( InsertButton( *this, TKGet( TK_Button0Pg0 ), mxActionListener, DIALOG_WIDTH - 46, DIALOG_HEIGHT - 48, 40, 14, mnTabIndex++, sal_True, STR_REMOVE, PushButtonType_STANDARD ) );
+ aControlList.push_back( InsertListBox( *this, TKGet( TK_ListBox0Pg0 ), mxActionListenerListBox0Pg0, sal_True, aItemList, PAGE_POS_X + 6, DIALOG_HEIGHT - 48, ( OD_DIALOG_WIDTH - 50 ) - ( PAGE_POS_X + 6 ), 12, mnTabIndex++ ) );
+ aControlList.push_back( InsertButton( *this, TKGet( TK_Button0Pg0 ), mxActionListener, OD_DIALOG_WIDTH - 46, DIALOG_HEIGHT - 48, 40, 14, mnTabIndex++, sal_True, STR_REMOVE, PushButtonType_STANDARD ) );
maControlPages.push_back( aControlList );
DeactivatePage( 0 );
UpdateControlStatesPage0();
@@ -616,6 +616,19 @@ void OptimizerDialog::InitPage3()
// -----------------------------------------------------------------------------
+static OUString ImpValueOfInMB( const sal_Int64& rVal )
+{
+ double fVal( static_cast<double>( rVal ) );
+ fVal /= ( 1 << 20 );
+ fVal += 0.05;
+ rtl::OUStringBuffer aVal( OUString::valueOf( fVal ) );
+ sal_Int32 nX( OUString( aVal.getStr() ).indexOf( '.', 0 ) );
+ if ( nX > 0 )
+ aVal.setLength( nX + 2 );
+ aVal.append( OUString::createFromAscii( " MB" ) );
+ return aVal.makeStringAndClear();
+}
+
void OptimizerDialog::UpdateControlStatesPage4()
{
sal_Bool bSaveAs( GetConfigProperty( TK_SaveAs, sal_True ) );
@@ -819,19 +832,32 @@ void OptimizerDialog::UpdateControlStatesPage4()
setControlProperty( TKGet( TK_FixedText4Pg4 ), TKGet( TK_Label ), Any( aSummaryStrings[ 0 ] ) );
setControlProperty( TKGet( TK_FixedText5Pg4 ), TKGet( TK_Label ), Any( aSummaryStrings[ 1 ] ) );
setControlProperty( TKGet( TK_FixedText6Pg4 ), TKGet( TK_Label ), Any( aSummaryStrings[ 2 ] ) );
-}
-static OUString ImpValueOfInMB( const sal_Int64& rVal )
-{
- double fVal( static_cast<double>( rVal ) );
- fVal /= ( 1 << 20 );
- fVal += 0.05;
- rtl::OUStringBuffer aVal( OUString::valueOf( fVal ) );
- sal_Int32 nX( OUString( aVal.getStr() ).indexOf( '.', 0 ) );
- if ( nX > 0 )
- aVal.setLength( nX + 2 );
- aVal.append( OUString::createFromAscii( " MB" ) );
- return aVal.makeStringAndClear();
+ sal_Int64 nCurrentFileSize = 0;
+ sal_Int64 nEstimatedFileSize = 0;
+ Reference< XStorable > xStorable( mxController->getModel(), UNO_QUERY );
+ if ( xStorable.is() && xStorable->hasLocation() )
+ nCurrentFileSize = PPPOptimizer::GetFileSize( xStorable->getLocation() );
+
+ if ( nCurrentFileSize )
+ {
+ double fE = static_cast< double >( nCurrentFileSize );
+ if ( nImageResolution )
+ {
+ double v = ( static_cast< double >( nImageResolution ) + 75.0 ) / 300.0;
+ if ( v < 1.0 )
+ fE *= v;
+ }
+ if ( bJPEGCompression )
+ {
+ double v = 0.75 - ( ( 100.0 - static_cast< double >( nJPEGQuality ) ) / 400.0 ) ;
+ fE *= v;
+ }
+ nEstimatedFileSize = static_cast< sal_Int64 >( fE );
+ }
+ setControlProperty( TKGet( TK_FixedText7Pg4 ), TKGet( TK_Label ), Any( ImpValueOfInMB( nCurrentFileSize ) ) );
+ setControlProperty( TKGet( TK_FixedText8Pg4 ), TKGet( TK_Label ), Any( ImpValueOfInMB( nEstimatedFileSize ) ) );
+ SetConfigProperty( TK_EstimatedFileSize, Any( nEstimatedFileSize ) );
}
void OptimizerDialog::InitPage4()
@@ -865,12 +891,6 @@ void OptimizerDialog::InitPage4()
Reference< XMultiPropertySet > xMultiPropertySet( insertControlModel( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlProgressBarModel" ) ),
TKGet( TK_Progress ), aNames, aValues ), UNO_QUERY );
}
- sal_Int64 nCurrentFileSize = 0;
- sal_Int64 nEstimatedFileSize = 0;
- Reference< XStorable > xStorable( mxController->getModel(), UNO_QUERY );
- if ( xStorable.is() && xStorable->hasLocation() )
- nCurrentFileSize = PPPOptimizer::GetFileSize( xStorable->getLocation() );
-
Reference< XTextListener > xTextListener;
Sequence< OUString > aItemList;
std::vector< rtl::OUString > aControlList;
@@ -882,11 +902,11 @@ void OptimizerDialog::InitPage4()
aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText5Pg4 ), OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 22, PAGE_WIDTH - 12, 8, sal_False, sal_False, mnTabIndex++ ) );
aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText6Pg4 ), OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 30, PAGE_WIDTH - 12, 8, sal_False, sal_False, mnTabIndex++ ) );
- aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText2Pg4 ), getString( STR_CURRENT_FILESIZE ), PAGE_POS_X + 6, PAGE_POS_Y + 50, 58, 8, sal_False, sal_False, mnTabIndex++ ) );
- aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText7Pg4 ), ImpValueOfInMB( nCurrentFileSize ), PAGE_POS_X + 70, PAGE_POS_Y + 50, 30, 8, sal_False, sal_False, mnTabIndex++ ) );
+ aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText2Pg4 ), getString( STR_CURRENT_FILESIZE ), PAGE_POS_X + 6, PAGE_POS_Y + 50, 88, 8, sal_False, sal_False, mnTabIndex++ ) );
+ aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText7Pg4 ), OUString(), PAGE_POS_X + 100, PAGE_POS_Y + 50, 30, 8, sal_False, sal_False, mnTabIndex++ ) );
setControlProperty( TKGet( TK_FixedText7Pg4 ), TKGet( TK_Align ), Any( static_cast< short >( 2 ) ) );
- aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText3Pg4 ), getString( STR_ESTIMATED_FILESIZE ), PAGE_POS_X + 6, PAGE_POS_Y + 58, 58, 8, sal_False, sal_False, mnTabIndex++ ) );
- aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText8Pg4 ), ImpValueOfInMB( nEstimatedFileSize ), PAGE_POS_X + 70, PAGE_POS_Y + 58, 30, 8, sal_False, sal_False, mnTabIndex++ ) );
+ aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText3Pg4 ), getString( STR_ESTIMATED_FILESIZE ), PAGE_POS_X + 6, PAGE_POS_Y + 58, 88, 8, sal_False, sal_False, mnTabIndex++ ) );
+ aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText8Pg4 ), OUString(), PAGE_POS_X + 100, PAGE_POS_Y + 58, 30, 8, sal_False, sal_False, mnTabIndex++ ) );
setControlProperty( TKGet( TK_FixedText8Pg4 ), TKGet( TK_Align ), Any( static_cast< short >( 2 ) ) );
aControlList.push_back( InsertRadioButton( *this, TKGet( TK_RadioButton0Pg4 ), mxItemListener, getString( STR_APPLY_TO_CURRENT ), PAGE_POS_X + 6, PAGE_POS_Y + 78, PAGE_WIDTH - 12, 8, sal_False, mnTabIndex++ ) );
@@ -894,8 +914,8 @@ void OptimizerDialog::InitPage4()
aControlList.push_back( InsertFixedText( *this, TKGet( TK_FixedText1Pg4 ), OUString(), PAGE_POS_X + 6, DIALOG_HEIGHT - 86, PAGE_WIDTH - 12, 8, sal_True, sal_False, mnTabIndex++ ) );
aControlList.push_back( TKGet( TK_Progress ) );
aControlList.push_back( InsertSeparator( *this, TKGet( TK_Separator1Pg4 ), 0, PAGE_POS_X + 6, DIALOG_HEIGHT - 58, PAGE_WIDTH - 12, 1 ) );
- aControlList.push_back( InsertCheckBox( *this, TKGet( TK_CheckBox1Pg4 ), mxItemListener, getString( STR_SAVE_SETTINGS ), PAGE_POS_X + 6, DIALOG_HEIGHT - 48, 70, 8, mnTabIndex++ ) );
- aControlList.push_back( InsertComboBox( *this, TKGet( TK_ComboBox0Pg4 ), xTextListener, sal_True, aItemList, PAGE_POS_X + 76, DIALOG_HEIGHT - 48, 100, 12, mnTabIndex++ ) );
+ aControlList.push_back( InsertCheckBox( *this, TKGet( TK_CheckBox1Pg4 ), mxItemListener, getString( STR_SAVE_SETTINGS ), PAGE_POS_X + 6, DIALOG_HEIGHT - 48, 100, 8, mnTabIndex++ ) );
+ aControlList.push_back( InsertComboBox( *this, TKGet( TK_ComboBox0Pg4 ), xTextListener, sal_True, aItemList, PAGE_POS_X + 106, DIALOG_HEIGHT - 48, 100, 12, mnTabIndex++ ) );
maControlPages.push_back( aControlList );
DeactivatePage( 4 );
diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx
index 45fb9898afed..276e84dfc3b8 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: pppoptimizertoken.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sj $ $Date: 2007-05-22 16:53:24 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:36 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -230,6 +230,7 @@ static const TokenTable pTokenTableArray[] =
{ "SaveAs", TK_SaveAs },
{ "SaveAsURL", TK_SaveAsURL },
{ "OpenNewDocument", TK_OpenNewDocument },
+ { "EstimatedFileSize", TK_EstimatedFileSize },
{ "Status", TK_Status },
{ "Pages", TK_Pages },
diff --git a/sdext/source/minimizer/pppoptimizertoken.hxx b/sdext/source/minimizer/pppoptimizertoken.hxx
index ff69c2197c3a..4959e443df85 100644
--- a/sdext/source/minimizer/pppoptimizertoken.hxx
+++ b/sdext/source/minimizer/pppoptimizertoken.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: pppoptimizertoken.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sj $ $Date: 2007-05-22 16:53:24 $
+ * last change: $Author: sj $ $Date: 2007-05-24 10:08:36 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -206,6 +206,7 @@ enum PPPOptimizerTokenEnum
TK_SaveAs,
TK_SaveAsURL,
TK_OpenNewDocument,
+ TK_EstimatedFileSize,
TK_Status,
TK_Pages,