Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "FilterConfigCache.hxx"
21 :
22 : #include <vcl/graphicfilter.hxx>
23 : #include <com/sun/star/uno/Any.h>
24 : #include <comphelper/processfactory.hxx>
25 : #include <com/sun/star/uno/Exception.hpp>
26 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 : #include <com/sun/star/beans/XPropertySet.hpp>
28 : #include <com/sun/star/configuration/theDefaultProvider.hpp>
29 : #include <com/sun/star/container/XNameAccess.hpp>
30 :
31 : using namespace ::com::sun::star::lang ; // XMultiServiceFactory
32 : using namespace ::com::sun::star::container ; // XNameAccess
33 : using namespace ::com::sun::star::uno ; // Reference
34 : using namespace ::com::sun::star::beans ; // PropertyValue
35 : using namespace ::com::sun::star::configuration ;
36 :
37 : const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameList[] =
38 : {
39 : IMP_BMP, IMP_GIF, IMP_PNG,IMP_JPEG, IMP_XBM, IMP_XPM,
40 : EXP_BMP, EXP_JPEG, EXP_PNG, NULL
41 : };
42 :
43 : const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
44 : {
45 : IMP_SVMETAFILE, IMP_WMF, IMP_EMF, IMP_SVSGF, IMP_SVSGV, IMP_SVG,
46 : EXP_SVMETAFILE, EXP_WMF, EXP_EMF, EXP_SVG, NULL
47 : };
48 :
49 : const char* FilterConfigCache::FilterConfigCacheEntry::ExternalPixelFilterNameList[] =
50 : {
51 : "egi", "icd", "ipd", "ipx", "ipb", "epb", "epg",
52 : "epp", "ira", "era", "itg", "iti", "eti", "exp", NULL
53 : };
54 :
55 : sal_Bool FilterConfigCache::bInitialized = sal_False;
56 : sal_Int32 FilterConfigCache::nIndType = -1;
57 : sal_Int32 FilterConfigCache::nIndUIName = -1;
58 : sal_Int32 FilterConfigCache::nIndDocumentService = -1;
59 : sal_Int32 FilterConfigCache::nIndFilterService = -1;
60 : sal_Int32 FilterConfigCache::nIndFlags = -1;
61 : sal_Int32 FilterConfigCache::nIndUserData = -1;
62 : sal_Int32 FilterConfigCache::nIndFileFormatVersion = -1;
63 : sal_Int32 FilterConfigCache::nIndTemplateName = -1;
64 :
65 3386 : sal_Bool FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry )
66 : {
67 3386 : bIsPixelFormat = bIsInternalFilter = sal_False;
68 3386 : sFilterName = String( rUserDataEntry );
69 : const char** pPtr;
70 30626 : for ( pPtr = InternalPixelFilterNameList; *pPtr && ( bIsInternalFilter == sal_False ); pPtr++ )
71 : {
72 27240 : if ( sFilterName.EqualsIgnoreCaseAscii( *pPtr ) )
73 : {
74 693 : bIsInternalFilter = sal_True;
75 693 : bIsPixelFormat = sal_True;
76 : }
77 : }
78 25465 : for ( pPtr = InternalVectorFilterNameList; *pPtr && ( bIsInternalFilter == sal_False ); pPtr++ )
79 : {
80 22079 : if ( sFilterName.EqualsIgnoreCaseAscii( *pPtr ) )
81 770 : bIsInternalFilter = sal_True;
82 : }
83 3386 : if ( !bIsInternalFilter )
84 : {
85 18628 : for ( pPtr = ExternalPixelFilterNameList; *pPtr && ( bIsPixelFormat == sal_False ); pPtr++ )
86 : {
87 16705 : if ( sFilterName.EqualsIgnoreCaseAscii( *pPtr ) )
88 1384 : bIsPixelFormat = sal_True;
89 : }
90 1923 : OUString sTemp(SVLIBRARY("?"));
91 1923 : sal_Int32 nIndex = sTemp.indexOf(static_cast<sal_Unicode>('?'));
92 1923 : sFilterName = sTemp.replaceAt(nIndex, 1, sFilterName);
93 : }
94 3386 : return sFilterName.Len() != 0;
95 : }
96 :
97 4622 : String FilterConfigCache::FilterConfigCacheEntry::GetShortName()
98 : {
99 4622 : String aShortName;
100 4622 : if ( lExtensionList.getLength() )
101 : {
102 4622 : aShortName = lExtensionList[ 0 ];
103 4622 : if ( aShortName.SearchAscii( "*.", 0 ) == 0 )
104 0 : aShortName.Erase( 0, 2 );
105 : }
106 4622 : return aShortName;
107 : }
108 :
109 : /** helper to open the configuration root of the underlying
110 : config package
111 :
112 : @param sPackage
113 : specify, which config package should be opened.
114 : Must be one of "types" or "filters"
115 :
116 : @return A valid object if open was successful. The access on opened
117 : data will be readonly. It returns NULL in case open failed.
118 :
119 : @throws It let pass RuntimeExceptions only.
120 : */
121 154 : Reference< XInterface > openConfig(const char* sPackage)
122 : throw(RuntimeException)
123 : {
124 : Reference< XComponentContext > xContext(
125 154 : comphelper::getProcessComponentContext() );
126 154 : Reference< XInterface > xCfg;
127 : try
128 : {
129 : // get access to config API (not to file!)
130 154 : Reference< XMultiServiceFactory > xConfigProvider = theDefaultProvider::get( xContext );
131 :
132 308 : Sequence< Any > lParams(1);
133 308 : PropertyValue aParam ;
134 :
135 : // define cfg path for open
136 154 : aParam.Name = OUString( "nodepath" );
137 154 : if (rtl_str_compareIgnoreAsciiCase(sPackage, "types") == 0)
138 77 : aParam.Value <<= OUString( "/org.openoffice.TypeDetection.Types/Types" );
139 154 : if (rtl_str_compareIgnoreAsciiCase(sPackage, "filters") == 0)
140 77 : aParam.Value <<= OUString( "/org.openoffice.TypeDetection.GraphicFilter/Filters" );
141 154 : lParams[0] = makeAny(aParam);
142 :
143 : // get access to file
144 462 : xCfg = xConfigProvider->createInstanceWithArguments(
145 462 : OUString( "com.sun.star.configuration.ConfigurationAccess" ), lParams);
146 : }
147 0 : catch(const RuntimeException&)
148 0 : { throw; }
149 0 : catch(const Exception&)
150 0 : { xCfg.clear(); }
151 :
152 154 : return xCfg;
153 : }
154 :
155 77 : void FilterConfigCache::ImplInit()
156 : {
157 77 : OUString STYPE ( "Type" );
158 154 : OUString SUINAME ( "UIName" );
159 154 : OUString SFLAGS ( "Flags" );
160 154 : OUString SMEDIATYPE ( "MediaType" );
161 154 : OUString SEXTENSIONS ( "Extensions" );
162 154 : OUString SFORMATNAME ( "FormatName" );
163 154 : OUString SREALFILTERNAME ( "RealFilterName" );
164 :
165 : // get access to config
166 154 : Reference< XNameAccess > xTypeAccess ( openConfig("types" ), UNO_QUERY );
167 154 : Reference< XNameAccess > xFilterAccess( openConfig("filters"), UNO_QUERY );
168 :
169 77 : if ( xTypeAccess.is() && xFilterAccess.is() )
170 : {
171 77 : Sequence< OUString > lAllFilter = xFilterAccess->getElementNames();
172 77 : sal_Int32 nAllFilterCount = lAllFilter.getLength();
173 :
174 3421 : for ( sal_Int32 i = 0; i < nAllFilterCount; i++ )
175 : {
176 3344 : OUString sInternalFilterName = lAllFilter[ i ];
177 6688 : Reference< XPropertySet > xFilterSet;
178 3344 : xFilterAccess->getByName( sInternalFilterName ) >>= xFilterSet;
179 3344 : if (!xFilterSet.is())
180 0 : continue;
181 :
182 6688 : FilterConfigCacheEntry aEntry;
183 :
184 3344 : aEntry.sInternalFilterName = sInternalFilterName;
185 3344 : xFilterSet->getPropertyValue(STYPE) >>= aEntry.sType;
186 3344 : xFilterSet->getPropertyValue(SUINAME) >>= aEntry.sUIName;
187 3344 : xFilterSet->getPropertyValue(SREALFILTERNAME) >>= aEntry.sFilterType;
188 6688 : Sequence< OUString > lFlags;
189 3344 : xFilterSet->getPropertyValue(SFLAGS) >>= lFlags;
190 3344 : if (lFlags.getLength()!=1 || lFlags[0].isEmpty())
191 0 : continue;
192 3344 : if (lFlags[0].equalsIgnoreAsciiCase("import"))
193 2052 : aEntry.nFlags = 1;
194 1292 : else if (lFlags[0].equalsIgnoreAsciiCase("export"))
195 1292 : aEntry.nFlags = 2;
196 :
197 6688 : OUString sFormatName;
198 3344 : xFilterSet->getPropertyValue(SFORMATNAME) >>= sFormatName;
199 3344 : aEntry.CreateFilterName( sFormatName );
200 :
201 6688 : Reference< XPropertySet > xTypeSet;
202 3344 : xTypeAccess->getByName( aEntry.sType ) >>= xTypeSet;
203 3344 : if (!xTypeSet.is())
204 0 : continue;
205 :
206 3344 : xTypeSet->getPropertyValue(SMEDIATYPE) >>= aEntry.sMediaType;
207 3344 : xTypeSet->getPropertyValue(SEXTENSIONS) >>= aEntry.lExtensionList;
208 :
209 : // The first extension will be used
210 : // to generate our internal FilterType ( BMP, WMF ... )
211 6688 : String aExtension( aEntry.GetShortName() );
212 3344 : if (aExtension.Len() != 3)
213 0 : continue;
214 :
215 3344 : if ( aEntry.nFlags & 1 )
216 2052 : aImport.push_back( aEntry );
217 3344 : if ( aEntry.nFlags & 2 )
218 1292 : aExport.push_back( aEntry );
219 :
220 : // bFilterEntryCreated!?
221 3344 : if (!( aEntry.nFlags & 3 ))
222 0 : continue; //? Entry was already inserted ... but following code will be supressed?!
223 3421 : }
224 77 : }
225 77 : };
226 :
227 : const char* FilterConfigCache::InternalFilterListForSvxLight[] =
228 : {
229 : "bmp","1","SVBMP",
230 : "bmp","2","SVBMP",
231 : "dxf","1","idx",
232 : "eps","1","ips",
233 : "eps","2","eps",
234 : "gif","1","SVIGIF",
235 : "gif","2","egi",
236 : "jpg","1","SVIJPEG",
237 : "jpg","2","SVEJPEG",
238 : "sgv","1","SVSGV",
239 : "sgf","1","SVSGF",
240 : "met","1","ime",
241 : "met","2","eme",
242 : "png","1","SVIPNG",
243 : "png","2","SVEPNG",
244 : "pct","1","ipt",
245 : "pct","2","ept",
246 : "pcd","1","icd",
247 : "psd","1","ipd",
248 : "pcx","1","ipx",
249 : "pbm","1","ipb",
250 : "pbm","2","epb",
251 : "pgm","1","ipb",
252 : "pgm","2","epg",
253 : "ppm","1","ipb",
254 : "ppm","2","epp",
255 : "ras","1","ira",
256 : "ras","2","era",
257 : "svm","1","SVMETAFILE",
258 : "svm","2","SVMETAFILE",
259 : "tga","1","itg",
260 : "tif","1","iti",
261 : "tif","2","eti",
262 : "emf","1","SVEMF",
263 : "emf","2","SVEMF",
264 : "wmf","1","SVWMF",
265 : "wmf","2","SVWMF",
266 : "xbm","1","SVIXBM",
267 : "xpm","1","SVIXPM",
268 : "xpm","2","exp",
269 : "svg","1","SVISVG",
270 : "svg","2","SVESVG",
271 : NULL
272 : };
273 :
274 1 : void FilterConfigCache::ImplInitSmart()
275 : {
276 : const char** pPtr;
277 43 : for ( pPtr = InternalFilterListForSvxLight; *pPtr; pPtr++ )
278 : {
279 42 : FilterConfigCacheEntry aEntry;
280 :
281 84 : OUString sExtension( OUString::createFromAscii( *pPtr++ ) );
282 :
283 42 : aEntry.lExtensionList.realloc( 1 );
284 42 : aEntry.lExtensionList[ 0 ] = sExtension;
285 :
286 42 : aEntry.sType = sExtension;
287 42 : aEntry.sUIName = sExtension;
288 :
289 84 : OString sFlags( *pPtr++ );
290 42 : aEntry.nFlags = sFlags.toInt32();
291 :
292 84 : OUString sUserData( OUString::createFromAscii( *pPtr ) );
293 42 : aEntry.CreateFilterName( sUserData );
294 :
295 42 : if ( aEntry.nFlags & 1 )
296 25 : aImport.push_back( aEntry );
297 42 : if ( aEntry.nFlags & 2 )
298 17 : aExport.push_back( aEntry );
299 42 : }
300 1 : }
301 :
302 : // ------------------------------------------------------------------------
303 :
304 78 : FilterConfigCache::FilterConfigCache( sal_Bool bConfig ) :
305 78 : bUseConfig ( bConfig )
306 : {
307 78 : if ( bUseConfig )
308 77 : ImplInit();
309 : else
310 1 : ImplInitSmart();
311 78 : }
312 :
313 78 : FilterConfigCache::~FilterConfigCache()
314 : {
315 78 : }
316 :
317 3630 : String FilterConfigCache::GetImportFilterName( sal_uInt16 nFormat )
318 : {
319 3630 : if( nFormat < aImport.size() )
320 3630 : return aImport[ nFormat ].sFilterName;
321 0 : return String::EmptyString();
322 : }
323 :
324 2 : sal_uInt16 FilterConfigCache::GetImportFormatNumber( const String& rFormatName )
325 : {
326 2 : CacheVector::const_iterator aIter, aEnd;
327 56 : for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
328 : {
329 54 : if ( aIter->sUIName.equalsIgnoreAsciiCase( rFormatName ) )
330 0 : break;
331 : }
332 2 : return sal::static_int_cast< sal_uInt16 >(aIter == aImport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aImport.begin());
333 : }
334 :
335 : /// get the index of the filter that matches this extension
336 3749 : sal_uInt16 FilterConfigCache::GetImportFormatNumberForExtension( const String& rExt )
337 : {
338 3749 : CacheVector::const_iterator aIter, aEnd;
339 76174 : for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
340 : {
341 166475 : for ( sal_Int32 i = 0; i < aIter->lExtensionList.getLength(); i++ )
342 : {
343 94050 : if ( aIter->lExtensionList[i].equalsIgnoreAsciiCase( rExt ) )
344 3684 : return sal::static_int_cast< sal_uInt16 >( aIter - aImport.begin() );
345 : }
346 : }
347 65 : return GRFILTER_FORMAT_NOTFOUND;
348 : }
349 :
350 0 : sal_uInt16 FilterConfigCache::GetImportFormatNumberForMediaType( const String& rMediaType )
351 : {
352 0 : CacheVector::const_iterator aIter, aEnd;
353 0 : for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
354 : {
355 0 : if ( aIter->sMediaType.equalsIgnoreAsciiCase( rMediaType ) )
356 0 : break;
357 : }
358 0 : return sal::static_int_cast< sal_uInt16 >(aIter == aImport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aImport.begin());
359 : }
360 :
361 13 : sal_uInt16 FilterConfigCache::GetImportFormatNumberForShortName( const String& rShortName )
362 : {
363 13 : CacheVector::const_iterator aEnd;
364 13 : CacheVector::iterator aIter;
365 250 : for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
366 : {
367 243 : if ( aIter->GetShortName().EqualsIgnoreCaseAscii( rShortName ) )
368 6 : break;
369 : }
370 13 : return sal::static_int_cast< sal_uInt16 >(aIter == aImport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aImport.begin());
371 : }
372 :
373 0 : sal_uInt16 FilterConfigCache::GetImportFormatNumberForTypeName( const String& rType )
374 : {
375 0 : CacheVector::const_iterator aIter, aEnd;
376 0 : for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
377 : {
378 0 : if ( aIter->sType.equalsIgnoreAsciiCase( rType ) )
379 0 : break;
380 : }
381 0 : return sal::static_int_cast< sal_uInt16 >(aIter == aImport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aImport.begin());
382 : }
383 :
384 468 : String FilterConfigCache::GetImportFormatName( sal_uInt16 nFormat )
385 : {
386 468 : if( nFormat < aImport.size() )
387 468 : return aImport[ nFormat ].sUIName;
388 0 : return String::EmptyString();
389 : }
390 :
391 0 : String FilterConfigCache::GetImportFormatMediaType( sal_uInt16 nFormat )
392 : {
393 0 : if( nFormat < aImport.size() )
394 0 : return aImport[ nFormat ].sMediaType;
395 0 : return String::EmptyString();
396 : }
397 :
398 0 : String FilterConfigCache::GetImportFormatShortName( sal_uInt16 nFormat )
399 : {
400 0 : if( nFormat < aImport.size() )
401 0 : return aImport[ nFormat ].GetShortName();
402 0 : return String::EmptyString();
403 : }
404 :
405 12 : String FilterConfigCache::GetImportFormatExtension( sal_uInt16 nFormat, sal_Int32 nEntry )
406 : {
407 12 : if ( (nFormat < aImport.size()) && (nEntry < aImport[ nFormat ].lExtensionList.getLength()) )
408 12 : return aImport[ nFormat ].lExtensionList[ nEntry ];
409 0 : return String::EmptyString();
410 : }
411 :
412 0 : String FilterConfigCache::GetImportFilterType( sal_uInt16 nFormat )
413 : {
414 0 : if( nFormat < aImport.size() )
415 0 : return aImport[ nFormat ].sType;
416 0 : return String::EmptyString();
417 : }
418 :
419 0 : String FilterConfigCache::GetImportFilterTypeName( sal_uInt16 nFormat )
420 : {
421 0 : if( nFormat < aImport.size() )
422 0 : return aImport[ nFormat ].sFilterType;
423 0 : return String::EmptyString();
424 : }
425 :
426 0 : String FilterConfigCache::GetImportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry )
427 : {
428 0 : String aWildcard( GetImportFormatExtension( nFormat, nEntry ) );
429 0 : if ( aWildcard.Len() )
430 0 : aWildcard.Insert( OUString("*."), 0 );
431 0 : return aWildcard;
432 : }
433 :
434 3630 : sal_Bool FilterConfigCache::IsImportInternalFilter( sal_uInt16 nFormat )
435 : {
436 3630 : return (nFormat < aImport.size()) && aImport[ nFormat ].bIsInternalFilter;
437 : }
438 :
439 0 : sal_Bool FilterConfigCache::IsImportPixelFormat( sal_uInt16 nFormat )
440 : {
441 0 : return (nFormat < aImport.size()) && aImport[ nFormat ].bIsPixelFormat;
442 : }
443 :
444 : // ------------------------------------------------------------------------
445 :
446 89 : String FilterConfigCache::GetExportFilterName( sal_uInt16 nFormat )
447 : {
448 89 : if( nFormat < aExport.size() )
449 89 : return aExport[ nFormat ].sFilterName;
450 0 : return String::EmptyString();
451 : }
452 :
453 0 : sal_uInt16 FilterConfigCache::GetExportFormatNumber( const String& rFormatName )
454 : {
455 0 : CacheVector::const_iterator aIter, aEnd;
456 0 : for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter)
457 : {
458 0 : if ( aIter->sUIName.equalsIgnoreAsciiCase( rFormatName ) )
459 0 : break;
460 : }
461 0 : return sal::static_int_cast< sal_uInt16 >(aIter == aExport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aExport.begin());
462 : }
463 :
464 0 : sal_uInt16 FilterConfigCache::GetExportFormatNumberForMediaType( const String& rMediaType )
465 : {
466 0 : CacheVector::const_iterator aIter, aEnd;
467 0 : for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter)
468 : {
469 0 : if ( aIter->sMediaType.equalsIgnoreAsciiCase( rMediaType ) )
470 0 : break;
471 : }
472 0 : return sal::static_int_cast< sal_uInt16 >(aIter == aExport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aExport.begin());
473 : }
474 :
475 89 : sal_uInt16 FilterConfigCache::GetExportFormatNumberForShortName( const String& rShortName )
476 : {
477 89 : CacheVector::const_iterator aEnd;
478 89 : CacheVector::iterator aIter;
479 1035 : for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter)
480 : {
481 1035 : if ( aIter->GetShortName().EqualsIgnoreCaseAscii( rShortName ) )
482 89 : break;
483 : }
484 89 : return sal::static_int_cast< sal_uInt16 >(aIter == aExport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aExport.begin());
485 : }
486 :
487 0 : sal_uInt16 FilterConfigCache::GetExportFormatNumberForTypeName( const String& rType )
488 : {
489 0 : CacheVector::const_iterator aIter, aEnd;
490 0 : for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter)
491 : {
492 0 : if ( aIter->sType.equalsIgnoreAsciiCase( rType ) )
493 0 : break;
494 : }
495 0 : return sal::static_int_cast< sal_uInt16 >(aIter == aExport.end() ? GRFILTER_FORMAT_NOTFOUND : aIter - aExport.begin());
496 : }
497 :
498 0 : String FilterConfigCache::GetExportFormatName( sal_uInt16 nFormat )
499 : {
500 0 : if( nFormat < aExport.size() )
501 0 : return aExport[ nFormat ].sUIName;
502 0 : return String::EmptyString();
503 : }
504 :
505 0 : String FilterConfigCache::GetExportFormatMediaType( sal_uInt16 nFormat )
506 : {
507 0 : if( nFormat < aExport.size() )
508 0 : return aExport[ nFormat ].sMediaType;
509 0 : return String::EmptyString();
510 : }
511 :
512 0 : String FilterConfigCache::GetExportFormatShortName( sal_uInt16 nFormat )
513 : {
514 0 : if( nFormat < aExport.size() )
515 0 : return aExport[ nFormat ].GetShortName();
516 0 : return String::EmptyString();
517 : }
518 :
519 0 : String FilterConfigCache::GetExportFormatExtension( sal_uInt16 nFormat, sal_Int32 nEntry )
520 : {
521 0 : if ( (nFormat < aExport.size()) && (nEntry < aExport[ nFormat ].lExtensionList.getLength()) )
522 0 : return aExport[ nFormat ].lExtensionList[ nEntry ];
523 0 : return String::EmptyString();
524 : }
525 :
526 0 : String FilterConfigCache::GetExportFilterTypeName( sal_uInt16 nFormat )
527 : {
528 0 : if( nFormat < aExport.size() )
529 0 : return aExport[ nFormat ].sFilterType;
530 0 : return String::EmptyString();
531 : }
532 :
533 0 : String FilterConfigCache::GetExportInternalFilterName( sal_uInt16 nFormat )
534 : {
535 0 : if( nFormat < aExport.size() )
536 0 : return aExport[ nFormat ].sInternalFilterName;
537 0 : return String::EmptyString();
538 : }
539 :
540 0 : String FilterConfigCache::GetExportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry )
541 : {
542 0 : String aWildcard( GetExportFormatExtension( nFormat, nEntry ) );
543 0 : if ( aWildcard.Len() )
544 0 : aWildcard.Insert( OUString("*."), 0 );
545 0 : return aWildcard;
546 : }
547 :
548 89 : sal_Bool FilterConfigCache::IsExportInternalFilter( sal_uInt16 nFormat )
549 : {
550 89 : return (nFormat < aExport.size()) && aExport[ nFormat ].bIsInternalFilter;
551 : }
552 :
553 89 : sal_Bool FilterConfigCache::IsExportPixelFormat( sal_uInt16 nFormat )
554 : {
555 89 : return (nFormat < aExport.size()) && aExport[ nFormat ].bIsPixelFormat;
556 465 : }
557 :
558 : // ------------------------------------------------------------------------
559 :
560 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|