Bump version to 6.4-15
[LibreOffice.git] / include / sfx2 / docfilt.hxx
blob393bc39e12c2126861af94925b7762e64a2bceb7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SFX2_DOCFILT_HXX
20 #define INCLUDED_SFX2_DOCFILT_HXX
22 #include <comphelper/documentconstants.hxx>
23 #include <rtl/ustring.hxx>
24 #include <sal/config.h>
25 #include <sal/types.h>
26 #include <sot/formats.hxx>
27 #include <sfx2/dllapi.h>
28 #include <tools/wldcrd.hxx>
30 #include <memory>
32 namespace com::sun::star::embed { class XStorage; }
33 namespace com::sun::star::uno { template <typename > class Reference; }
35 class SotStorage;
37 class SFX2_DLLPUBLIC SfxFilter
39 friend class SfxFilterContainer;
41 WildCard aWildCard;
43 OUString aTypeName;
44 OUString aUserData;
45 OUString aServiceName;
46 OUString aMimeType;
47 OUString maFilterName;
48 OUString aUIName;
49 OUString aDefaultTemplate;
51 /**
52 * Custom provider name in case the filter is provided via external
53 * libraries. Empty for conventional filter types.
55 OUString const maProvider;
57 SfxFilterFlags nFormatType;
58 sal_Int32 nVersion;
59 SotClipboardFormatId lFormat;
60 bool mbEnabled;
62 public:
63 SfxFilter( const OUString& rProvider, const OUString& rFilterName );
65 SfxFilter( const OUString &rName,
66 const OUString &rWildCard,
67 SfxFilterFlags nFormatType,
68 SotClipboardFormatId lFormat,
69 const OUString &rTypeName,
70 const OUString &rMimeType,
71 const OUString &rUserData,
72 const OUString& rServiceName,
73 bool bEnabled = true );
74 ~SfxFilter();
76 bool IsAllowedAsTemplate() const { return bool(nFormatType & SfxFilterFlags::TEMPLATE); }
77 bool IsOwnFormat() const { return bool(nFormatType & SfxFilterFlags::OWN); }
78 /// If the filter supports digital signatures.
79 bool GetSupportsSigning() const { return bool(nFormatType & SfxFilterFlags::SUPPORTSSIGNING); }
80 bool GetGpgEncryption() const { return bool(nFormatType & SfxFilterFlags::GPGENCRYPTION); }
81 bool IsOwnTemplateFormat() const { return bool(nFormatType & SfxFilterFlags::TEMPLATEPATH); }
82 /// not our built-in format
83 bool IsAlienFormat() const { return bool(nFormatType & SfxFilterFlags::ALIEN); }
84 /// an unusual/legacy file to be loading
85 bool IsExoticFormat() const { return bool(nFormatType & SfxFilterFlags::EXOTIC); }
86 bool CanImport() const { return bool(nFormatType & SfxFilterFlags::IMPORT); }
87 bool CanExport() const { return bool(nFormatType & SfxFilterFlags::EXPORT); }
88 SfxFilterFlags GetFilterFlags() const { return nFormatType; }
89 const OUString& GetFilterName() const { return maFilterName; }
90 const OUString& GetMimeType() const { return aMimeType; }
91 const OUString& GetName() const { return maFilterName; }
92 const WildCard& GetWildcard() const { return aWildCard; }
93 const OUString& GetRealTypeName() const { return aTypeName; }
94 SotClipboardFormatId GetFormat() const { return lFormat; }
95 const OUString& GetTypeName() const { return aTypeName; }
96 const OUString& GetUIName() const { return aUIName; }
97 const OUString& GetUserData() const { return aUserData; }
98 const OUString& GetDefaultTemplate() const { return aDefaultTemplate; }
99 void SetDefaultTemplate( const OUString& rStr ) { aDefaultTemplate = rStr; }
100 bool UsesStorage() const { return GetFormat() != SotClipboardFormatId::NONE; }
101 void SetUIName( const OUString& rName ) { aUIName = rName; }
102 void SetVersion( sal_Int32 nVersionP ) { nVersion = nVersionP; }
103 sal_Int32 GetVersion() const { return nVersion; }
104 OUString GetSuffixes() const;
105 OUString GetDefaultExtension() const;
106 const OUString& GetServiceName() const { return aServiceName; }
107 const OUString& GetProviderName() const { return maProvider;}
109 static std::shared_ptr<const SfxFilter> GetDefaultFilter( const OUString& rName );
110 static std::shared_ptr<const SfxFilter> GetFilterByName( const OUString& rName );
111 static std::shared_ptr<const SfxFilter> GetDefaultFilterFromFactory( const OUString& rServiceName );
113 static OUString GetTypeFromStorage( const SotStorage& rStg );
114 /// @throws css::beans::UnknownPropertyException
115 /// @throws css::lang::WrappedTargetException
116 /// @throws css::uno::RuntimeException
117 static OUString GetTypeFromStorage(
118 const css::uno::Reference<css::embed::XStorage>& xStorage );
119 bool IsEnabled() const { return mbEnabled; }
122 #endif
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */