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 : #ifndef INCLUDED_SFX2_DOCFILT_HXX
20 : #define INCLUDED_SFX2_DOCFILT_HXX
21 :
22 : #include <com/sun/star/plugin/PluginDescription.hpp>
23 : #include <com/sun/star/embed/XStorage.hpp>
24 : #include <com/sun/star/beans/UnknownPropertyException.hpp>
25 : #include <com/sun/star/lang/WrappedTargetException.hpp>
26 : #include <com/sun/star/uno/RuntimeException.hpp>
27 : #include <comphelper/documentconstants.hxx>
28 : #include <rtl/ustring.hxx>
29 : #include <sal/config.h>
30 : #include <sal/types.h>
31 : #include <sfx2/dllapi.h>
32 : #include <sfx2/sfxdefs.hxx>
33 : #include <tools/wldcrd.hxx>
34 :
35 : #define SFX_FILTER_STARTPRESENTATION 0x20000000L
36 :
37 : class SfxFilterContainer;
38 : class SotStorage;
39 :
40 : class SFX2_DLLPUBLIC SfxFilter
41 : {
42 : friend class SfxFilterContainer;
43 :
44 : WildCard aWildCard;
45 :
46 : OUString aTypeName;
47 : OUString aUserData;
48 : OUString aServiceName;
49 : OUString aMimeType;
50 : OUString maFilterName;
51 : OUString aPattern;
52 : OUString aUIName;
53 : OUString aDefaultTemplate;
54 :
55 : /**
56 : * Custom provider name in case the filter is provided via external
57 : * libraries. Empty for conventional filter types.
58 : */
59 : OUString maProvider;
60 :
61 : SfxFilterFlags nFormatType;
62 : sal_uIntPtr nVersion;
63 : sal_uIntPtr lFormat;
64 : sal_uInt16 nDocIcon;
65 :
66 : public:
67 : SfxFilter( const OUString& rProvider, const OUString& rFilterName );
68 :
69 : SfxFilter( const OUString &rName,
70 : const OUString &rWildCard,
71 : SfxFilterFlags nFormatType,
72 : sal_uInt32 lFormat,
73 : const OUString &rTypeName,
74 : sal_uInt16 nDocIcon,
75 : const OUString &rMimeType,
76 : const OUString &rUserData,
77 : const OUString& rServiceName );
78 : ~SfxFilter();
79 :
80 0 : bool IsAllowedAsTemplate() const { return nFormatType & SFX_FILTER_TEMPLATE; }
81 0 : bool IsOwnFormat() const { return nFormatType & SFX_FILTER_OWN; }
82 0 : bool IsOwnTemplateFormat() const { return nFormatType & SFX_FILTER_TEMPLATEPATH; }
83 0 : bool IsAlienFormat() const { return nFormatType & SFX_FILTER_ALIEN; }
84 0 : bool CanImport() const { return nFormatType & SFX_FILTER_IMPORT; }
85 0 : bool CanExport() const { return nFormatType & SFX_FILTER_EXPORT; }
86 : bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; }
87 0 : SfxFilterFlags GetFilterFlags() const { return nFormatType; }
88 0 : const OUString& GetFilterName() const { return maFilterName; }
89 0 : const OUString& GetMimeType() const { return aMimeType; }
90 0 : const OUString& GetName() const { return maFilterName; }
91 0 : const WildCard& GetWildcard() const { return aWildCard; }
92 0 : const OUString& GetRealTypeName() const { return aTypeName; }
93 0 : sal_uIntPtr GetFormat() const { return lFormat; }
94 0 : const OUString& GetTypeName() const { return aTypeName; }
95 0 : const OUString& GetUIName() const { return aUIName; }
96 : sal_uInt16 GetDocIconId() const { return nDocIcon; }
97 0 : const OUString& GetUserData() const { return aUserData; }
98 0 : const OUString& GetDefaultTemplate() const { return aDefaultTemplate; }
99 0 : void SetDefaultTemplate( const OUString& rStr ) { aDefaultTemplate = rStr; }
100 0 : bool UsesStorage() const { return GetFormat() != 0; }
101 : void SetURLPattern( const OUString& rStr );
102 : OUString GetURLPattern() const { return aPattern; }
103 0 : void SetUIName( const OUString& rName ) { aUIName = rName; }
104 0 : void SetVersion( sal_uIntPtr nVersionP ) { nVersion = nVersionP; }
105 0 : sal_uIntPtr GetVersion() const { return nVersion; }
106 : OUString GetSuffixes() const;
107 : OUString GetDefaultExtension() const;
108 0 : const OUString& GetServiceName() const { return aServiceName; }
109 : const OUString& GetProviderName() const;
110 :
111 : static const SfxFilter* GetDefaultFilter( const OUString& rName );
112 : static const SfxFilter* GetFilterByName( const OUString& rName );
113 : static const SfxFilter* GetDefaultFilterFromFactory( const OUString& rServiceName );
114 :
115 : static OUString GetTypeFromStorage( const SotStorage& rStg );
116 : static OUString GetTypeFromStorage(
117 : const com::sun::star::uno::Reference<com::sun::star::embed::XStorage>& xStorage,
118 : bool bTemplate = false, OUString* pName = NULL )
119 : throw ( com::sun::star::beans::UnknownPropertyException,
120 : com::sun::star::lang::WrappedTargetException,
121 : com::sun::star::uno::RuntimeException );
122 : };
123 :
124 : #endif
125 :
126 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|