1c142477cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3c142477cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4c142477cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5c142477cSAndrew Rist * distributed with this work for additional information 6c142477cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7c142477cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8c142477cSAndrew Rist * "License"); you may not use this file except in compliance 9c142477cSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11c142477cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13c142477cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14c142477cSAndrew Rist * software distributed under the License is distributed on an 15c142477cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16c142477cSAndrew Rist * KIND, either express or implied. See the License for the 17c142477cSAndrew Rist * specific language governing permissions and limitations 18c142477cSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20c142477cSAndrew Rist *************************************************************/ 21c142477cSAndrew Rist 22c142477cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sdext.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "configurationaccess.hxx" 28cdf0e10cSrcweir #include <com/sun/star/frame/XComponentLoader.hpp> 29cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp> 30cdf0e10cSrcweir #include <com/sun/star/util/XChangesBatch.hpp> 31cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 32cdf0e10cSrcweir #include <com/sun/star/util/XMacroExpander.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 34*597a4c59SAriel Constenla-Haile #include <com/sun/star/resource/XResourceBundleLoader.hpp> 35cdf0e10cSrcweir 36*597a4c59SAriel Constenla-Haile #include <rtl/ustrbuf.hxx> 37*597a4c59SAriel Constenla-Haile 38*597a4c59SAriel Constenla-Haile #include "minimizer.hrc" 39*597a4c59SAriel Constenla-Haile 40cdf0e10cSrcweir using namespace ::com::sun::star; 41cdf0e10cSrcweir using namespace ::com::sun::star::uno; 42cdf0e10cSrcweir using namespace ::com::sun::star::beans; 43cdf0e10cSrcweir using namespace ::com::sun::star::container; 44cdf0e10cSrcweir 45*597a4c59SAriel Constenla-Haile using rtl::OUString; 46*597a4c59SAriel Constenla-Haile using rtl::OUStringBuffer; 47*597a4c59SAriel Constenla-Haile 48*597a4c59SAriel Constenla-Haile 49*597a4c59SAriel Constenla-Haile #include <rtl/instance.hxx> 50*597a4c59SAriel Constenla-Haile 51*597a4c59SAriel Constenla-Haile typedef std::map < sal_Int32, rtl::OUString > StringResourceMap; 52*597a4c59SAriel Constenla-Haile 53*597a4c59SAriel Constenla-Haile struct StaticResourceMap 54*597a4c59SAriel Constenla-Haile : public rtl::StaticWithInit< StringResourceMap, StaticResourceMap > 55*597a4c59SAriel Constenla-Haile { 56*597a4c59SAriel Constenla-Haile StringResourceMap & 57*597a4c59SAriel Constenla-Haile operator()() const; 58*597a4c59SAriel Constenla-Haile }; 59*597a4c59SAriel Constenla-Haile 60*597a4c59SAriel Constenla-Haile StringResourceMap & 61*597a4c59SAriel Constenla-Haile StaticResourceMap::operator()() const 62*597a4c59SAriel Constenla-Haile { 63*597a4c59SAriel Constenla-Haile static StringResourceMap aMap; 64*597a4c59SAriel Constenla-Haile return aMap; 65*597a4c59SAriel Constenla-Haile } 66*597a4c59SAriel Constenla-Haile 67cdf0e10cSrcweir static const OUString& GetConfigurationProviderServiceName (void) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir static const OUString sConfigurationProviderServiceName ( 70cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 71cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationProvider")); 72cdf0e10cSrcweir return sConfigurationProviderServiceName; 73cdf0e10cSrcweir } 74cdf0e10cSrcweir static const OUString& GetPathToConfigurationRoot (void) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir static const OUString sPathToConfigurationRoot ( 77*597a4c59SAriel Constenla-Haile RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Impress/PresentationMinimizer")); 78cdf0e10cSrcweir return sPathToConfigurationRoot; 79cdf0e10cSrcweir } 80cdf0e10cSrcweir 81*597a4c59SAriel Constenla-Haile static OUString lcl_loadString( 82*597a4c59SAriel Constenla-Haile const Reference< resource::XResourceBundle > xResourceBundle, 83*597a4c59SAriel Constenla-Haile sal_Int32 nResourceId ) 84*597a4c59SAriel Constenla-Haile { 85*597a4c59SAriel Constenla-Haile OUString sString; 86*597a4c59SAriel Constenla-Haile OUStringBuffer sKey; 87*597a4c59SAriel Constenla-Haile sKey.appendAscii( RTL_CONSTASCII_STRINGPARAM( "string:" ) ); 88*597a4c59SAriel Constenla-Haile sKey.append( nResourceId ); 89*597a4c59SAriel Constenla-Haile 90*597a4c59SAriel Constenla-Haile try 91*597a4c59SAriel Constenla-Haile { 92*597a4c59SAriel Constenla-Haile OSL_VERIFY( xResourceBundle->getByName( sKey.makeStringAndClear() ) >>= sString ); 93*597a4c59SAriel Constenla-Haile } 94*597a4c59SAriel Constenla-Haile catch( const uno::Exception& ) 95*597a4c59SAriel Constenla-Haile { 96*597a4c59SAriel Constenla-Haile OSL_ENSURE( false, "OptimizerSettings: missing resource!" ); 97*597a4c59SAriel Constenla-Haile } 98*597a4c59SAriel Constenla-Haile 99*597a4c59SAriel Constenla-Haile return sString; 100*597a4c59SAriel Constenla-Haile } 101*597a4c59SAriel Constenla-Haile 102cdf0e10cSrcweir void OptimizerSettings::LoadSettingsFromConfiguration( const Reference< XNameAccess >& rSettings ) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir if ( rSettings.is() ) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir const Sequence< OUString > aElements( rSettings->getElementNames() ); 107cdf0e10cSrcweir for ( int i = 0; i < aElements.getLength(); i++ ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir try 110cdf0e10cSrcweir { 111cdf0e10cSrcweir const OUString aPropertyName( aElements[ i ] ); 112cdf0e10cSrcweir Any aValue( rSettings->getByName( aPropertyName ) ); 113cdf0e10cSrcweir switch( TKGet( aPropertyName ) ) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir case TK_Name : aValue >>= maName; break; 116cdf0e10cSrcweir case TK_JPEGCompression : aValue >>= mbJPEGCompression; break; 117cdf0e10cSrcweir case TK_JPEGQuality : aValue >>= mnJPEGQuality; break; 118cdf0e10cSrcweir case TK_RemoveCropArea : aValue >>= mbRemoveCropArea; break; 119cdf0e10cSrcweir case TK_ImageResolution : aValue >>= mnImageResolution; break; 120cdf0e10cSrcweir case TK_EmbedLinkedGraphics : aValue >>= mbEmbedLinkedGraphics; break; 121cdf0e10cSrcweir case TK_OLEOptimization : aValue >>= mbOLEOptimization; break; 122cdf0e10cSrcweir case TK_OLEOptimizationType : aValue >>= mnOLEOptimizationType; break; 123cdf0e10cSrcweir case TK_DeleteUnusedMasterPages : aValue >>= mbDeleteUnusedMasterPages; break; 124cdf0e10cSrcweir case TK_DeleteHiddenSlides : aValue >>= mbDeleteHiddenSlides; break; 125cdf0e10cSrcweir case TK_DeleteNotesPages : aValue >>= mbDeleteNotesPages ;break; 126cdf0e10cSrcweir case TK_SaveAs : aValue >>= mbSaveAs; break; 127cdf0e10cSrcweir // case TK_SaveAsURL : aValue >>= maSaveAsURL; break; // URL is not saved to configuration 128cdf0e10cSrcweir // case TK_FilterName : aValue >>= maFilterName; break; // URL is not saved to configuration 129cdf0e10cSrcweir case TK_OpenNewDocument : aValue >>= mbOpenNewDocument; break; 130cdf0e10cSrcweir default: break; 131cdf0e10cSrcweir } 132cdf0e10cSrcweir } 133cdf0e10cSrcweir catch( Exception& ) 134cdf0e10cSrcweir { 135cdf0e10cSrcweir } 136cdf0e10cSrcweir } 137cdf0e10cSrcweir } 138cdf0e10cSrcweir } 139cdf0e10cSrcweir 140cdf0e10cSrcweir void OptimizerSettings::SaveSettingsToConfiguration( const Reference< XNameReplace >& rSettings ) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir if ( rSettings.is() ) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir OUString pNames[] = { 145cdf0e10cSrcweir TKGet( TK_Name ), 146cdf0e10cSrcweir TKGet( TK_JPEGCompression ), 147cdf0e10cSrcweir TKGet( TK_JPEGQuality ), 148cdf0e10cSrcweir TKGet( TK_RemoveCropArea ), 149cdf0e10cSrcweir TKGet( TK_ImageResolution ), 150cdf0e10cSrcweir TKGet( TK_EmbedLinkedGraphics ), 151cdf0e10cSrcweir TKGet( TK_OLEOptimization ), 152cdf0e10cSrcweir TKGet( TK_OLEOptimizationType ), 153cdf0e10cSrcweir TKGet( TK_DeleteUnusedMasterPages ), 154cdf0e10cSrcweir TKGet( TK_DeleteHiddenSlides ), 155cdf0e10cSrcweir TKGet( TK_DeleteNotesPages ), 156cdf0e10cSrcweir TKGet( TK_SaveAs ), 157cdf0e10cSrcweir // TKGet( TK_SaveAsURL ), 158cdf0e10cSrcweir // TKGet( TK_FilterName ), 159cdf0e10cSrcweir TKGet( TK_OpenNewDocument ) }; 160cdf0e10cSrcweir 161cdf0e10cSrcweir Any pValues[] = { 162cdf0e10cSrcweir Any( maName ), 163cdf0e10cSrcweir Any( mbJPEGCompression ), 164cdf0e10cSrcweir Any( mnJPEGQuality ), 165cdf0e10cSrcweir Any( mbRemoveCropArea ), 166cdf0e10cSrcweir Any( mnImageResolution ), 167cdf0e10cSrcweir Any( mbEmbedLinkedGraphics ), 168cdf0e10cSrcweir Any( mbOLEOptimization ), 169cdf0e10cSrcweir Any( mnOLEOptimizationType ), 170cdf0e10cSrcweir Any( mbDeleteUnusedMasterPages ), 171cdf0e10cSrcweir Any( mbDeleteHiddenSlides ), 172cdf0e10cSrcweir Any( mbDeleteNotesPages ), 173cdf0e10cSrcweir Any( mbSaveAs ), 174cdf0e10cSrcweir // Any( maSaveAsURL ), 175cdf0e10cSrcweir // Any( maFilterName ), 176cdf0e10cSrcweir Any( mbOpenNewDocument ) }; 177cdf0e10cSrcweir 178cdf0e10cSrcweir sal_Int32 i, nCount = sizeof( pNames ) / sizeof( OUString ); 179cdf0e10cSrcweir 180cdf0e10cSrcweir for ( i = 0; i < nCount; i++ ) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir try 183cdf0e10cSrcweir { 184cdf0e10cSrcweir rSettings->replaceByName( pNames[ i ], pValues[ i ] ); 185cdf0e10cSrcweir } 186cdf0e10cSrcweir catch( Exception& /* rException */ ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir } 189cdf0e10cSrcweir } 190cdf0e10cSrcweir } 191cdf0e10cSrcweir } 192cdf0e10cSrcweir 193cdf0e10cSrcweir sal_Bool OptimizerSettings::operator==( const OptimizerSettings& rOptimizerSettings ) const 194cdf0e10cSrcweir { 195cdf0e10cSrcweir return ( rOptimizerSettings.mbJPEGCompression == mbJPEGCompression ) 196cdf0e10cSrcweir && ( rOptimizerSettings.mnJPEGQuality == mnJPEGQuality ) 197cdf0e10cSrcweir && ( rOptimizerSettings.mbRemoveCropArea == mbRemoveCropArea ) 198cdf0e10cSrcweir && ( rOptimizerSettings.mnImageResolution == mnImageResolution ) 199cdf0e10cSrcweir && ( rOptimizerSettings.mbEmbedLinkedGraphics == mbEmbedLinkedGraphics ) 200cdf0e10cSrcweir && ( rOptimizerSettings.mbOLEOptimization == mbOLEOptimization ) 201cdf0e10cSrcweir && ( rOptimizerSettings.mnOLEOptimizationType == mnOLEOptimizationType ) 202cdf0e10cSrcweir && ( rOptimizerSettings.mbDeleteUnusedMasterPages == mbDeleteUnusedMasterPages ) 203cdf0e10cSrcweir && ( rOptimizerSettings.mbDeleteHiddenSlides == mbDeleteHiddenSlides ) 204cdf0e10cSrcweir && ( rOptimizerSettings.mbDeleteNotesPages == mbDeleteNotesPages ); 205cdf0e10cSrcweir // && ( rOptimizerSettings.mbOpenNewDocument == mbOpenNewDocument ); 206cdf0e10cSrcweir } 207cdf0e10cSrcweir 208cdf0e10cSrcweir 209*597a4c59SAriel Constenla-Haile ConfigurationAccess::ConfigurationAccess( const Reference< uno::XComponentContext >& rxContext, OptimizerSettings* pDefaultSettings ) : 210*597a4c59SAriel Constenla-Haile m_xContext( rxContext ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir LoadStrings(); 213cdf0e10cSrcweir maSettings.push_back( pDefaultSettings ? 214cdf0e10cSrcweir *pDefaultSettings : OptimizerSettings() ); 215cdf0e10cSrcweir maSettings.back().maName = TKGet( TK_LastUsedSettings ); 216cdf0e10cSrcweir LoadConfiguration(); 217cdf0e10cSrcweir maInitialSettings = maSettings; 218cdf0e10cSrcweir }; 219cdf0e10cSrcweir 220cdf0e10cSrcweir ConfigurationAccess::~ConfigurationAccess() 221cdf0e10cSrcweir { 222cdf0e10cSrcweir } 223cdf0e10cSrcweir 224*597a4c59SAriel Constenla-Haile rtl::OUString ConfigurationAccess::getString( sal_Int32 nResId ) 225cdf0e10cSrcweir { 226*597a4c59SAriel Constenla-Haile const StringResourceMap &aStrings = StaticResourceMap::get(); 227*597a4c59SAriel Constenla-Haile StringResourceMap::const_iterator aIter( aStrings.find( nResId ) ); 228*597a4c59SAriel Constenla-Haile return aIter != aStrings.end() ? ((*aIter).second) : rtl::OUString(); 229cdf0e10cSrcweir } 230cdf0e10cSrcweir 231cdf0e10cSrcweir void ConfigurationAccess::LoadStrings() 232cdf0e10cSrcweir { 233*597a4c59SAriel Constenla-Haile static bool bLoaded = false; 234*597a4c59SAriel Constenla-Haile if ( bLoaded ) 235*597a4c59SAriel Constenla-Haile return; 236*597a4c59SAriel Constenla-Haile else 237*597a4c59SAriel Constenla-Haile bLoaded = true; 238cdf0e10cSrcweir try 239cdf0e10cSrcweir { 240*597a4c59SAriel Constenla-Haile 241*597a4c59SAriel Constenla-Haile Reference< resource::XResourceBundleLoader > xResourceBundleLoader( 242*597a4c59SAriel Constenla-Haile m_xContext->getValueByName( 243*597a4c59SAriel Constenla-Haile OUString( RTL_CONSTASCII_USTRINGPARAM( 244*597a4c59SAriel Constenla-Haile "/singletons/com.sun.star.resource.OfficeResourceLoader" ) ) ), 245*597a4c59SAriel Constenla-Haile UNO_QUERY_THROW ); 246*597a4c59SAriel Constenla-Haile 247*597a4c59SAriel Constenla-Haile Reference< resource::XResourceBundle > xResourceBundle( 248*597a4c59SAriel Constenla-Haile xResourceBundleLoader->loadBundle_Default( 249*597a4c59SAriel Constenla-Haile OUString( RTL_CONSTASCII_USTRINGPARAM( "minimizer" ) ) ), 250*597a4c59SAriel Constenla-Haile UNO_SET_THROW ); 251*597a4c59SAriel Constenla-Haile 252*597a4c59SAriel Constenla-Haile StringResourceMap &aStrings = StaticResourceMap::get(); 253*597a4c59SAriel Constenla-Haile aStrings[ STR_PRESENTATION_MINIMIZER ] = lcl_loadString( xResourceBundle, STR_PRESENTATION_MINIMIZER ); 254*597a4c59SAriel Constenla-Haile aStrings[ STR_STEPS ] = lcl_loadString( xResourceBundle, STR_STEPS ); 255*597a4c59SAriel Constenla-Haile aStrings[ STR_HELP ] = lcl_loadString( xResourceBundle, STR_HELP ); 256*597a4c59SAriel Constenla-Haile aStrings[ STR_BACK ] = lcl_loadString( xResourceBundle, STR_BACK ); 257*597a4c59SAriel Constenla-Haile aStrings[ STR_NEXT ] = lcl_loadString( xResourceBundle, STR_NEXT ); 258*597a4c59SAriel Constenla-Haile aStrings[ STR_FINISH ] = lcl_loadString( xResourceBundle, STR_FINISH ); 259*597a4c59SAriel Constenla-Haile aStrings[ STR_CANCEL ] = lcl_loadString( xResourceBundle, STR_CANCEL ); 260*597a4c59SAriel Constenla-Haile aStrings[ STR_INTRODUCTION ] = lcl_loadString( xResourceBundle, STR_INTRODUCTION ); 261*597a4c59SAriel Constenla-Haile aStrings[ STR_INTRODUCTION_T ] = lcl_loadString( xResourceBundle, STR_INTRODUCTION_T ); 262*597a4c59SAriel Constenla-Haile aStrings[ STR_CHOSE_SETTINGS ] = lcl_loadString( xResourceBundle, STR_CHOSE_SETTINGS ); 263*597a4c59SAriel Constenla-Haile aStrings[ STR_REMOVE ] = lcl_loadString( xResourceBundle, STR_REMOVE ); 264*597a4c59SAriel Constenla-Haile aStrings[ STR_GRAPHIC_OPTIMIZATION ] = lcl_loadString( xResourceBundle, STR_GRAPHIC_OPTIMIZATION ); 265*597a4c59SAriel Constenla-Haile aStrings[ STR_IMAGE_OPTIMIZATION ] = lcl_loadString( xResourceBundle, STR_IMAGE_OPTIMIZATION ); 266*597a4c59SAriel Constenla-Haile aStrings[ STR_LOSSLESS_COMPRESSION ] = lcl_loadString( xResourceBundle, STR_LOSSLESS_COMPRESSION ); 267*597a4c59SAriel Constenla-Haile aStrings[ STR_JPEG_COMPRESSION ] = lcl_loadString( xResourceBundle, STR_JPEG_COMPRESSION ); 268*597a4c59SAriel Constenla-Haile aStrings[ STR_QUALITY ] = lcl_loadString( xResourceBundle, STR_QUALITY ); 269*597a4c59SAriel Constenla-Haile aStrings[ STR_REMOVE_CROP_AREA ] = lcl_loadString( xResourceBundle, STR_REMOVE_CROP_AREA ); 270*597a4c59SAriel Constenla-Haile aStrings[ STR_IMAGE_RESOLUTION ] = lcl_loadString( xResourceBundle, STR_IMAGE_RESOLUTION ); 271*597a4c59SAriel Constenla-Haile aStrings[ STR_IMAGE_RESOLUTION_0 ] = lcl_loadString( xResourceBundle, STR_IMAGE_RESOLUTION_0 ); 272*597a4c59SAriel Constenla-Haile aStrings[ STR_IMAGE_RESOLUTION_1 ] = lcl_loadString( xResourceBundle, STR_IMAGE_RESOLUTION_1 ); 273*597a4c59SAriel Constenla-Haile aStrings[ STR_IMAGE_RESOLUTION_2 ] = lcl_loadString( xResourceBundle, STR_IMAGE_RESOLUTION_2 ); 274*597a4c59SAriel Constenla-Haile aStrings[ STR_IMAGE_RESOLUTION_3 ] = lcl_loadString( xResourceBundle, STR_IMAGE_RESOLUTION_3 ); 275*597a4c59SAriel Constenla-Haile aStrings[ STR_EMBED_LINKED_GRAPHICS ] = lcl_loadString( xResourceBundle, STR_EMBED_LINKED_GRAPHICS ); 276*597a4c59SAriel Constenla-Haile aStrings[ STR_OLE_OBJECTS ] = lcl_loadString( xResourceBundle, STR_OLE_OBJECTS ); 277*597a4c59SAriel Constenla-Haile aStrings[ STR_OLE_OPTIMIZATION ] = lcl_loadString( xResourceBundle, STR_OLE_OPTIMIZATION ); 278*597a4c59SAriel Constenla-Haile aStrings[ STR_OLE_REPLACE ] = lcl_loadString( xResourceBundle, STR_OLE_REPLACE ); 279*597a4c59SAriel Constenla-Haile aStrings[ STR_ALL_OLE_OBJECTS ] = lcl_loadString( xResourceBundle, STR_ALL_OLE_OBJECTS ); 280*597a4c59SAriel Constenla-Haile aStrings[ STR_ALIEN_OLE_OBJECTS_ONLY ] = lcl_loadString( xResourceBundle, STR_ALIEN_OLE_OBJECTS_ONLY ); 281*597a4c59SAriel Constenla-Haile aStrings[ STR_OLE_OBJECTS_DESC ] = lcl_loadString( xResourceBundle, STR_OLE_OBJECTS_DESC ); 282*597a4c59SAriel Constenla-Haile aStrings[ STR_NO_OLE_OBJECTS_DESC ] = lcl_loadString( xResourceBundle, STR_NO_OLE_OBJECTS_DESC ); 283*597a4c59SAriel Constenla-Haile aStrings[ STR_SLIDES ] = lcl_loadString( xResourceBundle, STR_SLIDES ); 284*597a4c59SAriel Constenla-Haile aStrings[ STR_CHOOSE_SLIDES ] = lcl_loadString( xResourceBundle, STR_CHOOSE_SLIDES ); 285*597a4c59SAriel Constenla-Haile aStrings[ STR_MASTER_PAGES ] = lcl_loadString( xResourceBundle, STR_MASTER_PAGES ); 286*597a4c59SAriel Constenla-Haile aStrings[ STR_DELETE_MASTER_PAGES ] = lcl_loadString( xResourceBundle, STR_DELETE_MASTER_PAGES ); 287*597a4c59SAriel Constenla-Haile aStrings[ STR_DELETE_NOTES_PAGES ] = lcl_loadString( xResourceBundle, STR_DELETE_NOTES_PAGES ); 288*597a4c59SAriel Constenla-Haile aStrings[ STR_DELETE_HIDDEN_SLIDES ] = lcl_loadString( xResourceBundle, STR_DELETE_HIDDEN_SLIDES ); 289*597a4c59SAriel Constenla-Haile aStrings[ STR_CUSTOM_SHOW ] = lcl_loadString( xResourceBundle, STR_CUSTOM_SHOW ); 290*597a4c59SAriel Constenla-Haile aStrings[ STR_SUMMARY ] = lcl_loadString( xResourceBundle, STR_SUMMARY ); 291*597a4c59SAriel Constenla-Haile aStrings[ STR_SUMMARY_TITLE ] = lcl_loadString( xResourceBundle, STR_SUMMARY_TITLE ); 292*597a4c59SAriel Constenla-Haile aStrings[ STR_PROGRESS ] = lcl_loadString( xResourceBundle, STR_PROGRESS ); 293*597a4c59SAriel Constenla-Haile aStrings[ STR_OBJECTS_OPTIMIZED ] = lcl_loadString( xResourceBundle, STR_OBJECTS_OPTIMIZED ); 294*597a4c59SAriel Constenla-Haile aStrings[ STR_APPLY_TO_CURRENT ] = lcl_loadString( xResourceBundle, STR_APPLY_TO_CURRENT ); 295*597a4c59SAriel Constenla-Haile aStrings[ STR_AUTOMATICALLY_OPEN ] = lcl_loadString( xResourceBundle, STR_AUTOMATICALLY_OPEN ); 296*597a4c59SAriel Constenla-Haile aStrings[ STR_SAVE_SETTINGS ] = lcl_loadString( xResourceBundle, STR_SAVE_SETTINGS ); 297*597a4c59SAriel Constenla-Haile aStrings[ STR_SAVE_AS ] = lcl_loadString( xResourceBundle, STR_SAVE_AS ); 298*597a4c59SAriel Constenla-Haile aStrings[ STR_DELETE_SLIDES ] = lcl_loadString( xResourceBundle, STR_DELETE_SLIDES ); 299*597a4c59SAriel Constenla-Haile aStrings[ STR_OPTIMIZE_IMAGES ] = lcl_loadString( xResourceBundle, STR_OPTIMIZE_IMAGES ); 300*597a4c59SAriel Constenla-Haile aStrings[ STR_CREATE_REPLACEMENT ] = lcl_loadString( xResourceBundle, STR_CREATE_REPLACEMENT ); 301*597a4c59SAriel Constenla-Haile aStrings[ STR_CURRENT_FILESIZE ] = lcl_loadString( xResourceBundle, STR_CURRENT_FILESIZE ); 302*597a4c59SAriel Constenla-Haile aStrings[ STR_ESTIMATED_FILESIZE ] = lcl_loadString( xResourceBundle, STR_ESTIMATED_FILESIZE ); 303*597a4c59SAriel Constenla-Haile aStrings[ STR_MB ] = lcl_loadString( xResourceBundle, STR_MB ); 304*597a4c59SAriel Constenla-Haile aStrings[ STR_MY_SETTINGS ] = lcl_loadString( xResourceBundle, STR_MY_SETTINGS ); 305*597a4c59SAriel Constenla-Haile aStrings[ STR_DEFAULT_SESSION ] = lcl_loadString( xResourceBundle, STR_DEFAULT_SESSION ); 306*597a4c59SAriel Constenla-Haile aStrings[ STR_MODIFY_WARNING ] = lcl_loadString( xResourceBundle, STR_MODIFY_WARNING ); 307*597a4c59SAriel Constenla-Haile aStrings[ STR_YES ] = lcl_loadString( xResourceBundle, STR_YES ); 308*597a4c59SAriel Constenla-Haile aStrings[ STR_OK ] = lcl_loadString( xResourceBundle, STR_OK ); 309*597a4c59SAriel Constenla-Haile aStrings[ STR_INFO_1 ] = lcl_loadString( xResourceBundle, STR_INFO_1 ); 310*597a4c59SAriel Constenla-Haile aStrings[ STR_INFO_2 ] = lcl_loadString( xResourceBundle, STR_INFO_2 ); 311*597a4c59SAriel Constenla-Haile aStrings[ STR_INFO_3 ] = lcl_loadString( xResourceBundle, STR_INFO_3 ); 312*597a4c59SAriel Constenla-Haile aStrings[ STR_INFO_4 ] = lcl_loadString( xResourceBundle, STR_INFO_4 ); 313*597a4c59SAriel Constenla-Haile aStrings[ STR_DUPLICATING_PRESENTATION ] = lcl_loadString( xResourceBundle, STR_DUPLICATING_PRESENTATION ); 314*597a4c59SAriel Constenla-Haile aStrings[ STR_DELETING_SLIDES ] = lcl_loadString( xResourceBundle, STR_DELETING_SLIDES ); 315*597a4c59SAriel Constenla-Haile aStrings[ STR_OPTIMIZING_GRAPHICS ] = lcl_loadString( xResourceBundle, STR_OPTIMIZING_GRAPHICS ); 316*597a4c59SAriel Constenla-Haile aStrings[ STR_CREATING_OLE_REPLACEMENTS] = lcl_loadString( xResourceBundle, STR_CREATING_OLE_REPLACEMENTS ); 317*597a4c59SAriel Constenla-Haile aStrings[ STR_FILESIZESEPARATOR ] = lcl_loadString( xResourceBundle, STR_FILESIZESEPARATOR ); 318*597a4c59SAriel Constenla-Haile aStrings[ STR_INFO_DIALOG ] = lcl_loadString( xResourceBundle, STR_INFO_DIALOG ); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir catch( Exception& ) 321cdf0e10cSrcweir { 322cdf0e10cSrcweir } 323cdf0e10cSrcweir } 324cdf0e10cSrcweir 325cdf0e10cSrcweir void ConfigurationAccess::LoadConfiguration() 326cdf0e10cSrcweir { 327cdf0e10cSrcweir try 328cdf0e10cSrcweir { 329cdf0e10cSrcweir do 330cdf0e10cSrcweir { 331cdf0e10cSrcweir Reference< XInterface > xRoot( OpenConfiguration( true ) ); 332cdf0e10cSrcweir if ( !xRoot.is() ) 333cdf0e10cSrcweir break; 334cdf0e10cSrcweir Reference< container::XNameAccess > xSet( GetConfigurationNode( xRoot, TKGet( TK_LastUsedSettings ) ), UNO_QUERY ); 335cdf0e10cSrcweir if ( xSet.is() ) 336cdf0e10cSrcweir { 337cdf0e10cSrcweir OptimizerSettings& rCurrent( maSettings.front() ); 338cdf0e10cSrcweir rCurrent.LoadSettingsFromConfiguration( xSet ); 339cdf0e10cSrcweir } 340cdf0e10cSrcweir xSet = Reference< container::XNameAccess >( GetConfigurationNode( xRoot, TKGet( TK_Settings_Templates ) ), UNO_QUERY ); 341cdf0e10cSrcweir if ( xSet.is() ) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir const Sequence< OUString > aElements( xSet->getElementNames() ); 344cdf0e10cSrcweir for ( int i = 0; i < aElements.getLength(); i++ ) 345cdf0e10cSrcweir { 346cdf0e10cSrcweir try 347cdf0e10cSrcweir { 348cdf0e10cSrcweir OUString aPath( TKGet( TK_Settings_Templates_ ).concat( aElements[ i ] ) ); 349cdf0e10cSrcweir Reference< container::XNameAccess > xTemplates( GetConfigurationNode( xRoot, aPath ), UNO_QUERY ); 350cdf0e10cSrcweir if ( xTemplates.is() ) 351cdf0e10cSrcweir { 352cdf0e10cSrcweir maSettings.push_back( OptimizerSettings() ); 353cdf0e10cSrcweir maSettings.back().LoadSettingsFromConfiguration( xTemplates ); 354cdf0e10cSrcweir } 355cdf0e10cSrcweir } 356cdf0e10cSrcweir catch( Exception& /* rException */ ) 357cdf0e10cSrcweir { 358cdf0e10cSrcweir } 359cdf0e10cSrcweir } 360cdf0e10cSrcweir } 361cdf0e10cSrcweir } 362cdf0e10cSrcweir while( false ); 363cdf0e10cSrcweir } 364cdf0e10cSrcweir catch( Exception& ) 365cdf0e10cSrcweir { 366cdf0e10cSrcweir } 367cdf0e10cSrcweir } 368cdf0e10cSrcweir 369cdf0e10cSrcweir void ConfigurationAccess::SaveConfiguration() 370cdf0e10cSrcweir { 371cdf0e10cSrcweir try 372cdf0e10cSrcweir { 373cdf0e10cSrcweir do 374cdf0e10cSrcweir { 375cdf0e10cSrcweir int i; 376cdf0e10cSrcweir unsigned int k; 377cdf0e10cSrcweir Reference<util::XChangesBatch> xRoot( OpenConfiguration( false ), UNO_QUERY_THROW ); 378cdf0e10cSrcweir 379cdf0e10cSrcweir // storing the last used settings 380cdf0e10cSrcweir Reference< container::XNameReplace > xSet( GetConfigurationNode( xRoot, TKGet( TK_LastUsedSettings ) ), UNO_QUERY_THROW ); 381cdf0e10cSrcweir OptimizerSettings& rCurrent( maSettings.front() ); 382cdf0e10cSrcweir rCurrent.SaveSettingsToConfiguration( xSet ); 383cdf0e10cSrcweir 384cdf0e10cSrcweir // updating template elements 385cdf0e10cSrcweir xSet = Reference< container::XNameReplace >( GetConfigurationNode( xRoot, TKGet( TK_Settings_Templates ) ), UNO_QUERY_THROW ); 386cdf0e10cSrcweir Reference< container::XNameContainer > xNameContainer( xSet, UNO_QUERY_THROW ); 387cdf0e10cSrcweir 388cdf0e10cSrcweir const Sequence< OUString > aElements( xSet->getElementNames() ); 389cdf0e10cSrcweir for( i = 0; i < aElements.getLength(); i++ ) 390cdf0e10cSrcweir xNameContainer->removeByName( aElements[ i ] ); 391cdf0e10cSrcweir 392cdf0e10cSrcweir for( k = 1; k < maSettings.size(); k++ ) 393cdf0e10cSrcweir { 394cdf0e10cSrcweir OptimizerSettings& rSettings( maSettings[ k ] ); 395cdf0e10cSrcweir OUString aElementName( TKGet( TK_Template ).concat( OUString::valueOf( static_cast< sal_Int32 >( k ) ) ) ); 396cdf0e10cSrcweir Reference< lang::XSingleServiceFactory > xChildFactory ( xSet, UNO_QUERY_THROW ); 397cdf0e10cSrcweir Reference< container::XNameReplace > xChild( xChildFactory->createInstance(), UNO_QUERY_THROW ); 398cdf0e10cSrcweir xNameContainer->insertByName( aElementName, Any( xChild ) ); 399cdf0e10cSrcweir 400cdf0e10cSrcweir OUString aPath( TKGet( TK_Settings_Templates_ ).concat( aElementName ) ); 401cdf0e10cSrcweir Reference< container::XNameReplace > xTemplates( GetConfigurationNode( xRoot, aPath ), UNO_QUERY ); 402cdf0e10cSrcweir rSettings.SaveSettingsToConfiguration( xTemplates ); 403cdf0e10cSrcweir } 404cdf0e10cSrcweir xRoot->commitChanges(); 405cdf0e10cSrcweir } 406cdf0e10cSrcweir while( false ); 407cdf0e10cSrcweir } 408cdf0e10cSrcweir catch( Exception& /* rException */ ) 409cdf0e10cSrcweir { 410cdf0e10cSrcweir 411cdf0e10cSrcweir } 412cdf0e10cSrcweir } 413cdf0e10cSrcweir 414cdf0e10cSrcweir Reference< XInterface > ConfigurationAccess::OpenConfiguration( bool bReadOnly ) 415cdf0e10cSrcweir { 416cdf0e10cSrcweir Reference< XInterface > xRoot; 417cdf0e10cSrcweir try 418cdf0e10cSrcweir { 419*597a4c59SAriel Constenla-Haile Reference< lang::XMultiServiceFactory > xProvider( m_xContext->getServiceManager()->createInstanceWithContext( GetConfigurationProviderServiceName(), m_xContext ), UNO_QUERY ); 420cdf0e10cSrcweir if ( xProvider.is() ) 421cdf0e10cSrcweir { 422cdf0e10cSrcweir Sequence< Any > aCreationArguments( 2 ); 423cdf0e10cSrcweir aCreationArguments[0] = makeAny( PropertyValue( 424cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ), 0, 425cdf0e10cSrcweir makeAny( GetPathToConfigurationRoot() ), 426cdf0e10cSrcweir PropertyState_DIRECT_VALUE ) ); 427cdf0e10cSrcweir aCreationArguments[1] = makeAny(beans::PropertyValue( 428cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( "lazywrite" ) ), 0, makeAny( true ), 429cdf0e10cSrcweir PropertyState_DIRECT_VALUE ) ); 430cdf0e10cSrcweir OUString sAccessService; 431cdf0e10cSrcweir if ( bReadOnly ) 432cdf0e10cSrcweir sAccessService = OUString( RTL_CONSTASCII_USTRINGPARAM( 433cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationAccess" ) ); 434cdf0e10cSrcweir else 435cdf0e10cSrcweir sAccessService = OUString( RTL_CONSTASCII_USTRINGPARAM( 436cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationUpdateAccess" ) ); 437cdf0e10cSrcweir 438cdf0e10cSrcweir xRoot = xProvider->createInstanceWithArguments( 439cdf0e10cSrcweir sAccessService, aCreationArguments ); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir } 442cdf0e10cSrcweir catch ( Exception& /* rException */ ) 443cdf0e10cSrcweir { 444cdf0e10cSrcweir } 445cdf0e10cSrcweir return xRoot; 446cdf0e10cSrcweir } 447cdf0e10cSrcweir 448cdf0e10cSrcweir Reference< XInterface > ConfigurationAccess::GetConfigurationNode( 449cdf0e10cSrcweir const Reference< XInterface >& xRoot, 450cdf0e10cSrcweir const OUString& sPathToNode ) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir Reference< XInterface > xNode; 453cdf0e10cSrcweir try 454cdf0e10cSrcweir { 455cdf0e10cSrcweir if ( !sPathToNode.getLength() ) 456cdf0e10cSrcweir xNode = xRoot; 457cdf0e10cSrcweir else 458cdf0e10cSrcweir { 459cdf0e10cSrcweir Reference< XHierarchicalNameAccess > xHierarchy( xRoot, UNO_QUERY ); 460cdf0e10cSrcweir if ( xHierarchy.is() ) 461cdf0e10cSrcweir { 462cdf0e10cSrcweir xHierarchy->getByHierarchicalName( sPathToNode ) >>= xNode; 463cdf0e10cSrcweir } 464cdf0e10cSrcweir } 465cdf0e10cSrcweir } 466cdf0e10cSrcweir catch ( Exception& rException ) 467cdf0e10cSrcweir { 468cdf0e10cSrcweir OSL_TRACE ("caught exception while getting configuration node %s: %s", 469cdf0e10cSrcweir ::rtl::OUStringToOString(sPathToNode, 470cdf0e10cSrcweir RTL_TEXTENCODING_UTF8).getStr(), 471cdf0e10cSrcweir ::rtl::OUStringToOString(rException.Message, 472cdf0e10cSrcweir RTL_TEXTENCODING_UTF8).getStr()); 473cdf0e10cSrcweir } 474cdf0e10cSrcweir return xNode; 475cdf0e10cSrcweir } 476cdf0e10cSrcweir 477cdf0e10cSrcweir com::sun::star::uno::Any ConfigurationAccess::GetConfigProperty( const PPPOptimizerTokenEnum ePropertyToken ) const 478cdf0e10cSrcweir { 479cdf0e10cSrcweir Any aRetValue; 480cdf0e10cSrcweir const OptimizerSettings& rSettings( maSettings.front() ); 481cdf0e10cSrcweir try 482cdf0e10cSrcweir { 483cdf0e10cSrcweir switch( ePropertyToken ) 484cdf0e10cSrcweir { 485cdf0e10cSrcweir case TK_Name : aRetValue <<= rSettings.maName; break; 486cdf0e10cSrcweir case TK_JPEGCompression : aRetValue <<= rSettings.mbJPEGCompression; break; 487cdf0e10cSrcweir case TK_JPEGQuality : aRetValue <<= rSettings.mnJPEGQuality; break; 488cdf0e10cSrcweir case TK_RemoveCropArea : aRetValue <<= rSettings.mbRemoveCropArea; break; 489cdf0e10cSrcweir case TK_ImageResolution : aRetValue <<= rSettings.mnImageResolution; break; 490cdf0e10cSrcweir case TK_EmbedLinkedGraphics : aRetValue <<= rSettings.mbEmbedLinkedGraphics; break; 491cdf0e10cSrcweir case TK_OLEOptimization : aRetValue <<= rSettings.mbOLEOptimization; break; 492cdf0e10cSrcweir case TK_OLEOptimizationType : aRetValue <<= rSettings.mnOLEOptimizationType; break; 493cdf0e10cSrcweir case TK_DeleteUnusedMasterPages : aRetValue <<= rSettings.mbDeleteUnusedMasterPages; break; 494cdf0e10cSrcweir case TK_DeleteHiddenSlides : aRetValue <<= rSettings.mbDeleteHiddenSlides; break; 495cdf0e10cSrcweir case TK_DeleteNotesPages : aRetValue <<= rSettings.mbDeleteNotesPages; break; 496cdf0e10cSrcweir case TK_SaveAs : aRetValue <<= rSettings.mbSaveAs; break; 497cdf0e10cSrcweir case TK_SaveAsURL : aRetValue <<= rSettings.maSaveAsURL; break; 498cdf0e10cSrcweir case TK_FilterName : aRetValue <<= rSettings.maFilterName; break; 499cdf0e10cSrcweir case TK_OpenNewDocument : aRetValue <<= rSettings.mbOpenNewDocument; break; 500cdf0e10cSrcweir case TK_EstimatedFileSize : aRetValue <<= rSettings.mnEstimatedFileSize; break; 501cdf0e10cSrcweir default: 502cdf0e10cSrcweir break; 503cdf0e10cSrcweir } 504cdf0e10cSrcweir } 505cdf0e10cSrcweir catch( Exception& /* rException */ ) 506cdf0e10cSrcweir { 507cdf0e10cSrcweir } 508cdf0e10cSrcweir return aRetValue; 509cdf0e10cSrcweir } 510cdf0e10cSrcweir 511cdf0e10cSrcweir void ConfigurationAccess::SetConfigProperty( const PPPOptimizerTokenEnum ePropertyToken, const com::sun::star::uno::Any& rValue ) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir OptimizerSettings& rSettings( maSettings.front() ); 514cdf0e10cSrcweir try 515cdf0e10cSrcweir { 516cdf0e10cSrcweir switch( ePropertyToken ) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir case TK_Name : rValue >>= rSettings.maName; break; 519cdf0e10cSrcweir case TK_JPEGCompression : rValue >>= rSettings.mbJPEGCompression; break; 520cdf0e10cSrcweir case TK_JPEGQuality : rValue >>= rSettings.mnJPEGQuality; break; 521cdf0e10cSrcweir case TK_RemoveCropArea : rValue >>= rSettings.mbRemoveCropArea; break; 522cdf0e10cSrcweir case TK_ImageResolution : rValue >>= rSettings.mnImageResolution; break; 523cdf0e10cSrcweir case TK_EmbedLinkedGraphics : rValue >>= rSettings.mbEmbedLinkedGraphics; break; 524cdf0e10cSrcweir case TK_OLEOptimization : rValue >>= rSettings.mbOLEOptimization; break; 525cdf0e10cSrcweir case TK_OLEOptimizationType : rValue >>= rSettings.mnOLEOptimizationType; break; 526cdf0e10cSrcweir case TK_DeleteUnusedMasterPages : rValue >>= rSettings.mbDeleteUnusedMasterPages; break; 527cdf0e10cSrcweir case TK_DeleteHiddenSlides : rValue >>= rSettings.mbDeleteHiddenSlides; break; 528cdf0e10cSrcweir case TK_DeleteNotesPages : rValue >>= rSettings.mbDeleteNotesPages; break; 529cdf0e10cSrcweir case TK_CustomShowName : rValue >>= rSettings.maCustomShowName; break; 530cdf0e10cSrcweir case TK_SaveAs : rValue >>= rSettings.mbSaveAs; break; 531cdf0e10cSrcweir case TK_SaveAsURL : rValue >>= rSettings.maSaveAsURL; break; 532cdf0e10cSrcweir case TK_FilterName : rValue >>= rSettings.maFilterName; break; 533cdf0e10cSrcweir case TK_OpenNewDocument : rValue >>= rSettings.mbOpenNewDocument; break; 534cdf0e10cSrcweir case TK_EstimatedFileSize : rValue >>= rSettings.mnEstimatedFileSize; break; 535cdf0e10cSrcweir default: 536cdf0e10cSrcweir break; 537cdf0e10cSrcweir } 538cdf0e10cSrcweir } 539cdf0e10cSrcweir catch( Exception& /* rException */ ) 540cdf0e10cSrcweir { 541cdf0e10cSrcweir } 542cdf0e10cSrcweir } 543cdf0e10cSrcweir 544cdf0e10cSrcweir sal_Bool ConfigurationAccess::GetConfigProperty( const PPPOptimizerTokenEnum ePropertyToken, const sal_Bool bDefault ) const 545cdf0e10cSrcweir { 546cdf0e10cSrcweir sal_Bool bRetValue = bDefault; 547cdf0e10cSrcweir if ( ! ( GetConfigProperty( ePropertyToken ) >>= bRetValue ) ) 548cdf0e10cSrcweir bRetValue = bDefault; 549cdf0e10cSrcweir return bRetValue; 550cdf0e10cSrcweir } 551cdf0e10cSrcweir 552cdf0e10cSrcweir sal_Int16 ConfigurationAccess::GetConfigProperty( const PPPOptimizerTokenEnum ePropertyToken, const sal_Int16 nDefault ) const 553cdf0e10cSrcweir { 554cdf0e10cSrcweir sal_Int16 nRetValue = nDefault; 555cdf0e10cSrcweir if ( ! ( GetConfigProperty( ePropertyToken ) >>= nRetValue ) ) 556cdf0e10cSrcweir nRetValue = nDefault; 557cdf0e10cSrcweir return nRetValue; 558cdf0e10cSrcweir } 559cdf0e10cSrcweir 560cdf0e10cSrcweir sal_Int32 ConfigurationAccess::GetConfigProperty( const PPPOptimizerTokenEnum ePropertyToken, const sal_Int32 nDefault ) const 561cdf0e10cSrcweir { 562cdf0e10cSrcweir sal_Int32 nRetValue = nDefault; 563cdf0e10cSrcweir if ( ! ( GetConfigProperty( ePropertyToken ) >>= nRetValue ) ) 564cdf0e10cSrcweir nRetValue = nDefault; 565cdf0e10cSrcweir return nRetValue; 566cdf0e10cSrcweir } 567cdf0e10cSrcweir 568cdf0e10cSrcweir Sequence< PropertyValue > ConfigurationAccess::GetConfigurationSequence() 569cdf0e10cSrcweir { 570cdf0e10cSrcweir Sequence< PropertyValue > aRet( 15 ); 571cdf0e10cSrcweir OptimizerSettings& rSettings( maSettings.front() ); 572cdf0e10cSrcweir aRet[ 0 ].Name = TKGet( TK_JPEGCompression ); 573cdf0e10cSrcweir aRet[ 0 ].Value= Any( rSettings.mbJPEGCompression ); 574cdf0e10cSrcweir aRet[ 1 ].Name = TKGet( TK_JPEGQuality ); 575cdf0e10cSrcweir aRet[ 1 ].Value= Any( rSettings.mnJPEGQuality ); 576cdf0e10cSrcweir aRet[ 2 ].Name = TKGet( TK_RemoveCropArea ); 577cdf0e10cSrcweir aRet[ 2 ].Value= Any( rSettings.mbRemoveCropArea ); 578cdf0e10cSrcweir aRet[ 3 ].Name = TKGet( TK_ImageResolution ); 579cdf0e10cSrcweir aRet[ 3 ].Value= Any( rSettings.mnImageResolution ); 580cdf0e10cSrcweir aRet[ 4 ].Name = TKGet( TK_EmbedLinkedGraphics ); 581cdf0e10cSrcweir aRet[ 4 ].Value= Any( rSettings.mbEmbedLinkedGraphics ); 582cdf0e10cSrcweir aRet[ 5 ].Name = TKGet( TK_OLEOptimization ); 583cdf0e10cSrcweir aRet[ 5 ].Value= Any( rSettings.mbOLEOptimization ); 584cdf0e10cSrcweir aRet[ 6 ].Name = TKGet( TK_OLEOptimizationType ); 585cdf0e10cSrcweir aRet[ 6 ].Value= Any( rSettings.mnOLEOptimizationType ); 586cdf0e10cSrcweir aRet[ 7 ].Name = TKGet( TK_DeleteUnusedMasterPages ); 587cdf0e10cSrcweir aRet[ 7 ].Value= Any( rSettings.mbDeleteUnusedMasterPages ); 588cdf0e10cSrcweir aRet[ 8 ].Name = TKGet( TK_DeleteHiddenSlides ); 589cdf0e10cSrcweir aRet[ 8 ].Value= Any( rSettings.mbDeleteHiddenSlides ); 590cdf0e10cSrcweir aRet[ 9 ].Name = TKGet( TK_DeleteNotesPages ); 591cdf0e10cSrcweir aRet[ 9 ].Value= Any( rSettings.mbDeleteNotesPages ); 592cdf0e10cSrcweir aRet[ 10].Name = TKGet( TK_CustomShowName ); 593cdf0e10cSrcweir aRet[ 10].Value= Any( rSettings.maCustomShowName ); 594cdf0e10cSrcweir aRet[ 11].Name = TKGet( TK_SaveAsURL ); 595cdf0e10cSrcweir aRet[ 11].Value= Any( rSettings.maSaveAsURL ); 596cdf0e10cSrcweir aRet[ 12].Name = TKGet( TK_FilterName ); 597cdf0e10cSrcweir aRet[ 12].Value= Any( rSettings.maFilterName ); 598cdf0e10cSrcweir aRet[ 13].Name = TKGet( TK_OpenNewDocument ); 599cdf0e10cSrcweir aRet[ 13].Value= Any( rSettings.mbOpenNewDocument ); 600cdf0e10cSrcweir aRet[ 14].Name = TKGet( TK_EstimatedFileSize ); 601cdf0e10cSrcweir aRet[ 14].Value= Any( rSettings.mnEstimatedFileSize ); 602cdf0e10cSrcweir return aRet; 603cdf0e10cSrcweir } 604cdf0e10cSrcweir 605cdf0e10cSrcweir std::vector< OptimizerSettings >::iterator ConfigurationAccess::GetOptimizerSettingsByName( const rtl::OUString& rName ) 606cdf0e10cSrcweir { 607cdf0e10cSrcweir std::vector< OptimizerSettings >::iterator aIter( maSettings.begin() + 1 ); 608cdf0e10cSrcweir while ( aIter != maSettings.end() ) 609cdf0e10cSrcweir { 610cdf0e10cSrcweir if ( aIter->maName == rName ) 611cdf0e10cSrcweir break; 612cdf0e10cSrcweir aIter++; 613cdf0e10cSrcweir } 614cdf0e10cSrcweir return aIter; 615cdf0e10cSrcweir } 616