1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docfilt.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SFX_DOCFILT_HACK_HXX
31 #define _SFX_DOCFILT_HACK_HXX
33 #include "sal/config.h"
34 #include "sfx2/dllapi.h"
35 #include "sal/types.h"
36 #include <com/sun/star/plugin/PluginDescription.hpp>
37 #include <com/sun/star/embed/XStorage.hpp>
38 #include <com/sun/star/beans/UnknownPropertyException.hpp>
39 #include <com/sun/star/lang/WrappedTargetException.hpp>
40 #include <com/sun/star/uno/RuntimeException.hpp>
41 #include <tools/wldcrd.hxx>
43 #define SFX_FILTER_IMPORT 0x00000001L
44 #define SFX_FILTER_EXPORT 0x00000002L
45 #define SFX_FILTER_TEMPLATE 0x00000004L
46 #define SFX_FILTER_INTERNAL 0x00000008L
47 #define SFX_FILTER_TEMPLATEPATH 0x00000010L
48 #define SFX_FILTER_OWN 0x00000020L
49 #define SFX_FILTER_ALIEN 0x00000040L
50 #define SFX_FILTER_USESOPTIONS 0x00000080L
51 #define SFX_FILTER_NOTINFILEDLG 0x00001000L
52 #define SFX_FILTER_NOTINCHOOSER 0x00002000L
54 #define SFX_FILTER_DEFAULT 0x00000100L
55 #define SFX_FILTER_EXECUTABLE 0x00000200L
56 #define SFX_FILTER_SUPPORTSSELECTION 0x00000400L
57 #define SFX_FILTER_MAPTOAPPPLUG 0x00000800L
58 #define SFX_FILTER_ASYNC 0x00004000L
59 // Legt Objekt nur an, kein Laden
60 #define SFX_FILTER_CREATOR 0x00008000L
61 #define SFX_FILTER_OPENREADONLY 0x00010000L
62 #define SFX_FILTER_MUSTINSTALL 0x00020000L
63 #define SFX_FILTER_CONSULTSERVICE 0x00040000L
65 #define SFX_FILTER_STARONEFILTER 0x00080000L
66 #define SFX_FILTER_PACKED 0x00100000L
67 #define SFX_FILTER_SILENTEXPORT 0x00200000L
69 #define SFX_FILTER_BROWSERPREFERED 0x00400000L
70 #define SFX_FILTER_PREFERED 0x10000000L
71 #define SFX_FILTER_STARTPRESENTATION 0x20000000L
73 #define SFX_FILTER_VERSION_NONE 0
74 #define SFX_FILTER_NOTINSTALLED SFX_FILTER_MUSTINSTALL | SFX_FILTER_CONSULTSERVICE
76 #include <sfx2/sfxdefs.hxx>
78 //========================================================================
79 class SfxFilterContainer
;
81 class SFX2_DLLPUBLIC SfxFilter
83 friend class SfxFilterContainer
;
89 SfxFilterFlags nFormatType
;
97 String aDefaultTemplate
;
100 SfxFilter( const String
&rName
,
101 const String
&rWildCard
,
102 SfxFilterFlags nFormatType
,
104 const String
&rTypeName
,
106 const String
&rMimeType
,
107 const String
&rUserData
,
108 const String
& rServiceName
);
111 bool IsAllowedAsTemplate() const { return nFormatType
& SFX_FILTER_TEMPLATE
; }
112 bool IsOwnFormat() const { return nFormatType
& SFX_FILTER_OWN
; }
113 bool IsOwnTemplateFormat() const { return nFormatType
& SFX_FILTER_TEMPLATEPATH
; }
114 bool IsAlienFormat() const { return nFormatType
& SFX_FILTER_ALIEN
; }
115 bool CanImport() const { return nFormatType
& SFX_FILTER_IMPORT
; }
116 bool CanExport() const { return nFormatType
& SFX_FILTER_EXPORT
; }
117 bool IsInternal() const { return nFormatType
& SFX_FILTER_INTERNAL
; }
118 SfxFilterFlags
GetFilterFlags() const { return nFormatType
; }
119 const String
& GetFilterName() const { return aFilterName
; }
120 const String
& GetMimeType() const { return aMimeType
; }
121 const String
& GetName() const { return aFilterName
; }
122 const WildCard
& GetWildcard() const { return aWildCard
; }
123 const String
& GetRealTypeName() const { return aTypeName
; }
124 ULONG
GetFormat() const { return lFormat
; }
125 const String
& GetTypeName() const { return aTypeName
; }
126 const String
& GetUIName() const { return aUIName
; }
127 USHORT
GetDocIconId() const { return nDocIcon
; }
128 const String
& GetUserData() const { return aUserData
; }
129 const String
& GetDefaultTemplate() const { return aDefaultTemplate
; }
130 void SetDefaultTemplate( const String
& rStr
) { aDefaultTemplate
= rStr
; }
131 BOOL
UsesStorage() const { return GetFormat() != 0; }
132 void SetURLPattern( const String
& rStr
) { aPattern
= rStr
; aPattern
.ToLowerAscii(); }
133 String
GetURLPattern() const { return aPattern
; }
134 void SetUIName( const String
& rName
) { aUIName
= rName
; }
135 void SetVersion( ULONG nVersionP
) { nVersion
= nVersionP
; }
136 ULONG
GetVersion() const { return nVersion
; }
137 String
GetSuffixes() const;
138 String
GetDefaultExtension() const;
139 const String
& GetServiceName() const { return aServiceName
; }
141 static const SfxFilter
* GetDefaultFilter( const String
& rName
);
142 static const SfxFilter
* GetFilterByName( const String
& rName
);
143 static const SfxFilter
* GetDefaultFilterFromFactory( const String
& rServiceName
);
145 static String
GetTypeFromStorage( const SotStorage
& rStg
);
146 static String
GetTypeFromStorage( const com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
>& xStorage
,
147 BOOL bTemplate
= FALSE
,
149 throw ( ::com::sun::star::beans::UnknownPropertyException
,
150 ::com::sun::star::lang::WrappedTargetException
,
151 ::com::sun::star::uno::RuntimeException
);