xref: /trunk/main/sdext/source/minimizer/configurationaccess.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sdext.hxx"
30 
31 #include "configurationaccess.hxx"
32 #include <com/sun/star/frame/XComponentLoader.hpp>
33 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
34 #include <com/sun/star/util/XChangesBatch.hpp>
35 #include <com/sun/star/container/XNameContainer.hpp>
36 #include <com/sun/star/util/XMacroExpander.hpp>
37 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
38 
39 using namespace ::rtl;
40 using namespace ::com::sun::star;
41 using namespace ::com::sun::star::uno;
42 using namespace ::com::sun::star::beans;
43 using namespace ::com::sun::star::container;
44 
45 static const OUString& GetConfigurationProviderServiceName (void)
46 {
47     static const OUString sConfigurationProviderServiceName (
48         RTL_CONSTASCII_USTRINGPARAM(
49             "com.sun.star.configuration.ConfigurationProvider"));
50     return sConfigurationProviderServiceName;
51 }
52 static const OUString& GetPathToConfigurationRoot (void)
53 {
54     static const OUString sPathToConfigurationRoot (
55         RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.extension.SunPresentationMinimizer"));
56     return sPathToConfigurationRoot;
57 }
58 
59 void OptimizerSettings::LoadSettingsFromConfiguration( const Reference< XNameAccess >& rSettings )
60 {
61     if ( rSettings.is() )
62     {
63         const Sequence< OUString > aElements( rSettings->getElementNames() );
64         for ( int i = 0; i < aElements.getLength(); i++ )
65         {
66             try
67             {
68                 const OUString aPropertyName( aElements[ i ] );
69                 Any aValue( rSettings->getByName( aPropertyName ) );
70                 switch( TKGet( aPropertyName ) )
71                 {
72                     case TK_Name :                      aValue >>= maName; break;
73                     case TK_JPEGCompression :           aValue >>= mbJPEGCompression; break;
74                     case TK_JPEGQuality :               aValue >>= mnJPEGQuality; break;
75                     case TK_RemoveCropArea :            aValue >>= mbRemoveCropArea; break;
76                     case TK_ImageResolution :           aValue >>= mnImageResolution; break;
77                     case TK_EmbedLinkedGraphics :       aValue >>= mbEmbedLinkedGraphics; break;
78                     case TK_OLEOptimization :           aValue >>= mbOLEOptimization; break;
79                     case TK_OLEOptimizationType :       aValue >>= mnOLEOptimizationType; break;
80                     case TK_DeleteUnusedMasterPages :   aValue >>= mbDeleteUnusedMasterPages; break;
81                     case TK_DeleteHiddenSlides :        aValue >>= mbDeleteHiddenSlides; break;
82                     case TK_DeleteNotesPages :          aValue >>= mbDeleteNotesPages ;break;
83                     case TK_SaveAs :                    aValue >>= mbSaveAs; break;
84 //                  case TK_SaveAsURL :                 aValue >>= maSaveAsURL; break;      // URL is not saved to configuration
85 //                  case TK_FilterName :                aValue >>= maFilterName; break;     // URL is not saved to configuration
86                     case TK_OpenNewDocument :           aValue >>= mbOpenNewDocument; break;
87                     default: break;
88                 }
89             }
90             catch( Exception& )
91             {
92             }
93         }
94     }
95 }
96 
97 void OptimizerSettings::SaveSettingsToConfiguration( const Reference< XNameReplace >& rSettings )
98 {
99     if ( rSettings.is() )
100     {
101         OUString pNames[] = {
102             TKGet( TK_Name ),
103             TKGet( TK_JPEGCompression ),
104             TKGet( TK_JPEGQuality ),
105             TKGet( TK_RemoveCropArea ),
106             TKGet( TK_ImageResolution ),
107             TKGet( TK_EmbedLinkedGraphics ),
108             TKGet( TK_OLEOptimization ),
109             TKGet( TK_OLEOptimizationType ),
110             TKGet( TK_DeleteUnusedMasterPages ),
111             TKGet( TK_DeleteHiddenSlides ),
112             TKGet( TK_DeleteNotesPages ),
113             TKGet( TK_SaveAs ),
114 //          TKGet( TK_SaveAsURL ),
115 //          TKGet( TK_FilterName ),
116             TKGet( TK_OpenNewDocument ) };
117 
118         Any pValues[] = {
119             Any( maName ),
120             Any( mbJPEGCompression ),
121             Any( mnJPEGQuality ),
122             Any( mbRemoveCropArea ),
123             Any( mnImageResolution ),
124             Any( mbEmbedLinkedGraphics ),
125             Any( mbOLEOptimization ),
126             Any( mnOLEOptimizationType ),
127             Any( mbDeleteUnusedMasterPages ),
128             Any( mbDeleteHiddenSlides ),
129             Any( mbDeleteNotesPages ),
130             Any( mbSaveAs ),
131 //          Any( maSaveAsURL ),
132 //          Any( maFilterName ),
133             Any( mbOpenNewDocument ) };
134 
135         sal_Int32 i, nCount = sizeof( pNames ) / sizeof( OUString );
136 
137         for ( i = 0; i < nCount; i++ )
138         {
139             try
140             {
141                 rSettings->replaceByName( pNames[ i ], pValues[ i ] );
142             }
143             catch( Exception& /* rException */ )
144             {
145             }
146         }
147     }
148 }
149 
150 sal_Bool OptimizerSettings::operator==( const OptimizerSettings& rOptimizerSettings ) const
151 {
152     return ( rOptimizerSettings.mbJPEGCompression == mbJPEGCompression )
153         && ( rOptimizerSettings.mnJPEGQuality == mnJPEGQuality )
154         && ( rOptimizerSettings.mbRemoveCropArea == mbRemoveCropArea )
155         && ( rOptimizerSettings.mnImageResolution == mnImageResolution )
156         && ( rOptimizerSettings.mbEmbedLinkedGraphics == mbEmbedLinkedGraphics )
157         && ( rOptimizerSettings.mbOLEOptimization == mbOLEOptimization )
158         && ( rOptimizerSettings.mnOLEOptimizationType == mnOLEOptimizationType )
159         && ( rOptimizerSettings.mbDeleteUnusedMasterPages == mbDeleteUnusedMasterPages )
160         && ( rOptimizerSettings.mbDeleteHiddenSlides == mbDeleteHiddenSlides )
161         && ( rOptimizerSettings.mbDeleteNotesPages == mbDeleteNotesPages );
162 //      && ( rOptimizerSettings.mbOpenNewDocument == mbOpenNewDocument );
163 }
164 
165 
166 ConfigurationAccess::ConfigurationAccess( const Reference< uno::XComponentContext >& rxMSF, OptimizerSettings* pDefaultSettings ) :
167     mxMSF( rxMSF )
168 {
169     LoadStrings();
170     maSettings.push_back( pDefaultSettings ?
171         *pDefaultSettings : OptimizerSettings() );
172     maSettings.back().maName = TKGet( TK_LastUsedSettings );
173     LoadConfiguration();
174     maInitialSettings = maSettings;
175 };
176 
177 ConfigurationAccess::~ConfigurationAccess()
178 {
179 }
180 
181 rtl::OUString ConfigurationAccess::getPath( const PPPOptimizerTokenEnum eToken )
182 {
183     rtl::OUString aPath;
184     try
185     {
186         static const OUString sProtocol( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.expand:" ) );
187         static const OUString stheMacroExpander( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander" ) );
188         Reference< container::XNameAccess > xSet( OpenConfiguration( true ), UNO_QUERY_THROW );
189         if ( xSet->hasByName( TKGet( eToken ) ) )
190             xSet->getByName( TKGet( eToken ) ) >>= aPath;
191         if ( aPath.match( sProtocol, 0 ) )
192         {
193             rtl::OUString aTmp( aPath.copy( 20 ) );
194             Reference< util::XMacroExpander > xExpander;
195             if ( mxMSF->getValueByName( stheMacroExpander ) >>= xExpander )
196             {
197                 aPath = xExpander->expandMacros( aTmp );
198             }
199         }
200     }
201     catch ( Exception& )
202     {
203     }
204     return aPath;
205 }
206 
207 rtl::OUString ConfigurationAccess::getString( const PPPOptimizerTokenEnum eToken ) const
208 {
209     std::map< PPPOptimizerTokenEnum, rtl::OUString, Compare >::const_iterator aIter( maStrings.find( eToken ) );
210     return aIter != maStrings.end() ? ((*aIter).second) : rtl::OUString();
211 }
212 
213 void ConfigurationAccess::LoadStrings()
214 {
215     try
216     {
217         do
218         {
219             Reference< XInterface > xRoot( OpenConfiguration( true ) );
220             if ( !xRoot.is() )
221                 break;
222             Reference< container::XNameAccess > xSet( GetConfigurationNode( xRoot, TKGet( TK_Strings ) ), UNO_QUERY );
223             if ( xSet.is() )
224             {
225                 const Sequence< OUString > aElements( xSet->getElementNames() );
226                 for ( int i = 0; i < aElements.getLength(); i++ )
227                 {
228                     try
229                     {
230                         OUString aString, aPropertyName( aElements[ i ] );
231                         if ( xSet->getByName( aPropertyName ) >>= aString )
232                             maStrings[ TKGet( aPropertyName ) ] = aString;
233                     }
234                     catch( Exception& )
235                     {
236                     }
237                 }
238             }
239         }
240         while( false );
241     }
242     catch( Exception& )
243     {
244     }
245 }
246 
247 void ConfigurationAccess::LoadConfiguration()
248 {
249     try
250     {
251         do
252         {
253             Reference< XInterface > xRoot( OpenConfiguration( true ) );
254             if ( !xRoot.is() )
255                 break;
256             Reference< container::XNameAccess > xSet( GetConfigurationNode( xRoot, TKGet( TK_LastUsedSettings ) ), UNO_QUERY );
257             if ( xSet.is() )
258             {
259                 OptimizerSettings& rCurrent( maSettings.front() );
260                 rCurrent.LoadSettingsFromConfiguration( xSet );
261             }
262             xSet = Reference< container::XNameAccess >( GetConfigurationNode( xRoot, TKGet( TK_Settings_Templates ) ), UNO_QUERY );
263             if ( xSet.is() )
264             {
265                 const Sequence< OUString > aElements( xSet->getElementNames() );
266                 for ( int i = 0; i < aElements.getLength(); i++ )
267                 {
268                     try
269                     {
270                         OUString aPath( TKGet( TK_Settings_Templates_ ).concat( aElements[ i ] ) );
271                         Reference< container::XNameAccess > xTemplates( GetConfigurationNode( xRoot, aPath ), UNO_QUERY );
272                         if ( xTemplates.is() )
273                         {
274                             maSettings.push_back( OptimizerSettings() );
275                             maSettings.back().LoadSettingsFromConfiguration( xTemplates );
276                         }
277                     }
278                     catch( Exception& /* rException */ )
279                     {
280                     }
281                 }
282             }
283         }
284         while( false );
285     }
286     catch( Exception& )
287     {
288     }
289 }
290 
291 void ConfigurationAccess::SaveConfiguration()
292 {
293     try
294     {
295         do
296         {
297             int i;
298             unsigned int k;
299             Reference<util::XChangesBatch> xRoot( OpenConfiguration( false ), UNO_QUERY_THROW );
300 
301             // storing the last used settings
302             Reference< container::XNameReplace > xSet( GetConfigurationNode( xRoot, TKGet( TK_LastUsedSettings ) ), UNO_QUERY_THROW );
303             OptimizerSettings& rCurrent( maSettings.front() );
304             rCurrent.SaveSettingsToConfiguration( xSet );
305 
306             // updating template elements
307             xSet = Reference< container::XNameReplace >( GetConfigurationNode( xRoot, TKGet( TK_Settings_Templates ) ), UNO_QUERY_THROW );
308             Reference< container::XNameContainer > xNameContainer( xSet, UNO_QUERY_THROW );
309 
310             const Sequence< OUString > aElements( xSet->getElementNames() );
311             for( i = 0; i < aElements.getLength(); i++ )
312                 xNameContainer->removeByName( aElements[ i ] );
313 
314             for( k = 1; k < maSettings.size(); k++ )
315             {
316                 OptimizerSettings& rSettings( maSettings[ k ] );
317                 OUString aElementName( TKGet( TK_Template ).concat( OUString::valueOf( static_cast< sal_Int32 >( k ) ) ) );
318                 Reference< lang::XSingleServiceFactory > xChildFactory ( xSet, UNO_QUERY_THROW );
319                 Reference< container::XNameReplace > xChild( xChildFactory->createInstance(), UNO_QUERY_THROW );
320                 xNameContainer->insertByName( aElementName, Any( xChild ) );
321 
322                 OUString aPath( TKGet( TK_Settings_Templates_ ).concat( aElementName ) );
323                 Reference< container::XNameReplace > xTemplates( GetConfigurationNode( xRoot, aPath ), UNO_QUERY );
324                 rSettings.SaveSettingsToConfiguration( xTemplates );
325             }
326             xRoot->commitChanges();
327         }
328         while( false );
329     }
330     catch( Exception& /* rException */ )
331     {
332 
333     }
334 }
335 
336 Reference< XInterface > ConfigurationAccess::OpenConfiguration( bool bReadOnly )
337 {
338     Reference< XInterface > xRoot;
339     try
340     {
341         Reference< lang::XMultiServiceFactory > xProvider( mxMSF->getServiceManager()->createInstanceWithContext( GetConfigurationProviderServiceName(), mxMSF ), UNO_QUERY );
342         if ( xProvider.is() )
343         {
344             Sequence< Any > aCreationArguments( 2 );
345             aCreationArguments[0] = makeAny( PropertyValue(
346                 OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ), 0,
347                 makeAny( GetPathToConfigurationRoot() ),
348                 PropertyState_DIRECT_VALUE ) );
349             aCreationArguments[1] = makeAny(beans::PropertyValue(
350                 OUString( RTL_CONSTASCII_USTRINGPARAM( "lazywrite" ) ), 0, makeAny( true ),
351                 PropertyState_DIRECT_VALUE ) );
352             OUString sAccessService;
353             if ( bReadOnly )
354                 sAccessService = OUString( RTL_CONSTASCII_USTRINGPARAM(
355                     "com.sun.star.configuration.ConfigurationAccess" ) );
356             else
357                 sAccessService = OUString( RTL_CONSTASCII_USTRINGPARAM(
358                     "com.sun.star.configuration.ConfigurationUpdateAccess" ) );
359 
360             xRoot = xProvider->createInstanceWithArguments(
361                 sAccessService, aCreationArguments );
362         }
363     }
364     catch ( Exception& /* rException */ )
365     {
366     }
367     return xRoot;
368 }
369 
370 Reference< XInterface > ConfigurationAccess::GetConfigurationNode(
371     const Reference< XInterface >& xRoot,
372     const OUString& sPathToNode )
373 {
374     Reference< XInterface > xNode;
375     try
376     {
377         if ( !sPathToNode.getLength() )
378             xNode = xRoot;
379         else
380         {
381             Reference< XHierarchicalNameAccess > xHierarchy( xRoot, UNO_QUERY );
382             if ( xHierarchy.is() )
383             {
384                 xHierarchy->getByHierarchicalName( sPathToNode ) >>= xNode;
385             }
386         }
387     }
388     catch ( Exception& rException )
389     {
390         OSL_TRACE ("caught exception while getting configuration node %s: %s",
391             ::rtl::OUStringToOString(sPathToNode,
392                 RTL_TEXTENCODING_UTF8).getStr(),
393             ::rtl::OUStringToOString(rException.Message,
394                 RTL_TEXTENCODING_UTF8).getStr());
395     }
396     return xNode;
397 }
398 
399 com::sun::star::uno::Any ConfigurationAccess::GetConfigProperty( const PPPOptimizerTokenEnum ePropertyToken ) const
400 {
401     Any aRetValue;
402     const OptimizerSettings& rSettings( maSettings.front() );
403     try
404     {
405         switch( ePropertyToken )
406         {
407             case TK_Name :                      aRetValue <<= rSettings.maName; break;
408             case TK_JPEGCompression :           aRetValue <<= rSettings.mbJPEGCompression; break;
409             case TK_JPEGQuality :               aRetValue <<= rSettings.mnJPEGQuality; break;
410             case TK_RemoveCropArea :            aRetValue <<= rSettings.mbRemoveCropArea; break;
411             case TK_ImageResolution :           aRetValue <<= rSettings.mnImageResolution; break;
412             case TK_EmbedLinkedGraphics :       aRetValue <<= rSettings.mbEmbedLinkedGraphics; break;
413             case TK_OLEOptimization :           aRetValue <<= rSettings.mbOLEOptimization; break;
414             case TK_OLEOptimizationType :       aRetValue <<= rSettings.mnOLEOptimizationType; break;
415             case TK_DeleteUnusedMasterPages :   aRetValue <<= rSettings.mbDeleteUnusedMasterPages; break;
416             case TK_DeleteHiddenSlides :        aRetValue <<= rSettings.mbDeleteHiddenSlides; break;
417             case TK_DeleteNotesPages :          aRetValue <<= rSettings.mbDeleteNotesPages; break;
418             case TK_SaveAs :                    aRetValue <<= rSettings.mbSaveAs; break;
419             case TK_SaveAsURL :                 aRetValue <<= rSettings.maSaveAsURL; break;
420             case TK_FilterName :                aRetValue <<= rSettings.maFilterName; break;
421             case TK_OpenNewDocument :           aRetValue <<= rSettings.mbOpenNewDocument; break;
422             case TK_EstimatedFileSize :         aRetValue <<= rSettings.mnEstimatedFileSize; break;
423             default:
424                 break;
425         }
426     }
427     catch( Exception& /* rException */ )
428     {
429     }
430     return aRetValue;
431 }
432 
433 void ConfigurationAccess::SetConfigProperty( const PPPOptimizerTokenEnum ePropertyToken, const com::sun::star::uno::Any& rValue )
434 {
435     OptimizerSettings& rSettings( maSettings.front() );
436     try
437     {
438         switch( ePropertyToken )
439         {
440             case TK_Name :                      rValue >>= rSettings.maName; break;
441             case TK_JPEGCompression :           rValue >>= rSettings.mbJPEGCompression; break;
442             case TK_JPEGQuality :               rValue >>= rSettings.mnJPEGQuality; break;
443             case TK_RemoveCropArea :            rValue >>= rSettings.mbRemoveCropArea; break;
444             case TK_ImageResolution :           rValue >>= rSettings.mnImageResolution; break;
445             case TK_EmbedLinkedGraphics :       rValue >>= rSettings.mbEmbedLinkedGraphics; break;
446             case TK_OLEOptimization :           rValue >>= rSettings.mbOLEOptimization; break;
447             case TK_OLEOptimizationType :       rValue >>= rSettings.mnOLEOptimizationType; break;
448             case TK_DeleteUnusedMasterPages :   rValue >>= rSettings.mbDeleteUnusedMasterPages; break;
449             case TK_DeleteHiddenSlides :        rValue >>= rSettings.mbDeleteHiddenSlides; break;
450             case TK_DeleteNotesPages :          rValue >>= rSettings.mbDeleteNotesPages; break;
451             case TK_CustomShowName :            rValue >>= rSettings.maCustomShowName; break;
452             case TK_SaveAs :                    rValue >>= rSettings.mbSaveAs; break;
453             case TK_SaveAsURL :                 rValue >>= rSettings.maSaveAsURL; break;
454             case TK_FilterName :                rValue >>= rSettings.maFilterName; break;
455             case TK_OpenNewDocument :           rValue >>= rSettings.mbOpenNewDocument; break;
456             case TK_EstimatedFileSize :         rValue >>= rSettings.mnEstimatedFileSize; break;
457             default:
458                 break;
459         }
460     }
461     catch( Exception& /* rException */ )
462     {
463     }
464 }
465 
466 sal_Bool ConfigurationAccess::GetConfigProperty( const PPPOptimizerTokenEnum ePropertyToken, const sal_Bool bDefault ) const
467 {
468     sal_Bool bRetValue = bDefault;
469     if ( ! ( GetConfigProperty( ePropertyToken ) >>= bRetValue ) )
470         bRetValue = bDefault;
471     return bRetValue;
472 }
473 
474 sal_Int16 ConfigurationAccess::GetConfigProperty( const PPPOptimizerTokenEnum ePropertyToken, const sal_Int16 nDefault ) const
475 {
476     sal_Int16 nRetValue = nDefault;
477     if ( ! ( GetConfigProperty( ePropertyToken ) >>= nRetValue ) )
478         nRetValue = nDefault;
479     return nRetValue;
480 }
481 
482 sal_Int32 ConfigurationAccess::GetConfigProperty( const PPPOptimizerTokenEnum ePropertyToken, const sal_Int32 nDefault ) const
483 {
484     sal_Int32 nRetValue = nDefault;
485     if ( ! ( GetConfigProperty( ePropertyToken ) >>= nRetValue ) )
486         nRetValue = nDefault;
487     return nRetValue;
488 }
489 
490 Sequence< PropertyValue > ConfigurationAccess::GetConfigurationSequence()
491 {
492     Sequence< PropertyValue > aRet( 15 );
493     OptimizerSettings& rSettings( maSettings.front() );
494     aRet[ 0 ].Name = TKGet( TK_JPEGCompression );
495     aRet[ 0 ].Value= Any( rSettings.mbJPEGCompression );
496     aRet[ 1 ].Name = TKGet( TK_JPEGQuality );
497     aRet[ 1 ].Value= Any( rSettings.mnJPEGQuality );
498     aRet[ 2 ].Name = TKGet( TK_RemoveCropArea );
499     aRet[ 2 ].Value= Any( rSettings.mbRemoveCropArea );
500     aRet[ 3 ].Name = TKGet( TK_ImageResolution );
501     aRet[ 3 ].Value= Any( rSettings.mnImageResolution );
502     aRet[ 4 ].Name = TKGet( TK_EmbedLinkedGraphics );
503     aRet[ 4 ].Value= Any( rSettings.mbEmbedLinkedGraphics );
504     aRet[ 5 ].Name = TKGet( TK_OLEOptimization );
505     aRet[ 5 ].Value= Any( rSettings.mbOLEOptimization );
506     aRet[ 6 ].Name = TKGet( TK_OLEOptimizationType );
507     aRet[ 6 ].Value= Any( rSettings.mnOLEOptimizationType );
508     aRet[ 7 ].Name = TKGet( TK_DeleteUnusedMasterPages );
509     aRet[ 7 ].Value= Any( rSettings.mbDeleteUnusedMasterPages );
510     aRet[ 8 ].Name = TKGet( TK_DeleteHiddenSlides );
511     aRet[ 8 ].Value= Any( rSettings.mbDeleteHiddenSlides );
512     aRet[ 9 ].Name = TKGet( TK_DeleteNotesPages );
513     aRet[ 9 ].Value= Any( rSettings.mbDeleteNotesPages );
514     aRet[ 10].Name = TKGet( TK_CustomShowName );
515     aRet[ 10].Value= Any( rSettings.maCustomShowName );
516     aRet[ 11].Name = TKGet( TK_SaveAsURL );
517     aRet[ 11].Value= Any( rSettings.maSaveAsURL );
518     aRet[ 12].Name = TKGet( TK_FilterName );
519     aRet[ 12].Value= Any( rSettings.maFilterName );
520     aRet[ 13].Name = TKGet( TK_OpenNewDocument );
521     aRet[ 13].Value= Any( rSettings.mbOpenNewDocument );
522     aRet[ 14].Name = TKGet( TK_EstimatedFileSize );
523     aRet[ 14].Value= Any( rSettings.mnEstimatedFileSize );
524     return aRet;
525 }
526 
527 std::vector< OptimizerSettings >::iterator ConfigurationAccess::GetOptimizerSettingsByName( const rtl::OUString& rName )
528 {
529     std::vector< OptimizerSettings >::iterator aIter( maSettings.begin() + 1 );
530     while ( aIter != maSettings.end() )
531     {
532         if ( aIter->maName == rName )
533             break;
534         aIter++;
535     }
536     return aIter;
537 }
538