LibreOffice Module sfx2 (master) 1
fltfnc.cxx
Go to the documentation of this file.
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 <com/sun/star/uno/Exception.hpp>
22#include <com/sun/star/beans/PropertyValue.hpp>
23#include <com/sun/star/beans/NamedValue.hpp>
24#include <com/sun/star/container/XNameAccess.hpp>
25#include <com/sun/star/container/XEnumeration.hpp>
26#include <com/sun/star/document/XTypeDetection.hpp>
27#include <com/sun/star/container/XContainerQuery.hpp>
28#include <com/sun/star/io/XInputStream.hpp>
29#include <com/sun/star/task/XInteractionHandler.hpp>
30#include <com/sun/star/lang/XMultiServiceFactory.hpp>
31
33
34#include <sot/exchange.hxx>
35#include <utility>
36#include <vcl/svapp.hxx>
37#include <vcl/weld.hxx>
38#include <rtl/ustring.hxx>
39#include <rtl/ustrbuf.hxx>
40#include <sal/log.hxx>
41#include <svl/stritem.hxx>
42
44
45#include <sal/types.h>
46#include <com/sun/star/uno/Reference.hxx>
49#include <tools/urlobj.hxx>
50
53
54#include <sfx2/docfilt.hxx>
55#include <sfx2/fcontnr.hxx>
56#include <sfxtypes.hxx>
57#include <sfx2/docfile.hxx>
58#include <sfx2/strings.hrc>
59#include <sfx2/sfxresid.hxx>
60#include <sfx2/objsh.hxx>
61#include <sfx2/sfxsids.hrc>
62#include "fltlst.hxx"
63#include <arrdecl.hxx>
64
65#include <vector>
66#include <memory>
67
68#if defined(DBG_UTIL)
69unsigned SfxStack::nLevel = 0;
70#endif
71
72using namespace com::sun::star;
73
75static bool bFirstRead = true;
76
77static void CreateFilterArr()
78{
79 static SfxFilterList_Impl theSfxFilterArray;
80 pFilterArr = &theSfxFilterArray;
81 static SfxFilterListener theSfxFilterListener;
82}
83
84static OUString ToUpper_Impl( const OUString &rStr )
85{
86 return SvtSysLocale().GetCharClass().uppercase( rStr );
87}
88
90{
91public:
92 OUString aName;
93
94 explicit SfxFilterContainer_Impl( OUString _aName )
95 : aName(std::move( _aName ))
96 {
97 }
98};
99
100std::shared_ptr<const SfxFilter> SfxFilterContainer::GetFilter4EA(const OUString& rEA, SfxFilterFlags nMust, SfxFilterFlags nDont) const
101{
102 SfxFilterMatcher aMatch(pImpl->aName);
103 return aMatch.GetFilter4EA(rEA, nMust, nDont);
104}
105
106std::shared_ptr<const SfxFilter> SfxFilterContainer::GetFilter4Extension(const OUString& rExt, SfxFilterFlags nMust, SfxFilterFlags nDont) const
107{
108 SfxFilterMatcher aMatch(pImpl->aName);
109 return aMatch.GetFilter4Extension(rExt, nMust, nDont);
110}
111
112std::shared_ptr<const SfxFilter> SfxFilterContainer::GetFilter4FilterName(const OUString& rName, SfxFilterFlags nMust, SfxFilterFlags nDont) const
113{
114 SfxFilterMatcher aMatch(pImpl->aName);
115 return aMatch.GetFilter4FilterName(rName, nMust, nDont);
116}
117
118std::shared_ptr<const SfxFilter> SfxFilterContainer::GetAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont ) const
119{
120 SfxFilterMatcher aMatch( pImpl->aName );
121 return aMatch.GetAnyFilter( nMust, nDont );
122}
123
124
126 : pImpl( new SfxFilterContainer_Impl( rName ) )
127{
128}
129
130
132{
133}
134
135
136OUString const & SfxFilterContainer::GetName() const
137{
138 return pImpl->aName;
139}
140
141std::shared_ptr<const SfxFilter> SfxFilterContainer::GetDefaultFilter_Impl( std::u16string_view rName )
142{
143 // Try to find out the type of factory.
144 // Interpret given name as Service- and ShortName!
145 SvtModuleOptions aOpt;
149
150 // could not classify factory by its service nor by its short name.
151 // Must be an unknown factory! => return NULL
153 return nullptr;
154
155 // For the following code we need some additional information.
156 OUString sServiceName = aOpt.GetFactoryName(eFactory);
157 OUString sDefaultFilter = aOpt.GetFactoryDefaultFilter(eFactory);
158
159 // Try to get the default filter. Don't forget to verify it.
160 // May the set default filter does not exists any longer or
161 // does not fit the given factory.
162 const SfxFilterMatcher aMatcher;
163 std::shared_ptr<const SfxFilter> pFilter = aMatcher.GetFilter4FilterName(sDefaultFilter);
164
165 if (
166 pFilter &&
167 !pFilter->GetServiceName().equalsIgnoreAsciiCase(sServiceName)
168 )
169 {
170 pFilter = nullptr;
171 }
172
173 // If at least no default filter could be located - use any filter of this
174 // factory.
175 if (!pFilter)
176 {
177 if ( bFirstRead )
179
180 for (const std::shared_ptr<const SfxFilter>& pCheckFilter : *pFilterArr)
181 {
182 if ( pCheckFilter->GetServiceName().equalsIgnoreAsciiCase(sServiceName) )
183 {
184 pFilter = pCheckFilter;
185 break;
186 }
187 }
188 }
189
190 return pFilter;
191}
192
193
194// Impl-Data is shared between all FilterMatchers of the same factory
196{
197public:
198 OUString aName;
199 mutable SfxFilterList_Impl* pList; // is created on demand
200
201 void InitForIterating() const;
202 void Update() const;
203 explicit SfxFilterMatcher_Impl(OUString _aName)
204 : aName(std::move(_aName))
205 , pList(nullptr)
206 {
207 }
209 {
210 // SfxFilterMatcher_Impl::InitForIterating() will set pList to
211 // either the global filter array matcher pFilterArr, or to
212 // a new SfxFilterList_Impl.
213 if (pList != pFilterArr)
214 delete pList;
215 }
216};
217
218namespace
219{
220 std::vector<std::unique_ptr<SfxFilterMatcher_Impl> > aImplArr;
221 int nSfxFilterMatcherCount;
222
223 SfxFilterMatcher_Impl & getSfxFilterMatcher_Impl(const OUString &rName)
224 {
225 OUString aName;
226
227 if (!rName.isEmpty())
229
230 // find the impl-Data of any comparable FilterMatcher that was created
231 // previously
232 for (std::unique_ptr<SfxFilterMatcher_Impl>& aImpl : aImplArr)
233 if (aImpl->aName == aName)
234 return *aImpl;
235
236 // first Matcher created for this factory
237 aImplArr.push_back(std::make_unique<SfxFilterMatcher_Impl>(aName));
238 return *aImplArr.back();
239 }
240}
241
243 : m_rImpl( getSfxFilterMatcher_Impl(rName) )
244{
245 ++nSfxFilterMatcherCount;
246}
247
249 : m_rImpl( getSfxFilterMatcher_Impl(OUString()) )
250{
251 // global FilterMatcher always uses global filter array (also created on
252 // demand)
253 ++nSfxFilterMatcherCount;
254}
255
257{
258 --nSfxFilterMatcherCount;
259 if (nSfxFilterMatcherCount == 0)
260 aImplArr.clear();
261}
262
264{
265 if ( pList )
266 {
267 // this List was already used
268 pList->clear();
269 for (const std::shared_ptr<const SfxFilter>& pFilter : *pFilterArr)
270 {
271 if ( pFilter->GetServiceName() == aName )
272 pList->push_back( pFilter );
273 }
274 }
275}
276
278{
279 if ( pList )
280 return;
281
282 if ( bFirstRead )
283 // global filter array has not been created yet
285
286 if ( !aName.isEmpty() )
287 {
288 // matcher of factory: use only filters of that document type
290 Update();
291 }
292 else
293 {
294 // global matcher: use global filter array
296 }
297}
298
299std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont ) const
300{
302 for (const std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
303 {
304 SfxFilterFlags nFlags = pFilter->GetFilterFlags();
305 if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) )
306 return pFilter;
307 }
308
309 return nullptr;
310}
311
312
314 SfxMedium const & rMedium,
315 std::shared_ptr<const SfxFilter>& rpFilter ) const
316{
317 uno::Reference<document::XTypeDetection> xDetection(
318 comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.TypeDetection"), uno::UNO_QUERY);
319
320 OUString sTypeName;
321 try
322 {
323 sTypeName = xDetection->queryTypeByURL( rMedium.GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
324 }
325 catch (uno::Exception&)
326 {
327 }
328
329 rpFilter = nullptr;
330 if ( !sTypeName.isEmpty() )
331 {
332 // make sure filter list is initialized
334 rpFilter = GetFilter4EA( sTypeName );
335 }
336
337 return rpFilter ? ERRCODE_NONE : ERRCODE_ABORT;
338}
339
340
341ErrCode SfxFilterMatcher::GuessFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
342{
343 return GuessFilterControlDefaultUI( rMedium, rpFilter, nMust, nDont );
344}
345
346
347ErrCode SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
348{
349 std::shared_ptr<const SfxFilter> pOldFilter = rpFilter;
350
351 // no detection service -> nothing to do !
352 uno::Reference<document::XTypeDetection> xDetection(
353 comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.TypeDetection"), uno::UNO_QUERY);
354
355 if (!xDetection.is())
356 return ERRCODE_ABORT;
357
358 try
359 {
360 // open the stream one times only ...
361 // Otherwise it will be tried more than once and show the same interaction more than once ...
362
364 uno::Reference< io::XInputStream > xInStream = rMedium.GetInputStream();
365 OUString aFilterName;
366 OUString sTypeName;
367
368 // stream exists => deep detection (with preselection ... if possible)
369 if (xInStream.is())
370 {
371 utl::MediaDescriptor aDescriptor;
372
373 aDescriptor[utl::MediaDescriptor::PROP_URL ] <<= sURL;
374 aDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM ] <<= xInStream;
376 SfxStringItem const * it = rMedium.GetItemSet().GetItem(SID_REFERER);
377 if (it != nullptr) {
379 <<= it->GetValue();
380 }
381
382 if ( !m_rImpl.aName.isEmpty() )
384
385 if ( pOldFilter )
386 {
387 aDescriptor[utl::MediaDescriptor::PROP_TYPENAME ] <<= pOldFilter->GetTypeName();
388 aDescriptor[utl::MediaDescriptor::PROP_FILTERNAME] <<= pOldFilter->GetFilterName();
389 }
390
391 uno::Sequence< beans::PropertyValue > lDescriptor = aDescriptor.getAsConstPropertyValueList();
392 sTypeName = xDetection->queryTypeByDescriptor(lDescriptor, true); // lDescriptor is used as In/Out param ... don't use aDescriptor.getAsConstPropertyValueList() directly!
393
394 for (const auto& rProp : std::as_const(lDescriptor))
395 {
396 if (rProp.Name == "FilterName")
397 // Type detection picked a preferred filter for this format.
398 aFilterName = rProp.Value.get<OUString>();
399 }
400 }
401 // no stream exists => try flat detection without preselection as fallback
402 else
403 sTypeName = xDetection->queryTypeByURL(sURL);
404
405 if (!sTypeName.isEmpty())
406 {
407 std::shared_ptr<const SfxFilter> pNewFilter;
408 if (!aFilterName.isEmpty())
409 // Type detection returned a suitable filter for this. Use it.
410 pNewFilter = SfxFilter::GetFilterByName(aFilterName);
411
412 // fdo#78742 respect requested document service if set
413 if (!pNewFilter || (!m_rImpl.aName.isEmpty()
414 && m_rImpl.aName != pNewFilter->GetServiceName()))
415 {
416 // detect filter by given type
417 // In case of this matcher is bound to a particular document type:
418 // If there is no acceptable type for this document at all, the type detection has possibly returned something else.
419 // The DocumentService property is only a preselection, and all preselections are considered as optional!
420 // This "wrong" type will be sorted out now because we match only allowed filters to the detected type
421 uno::Sequence< beans::NamedValue > lQuery { { "Name", css::uno::Any(sTypeName) } };
422
423 pNewFilter = GetFilterForProps(lQuery, nMust, nDont);
424 }
425
426 if (pNewFilter)
427 {
428 rpFilter = pNewFilter;
429 return ERRCODE_NONE;
430 }
431 }
432 }
433 catch (const uno::Exception&)
434 {}
435
436 return ERRCODE_ABORT;
437}
438
439
440bool SfxFilterMatcher::IsFilterInstalled_Impl( const std::shared_ptr<const SfxFilter>& pFilter )
441{
442 if ( pFilter->GetFilterFlags() & SfxFilterFlags::MUSTINSTALL )
443 {
444 // Here could a re-installation be offered
445 OUString aText( SfxResId(STR_FILTER_NOT_INSTALLED) );
446 aText = aText.replaceFirst( "$(FILTER)", pFilter->GetUIName() );
447 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr,
448 VclMessageType::Question, VclButtonsType::YesNo,
449 aText));
450 xQueryBox->set_default_response(RET_YES);
451
452 short nRet = xQueryBox->run();
453 if ( nRet == RET_YES )
454 {
455#ifdef DBG_UTIL
456 // Start Setup
457 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
458 VclMessageType::Info, VclButtonsType::Ok,
459 "Here should the Setup now be starting!"));
460 xInfoBox->run();
461#endif
462 // Installation must still give feedback if it worked or not,
463 // then the Filterflag be deleted
464 }
465
466 return ( !(pFilter->GetFilterFlags() & SfxFilterFlags::MUSTINSTALL) );
467 }
468 else if ( pFilter->GetFilterFlags() & SfxFilterFlags::CONSULTSERVICE )
469 {
470 OUString aText( SfxResId(STR_FILTER_CONSULT_SERVICE) );
471 aText = aText.replaceFirst( "$(FILTER)", pFilter->GetUIName() );
472 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
473 VclMessageType::Info, VclButtonsType::Ok,
474 aText));
475 xInfoBox->run();
476 return false;
477 }
478 else
479 return true;
480}
481
482
483ErrCode SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter ) const
484/* [Description]
485
486 Here the Filter selection box is pulled up. Otherwise GuessFilter
487 */
488
489{
490 std::shared_ptr<const SfxFilter> pOldFilter = rMedium.GetFilter();
491 if ( pOldFilter )
492 {
493 if( !IsFilterInstalled_Impl( pOldFilter ) )
494 pOldFilter = nullptr;
495 else
496 {
497 const SfxStringItem* pSalvageItem = rMedium.GetItemSet().GetItem(SID_DOC_SALVAGE, false);
498 if ( ( pOldFilter->GetFilterFlags() & SfxFilterFlags::PACKED ) && pSalvageItem )
499 // Salvage is always done without packing
500 pOldFilter = nullptr;
501 }
502 }
503
504 std::shared_ptr<const SfxFilter> pFilter = pOldFilter;
505
506 bool bPreview = rMedium.IsPreview_Impl();
507 const SfxStringItem* pReferer = rMedium.GetItemSet().GetItem(SID_REFERER, false);
508 if ( bPreview && rMedium.IsRemote() && ( !pReferer || !pReferer->GetValue().match("private:searchfolder:") ) )
509 return ERRCODE_ABORT;
510
511 ErrCode nErr = GuessFilter( rMedium, pFilter );
512 if ( nErr == ERRCODE_ABORT )
513 return nErr;
514
515 if ( nErr == ERRCODE_IO_PENDING )
516 {
517 rpFilter = pFilter;
518 return nErr;
519 }
520
521 if ( !pFilter )
522 {
523 std::shared_ptr<const SfxFilter> pInstallFilter;
524
525 // Now test the filter which are not installed (ErrCode is irrelevant)
526 GuessFilter( rMedium, pInstallFilter, SfxFilterFlags::IMPORT, SfxFilterFlags::CONSULTSERVICE );
527 if ( pInstallFilter )
528 {
529 if ( IsFilterInstalled_Impl( pInstallFilter ) )
530 // Maybe the filter was installed afterwards.
531 pFilter = pInstallFilter;
532 }
533 else
534 {
535 // Now test the filter, which first must be obtained by Star
536 // (ErrCode is irrelevant)
537 GuessFilter( rMedium, pInstallFilter, SfxFilterFlags::IMPORT, SfxFilterFlags::NONE );
538 if ( pInstallFilter )
539 IsFilterInstalled_Impl( pInstallFilter );
540 }
541 }
542
543 bool bHidden = bPreview;
544 const SfxStringItem* pFlags = rMedium.GetItemSet().GetItem(SID_OPTIONS, false);
545 if ( !bHidden && pFlags )
546 {
547 OUString aFlags( pFlags->GetValue() );
548 aFlags = aFlags.toAsciiUpperCase();
549 if( -1 != aFlags.indexOf( 'H' ) )
550 bHidden = true;
551 }
552 rpFilter = pFilter;
553
554 if ( bHidden )
555 nErr = pFilter ? ERRCODE_NONE : ERRCODE_ABORT;
556 return nErr;
557}
558
559std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilterForProps( const css::uno::Sequence < beans::NamedValue >& aSeq, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
560{
561 uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
562 if( !xServiceManager )
563 return nullptr;
564
565 static constexpr OUStringLiteral sTypeDetection = u"com.sun.star.document.TypeDetection";
566 uno::Reference< container::XContainerQuery > xTypeCFG( xServiceManager->createInstance( sTypeDetection ), uno::UNO_QUERY );
567 if ( !xTypeCFG )
568 return nullptr;
569
570 // make query for all types matching the properties
571 uno::Reference < css::container::XEnumeration > xEnum = xTypeCFG->createSubSetEnumerationByProperties( aSeq );
572 uno::Sequence<beans::PropertyValue> aProps;
573 while ( xEnum->hasMoreElements() )
574 {
575 static constexpr OUStringLiteral sPreferredFilter = u"PreferredFilter";
576 static constexpr OUStringLiteral sName = u"Name";
577
578 xEnum->nextElement() >>= aProps;
579 OUString aValue, aName;
580 for( const auto & rPropVal : aProps)
581 {
582 if (rPropVal.Name == sPreferredFilter)
583 rPropVal.Value >>= aValue;
584 else if (rPropVal.Name == sName)
585 rPropVal.Value >>= aName;
586 }
587
588 // try to get the preferred filter (works without loading all filters!)
589 if ( !aValue.isEmpty() )
590 {
591 std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName( aValue );
592 if ( !pFilter || (pFilter->GetFilterFlags() & nMust) != nMust || (pFilter->GetFilterFlags() & nDont ) )
593 // check for filter flags
594 // pFilter == 0: if preferred filter is a Writer filter, but Writer module is not installed
595 continue;
596
597 if ( !m_rImpl.aName.isEmpty() )
598 {
599 // if this is not the global FilterMatcher: check if filter matches the document type
600 if ( pFilter->GetServiceName() != m_rImpl.aName )
601 {
602 // preferred filter belongs to another document type; now we must search the filter
604 pFilter = GetFilter4EA( aName, nMust, nDont );
605 if ( pFilter )
606 return pFilter;
607 }
608 else
609 return pFilter;
610 }
611 else
612 return pFilter;
613 }
614 }
615
616 return nullptr;
617}
618
619std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4Mime( const OUString& rMediaType, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
620{
621 if ( m_rImpl.pList )
622 {
623 for (const std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
624 {
625 SfxFilterFlags nFlags = pFilter->GetFilterFlags();
626 if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetMimeType() == rMediaType )
627 return pFilter;
628 }
629
630 return nullptr;
631 }
632
633 css::uno::Sequence < css::beans::NamedValue > aSeq { { "MediaType", css::uno::Any(rMediaType) } };
634 return GetFilterForProps( aSeq, nMust, nDont );
635}
636
637std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4EA( const OUString& rType, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
638{
639 if ( m_rImpl.pList )
640 {
641 std::shared_ptr<const SfxFilter> pFirst;
642 for (const std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
643 {
644 SfxFilterFlags nFlags = pFilter->GetFilterFlags();
645 if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetTypeName() == rType )
646 {
647 if (nFlags & SfxFilterFlags::PREFERED)
648 return pFilter;
649 if (!pFirst)
650 pFirst = pFilter;
651 }
652 }
653 if (pFirst)
654 return pFirst;
655
656 return nullptr;
657 }
658
659 css::uno::Sequence < css::beans::NamedValue > aSeq { { "Name", css::uno::Any(rType) } };
660 return GetFilterForProps( aSeq, nMust, nDont );
661}
662
663std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
664{
665 if ( m_rImpl.pList )
666 {
667 if (OUString sExt = ToUpper_Impl(rExt); !sExt.isEmpty())
668 {
669 if (sExt[0] != '.')
670 sExt = "." + sExt;
671
672 for (const std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
673 {
674 SfxFilterFlags nFlags = pFilter->GetFilterFlags();
675 if ((nFlags & nMust) == nMust && !(nFlags & nDont))
676 {
677 OUString sWildCard = ToUpper_Impl(pFilter->GetWildcard().getGlob());
678
679 WildCard aCheck(sWildCard, ';');
680 if (aCheck.Matches(sExt))
681 return pFilter;
682 }
683 }
684 }
685
686 return nullptr;
687 }
688
689 // Use extension without dot!
690 OUString sExt( rExt );
691 if ( sExt.startsWith(".") )
692 sExt = sExt.copy(1);
693
694 css::uno::Sequence < css::beans::NamedValue > aSeq
695 { { "Extensions", css::uno::Any(uno::Sequence < OUString > { sExt } ) } };
696 return GetFilterForProps( aSeq, nMust, nDont );
697}
698
699std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4ClipBoardId( SotClipboardFormatId nId, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
700{
701 if (nId == SotClipboardFormatId::NONE)
702 return nullptr;
703
704 css::uno::Sequence < css::beans::NamedValue > aSeq
705 { { "ClipboardFormat", css::uno::Any(SotExchange::GetFormatName( nId )) } };
706 return GetFilterForProps( aSeq, nMust, nDont );
707}
708
709std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4UIName( std::u16string_view rName, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
710{
712 std::shared_ptr<const SfxFilter> pFirstFilter;
713 for (const std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
714 {
715 SfxFilterFlags nFlags = pFilter->GetFilterFlags();
716 if ( (nFlags & nMust) == nMust &&
717 !(nFlags & nDont ) && pFilter->GetUIName() == rName )
718 {
719 if ( pFilter->GetFilterFlags() & SfxFilterFlags::PREFERED )
720 return pFilter;
721 else if ( !pFirstFilter )
722 pFirstFilter = pFilter;
723 }
724 }
725 return pFirstFilter;
726}
727
728std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
729{
730 std::u16string_view aName( rName );
731 sal_Int32 nIndex = rName.indexOf(": ");
732 if ( nIndex != -1 )
733 {
734 SAL_WARN( "sfx.bastyp", "Old filter name used!");
735 aName = rName.subView( nIndex + 2 );
736 }
737
738 if ( bFirstRead )
739 {
740 uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
741 uno::Reference< container::XNameAccess > xFilterCFG ;
742 uno::Reference< container::XNameAccess > xTypeCFG ;
743 if( xServiceManager.is() )
744 {
745 static constexpr OUStringLiteral sFilterFactory = u"com.sun.star.document.FilterFactory";
746 static constexpr OUStringLiteral sTypeDetection = u"com.sun.star.document.TypeDetection";
747 xFilterCFG.set( xServiceManager->createInstance( sFilterFactory ), uno::UNO_QUERY );
748 xTypeCFG.set( xServiceManager->createInstance( sTypeDetection ), uno::UNO_QUERY );
749 }
750
751 if( xFilterCFG.is() && xTypeCFG.is() )
752 {
753 if ( !pFilterArr )
755 else
756 {
757 for (const std::shared_ptr<const SfxFilter>& pFilter : *pFilterArr)
758 {
759 SfxFilterFlags nFlags = pFilter->GetFilterFlags();
760 if ((nFlags & nMust) == nMust && !(nFlags & nDont) && pFilter->GetFilterName().equalsIgnoreAsciiCase(aName))
761 return pFilter;
762 }
763 }
764
765 SfxFilterContainer::ReadSingleFilter_Impl( rName, xTypeCFG, xFilterCFG, false );
766 }
767 }
768
770 if ( !pList )
771 pList = pFilterArr;
772
773 for (const std::shared_ptr<const SfxFilter>& pFilter : *pList)
774 {
775 SfxFilterFlags nFlags = pFilter->GetFilterFlags();
776 if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetFilterName().equalsIgnoreAsciiCase(aName))
777 return pFilter;
778 }
779
780 return nullptr;
781}
782
783IMPL_LINK( SfxFilterMatcher, MaybeFileHdl_Impl, OUString*, pString, bool )
784{
785 std::shared_ptr<const SfxFilter> pFilter = GetFilter4Extension( *pString );
786 return pFilter &&
787 !pFilter->GetWildcard().Matches(u"") &&
788 !pFilter->GetWildcard().Matches(u"*.*") &&
789 !pFilter->GetWildcard().Matches(u"*");
790}
791
792
794 const SfxFilterMatcher& rMatcher,
795 SfxFilterFlags nOrMaskP, SfxFilterFlags nAndMaskP )
796 : nOrMask( nOrMaskP ), nAndMask( nAndMaskP ),
797 nCurrent(0), m_rMatch(rMatcher.m_rImpl)
798{
799 if( nOrMask == static_cast<SfxFilterFlags>(0xffff) ) //Due to faulty build on s
800 nOrMask = SfxFilterFlags::NONE;
802}
803
804
805std::shared_ptr<const SfxFilter> SfxFilterMatcherIter::Find_Impl()
806{
807 std::shared_ptr<const SfxFilter> pFilter;
808 while( nCurrent < m_rMatch.pList->size() )
809 {
810 pFilter = (*m_rMatch.pList)[nCurrent++];
811 SfxFilterFlags nFlags = pFilter->GetFilterFlags();
812 if( ((nFlags & nOrMask) == nOrMask ) && !(nFlags & nAndMask ) )
813 break;
814 pFilter = nullptr;
815 }
816
817 return pFilter;
818}
819
820std::shared_ptr<const SfxFilter> SfxFilterMatcherIter::First()
821{
822 nCurrent = 0;
823 return Find_Impl();
824}
825
826
827std::shared_ptr<const SfxFilter> SfxFilterMatcherIter::Next()
828{
829 return Find_Impl();
830}
831
832/*---------------------------------------------------------------
833 helper to build own formatted string from given stringlist by
834 using given separator
835 ---------------------------------------------------------------*/
836static OUString implc_convertStringlistToString( const uno::Sequence< OUString >& lList ,
837 sal_Unicode cSeparator,
838 std::u16string_view sPrefix )
839{
840 OUStringBuffer sString ( 1000 ) ;
841 sal_Int32 nCount = lList.getLength();
842 sal_Int32 nItem = 0 ;
843 for( nItem=0; nItem<nCount; ++nItem )
844 {
845 if( !sPrefix.empty() )
846 {
847 sString.append( sPrefix );
848 }
849 sString.append( lList[nItem] );
850 if( nItem+1<nCount )
851 {
852 sString.append( cSeparator );
853 }
854 }
855 return sString.makeStringAndClear();
856}
857
858
860 const OUString& rName,
861 const uno::Reference< container::XNameAccess >& xTypeCFG,
862 const uno::Reference< container::XNameAccess >& xFilterCFG,
863 bool bUpdate
864 )
865{
866 OUString sFilterName( rName );
868 uno::Sequence< beans::PropertyValue > lFilterProperties;
869 uno::Any aResult;
870 try
871 {
872 aResult = xFilterCFG->getByName( sFilterName );
873 }
874 catch( container::NoSuchElementException& )
875 {
876 aResult = uno::Any();
877 }
878
879 if( !(aResult >>= lFilterProperties) )
880 return;
881
882 // collect information to add filter to container
883 // (attention: some information aren't available on filter directly ... you must search for corresponding type too!)
884 SfxFilterFlags nFlags = SfxFilterFlags::NONE;
885 SotClipboardFormatId nClipboardId = SotClipboardFormatId::NONE;
886 sal_Int32 nFormatVersion = 0 ;
887 OUString sMimeType ;
888 OUString sType ;
889 OUString sUIName ;
890 OUString sHumanName ;
891 OUString sDefaultTemplate ;
892 OUString sUserData ;
893 OUString sExtension ;
894 OUString sServiceName ;
895 bool bEnabled = true ;
896
897 // first get directly available properties
898 for( const auto& rFilterProperty : std::as_const(lFilterProperties) )
899 {
900 if ( rFilterProperty.Name == "FileFormatVersion" )
901 {
902 rFilterProperty.Value >>= nFormatVersion;
903 }
904 else if ( rFilterProperty.Name == "TemplateName" )
905 {
906 rFilterProperty.Value >>= sDefaultTemplate;
907 }
908 else if ( rFilterProperty.Name == "Flags" )
909 {
910 sal_Int32 nTmp(0);
911 rFilterProperty.Value >>= nTmp;
912 assert((nTmp & ~o3tl::typed_flags<SfxFilterFlags>::mask) == 0);
913 nFlags = static_cast<SfxFilterFlags>(nTmp);
914 }
915 else if ( rFilterProperty.Name == "UIName" )
916 {
917 rFilterProperty.Value >>= sUIName;
918 }
919 else if ( rFilterProperty.Name == "UserData" )
920 {
921 uno::Sequence< OUString > lUserData;
922 rFilterProperty.Value >>= lUserData;
923 sUserData = implc_convertStringlistToString( lUserData, ',', u"" );
924 }
925 else if ( rFilterProperty.Name == "DocumentService" )
926 {
927 rFilterProperty.Value >>= sServiceName;
928 }
929 else if (rFilterProperty.Name == "ExportExtension")
930 {
931 // Extension preferred by the filter. This takes precedence
932 // over those that are given in the file format type.
933 rFilterProperty.Value >>= sExtension;
934 sExtension = "*." + sExtension;
935 }
936 else if ( rFilterProperty.Name == "Type" )
937 {
938 rFilterProperty.Value >>= sType;
939 // Try to get filter .. but look for any exceptions!
940 // May be filter was deleted by another thread ...
941 try
942 {
943 aResult = xTypeCFG->getByName( sType );
944 }
945 catch (const container::NoSuchElementException&)
946 {
947 aResult = uno::Any();
948 }
949
950 uno::Sequence< beans::PropertyValue > lTypeProperties;
951 if( aResult >>= lTypeProperties )
952 {
953 // get indirect available properties then (types)
954 for( const auto& rTypeProperty : std::as_const(lTypeProperties) )
955 {
956 if ( rTypeProperty.Name == "ClipboardFormat" )
957 {
958 rTypeProperty.Value >>= sHumanName;
959 }
960 else if ( rTypeProperty.Name == "MediaType" )
961 {
962 rTypeProperty.Value >>= sMimeType;
963 }
964 else if ( rTypeProperty.Name == "Extensions" )
965 {
966 if (sExtension.isEmpty())
967 {
968 uno::Sequence< OUString > lExtensions;
969 rTypeProperty.Value >>= lExtensions;
970 sExtension = implc_convertStringlistToString( lExtensions, ';', u"*." );
971 }
972 }
973 }
974 }
975 }
976 else if ( rFilterProperty.Name == "Enabled" )
977 {
978 rFilterProperty.Value >>= bEnabled;
979 }
980
981 }
982
983 if ( sServiceName.isEmpty() )
984 return;
985
986 // old formats are found ... using HumanPresentableName!
987 if( !sHumanName.isEmpty() )
988 {
989 nClipboardId = SotExchange::RegisterFormatName( sHumanName );
990
991 // For external filters ignore clipboard IDs
992 if(nFlags & SfxFilterFlags::STARONEFILTER)
993 {
994 nClipboardId = SotClipboardFormatId::NONE;
995 }
996 }
997 // register SfxFilter
998 // first erase module name from old filter names!
999 // e.g: "scalc: DIF" => "DIF"
1000 sal_Int32 nStartRealName = sFilterName.indexOf( ": " );
1001 if( nStartRealName != -1 )
1002 {
1003 SAL_WARN( "sfx.bastyp", "Old format, not supported!");
1004 sFilterName = sFilterName.copy( nStartRealName+2 );
1005 }
1006
1007 std::shared_ptr<const SfxFilter> pFilter = bUpdate ? SfxFilter::GetFilterByName( sFilterName ) : nullptr;
1008 if (!pFilter)
1009 {
1010 pFilter = std::make_shared<SfxFilter>( sFilterName ,
1011 sExtension ,
1012 nFlags ,
1013 nClipboardId ,
1014 sType ,
1015 sMimeType ,
1016 sUserData ,
1017 sServiceName ,
1018 bEnabled );
1019 rList.push_back( pFilter );
1020 }
1021 else
1022 {
1023 SfxFilter* pFilt = const_cast<SfxFilter*>(pFilter.get());
1024 pFilt->maFilterName = sFilterName;
1025 pFilt->aWildCard = WildCard(sExtension, ';');
1026 pFilt->nFormatType = nFlags;
1027 pFilt->lFormat = nClipboardId;
1028 pFilt->aTypeName = sType;
1029 pFilt->aMimeType = sMimeType;
1030 pFilt->aUserData = sUserData;
1031 pFilt->aServiceName = sServiceName;
1032 pFilt->mbEnabled = bEnabled;
1033 }
1034
1035 SfxFilter* pFilt = const_cast<SfxFilter*>(pFilter.get());
1036
1037 // Don't forget to set right UIName!
1038 // Otherwise internal name is used as fallback ...
1039 pFilt->SetUIName( sUIName );
1040 pFilt->SetDefaultTemplate( sDefaultTemplate );
1041 if( nFormatVersion )
1042 {
1043 pFilt->SetVersion( nFormatVersion );
1044 }
1045}
1046
1048{
1049 if ( !pFilterArr )
1051
1052 bFirstRead = false;
1054
1055 try
1056 {
1057 // get the FilterFactory service to access the registered filters ... and types!
1058 uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
1059 uno::Reference< container::XNameAccess > xFilterCFG ;
1060 uno::Reference< container::XNameAccess > xTypeCFG ;
1061 if( xServiceManager.is() )
1062 {
1063 xFilterCFG.set( xServiceManager->createInstance( "com.sun.star.document.FilterFactory" ), uno::UNO_QUERY );
1064 xTypeCFG.set( xServiceManager->createInstance( "com.sun.star.document.TypeDetection" ), uno::UNO_QUERY );
1065 }
1066
1067 if( xFilterCFG.is() && xTypeCFG.is() )
1068 {
1069 // select right query to get right set of filters for search module
1070 const uno::Sequence< OUString > lFilterNames = xFilterCFG->getElementNames();
1071 if ( lFilterNames.hasElements() )
1072 {
1073 // If list of filters already exist ...
1074 // ReadExternalFilters must work in update mode.
1075 // Best way seems to mark all filters NOT_INSTALLED
1076 // and change it back for all valid filters afterwards.
1077 if( !rList.empty() )
1078 {
1079 bUpdate = true;
1080 for (const std::shared_ptr<const SfxFilter>& pFilter : rList)
1081 {
1082 SfxFilter* pNonConstFilter = const_cast<SfxFilter*>(pFilter.get());
1083 pNonConstFilter->nFormatType |= SFX_FILTER_NOTINSTALLED;
1084 }
1085 }
1086
1087 // get all properties of filters ... put it into the filter container
1088 for( const OUString& sFilterName : lFilterNames )
1089 {
1090 // Try to get filter .. but look for any exceptions!
1091 // May be filter was deleted by another thread ...
1092 ReadSingleFilter_Impl( sFilterName, xTypeCFG, xFilterCFG, bUpdate );
1093 }
1094 }
1095 }
1096 }
1097 catch(const uno::Exception&)
1098 {
1099 SAL_WARN( "sfx.bastyp", "SfxFilterContainer::ReadFilter()\nException detected. Possible not all filters could be cached." );
1100 }
1101
1102 if ( bUpdate )
1103 {
1104 // global filter array was modified, factory specific ones might need an
1105 // update too
1106 for (const auto& aImpl : aImplArr)
1107 aImpl->Update();
1108 }
1109}
1110
1111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
constexpr OUStringLiteral sServiceName
::std::vector< std::shared_ptr< const SfxFilter > > SfxFilterList_Impl
Definition: arrdecl.hxx:25
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
const OUString & GetValue() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
SfxFilterContainer_Impl(OUString _aName)
Definition: fltfnc.cxx:94
static SAL_DLLPRIVATE void ReadSingleFilter_Impl(const OUString &rName, const css::uno::Reference< css::container::XNameAccess > &xTypeCFG, const css::uno::Reference< css::container::XNameAccess > &xFilterCFG, bool bUpdate)
Definition: fltfnc.cxx:859
std::shared_ptr< const SfxFilter > GetFilter4FilterName(const OUString &rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:112
OUString const & GetName() const
Definition: fltfnc.cxx:136
static SAL_DLLPRIVATE std::shared_ptr< const SfxFilter > GetDefaultFilter_Impl(std::u16string_view)
Definition: fltfnc.cxx:141
std::shared_ptr< const SfxFilter > GetFilter4EA(const OUString &rEA, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:100
std::shared_ptr< const SfxFilter > GetFilter4Extension(const OUString &rExt, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:106
static SAL_DLLPRIVATE void ReadFilters_Impl(bool bUpdate=false)
Definition: fltfnc.cxx:1047
std::shared_ptr< const SfxFilter > GetAnyFilter(SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:118
SfxFilterContainer(const OUString &rName)
Definition: fltfnc.cxx:125
std::unique_ptr< SfxFilterContainer_Impl > pImpl
Definition: fcontnr.hxx:45
SfxFilterFlags nOrMask
Definition: fcontnr.hxx:101
SfxFilterMatcherIter(const SfxFilterMatcher &rMatcher, SfxFilterFlags nMask=SfxFilterFlags::NONE, SfxFilterFlags nNotMask=SFX_FILTER_NOTINSTALLED)
Definition: fltfnc.cxx:793
std::shared_ptr< const SfxFilter > First()
Definition: fltfnc.cxx:820
const SfxFilterMatcher_Impl & m_rMatch
Definition: fcontnr.hxx:104
SfxFilterFlags nAndMask
Definition: fcontnr.hxx:102
sal_uInt16 nCurrent
Definition: fcontnr.hxx:103
SAL_DLLPRIVATE std::shared_ptr< const SfxFilter > Find_Impl()
Definition: fltfnc.cxx:805
std::shared_ptr< const SfxFilter > Next()
Definition: fltfnc.cxx:827
void Update() const
Definition: fltfnc.cxx:263
void InitForIterating() const
Definition: fltfnc.cxx:277
SfxFilterMatcher_Impl(OUString _aName)
Definition: fltfnc.cxx:203
SfxFilterList_Impl * pList
Definition: fltfnc.cxx:199
ErrCode GuessFilterIgnoringContent(SfxMedium const &rMedium, std::shared_ptr< const SfxFilter > &) const
Definition: fltfnc.cxx:313
SfxFilterMatcher_Impl & m_rImpl
Definition: fcontnr.hxx:72
std::shared_ptr< const SfxFilter > GetAnyFilter(SfxFilterFlags nMustg=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:299
ErrCode GuessFilter(SfxMedium &rMedium, std::shared_ptr< const SfxFilter > &, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:341
std::shared_ptr< const SfxFilter > GetFilter4FilterName(const OUString &rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:728
std::shared_ptr< const SfxFilter > GetFilter4ClipBoardId(SotClipboardFormatId nId, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:699
std::shared_ptr< const SfxFilter > GetFilter4UIName(std::u16string_view rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:709
std::shared_ptr< const SfxFilter > GetFilter4EA(const OUString &rEA, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:637
ErrCode DetectFilter(SfxMedium &rMedium, std::shared_ptr< const SfxFilter > &) const
Definition: fltfnc.cxx:483
std::shared_ptr< const SfxFilter > GetFilterForProps(const css::uno::Sequence< css::beans::NamedValue > &aSeq, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:559
ErrCode GuessFilterControlDefaultUI(SfxMedium &rMedium, std::shared_ptr< const SfxFilter > &, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:347
std::shared_ptr< const SfxFilter > GetFilter4Extension(const OUString &rExt, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:663
static SAL_DLLPRIVATE bool IsFilterInstalled_Impl(const std::shared_ptr< const SfxFilter > &pFilter)
Definition: fltfnc.cxx:440
std::shared_ptr< const SfxFilter > GetFilter4Mime(const OUString &rMime, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
Definition: fltfnc.cxx:619
SfxFilterFlags nFormatType
Definition: docfilt.hxx:58
void SetDefaultTemplate(const OUString &rStr)
Definition: docfilt.hxx:100
OUString aUserData
Definition: docfilt.hxx:45
OUString maFilterName
Definition: docfilt.hxx:48
static std::shared_ptr< const SfxFilter > GetFilterByName(const OUString &rName)
Definition: docfilt.cxx:115
void SetVersion(sal_Int32 nVersionP)
Definition: docfilt.hxx:103
OUString aMimeType
Definition: docfilt.hxx:47
SotClipboardFormatId lFormat
Definition: docfilt.hxx:60
OUString aTypeName
Definition: docfilt.hxx:44
void SetUIName(const OUString &rName)
Definition: docfilt.hxx:102
bool mbEnabled
Definition: docfilt.hxx:61
OUString aServiceName
Definition: docfilt.hxx:46
WildCard aWildCard
Definition: docfilt.hxx:42
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const INetURLObject & GetURLObject() const
Definition: docfile.cxx:3597
SfxItemSet & GetItemSet() const
Definition: docfile.cxx:3647
css::uno::Reference< css::io::XInputStream > const & GetInputStream()
Definition: docfile.cxx:3680
css::uno::Reference< css::task::XInteractionHandler > GetInteractionHandler(bool bGetAlways=false)
Definition: docfile.cxx:3076
static OUString GetServiceNameFromFactory(const OUString &rFact)
Definition: objxtor.cxx:921
static unsigned nLevel
Definition: sfxtypes.hxx:29
static OUString GetFormatName(SotClipboardFormatId nFormat)
static SotClipboardFormatId RegisterFormatName(const OUString &rName)
const OUString & GetFactoryName(EFactory eFactory) const
static EFactory ClassifyFactoryByShortName(std::u16string_view sName)
OUString GetFactoryDefaultFilter(EFactory eFactory) const
static EFactory ClassifyFactoryByServiceName(std::u16string_view sName)
const CharClass & GetCharClass() const
bool Matches(std::u16string_view rStr) const
static constexpr OUStringLiteral PROP_INPUTSTREAM
static constexpr OUStringLiteral PROP_URL
static constexpr OUStringLiteral PROP_DOCUMENTSERVICE
static constexpr OUStringLiteral PROP_TYPENAME
static constexpr OUStringLiteral PROP_REFERRER
static constexpr OUStringLiteral PROP_FILTERNAME
static constexpr OUStringLiteral PROP_INTERACTIONHANDLER
int nCount
SfxFilterFlags
#define SFX_FILTER_NOTINSTALLED
float u
#define ERRCODE_IO_PENDING
#define ERRCODE_ABORT
#define ERRCODE_NONE
static SfxFilterList_Impl * pFilterArr
Definition: fltfnc.cxx:74
static OUString implc_convertStringlistToString(const uno::Sequence< OUString > &lList, sal_Unicode cSeparator, std::u16string_view sPrefix)
Definition: fltfnc.cxx:836
IMPL_LINK(SfxFilterMatcher, MaybeFileHdl_Impl, OUString *, pString, bool)
Definition: fltfnc.cxx:783
static void CreateFilterArr()
Definition: fltfnc.cxx:77
static OUString ToUpper_Impl(const OUString &rStr)
Definition: fltfnc.cxx:84
static bool bFirstRead
Definition: fltfnc.cxx:75
SotClipboardFormatId
OUString sName
OUString sPrefix
sal_Int32 nIndex
OUString aName
Sequence< sal_Int8 > aSeq
Definition: lnkbase2.cxx:83
#define SAL_WARN(area, stream)
size
Reference< XMultiServiceFactory > getProcessServiceFactory()
sal_Int16 nId
OUString SfxResId(TranslateId aId)
Definition: sfxresid.cxx:22
sal_uInt16 sal_Unicode
RET_YES