LibreOffice Module sfx2 (master) 1
fcontnr.hxx
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#ifndef INCLUDED_SFX2_FCONTNR_HXX
20#define INCLUDED_SFX2_FCONTNR_HXX
21
22#include <sal/config.h>
23#include <sfx2/dllapi.h>
24#include <sal/types.h>
25#include <rtl/ustring.hxx>
26#include <tools/link.hxx>
28#include <sot/formats.hxx>
29
30#include <memory>
31
32namespace com::sun::star::beans { struct NamedValue; }
33namespace com::sun::star::container { class XNameAccess; }
34namespace com::sun::star::uno { template <typename > class Sequence; }
35namespace com::sun::star::uno { template <typename > class Reference; }
36
37class ErrCode;
38class SfxFilter;
39class SfxMedium;
41
42
44{
45 std::unique_ptr<SfxFilterContainer_Impl> pImpl;
46
47public:
48 SfxFilterContainer( const OUString& rName );
50
51
52 OUString const & GetName() const;
53
54 std::shared_ptr<const SfxFilter> GetAnyFilter( SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
55 std::shared_ptr<const SfxFilter> GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
56 std::shared_ptr<const SfxFilter> GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
57 std::shared_ptr<const SfxFilter> GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
58
59 SAL_DLLPRIVATE static void ReadFilters_Impl( bool bUpdate=false );
60 SAL_DLLPRIVATE static void ReadSingleFilter_Impl( const OUString& rName,
61 const css::uno::Reference< css::container::XNameAccess >& xTypeCFG,
62 const css::uno::Reference< css::container::XNameAccess >& xFilterCFG,
63 bool bUpdate );
64 SAL_DLLPRIVATE static std::shared_ptr<const SfxFilter> GetDefaultFilter_Impl( std::u16string_view );
65};
66
68
70{
73public:
74 SfxFilterMatcher( const OUString& rFact );
79
80 SAL_DLLPRIVATE static bool IsFilterInstalled_Impl( const std::shared_ptr<const SfxFilter>& pFilter );
81 DECL_DLLPRIVATE_LINK( MaybeFileHdl_Impl, OUString*, bool );
82
83 ErrCode GuessFilterIgnoringContent( SfxMedium const & rMedium, std::shared_ptr<const SfxFilter>& ) const;
84 ErrCode GuessFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& , SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
85 ErrCode GuessFilterControlDefaultUI( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>&, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
86 ErrCode DetectFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& ) const;
87
88 std::shared_ptr<const SfxFilter> GetFilter4Mime( const OUString& rMime, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const;
89 std::shared_ptr<const SfxFilter> GetFilter4ClipBoardId( SotClipboardFormatId nId, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
90 std::shared_ptr<const SfxFilter> GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
91 std::shared_ptr<const SfxFilter> GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
92 std::shared_ptr<const SfxFilter> GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
93 std::shared_ptr<const SfxFilter> GetFilter4UIName( std::u16string_view rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
94 std::shared_ptr<const SfxFilter> GetFilterForProps( const css::uno::Sequence < css::beans::NamedValue >& aSeq, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
95 std::shared_ptr<const SfxFilter> GetAnyFilter( SfxFilterFlags nMustg=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED ) const;
96};
97
99
100{
103 sal_uInt16 nCurrent;
105
106 SAL_DLLPRIVATE std::shared_ptr<const SfxFilter> Find_Impl();
107
108public:
109 SfxFilterMatcherIter( const SfxFilterMatcher& rMatcher, SfxFilterFlags nMask = SfxFilterFlags::NONE, SfxFilterFlags nNotMask = SFX_FILTER_NOTINSTALLED );
112 std::shared_ptr<const SfxFilter> First();
113 std::shared_ptr<const SfxFilter> Next();
114};
115
116
117#endif
118
119/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< SfxFilterContainer_Impl > pImpl
Definition: fcontnr.hxx:45
SfxFilterFlags nOrMask
Definition: fcontnr.hxx:101
const SfxFilterMatcher_Impl & m_rMatch
Definition: fcontnr.hxx:104
SfxFilterMatcherIter & operator=(const SfxFilterMatcherIter &)=delete
SfxFilterFlags nAndMask
Definition: fcontnr.hxx:102
sal_uInt16 nCurrent
Definition: fcontnr.hxx:103
SfxFilterMatcherIter(const SfxFilterMatcherIter &)=delete
SfxFilterMatcher(const SfxFilterMatcher &)=delete
SfxFilterMatcher_Impl & m_rImpl
Definition: fcontnr.hxx:72
SfxFilterMatcher & operator=(const SfxFilterMatcher &)=delete
DECL_DLLPRIVATE_LINK(MaybeFileHdl_Impl, OUString *, bool)
virtual OUString GetName() const override
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
SfxFilterFlags
SotClipboardFormatId
Sequence< sal_Int8 > aSeq
Definition: lnkbase2.cxx:83
Reference