summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-02-10 16:28:30 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2019-03-05 20:47:37 +0100
commit7cefe392e37d82d5df9d7a0b1462b1121bd7ef1b (patch)
treef70a8332d759adf7e42fef88ce0772bf8321e88b /sdext
parent45511b361a211d463734f50297f62e62a275e2d3 (diff)
OptimizerDialog: use local method to reduce OUString operations
Change-Id: I356693ba9992c691c9079b3eaa2f26e57b005e1c Reviewed-on: https://gerrit.libreoffice.org/67640 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/minimizer/optimizerdialog.cxx28
1 files changed, 17 insertions, 11 deletions
diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx
index 3da7dc6c2d93..eb9670a31464 100644
--- a/sdext/source/minimizer/optimizerdialog.cxx
+++ b/sdext/source/minimizer/optimizerdialog.cxx
@@ -711,6 +711,18 @@ void TextListenerFormattedField0Pg1::disposing( const css::lang::EventObject& /*
{
}
+namespace
+{
+
+bool lcl_mapResolution(OUString& rResolution, const OUString& rImageResolution)
+{
+ if (rImageResolution.getToken(1, ';')!=rResolution)
+ return false;
+ rResolution = rImageResolution.getToken(0, ';');
+ return true;
+}
+
+}
void TextListenerComboBox0Pg1::textChanged( const TextEvent& /* rEvent */ )
{
@@ -719,17 +731,11 @@ void TextListenerComboBox0Pg1::textChanged( const TextEvent& /* rEvent */ )
if ( !(aAny >>= aString) )
return;
- sal_Int32 nI0, nI1, nI2, nI3, nI4;
- nI0 = nI1 = nI2 = nI3 = nI4 = 0;
-
- if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_0 ).getToken( 1, ';', nI0 ) == aString )
- aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_0 ).getToken( 0, ';', nI4 );
- else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_1 ).getToken( 1, ';', nI1 ) == aString )
- aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_1 ).getToken( 0, ';', nI4 );
- else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_2 ).getToken( 1, ';', nI2 ) == aString )
- aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_2 ).getToken( 0, ';', nI4 );
- else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_3 ).getToken( 1, ';', nI3 ) == aString )
- aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_3 ).getToken( 0, ';', nI4 );
+ for (int nIR{ STR_IMAGE_RESOLUTION_0 }; nIR <= STR_IMAGE_RESOLUTION_3; ++nIR)
+ {
+ if (lcl_mapResolution(aString, mrOptimizerDialog.getString(static_cast<PPPOptimizerTokenEnum>(nIR))))
+ break;
+ }
mrOptimizerDialog.SetConfigProperty( TK_ImageResolution, Any( aString.toInt32() ) );
}