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 :
21 : #include "filterfactory.hxx"
22 : #include "macros.hxx"
23 : #include "constant.hxx"
24 : #include "versions.hxx"
25 :
26 : #include <com/sun/star/lang/XInitialization.hpp>
27 : #include <comphelper/processfactory.hxx>
28 : #include <comphelper/enumhelper.hxx>
29 : #include <rtl/ustrbuf.hxx>
30 : #include <officecfg/Setup.hxx>
31 : #include <officecfg/TypeDetection/UISort.hxx>
32 :
33 :
34 : namespace filter{
35 : namespace config{
36 :
37 : /** @short define all possible parts of a filter query.
38 :
39 : @descr syntax: "<query>[:<param>[=<value>]]"
40 : e.g.: "_query_writer:default_first:use_order:sort_prop=uiname"
41 :
42 : argument description default
43 : -----------------------------------------------------------------------------------------------
44 : iflags=<mask> include filters by given mask 0
45 : eflags=<mask> exclude filters by given mask 0
46 : sort_prop=<[name,uiname]> sort by internal name or uiname name
47 : descending sort descending false
48 : use_order use order flag of filters for sorting false
49 : default_first set default filter on top of return list false
50 : case_sensitive compare "sort_prop" case sensitive false
51 : */
52 :
53 15032 : FilterFactory::FilterFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext)
54 15032 : : m_xContext(rxContext)
55 : {
56 : BaseContainer::init(rxContext ,
57 : FilterFactory::impl_getImplementationName() ,
58 : FilterFactory::impl_getSupportedServiceNames(),
59 15032 : FilterCache::E_FILTER );
60 15032 : }
61 :
62 :
63 :
64 30064 : FilterFactory::~FilterFactory()
65 : {
66 30064 : }
67 :
68 :
69 :
70 0 : css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstance(const OUString& sFilter)
71 : throw(css::uno::Exception ,
72 : css::uno::RuntimeException, std::exception)
73 : {
74 0 : return createInstanceWithArguments(sFilter, css::uno::Sequence< css::uno::Any >());
75 : }
76 :
77 :
78 :
79 1582 : css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstanceWithArguments(const OUString& sFilter ,
80 : const css::uno::Sequence< css::uno::Any >& lArguments)
81 : throw(css::uno::Exception ,
82 : css::uno::RuntimeException, std::exception)
83 : {
84 : // SAFE ->
85 1582 : ::osl::ResettableMutexGuard aLock(m_aLock);
86 :
87 3164 : OUString sRealFilter = sFilter;
88 :
89 : #ifdef _FILTER_CONFIG_MIGRATION_Q_
90 :
91 : /* -> TODO - HACK
92 : check if the given filter name really exist ...
93 : Because our old implementation worked with an internal
94 : type name instead of a filter name. For a small migration time
95 : we must simulate this old feature :-( */
96 :
97 1582 : if (!m_rCache->hasItem(FilterCache::E_FILTER, sFilter) && m_rCache->hasItem(FilterCache::E_TYPE, sFilter))
98 : {
99 : OSL_FAIL("Who use this deprecated functionality?");
100 : _FILTER_CONFIG_LOG_("FilterFactory::createInstanceWithArguments() ... simulate old type search functionality!\n");
101 :
102 0 : css::uno::Sequence< css::beans::NamedValue > lQuery(1);
103 0 : lQuery[0].Name = PROPNAME_TYPE;
104 0 : lQuery[0].Value <<= sFilter;
105 :
106 0 : css::uno::Reference< css::container::XEnumeration > xSet = createSubSetEnumerationByProperties(lQuery);
107 0 : while(xSet->hasMoreElements())
108 : {
109 0 : ::comphelper::SequenceAsHashMap lHandlerProps(xSet->nextElement());
110 0 : if (!(lHandlerProps[PROPNAME_NAME] >>= sRealFilter))
111 0 : continue;
112 0 : }
113 :
114 : // prevent outside code against NoSuchElementException!
115 : // But dont implement such defensive strategy for our new create handling :-)
116 0 : if (!m_rCache->hasItem(FilterCache::E_FILTER, sRealFilter))
117 0 : return css::uno::Reference< css::uno::XInterface>();
118 : }
119 :
120 : /* <- HACK */
121 :
122 : #endif // _FILTER_CONFIG_MIGRATION_Q_
123 :
124 : // search filter on cache
125 3164 : CacheItem aFilter = m_rCache->getItem(FilterCache::E_FILTER, sRealFilter);
126 3164 : OUString sFilterService;
127 1582 : aFilter[PROPNAME_FILTERSERVICE] >>= sFilterService;
128 :
129 : // create service instance
130 3164 : css::uno::Reference< css::uno::XInterface > xFilter;
131 1582 : if (!sFilterService.isEmpty())
132 1582 : xFilter = m_xContext->getServiceManager()->createInstanceWithContext(sFilterService, m_xContext);
133 :
134 : // initialize filter
135 3164 : css::uno::Reference< css::lang::XInitialization > xInit(xFilter, css::uno::UNO_QUERY);
136 1582 : if (xInit.is())
137 : {
138 : // format: lInitData[0] = seq<PropertyValue>, which contains all configuration properties of this filter
139 : // lInitData[1] = lArguments[0]
140 : // ...
141 : // lInitData[n] = lArguments[n-1]
142 1582 : css::uno::Sequence< css::beans::PropertyValue > lConfig;
143 1582 : aFilter >> lConfig;
144 :
145 3164 : ::comphelper::SequenceAsVector< css::uno::Any > stlArguments(lArguments);
146 1582 : stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig));
147 :
148 3164 : css::uno::Sequence< css::uno::Any > lInitData;
149 1582 : stlArguments >> lInitData;
150 :
151 3164 : xInit->initialize(lInitData);
152 : }
153 :
154 3164 : return xFilter;
155 : // <- SAFE
156 : }
157 :
158 :
159 :
160 0 : css::uno::Sequence< OUString > SAL_CALL FilterFactory::getAvailableServiceNames()
161 : throw(css::uno::RuntimeException, std::exception)
162 : {
163 : /* Attention: Instead of getElementNames() this method have to return only filter names,
164 : which can be created as UNO Services really. Thats why we search for filters,
165 : which dont have a valid value for the property "FilterService".
166 : Of course we cant check for corrupted service names here. We can check
167 : for empty strings only ...
168 : */
169 0 : CacheItem lIProps;
170 0 : CacheItem lEProps;
171 0 : lEProps[PROPNAME_FILTERSERVICE] <<= OUString();
172 :
173 0 : OUStringList lUNOFilters;
174 : try
175 : {
176 0 : lUNOFilters = m_rCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps, lEProps);
177 : }
178 0 : catch(const css::uno::RuntimeException&)
179 0 : { throw; }
180 0 : catch(const css::uno::Exception&)
181 0 : { lUNOFilters.clear(); }
182 :
183 0 : return lUNOFilters.getAsConstList();
184 : }
185 :
186 :
187 :
188 0 : css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::createSubSetEnumerationByQuery(const OUString& sQuery)
189 : throw (css::uno::RuntimeException, std::exception)
190 : {
191 : // reject old deprecated queries ...
192 0 : if (sQuery.matchAsciiL("_filterquery_",13,0))
193 : throw css::uno::RuntimeException(
194 : _FILTER_CONFIG_FROM_ASCII_("Use of deprecated and now unsupported query!"),
195 0 : static_cast< css::container::XContainerQuery* >(this));
196 :
197 : // convert "_query_xxx:..." to "getByDocService=xxx:..."
198 0 : OUString sNewQuery(sQuery);
199 0 : sal_Int32 pos = sNewQuery.indexOf("_query_");
200 0 : if (pos != -1)
201 : {
202 : OSL_FAIL("DEPRECATED!\nPlease use new query format: 'matchByDocumentService=...'");
203 0 : OUString sPatchedQuery("matchByDocumentService=" + sNewQuery.copy(7));
204 0 : sNewQuery = sPatchedQuery;
205 : }
206 :
207 : // analyze query and split it into its tokens
208 0 : QueryTokenizer lTokens(sNewQuery);
209 0 : QueryTokenizer::const_iterator pIt;
210 0 : OUStringList lEnumSet;
211 :
212 : // start query
213 : // (see attention comment below!)
214 0 : if (lTokens.valid())
215 : {
216 : // SAFE -> ----------------------
217 0 : ::osl::ResettableMutexGuard aLock(m_aLock);
218 : // May be not all filters was loaded ...
219 : // But we need it now!
220 0 : impl_loadOnDemand();
221 0 : aLock.clear();
222 : // <- SAFE ----------------------
223 :
224 0 : if (lTokens.find(QUERY_IDENTIFIER_GETPREFERREDFILTERFORTYPE) != lTokens.end())
225 : OSL_FAIL("DEPRECATED!\nPlease use prop search at the TypeDetection container!");
226 : else
227 0 : if (lTokens.find(QUERY_IDENTIFIER_MATCHBYDOCUMENTSERVICE) != lTokens.end())
228 0 : lEnumSet = impl_queryMatchByDocumentService(lTokens);
229 : else
230 0 : if (lTokens.find(QUERY_IDENTIFIER_GET_SORTED_FILTERLIST) != lTokens.end())
231 0 : lEnumSet = impl_getSortedFilterList(lTokens);
232 : }
233 :
234 : // pack list of item names as an enum list
235 : // Attention: Do not return empty reference for empty list!
236 : // The outside check "hasMoreElements()" should be enough, to detect this state :-)
237 0 : css::uno::Sequence< OUString > lSet = lEnumSet.getAsConstList();
238 0 : ::comphelper::OEnumerationByName* pEnum = new ::comphelper::OEnumerationByName(this, lSet);
239 0 : return css::uno::Reference< css::container::XEnumeration >(static_cast< css::container::XEnumeration* >(pEnum), css::uno::UNO_QUERY);
240 : }
241 :
242 :
243 :
244 0 : OUStringList FilterFactory::impl_queryMatchByDocumentService(const QueryTokenizer& lTokens) const
245 : {
246 : // analyze query
247 0 : QueryTokenizer::const_iterator pIt;
248 :
249 0 : OUString sDocumentService;
250 0 : sal_Int32 nIFlags = 0;
251 0 : sal_Int32 nEFlags = 0;
252 :
253 0 : pIt = lTokens.find(QUERY_IDENTIFIER_MATCHBYDOCUMENTSERVICE);
254 0 : if (pIt != lTokens.end())
255 0 : sDocumentService = pIt->second;
256 :
257 : #define COMP_HACK
258 : #ifdef COMP_HACK
259 0 : if ( sDocumentService == "writer" )
260 : {
261 : OSL_FAIL("DEPRECATED!\nPlease use right document service for filter query!");
262 0 : sDocumentService = "com.sun.star.text.TextDocument";
263 : }
264 0 : else if ( sDocumentService == "web" )
265 : {
266 : OSL_FAIL("DEPRECATED!\nPlease use right document service for filter query!");
267 0 : sDocumentService = "com.sun.star.text.WebDocument";
268 : }
269 0 : else if ( sDocumentService == "global" )
270 : {
271 : OSL_FAIL("DEPRECATED!\nPlease use right document service for filter query!");
272 0 : sDocumentService = "com.sun.star.text.GlobalDocument";
273 : }
274 0 : else if ( sDocumentService == "calc" )
275 : {
276 : OSL_FAIL("DEPRECATED!\nPlease use right document service for filter query!");
277 0 : sDocumentService = "com.sun.star.sheet.SpreadsheetDocument";
278 : }
279 0 : else if ( sDocumentService == "draw" )
280 : {
281 : OSL_FAIL("DEPRECATED!\nPlease use right document service for filter query!");
282 0 : sDocumentService = "com.sun.star.drawing.DrawingDocument";
283 : }
284 0 : else if ( sDocumentService == "impress" )
285 : {
286 : OSL_FAIL("DEPRECATED!\nPlease use right document service for filter query!");
287 0 : sDocumentService = "com.sun.star.presentation.PresentationDocument";
288 : }
289 0 : else if ( sDocumentService == "math" )
290 : {
291 : OSL_FAIL("DEPRECATED!\nPlease use right document service for filter query!");
292 0 : sDocumentService = "com.sun.star.formula.FormulaProperties";
293 : }
294 : #endif
295 :
296 0 : pIt = lTokens.find(QUERY_PARAM_IFLAGS);
297 0 : if (pIt != lTokens.end())
298 0 : nIFlags = OUString(pIt->second).toInt32();
299 :
300 0 : pIt = lTokens.find(QUERY_PARAM_EFLAGS);
301 0 : if (pIt != lTokens.end())
302 0 : nEFlags = OUString(pIt->second).toInt32();
303 :
304 : // SAFE -> ----------------------
305 0 : ::osl::ResettableMutexGuard aLock(m_aLock);
306 :
307 : // search suitable filters
308 0 : FilterCache* pCache = impl_getWorkingCache();
309 0 : OUStringList lFilterNames = pCache->getItemNames(FilterCache::E_FILTER);
310 0 : OUStringList lResult ;
311 :
312 0 : for (OUStringList::const_iterator pName = lFilterNames.begin();
313 0 : pName != lFilterNames.end() ;
314 : ++pName )
315 : {
316 : try
317 : {
318 0 : const OUString& sName = *pName;
319 0 : const CacheItem aFilter = pCache->getItem(FilterCache::E_FILTER, sName);
320 0 : CacheItem::const_iterator pProp ;
321 :
322 : // "matchByDocumentService=" => any filter will be addressed here
323 : // "matchByDocumentService=all" => any filter will be addressed here
324 : // "matchByDocumentService=com.sun.star..." => only filter matching this document service will be addressed
325 0 : OUString sCheckValue = aFilter.getUnpackedValueOrDefault(PROPNAME_DOCUMENTSERVICE, OUString());
326 0 : if (
327 0 : (!sDocumentService.isEmpty() ) &&
328 0 : (!sDocumentService.equals(QUERY_CONSTVALUE_ALL)) &&
329 0 : (!sCheckValue.equals(sDocumentService) )
330 : )
331 : {
332 0 : continue; // ignore filter -> try next one!
333 : }
334 :
335 : // "iflags=" => not allowed
336 : // "iflags=-1" => not allowed
337 : // "iflags=0" => not useful
338 : // "iflags=283648" => only filter, which has set these flag field will be addressed
339 0 : sal_Int32 nCheckValue = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, (sal_Int32)0);
340 0 : if (
341 0 : (nIFlags > 0 ) &&
342 0 : ((nCheckValue & nIFlags) != nIFlags)
343 : )
344 : {
345 0 : continue; // ignore filter -> try next one!
346 : }
347 :
348 : // "eflags=" => not allowed
349 : // "eflags=-1" => not allowed
350 : // "eflags=0" => not useful
351 : // "eflags=283648" => only filter, which has not set these flag field will be addressed
352 0 : if (
353 0 : (nEFlags > 0 ) &&
354 0 : ((nCheckValue & nEFlags) == nEFlags)
355 : )
356 : {
357 0 : continue; // ignore filter -> try next one!
358 : }
359 :
360 : // OK - this filter passed all checks.
361 : // It match the query ...
362 0 : lResult.push_back(sName);
363 : }
364 0 : catch(const css::uno::RuntimeException&)
365 0 : { throw; }
366 0 : catch(const css::uno::Exception&)
367 0 : { continue; }
368 : }
369 :
370 0 : aLock.clear();
371 : // <- SAFE ----------------------
372 :
373 0 : return lResult;
374 : }
375 :
376 :
377 :
378 : class stlcomp_removeIfMatchFlags
379 : {
380 : private:
381 : FilterCache* m_pCache ;
382 : sal_Int32 m_nFlags ;
383 : sal_Bool m_bIFlags;
384 :
385 : public:
386 0 : stlcomp_removeIfMatchFlags(FilterCache* pCache ,
387 : sal_Int32 nFlags ,
388 : sal_Bool bIFlags)
389 : : m_pCache (pCache )
390 : , m_nFlags (nFlags )
391 0 : , m_bIFlags(bIFlags)
392 0 : {}
393 :
394 0 : bool operator() (const OUString& sFilter) const
395 : {
396 : try
397 : {
398 0 : const CacheItem aFilter = m_pCache->getItem(FilterCache::E_FILTER, sFilter);
399 0 : sal_Int32 nFlags = aFilter.getUnpackedValueOrDefault(PROPNAME_FLAGS, ((sal_Int32)0));
400 :
401 0 : bool bMatch = false;
402 0 : if (m_bIFlags)
403 : // IFlags are interpeted as ALL_FLAGS_MUST_MATCH !
404 0 : bMatch = ((nFlags & m_nFlags) == m_nFlags);
405 : else
406 : // EFlags are interpreted as ATE_LEAST_ONE_FLAG_MUST_MATCH !
407 0 : bMatch = !(nFlags & m_nFlags);
408 : // We are asked for bRemove ! And bMatch = !bRemove => so bRemove = !bMatch .-)
409 0 : return !bMatch;
410 : }
411 0 : catch(const css::container::NoSuchElementException &)
412 : {
413 0 : return true;
414 : }
415 : }
416 : };
417 :
418 :
419 :
420 0 : OUStringList FilterFactory::impl_getSortedFilterList(const QueryTokenizer& lTokens) const
421 : {
422 : // analyze the given query parameter
423 0 : QueryTokenizer::const_iterator pIt1;
424 :
425 0 : OUString sModule;
426 0 : sal_Int32 nIFlags = -1;
427 0 : sal_Int32 nEFlags = -1;
428 :
429 0 : pIt1 = lTokens.find(QUERY_PARAM_MODULE);
430 0 : if (pIt1 != lTokens.end())
431 0 : sModule = pIt1->second;
432 0 : pIt1 = lTokens.find(QUERY_PARAM_IFLAGS);
433 0 : if (pIt1 != lTokens.end())
434 0 : nIFlags = OUString(pIt1->second).toInt32();
435 0 : pIt1 = lTokens.find(QUERY_PARAM_EFLAGS);
436 0 : if (pIt1 != lTokens.end())
437 0 : nEFlags = OUString(pIt1->second).toInt32();
438 :
439 : // simple search for filters of one specific module.
440 0 : OUStringList lFilterList;
441 0 : if (!sModule.isEmpty())
442 0 : lFilterList = impl_getSortedFilterListForModule(sModule, nIFlags, nEFlags);
443 : else
444 : {
445 : // more complex search for all filters
446 : // We check first, which office modules are installed ...
447 0 : OUStringList lModules = impl_getListOfInstalledModules();
448 0 : OUStringList::const_iterator pIt2;
449 0 : for ( pIt2 = lModules.begin();
450 0 : pIt2 != lModules.end() ;
451 : ++pIt2 )
452 : {
453 0 : sModule = *pIt2;
454 0 : OUStringList lFilters4Module = impl_getSortedFilterListForModule(sModule, nIFlags, nEFlags);
455 0 : OUStringList::const_iterator pIt3;
456 0 : for ( pIt3 = lFilters4Module.begin();
457 0 : pIt3 != lFilters4Module.end() ;
458 : ++pIt3 )
459 : {
460 0 : const OUString& sFilter = *pIt3;
461 0 : lFilterList.push_back(sFilter);
462 : }
463 0 : }
464 : }
465 :
466 0 : return lFilterList;
467 : }
468 :
469 :
470 :
471 0 : OUStringList FilterFactory::impl_getListOfInstalledModules() const
472 : {
473 : // SAFE -> ----------------------
474 0 : ::osl::ResettableMutexGuard aLock(m_aLock);
475 0 : css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
476 0 : aLock.clear();
477 : // <- SAFE ----------------------
478 :
479 0 : css::uno::Reference< css::container::XNameAccess > xModuleConfig = officecfg::Setup::Office::Factories::get(xContext);
480 0 : OUStringList lModules(xModuleConfig->getElementNames());
481 0 : return lModules;
482 : }
483 :
484 :
485 :
486 0 : OUStringList FilterFactory::impl_getSortedFilterListForModule(const OUString& sModule,
487 : sal_Int32 nIFlags,
488 : sal_Int32 nEFlags) const
489 : {
490 0 : OUStringList lSortedFilters = impl_readSortedFilterListFromConfig(sModule);
491 :
492 : // get all filters for the requested module
493 0 : CacheItem lIProps;
494 0 : lIProps[PROPNAME_DOCUMENTSERVICE] <<= sModule;
495 :
496 : // SAFE -> ----------------------
497 0 : ::osl::ResettableMutexGuard aLock(m_aLock);
498 0 : FilterCache* pCache = impl_getWorkingCache();
499 0 : OUStringList lOtherFilters = pCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
500 0 : aLock.clear();
501 : // <- SAFE ----------------------
502 :
503 : // bring "other" filters in an alphabeticly order
504 : // It's needed below.
505 0 : ::std::sort(lOtherFilters.begin(), lOtherFilters.end());
506 :
507 : // merge both lists together
508 0 : OUStringList lMergedFilters = lSortedFilters;
509 0 : const OUStringList::const_iterator itlOtherFiltersEnd = lOtherFilters.end();
510 0 : const OUStringList::const_iterator itlSortedFiltersEnd = lSortedFilters.end();
511 0 : for (OUStringList::const_iterator pIt = lOtherFilters.begin();
512 : pIt != itlOtherFiltersEnd ;
513 : ++pIt )
514 : {
515 0 : if (::std::find(lSortedFilters.begin(), lSortedFilters.end(), *pIt) == itlSortedFiltersEnd)
516 0 : lMergedFilters.push_back(*pIt);
517 : }
518 :
519 0 : OUStringList::iterator pItToErase;
520 :
521 : // remove all filters from this merged list, which does not fit the flag specification
522 0 : if (nIFlags != -1)
523 : {
524 0 : pItToErase = ::std::remove_if(lMergedFilters.begin(), lMergedFilters.end(), stlcomp_removeIfMatchFlags(pCache, nIFlags, sal_True));
525 0 : lMergedFilters.erase(pItToErase, lMergedFilters.end());
526 : }
527 0 : if (nEFlags != -1)
528 : {
529 0 : pItToErase = ::std::remove_if(lMergedFilters.begin(), lMergedFilters.end(), stlcomp_removeIfMatchFlags(pCache, nEFlags, sal_False));
530 0 : lMergedFilters.erase(pItToErase, lMergedFilters.end());
531 : }
532 :
533 : // sort the default filter to the front of this list
534 : // TODO
535 :
536 0 : return lMergedFilters;
537 : }
538 :
539 :
540 :
541 0 : OUStringList FilterFactory::impl_readSortedFilterListFromConfig(const OUString& sModule) const
542 : {
543 : // SAFE -> ----------------------
544 0 : ::osl::ResettableMutexGuard aLock(m_aLock);
545 0 : css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
546 0 : aLock.clear();
547 : // <- SAFE ----------------------
548 :
549 : try
550 : {
551 0 : css::uno::Reference< css::container::XNameAccess > xUISortConfig = officecfg::TypeDetection::UISort::ModuleDependendFilterOrder::get(xContext);
552 : // dont check the module name here. If it does not exists, an exception is thrown and catched below.
553 : // We return an empty list as result then.
554 0 : css::uno::Reference< css::container::XNameAccess > xModule;
555 0 : xUISortConfig->getByName(sModule) >>= xModule;
556 0 : if (xModule.is()) // only to be on the safe side of life if the exception was not thrown .-)
557 : {
558 : // Note: conversion of the returned Any to OUStringList throws
559 : // an IllegalArgumentException if the type does not match ...
560 : // but it resets the OUStringList to a length of 0 if the Any is empty!
561 0 : OUStringList lSortedFilters(xModule->getByName(PROPNAME_SORTEDFILTERLIST));
562 0 : return lSortedFilters;
563 0 : }
564 : }
565 0 : catch(const css::uno::RuntimeException&)
566 0 : { throw; }
567 0 : catch(const css::uno::Exception&)
568 : {}
569 :
570 0 : return OUStringList();
571 : }
572 :
573 :
574 :
575 15418 : OUString FilterFactory::impl_getImplementationName()
576 : {
577 15418 : return OUString( "com.sun.star.comp.filter.config.FilterFactory" );
578 : }
579 :
580 :
581 :
582 15106 : css::uno::Sequence< OUString > FilterFactory::impl_getSupportedServiceNames()
583 : {
584 15106 : css::uno::Sequence< OUString > lServiceNames(1);
585 15106 : lServiceNames[0] = "com.sun.star.document.FilterFactory";
586 15106 : return lServiceNames;
587 : }
588 :
589 :
590 :
591 15032 : css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
592 : {
593 15032 : FilterFactory* pNew = new FilterFactory( comphelper::getComponentContext(xSMGR) );
594 15032 : return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XMultiServiceFactory* >(pNew), css::uno::UNO_QUERY);
595 : }
596 :
597 : } // namespace config
598 : } // namespace filter
599 :
600 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|