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