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