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, IMP_MOV, 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 : bool FilterConfigCache::bInitialized = 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 2924 : bool FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry )
66 : {
67 2924 : bIsPixelFormat = bIsInternalFilter = false;
68 2924 : sFilterName = rUserDataEntry;
69 : const char** pPtr;
70 28849 : for ( pPtr = InternalPixelFilterNameList; *pPtr && !bIsInternalFilter; pPtr++ )
71 : {
72 25925 : if ( sFilterName.equalsIgnoreAsciiCase( OUString(*pPtr, strlen(*pPtr), RTL_TEXTENCODING_ASCII_US) ) )
73 : {
74 651 : bIsInternalFilter = true;
75 651 : bIsPixelFormat = true;
76 : }
77 : }
78 21559 : for ( pPtr = InternalVectorFilterNameList; *pPtr && !bIsInternalFilter; pPtr++ )
79 : {
80 18635 : if ( sFilterName.equalsIgnoreAsciiCase( OUString(*pPtr, strlen(*pPtr), RTL_TEXTENCODING_ASCII_US) ) )
81 650 : bIsInternalFilter = true;
82 : }
83 2924 : if ( !bIsInternalFilter )
84 : {
85 15724 : for ( pPtr = ExternalPixelFilterNameList; *pPtr && !bIsPixelFormat; pPtr++ )
86 : {
87 14101 : if ( sFilterName.equalsIgnoreAsciiCase( OUString(*pPtr, strlen(*pPtr), RTL_TEXTENCODING_ASCII_US) ) )
88 1168 : bIsPixelFormat = true;
89 : }
90 1623 : OUString sTemp(SVLIBRARY("?"));
91 1623 : sFilterName = sTemp.replaceFirst("?", sFilterName);
92 : }
93 2924 : return ! sFilterName.isEmpty();
94 : }
95 :
96 9331 : OUString FilterConfigCache::FilterConfigCacheEntry::GetShortName()
97 : {
98 9331 : OUString aShortName;
99 9331 : if ( lExtensionList.getLength() )
100 : {
101 9331 : aShortName = lExtensionList[ 0 ];
102 9331 : if ( aShortName.startsWith( "*." ) )
103 0 : aShortName = aShortName.replaceAt( 0, 2, "" );
104 : }
105 9331 : return aShortName;
106 : }
107 :
108 : /** helper to open the configuration root of the underlying
109 : config package
110 :
111 : @param sPackage
112 : specify, which config package should be opened.
113 : Must be one of "types" or "filters"
114 :
115 : @return A valid object if open was successful. The access on opened
116 : data will be readonly. It returns NULL in case open failed.
117 :
118 : @throws It let pass RuntimeExceptions only.
119 : */
120 128 : Reference< XInterface > openConfig(const char* sPackage)
121 : throw(RuntimeException)
122 : {
123 : Reference< XComponentContext > xContext(
124 128 : comphelper::getProcessComponentContext() );
125 128 : Reference< XInterface > xCfg;
126 : try
127 : {
128 : // get access to config API (not to file!)
129 128 : Reference< XMultiServiceFactory > xConfigProvider = theDefaultProvider::get( xContext );
130 :
131 256 : Sequence< Any > lParams(1);
132 256 : PropertyValue aParam ;
133 :
134 : // define cfg path for open
135 128 : aParam.Name = "nodepath";
136 128 : if (rtl_str_compareIgnoreAsciiCase(sPackage, "types") == 0)
137 64 : aParam.Value <<= OUString( "/org.openoffice.TypeDetection.Types/Types" );
138 128 : if (rtl_str_compareIgnoreAsciiCase(sPackage, "filters") == 0)
139 64 : aParam.Value <<= OUString( "/org.openoffice.TypeDetection.GraphicFilter/Filters" );
140 128 : lParams[0] = makeAny(aParam);
141 :
142 : // get access to file
143 384 : xCfg = xConfigProvider->createInstanceWithArguments(
144 384 : OUString( "com.sun.star.configuration.ConfigurationAccess" ), lParams);
145 : }
146 0 : catch(const RuntimeException&)
147 0 : { throw; }
148 0 : catch(const Exception&)
149 0 : { xCfg.clear(); }
150 :
151 128 : return xCfg;
152 : }
153 :
154 64 : void FilterConfigCache::ImplInit()
155 : {
156 64 : OUString STYPE ( "Type" );
157 128 : OUString SUINAME ( "UIName" );
158 128 : OUString SFLAGS ( "Flags" );
159 128 : OUString SMEDIATYPE ( "MediaType" );
160 128 : OUString SEXTENSIONS ( "Extensions" );
161 128 : OUString SFORMATNAME ( "FormatName" );
162 128 : OUString SREALFILTERNAME ( "RealFilterName" );
163 :
164 : // get access to config
165 128 : Reference< XNameAccess > xTypeAccess ( openConfig("types" ), UNO_QUERY );
166 128 : Reference< XNameAccess > xFilterAccess( openConfig("filters"), UNO_QUERY );
167 :
168 64 : if ( xTypeAccess.is() && xFilterAccess.is() )
169 : {
170 64 : Sequence< OUString > lAllFilter = xFilterAccess->getElementNames();
171 64 : sal_Int32 nAllFilterCount = lAllFilter.getLength();
172 :
173 2944 : for ( sal_Int32 i = 0; i < nAllFilterCount; i++ )
174 : {
175 2880 : OUString sInternalFilterName = lAllFilter[ i ];
176 5760 : Reference< XPropertySet > xFilterSet;
177 2880 : xFilterAccess->getByName( sInternalFilterName ) >>= xFilterSet;
178 2880 : if (!xFilterSet.is())
179 0 : continue;
180 :
181 5760 : FilterConfigCacheEntry aEntry;
182 :
183 2880 : aEntry.sInternalFilterName = sInternalFilterName;
184 2880 : xFilterSet->getPropertyValue(STYPE) >>= aEntry.sType;
185 2880 : xFilterSet->getPropertyValue(SUINAME) >>= aEntry.sUIName;
186 2880 : xFilterSet->getPropertyValue(SREALFILTERNAME) >>= aEntry.sFilterType;
187 5760 : Sequence< OUString > lFlags;
188 2880 : xFilterSet->getPropertyValue(SFLAGS) >>= lFlags;
189 2880 : if (lFlags.getLength()!=1 || lFlags[0].isEmpty())
190 0 : continue;
191 2880 : if (lFlags[0].equalsIgnoreAsciiCase("import"))
192 1792 : aEntry.nFlags = 1;
193 1088 : else if (lFlags[0].equalsIgnoreAsciiCase("export"))
194 1088 : aEntry.nFlags = 2;
195 :
196 5760 : OUString sFormatName;
197 2880 : xFilterSet->getPropertyValue(SFORMATNAME) >>= sFormatName;
198 2880 : aEntry.CreateFilterName( sFormatName );
199 :
200 5760 : Reference< XPropertySet > xTypeSet;
201 2880 : xTypeAccess->getByName( aEntry.sType ) >>= xTypeSet;
202 2880 : if (!xTypeSet.is())
203 0 : continue;
204 :
205 2880 : xTypeSet->getPropertyValue(SMEDIATYPE) >>= aEntry.sMediaType;
206 2880 : xTypeSet->getPropertyValue(SEXTENSIONS) >>= aEntry.lExtensionList;
207 :
208 : // The first extension will be used
209 : // to generate our internal FilterType ( BMP, WMF ... )
210 5760 : OUString aExtension( aEntry.GetShortName() );
211 2880 : if (aExtension.getLength() != 3)
212 0 : continue;
213 :
214 2880 : if ( aEntry.nFlags & 1 )
215 1792 : aImport.push_back( aEntry );
216 2880 : if ( aEntry.nFlags & 2 )
217 1088 : aExport.push_back( aEntry );
218 :
219 : // bFilterEntryCreated!?
220 2880 : if (!( aEntry.nFlags & 3 ))
221 0 : continue; //? Entry was already inserted ... but following code will be suppressed?!
222 2944 : }
223 64 : }
224 64 : };
225 :
226 : const char* FilterConfigCache::InternalFilterListForSvxLight[] =
227 : {
228 : "bmp","1","SVBMP",
229 : "bmp","2","SVBMP",
230 : "dxf","1","idx",
231 : "eps","1","ips",
232 : "eps","2","eps",
233 : "gif","1","SVIGIF",
234 : "gif","2","egi",
235 : "jpg","1","SVIJPEG",
236 : "jpg","2","SVEJPEG",
237 : "mov","1","SVMOV",
238 : "mov","2","SVMOV",
239 : "sgv","1","SVSGV",
240 : "sgf","1","SVSGF",
241 : "met","1","ime",
242 : "met","2","eme",
243 : "png","1","SVIPNG",
244 : "png","2","SVEPNG",
245 : "pct","1","ipt",
246 : "pct","2","ept",
247 : "pcd","1","icd",
248 : "psd","1","ipd",
249 : "pcx","1","ipx",
250 : "pbm","1","ipb",
251 : "pbm","2","epb",
252 : "pgm","1","ipb",
253 : "pgm","2","epg",
254 : "ppm","1","ipb",
255 : "ppm","2","epp",
256 : "ras","1","ira",
257 : "ras","2","era",
258 : "svm","1","SVMETAFILE",
259 : "svm","2","SVMETAFILE",
260 : "tga","1","itg",
261 : "tif","1","iti",
262 : "tif","2","eti",
263 : "emf","1","SVEMF",
264 : "emf","2","SVEMF",
265 : "wmf","1","SVWMF",
266 : "wmf","2","SVWMF",
267 : "xbm","1","SVIXBM",
268 : "xpm","1","SVIXPM",
269 : "xpm","2","exp",
270 : "svg","1","SVISVG",
271 : "svg","2","SVESVG",
272 : NULL
273 : };
274 :
275 1 : void FilterConfigCache::ImplInitSmart()
276 : {
277 : const char** pPtr;
278 45 : for ( pPtr = InternalFilterListForSvxLight; *pPtr; pPtr++ )
279 : {
280 44 : FilterConfigCacheEntry aEntry;
281 :
282 88 : OUString sExtension( OUString::createFromAscii( *pPtr++ ) );
283 :
284 44 : aEntry.lExtensionList.realloc( 1 );
285 44 : aEntry.lExtensionList[ 0 ] = sExtension;
286 :
287 44 : aEntry.sType = sExtension;
288 44 : aEntry.sUIName = sExtension;
289 :
290 88 : OString sFlags( *pPtr++ );
291 44 : aEntry.nFlags = sFlags.toInt32();
292 :
293 88 : OUString sUserData( OUString::createFromAscii( *pPtr ) );
294 44 : aEntry.CreateFilterName( sUserData );
295 :
296 44 : if ( aEntry.nFlags & 1 )
297 26 : aImport.push_back( aEntry );
298 44 : if ( aEntry.nFlags & 2 )
299 18 : aExport.push_back( aEntry );
300 44 : }
301 1 : }
302 :
303 65 : FilterConfigCache::FilterConfigCache( bool bConfig ) :
304 65 : bUseConfig ( bConfig )
305 : {
306 65 : if ( bUseConfig )
307 64 : ImplInit();
308 : else
309 1 : ImplInitSmart();
310 65 : }
311 :
312 65 : FilterConfigCache::~FilterConfigCache()
313 : {
314 65 : }
315 :
316 7115 : OUString FilterConfigCache::GetImportFilterName( sal_uInt16 nFormat )
317 : {
318 7115 : if( nFormat < aImport.size() )
319 7115 : return aImport[ nFormat ].sFilterName;
320 0 : return OUString("");
321 : }
322 :
323 16 : sal_uInt16 FilterConfigCache::GetImportFormatNumber( const OUString& rFormatName )
324 : {
325 16 : CacheVector::const_iterator aIter, aEnd;
326 280 : for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
327 : {
328 272 : if ( aIter->sUIName.equalsIgnoreAsciiCase( rFormatName ) )
329 8 : return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin());
330 : }
331 8 : return GRFILTER_FORMAT_NOTFOUND;
332 : }
333 :
334 : /// get the index of the filter that matches this extension
335 7061 : sal_uInt16 FilterConfigCache::GetImportFormatNumberForExtension( const OUString& rExt )
336 : {
337 7061 : CacheVector::const_iterator aIter, aEnd;
338 125569 : for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
339 : {
340 287941 : for ( sal_Int32 i = 0; i < aIter->lExtensionList.getLength(); i++ )
341 : {
342 169433 : if ( aIter->lExtensionList[i].equalsIgnoreAsciiCase( rExt ) )
343 6991 : return sal::static_int_cast< sal_uInt16 >( aIter - aImport.begin() );
344 : }
345 : }
346 70 : return GRFILTER_FORMAT_NOTFOUND;
347 : }
348 :
349 0 : sal_uInt16 FilterConfigCache::GetImportFormatNumberForMediaType( const OUString& rMediaType )
350 : {
351 0 : CacheVector::const_iterator aIter, aEnd;
352 0 : for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
353 : {
354 0 : if ( aIter->sMediaType.equalsIgnoreAsciiCase( rMediaType ) )
355 0 : return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin());
356 : }
357 0 : return GRFILTER_FORMAT_NOTFOUND;
358 : }
359 :
360 222 : sal_uInt16 FilterConfigCache::GetImportFormatNumberForShortName( const OUString& rShortName )
361 : {
362 222 : CacheVector::const_iterator aEnd;
363 222 : CacheVector::iterator aIter;
364 3522 : for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
365 : {
366 3432 : if ( aIter->GetShortName().equalsIgnoreAsciiCase( rShortName ) )
367 132 : return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin());
368 : }
369 90 : return GRFILTER_FORMAT_NOTFOUND;
370 : }
371 :
372 1 : sal_uInt16 FilterConfigCache::GetImportFormatNumberForTypeName( const OUString& rType )
373 : {
374 1 : CacheVector::const_iterator aIter, aEnd;
375 3 : for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
376 : {
377 3 : if ( aIter->sType.equalsIgnoreAsciiCase( rType ) )
378 1 : return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin());
379 : }
380 0 : return GRFILTER_FORMAT_NOTFOUND;
381 : }
382 :
383 477 : OUString FilterConfigCache::GetImportFormatName( sal_uInt16 nFormat )
384 : {
385 477 : if( nFormat < aImport.size() )
386 477 : return aImport[ nFormat ].sUIName;
387 0 : return OUString("");
388 : }
389 :
390 0 : OUString FilterConfigCache::GetImportFormatMediaType( sal_uInt16 nFormat )
391 : {
392 0 : if( nFormat < aImport.size() )
393 0 : return aImport[ nFormat ].sMediaType;
394 0 : return OUString("");
395 : }
396 :
397 154 : OUString FilterConfigCache::GetImportFormatShortName( sal_uInt16 nFormat )
398 : {
399 154 : if( nFormat < aImport.size() )
400 154 : return aImport[ nFormat ].GetShortName();
401 0 : return OUString("");
402 : }
403 :
404 252 : OUString FilterConfigCache::GetImportFormatExtension( sal_uInt16 nFormat, sal_Int32 nEntry )
405 : {
406 252 : if ( (nFormat < aImport.size()) && (nEntry < aImport[ nFormat ].lExtensionList.getLength()) )
407 252 : return aImport[ nFormat ].lExtensionList[ nEntry ];
408 0 : return OUString("");
409 : }
410 :
411 0 : OUString FilterConfigCache::GetImportFilterType( sal_uInt16 nFormat )
412 : {
413 0 : if( nFormat < aImport.size() )
414 0 : return aImport[ nFormat ].sType;
415 0 : return OUString("");
416 : }
417 :
418 4 : OUString FilterConfigCache::GetImportFilterTypeName( sal_uInt16 nFormat )
419 : {
420 4 : if( nFormat < aImport.size() )
421 4 : return aImport[ nFormat ].sFilterType;
422 0 : return OUString("");
423 : }
424 :
425 0 : OUString FilterConfigCache::GetImportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry )
426 : {
427 0 : OUString aWildcard( GetImportFormatExtension( nFormat, nEntry ) );
428 0 : if ( !aWildcard.isEmpty() )
429 0 : aWildcard = aWildcard.replaceAt( 0, 0, "*." );
430 0 : return aWildcard;
431 : }
432 :
433 7115 : bool FilterConfigCache::IsImportInternalFilter( sal_uInt16 nFormat )
434 : {
435 7115 : return (nFormat < aImport.size()) && aImport[ nFormat ].bIsInternalFilter;
436 : }
437 :
438 0 : bool FilterConfigCache::IsImportPixelFormat( sal_uInt16 nFormat )
439 : {
440 0 : return (nFormat < aImport.size()) && aImport[ nFormat ].bIsPixelFormat;
441 : }
442 :
443 284 : OUString FilterConfigCache::GetExportFilterName( sal_uInt16 nFormat )
444 : {
445 284 : if( nFormat < aExport.size() )
446 284 : return aExport[ nFormat ].sFilterName;
447 0 : return OUString("");
448 : }
449 :
450 0 : sal_uInt16 FilterConfigCache::GetExportFormatNumber( const OUString& rFormatName )
451 : {
452 0 : CacheVector::const_iterator aIter, aEnd;
453 0 : for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter)
454 : {
455 0 : if ( aIter->sUIName.equalsIgnoreAsciiCase( rFormatName ) )
456 0 : return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin());
457 : }
458 0 : return GRFILTER_FORMAT_NOTFOUND;
459 : }
460 :
461 0 : sal_uInt16 FilterConfigCache::GetExportFormatNumberForMediaType( const OUString& rMediaType )
462 : {
463 0 : CacheVector::const_iterator aIter, aEnd;
464 0 : for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter)
465 : {
466 0 : if ( aIter->sMediaType.equalsIgnoreAsciiCase( rMediaType ) )
467 0 : return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin());
468 : }
469 0 : return GRFILTER_FORMAT_NOTFOUND;
470 : }
471 :
472 284 : sal_uInt16 FilterConfigCache::GetExportFormatNumberForShortName( const OUString& rShortName )
473 : {
474 284 : CacheVector::const_iterator aEnd;
475 284 : CacheVector::iterator aIter;
476 2864 : for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter)
477 : {
478 2864 : if ( aIter->GetShortName().equalsIgnoreAsciiCase( rShortName ) )
479 284 : return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin());
480 : }
481 0 : return GRFILTER_FORMAT_NOTFOUND;
482 : }
483 :
484 0 : sal_uInt16 FilterConfigCache::GetExportFormatNumberForTypeName( const OUString& rType )
485 : {
486 0 : CacheVector::const_iterator aIter, aEnd;
487 0 : for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter)
488 : {
489 0 : if ( aIter->sType.equalsIgnoreAsciiCase( rType ) )
490 0 : return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin());
491 : }
492 0 : return GRFILTER_FORMAT_NOTFOUND;
493 : }
494 :
495 0 : OUString FilterConfigCache::GetExportFormatName( sal_uInt16 nFormat )
496 : {
497 0 : if( nFormat < aExport.size() )
498 0 : return aExport[ nFormat ].sUIName;
499 0 : return OUString("");
500 : }
501 :
502 0 : OUString FilterConfigCache::GetExportFormatMediaType( sal_uInt16 nFormat )
503 : {
504 0 : if( nFormat < aExport.size() )
505 0 : return aExport[ nFormat ].sMediaType;
506 0 : return OUString("");
507 : }
508 :
509 1 : OUString FilterConfigCache::GetExportFormatShortName( sal_uInt16 nFormat )
510 : {
511 1 : if( nFormat < aExport.size() )
512 1 : return aExport[ nFormat ].GetShortName();
513 0 : return OUString("");
514 : }
515 :
516 0 : OUString FilterConfigCache::GetExportFormatExtension( sal_uInt16 nFormat, sal_Int32 nEntry )
517 : {
518 0 : if ( (nFormat < aExport.size()) && (nEntry < aExport[ nFormat ].lExtensionList.getLength()) )
519 0 : return aExport[ nFormat ].lExtensionList[ nEntry ];
520 0 : return OUString("");
521 : }
522 :
523 0 : OUString FilterConfigCache::GetExportFilterTypeName( sal_uInt16 nFormat )
524 : {
525 0 : if( nFormat < aExport.size() )
526 0 : return aExport[ nFormat ].sFilterType;
527 0 : return OUString("");
528 : }
529 :
530 10 : OUString FilterConfigCache::GetExportInternalFilterName( sal_uInt16 nFormat )
531 : {
532 10 : if( nFormat < aExport.size() )
533 10 : return aExport[ nFormat ].sInternalFilterName;
534 0 : return OUString("");
535 : }
536 :
537 0 : OUString FilterConfigCache::GetExportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry )
538 : {
539 0 : OUString aWildcard( GetExportFormatExtension( nFormat, nEntry ) );
540 0 : if ( !aWildcard.isEmpty() )
541 0 : aWildcard = aWildcard.replaceAt( 0, 0, "*." );
542 0 : return aWildcard;
543 : }
544 :
545 284 : bool FilterConfigCache::IsExportInternalFilter( sal_uInt16 nFormat )
546 : {
547 284 : return (nFormat < aExport.size()) && aExport[ nFormat ].bIsInternalFilter;
548 : }
549 :
550 318 : bool FilterConfigCache::IsExportPixelFormat( sal_uInt16 nFormat )
551 : {
552 318 : return (nFormat < aExport.size()) && aExport[ nFormat ].bIsPixelFormat;
553 801 : }
554 :
555 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|