LibreOffice Module sfx2 (master) 1
docfilt.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_DOCFILT_HXX
20#define INCLUDED_SFX2_DOCFILT_HXX
21
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>
29
30#include <memory>
31#include <string_view>
32
33namespace com::sun::star::embed { class XStorage; }
34namespace com::sun::star::uno { template <typename > class Reference; }
35
36class SotStorage;
37
39{
40 friend class SfxFilterContainer;
41
43
44 OUString aTypeName;
45 OUString aUserData;
46 OUString aServiceName;
47 OUString aMimeType;
48 OUString maFilterName;
49 OUString aUIName;
51
56 OUString maProvider;
57
59 sal_Int32 nVersion;
62
63public:
64 SfxFilter( OUString aProvider, OUString aFilterName );
65
66 SfxFilter( OUString aName,
67 std::u16string_view rWildCard,
68 SfxFilterFlags nFormatType,
70 OUString aTypeName,
71 OUString aMimeType,
72 OUString aUserData,
73 OUString aServiceName,
74 bool bEnabled = true );
75 ~SfxFilter();
76
77 bool IsAllowedAsTemplate() const { return bool(nFormatType & SfxFilterFlags::TEMPLATE); }
78 bool IsOwnFormat() const { return bool(nFormatType & SfxFilterFlags::OWN); }
80 bool GetSupportsSigning() const { return bool(nFormatType & SfxFilterFlags::SUPPORTSSIGNING); }
81 bool GetGpgEncryption() const { return bool(nFormatType & SfxFilterFlags::GPGENCRYPTION); }
82 bool IsOwnTemplateFormat() const { return bool(nFormatType & SfxFilterFlags::TEMPLATEPATH); }
84 bool IsAlienFormat() const { return bool(nFormatType & SfxFilterFlags::ALIEN); }
86 bool IsExoticFormat() const { return bool(nFormatType & SfxFilterFlags::EXOTIC); }
87 bool CanImport() const { return bool(nFormatType & SfxFilterFlags::IMPORT); }
88 bool CanExport() const { return bool(nFormatType & SfxFilterFlags::EXPORT); }
89 SfxFilterFlags GetFilterFlags() const { return nFormatType; }
90 const OUString& GetFilterName() const { return maFilterName; }
91 const OUString& GetMimeType() const { return aMimeType; }
92 const OUString& GetName() const { return maFilterName; }
93 const WildCard& GetWildcard() const { return aWildCard; }
94 const OUString& GetRealTypeName() const { return aTypeName; }
95 SotClipboardFormatId GetFormat() const { return lFormat; }
96 const OUString& GetTypeName() const { return aTypeName; }
97 const OUString& GetUIName() const { return aUIName; }
98 const OUString& GetUserData() const { return aUserData; }
99 const OUString& GetDefaultTemplate() const { return aDefaultTemplate; }
100 void SetDefaultTemplate( const OUString& rStr ) { aDefaultTemplate = rStr; }
101 bool UsesStorage() const { return GetFormat() != SotClipboardFormatId::NONE; }
102 void SetUIName( const OUString& rName ) { aUIName = rName; }
103 void SetVersion( sal_Int32 nVersionP ) { nVersion = nVersionP; }
104 sal_Int32 GetVersion() const { return nVersion; }
105 OUString GetSuffixes() const;
106 OUString GetDefaultExtension() const;
107 const OUString& GetServiceName() const { return aServiceName; }
108 const OUString& GetProviderName() const { return maProvider;}
109
110 static std::shared_ptr<const SfxFilter> GetDefaultFilter( std::u16string_view rName );
111 static std::shared_ptr<const SfxFilter> GetFilterByName( const OUString& rName );
112 static std::shared_ptr<const SfxFilter> GetDefaultFilterFromFactory( const OUString& rServiceName );
113
114 static OUString GetTypeFromStorage( const SotStorage& rStg );
118 static OUString GetTypeFromStorage(
119 const css::uno::Reference<css::embed::XStorage>& xStorage );
120 bool IsEnabled() const { return mbEnabled; }
121};
122
123#endif
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const sal_uInt16 nVersion
Definition: childwin.cxx:43
bool CanImport() const
Definition: docfilt.hxx:87
const OUString & GetUserData() const
Definition: docfilt.hxx:98
const OUString & GetMimeType() const
Definition: docfilt.hxx:91
SfxFilterFlags GetFilterFlags() const
Definition: docfilt.hxx:89
const OUString & GetFilterName() const
Definition: docfilt.hxx:90
OUString aDefaultTemplate
Definition: docfilt.hxx:50
SfxFilterFlags nFormatType
Definition: docfilt.hxx:58
bool CanExport() const
Definition: docfilt.hxx:88
bool IsExoticFormat() const
an unusual/legacy file to be loading
Definition: docfilt.hxx:86
sal_Int32 nVersion
Definition: docfilt.hxx:59
void SetDefaultTemplate(const OUString &rStr)
Definition: docfilt.hxx:100
bool GetSupportsSigning() const
If the filter supports digital signatures.
Definition: docfilt.hxx:80
OUString aUserData
Definition: docfilt.hxx:45
bool IsAllowedAsTemplate() const
Definition: docfilt.hxx:77
bool IsAlienFormat() const
not our built-in format
Definition: docfilt.hxx:84
bool IsOwnFormat() const
Definition: docfilt.hxx:78
const OUString & GetProviderName() const
Definition: docfilt.hxx:108
SotClipboardFormatId GetFormat() const
Definition: docfilt.hxx:95
OUString maFilterName
Definition: docfilt.hxx:48
OUString maProvider
Custom provider name in case the filter is provided via external libraries.
Definition: docfilt.hxx:56
const OUString & GetUIName() const
Definition: docfilt.hxx:97
bool GetGpgEncryption() const
Definition: docfilt.hxx:81
const WildCard & GetWildcard() const
Definition: docfilt.hxx:93
void SetVersion(sal_Int32 nVersionP)
Definition: docfilt.hxx:103
bool IsOwnTemplateFormat() const
Definition: docfilt.hxx:82
OUString aUIName
Definition: docfilt.hxx:49
OUString aMimeType
Definition: docfilt.hxx:47
SotClipboardFormatId lFormat
Definition: docfilt.hxx:60
OUString aTypeName
Definition: docfilt.hxx:44
sal_Int32 GetVersion() const
Definition: docfilt.hxx:104
void SetUIName(const OUString &rName)
Definition: docfilt.hxx:102
bool mbEnabled
Definition: docfilt.hxx:61
const OUString & GetTypeName() const
Definition: docfilt.hxx:96
bool UsesStorage() const
Definition: docfilt.hxx:101
static OUString GetTypeFromStorage(const css::uno::Reference< css::embed::XStorage > &xStorage)
const OUString & GetName() const
Definition: docfilt.hxx:92
OUString aServiceName
Definition: docfilt.hxx:46
bool IsEnabled() const
Definition: docfilt.hxx:120
const OUString & GetRealTypeName() const
Definition: docfilt.hxx:94
WildCard aWildCard
Definition: docfilt.hxx:42
const OUString & GetServiceName() const
Definition: docfilt.hxx:107
const OUString & GetDefaultTemplate() const
Definition: docfilt.hxx:99
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
SfxFilterFlags
OUString aUIName
SotClipboardFormatId
Implementation of the interface com.sun.star.rdf.XDocumentMetadataAccess.
Reference
const sal_Unicode *const aMimeType[]