diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-12 12:31:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-12 13:01:50 +0100 |
commit | 58e31745600757f3d95085e67aa6bf13d7b9878b (patch) | |
tree | e165629c049dccdc3c991d40e07de0401b6f9b0f /sdext/source/minimizer/configurationaccess.cxx | |
parent | a8f21e120b1073d7019d41e85cc9a15104ed5c93 (diff) |
loplugin:flatten in sdext
Change-Id: I5a7c2d38ef2e4af54316becd807bffab83d402d0
Reviewed-on: https://gerrit.libreoffice.org/67715
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext/source/minimizer/configurationaccess.cxx')
-rw-r--r-- | sdext/source/minimizer/configurationaccess.cxx | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/sdext/source/minimizer/configurationaccess.cxx b/sdext/source/minimizer/configurationaccess.cxx index f7978379761b..f0e16bd12461 100644 --- a/sdext/source/minimizer/configurationaccess.cxx +++ b/sdext/source/minimizer/configurationaccess.cxx @@ -41,89 +41,89 @@ static OUString GetPathToConfigurationRoot() void OptimizerSettings::LoadSettingsFromConfiguration( const Reference< XNameAccess >& rSettings ) { - if ( rSettings.is() ) + if ( !rSettings.is() ) + return; + + const Sequence< OUString > aElements( rSettings->getElementNames() ); + for ( int i = 0; i < aElements.getLength(); i++ ) { - const Sequence< OUString > aElements( rSettings->getElementNames() ); - for ( int i = 0; i < aElements.getLength(); i++ ) + try { - try + const OUString aPropertyName( aElements[ i ] ); + Any aValue( rSettings->getByName( aPropertyName ) ); + switch( TKGet( aPropertyName ) ) { - const OUString aPropertyName( aElements[ i ] ); - Any aValue( rSettings->getByName( aPropertyName ) ); - switch( TKGet( aPropertyName ) ) - { - case TK_Name : aValue >>= maName; break; - case TK_JPEGCompression : aValue >>= mbJPEGCompression; break; - case TK_JPEGQuality : aValue >>= mnJPEGQuality; break; - case TK_RemoveCropArea : aValue >>= mbRemoveCropArea; break; - case TK_ImageResolution : aValue >>= mnImageResolution; break; - case TK_EmbedLinkedGraphics : aValue >>= mbEmbedLinkedGraphics; break; - case TK_OLEOptimization : aValue >>= mbOLEOptimization; break; - case TK_OLEOptimizationType : aValue >>= mnOLEOptimizationType; break; - case TK_DeleteUnusedMasterPages : aValue >>= mbDeleteUnusedMasterPages; break; - case TK_DeleteHiddenSlides : aValue >>= mbDeleteHiddenSlides; break; - case TK_DeleteNotesPages : aValue >>= mbDeleteNotesPages ;break; - case TK_SaveAs : aValue >>= mbSaveAs; break; + case TK_Name : aValue >>= maName; break; + case TK_JPEGCompression : aValue >>= mbJPEGCompression; break; + case TK_JPEGQuality : aValue >>= mnJPEGQuality; break; + case TK_RemoveCropArea : aValue >>= mbRemoveCropArea; break; + case TK_ImageResolution : aValue >>= mnImageResolution; break; + case TK_EmbedLinkedGraphics : aValue >>= mbEmbedLinkedGraphics; break; + case TK_OLEOptimization : aValue >>= mbOLEOptimization; break; + case TK_OLEOptimizationType : aValue >>= mnOLEOptimizationType; break; + case TK_DeleteUnusedMasterPages : aValue >>= mbDeleteUnusedMasterPages; break; + case TK_DeleteHiddenSlides : aValue >>= mbDeleteHiddenSlides; break; + case TK_DeleteNotesPages : aValue >>= mbDeleteNotesPages ;break; + case TK_SaveAs : aValue >>= mbSaveAs; break; // case TK_SaveAsURL : aValue >>= maSaveAsURL; break; // URL is not saved to configuration // case TK_FilterName : aValue >>= maFilterName; break; // URL is not saved to configuration - case TK_OpenNewDocument : aValue >>= mbOpenNewDocument; break; - default: break; - } - } - catch (const Exception&) - { + case TK_OpenNewDocument : aValue >>= mbOpenNewDocument; break; + default: break; } } + catch (const Exception&) + { + } } } void OptimizerSettings::SaveSettingsToConfiguration( const Reference< XNameReplace >& rSettings ) { - if ( rSettings.is() ) - { - OUString pNames[] = { - OUString("Name"), - OUString("JPEGCompression"), - OUString("JPEGQuality"), - OUString("RemoveCropArea"), - OUString("ImageResolution"), - OUString("EmbedLinkedGraphics"), - OUString("OLEOptimization"), - OUString("OLEOptimizationType"), - OUString("DeleteUnusedMasterPages"), - OUString("DeleteHiddenSlides"), - OUString("DeleteNotesPages"), - OUString("SaveAs"), + if ( !rSettings.is() ) + return; + + OUString pNames[] = { + OUString("Name"), + OUString("JPEGCompression"), + OUString("JPEGQuality"), + OUString("RemoveCropArea"), + OUString("ImageResolution"), + OUString("EmbedLinkedGraphics"), + OUString("OLEOptimization"), + OUString("OLEOptimizationType"), + OUString("DeleteUnusedMasterPages"), + OUString("DeleteHiddenSlides"), + OUString("DeleteNotesPages"), + OUString("SaveAs"), // OUString("SaveAsURL"), // OUString("FilterName"), - OUString("OpenNewDocument") }; - - Any pValues[] = { - Any( maName ), - Any( mbJPEGCompression ), - Any( mnJPEGQuality ), - Any( mbRemoveCropArea ), - Any( mnImageResolution ), - Any( mbEmbedLinkedGraphics ), - Any( mbOLEOptimization ), - Any( mnOLEOptimizationType ), - Any( mbDeleteUnusedMasterPages ), - Any( mbDeleteHiddenSlides ), - Any( mbDeleteNotesPages ), - Any( mbSaveAs ), + OUString("OpenNewDocument") }; + + Any pValues[] = { + Any( maName ), + Any( mbJPEGCompression ), + Any( mnJPEGQuality ), + Any( mbRemoveCropArea ), + Any( mnImageResolution ), + Any( mbEmbedLinkedGraphics ), + Any( mbOLEOptimization ), + Any( mnOLEOptimizationType ), + Any( mbDeleteUnusedMasterPages ), + Any( mbDeleteHiddenSlides ), + Any( mbDeleteNotesPages ), + Any( mbSaveAs ), // Any( maSaveAsURL ), // Any( maFilterName ), - Any( mbOpenNewDocument ) }; + Any( mbOpenNewDocument ) }; - for ( int i = 0; i < int(SAL_N_ELEMENTS( pNames )); i++ ) + for ( int i = 0; i < int(SAL_N_ELEMENTS( pNames )); i++ ) + { + try + { + rSettings->replaceByName( pNames[ i ], pValues[ i ] ); + } + catch (const Exception&) { - try - { - rSettings->replaceByName( pNames[ i ], pValues[ i ] ); - } - catch (const Exception&) - { - } } } } |