xref: /AOO41X/main/sfx2/inc/sfx2/docfilt.hxx (revision 353d8f4d17010cd2d0ea815067cad67e477f2bee)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SFX_DOCFILT_HACK_HXX
24 #define _SFX_DOCFILT_HACK_HXX
25 
26 #include "sal/config.h"
27 #include "sfx2/dllapi.h"
28 #include "sal/types.h"
29 #include <com/sun/star/plugin/PluginDescription.hpp>
30 #include <com/sun/star/embed/XStorage.hpp>
31 #include <com/sun/star/beans/UnknownPropertyException.hpp>
32 #include <com/sun/star/lang/WrappedTargetException.hpp>
33 #include <com/sun/star/uno/RuntimeException.hpp>
34 #include <tools/wldcrd.hxx>
35 
36 #include <comphelper/documentconstants.hxx>
37 
38 #include <sfx2/sfxdefs.hxx>
39 
40 //========================================================================
41 class SfxFilterContainer;
42 class SotStorage;
43 class SFX2_DLLPUBLIC SfxFilter
44 {
45 friend class SfxFilterContainer;
46 
47     WildCard        aWildCard;
48     sal_uIntPtr         lFormat;
49     String          aTypeName;
50     String          aUserData;
51     SfxFilterFlags  nFormatType;
52     sal_uInt16          nDocIcon;
53     String          aServiceName;
54     String          aMimeType;
55     String          aFilterName;
56     String          aPattern;
57     sal_uIntPtr           nVersion;
58     String          aUIName;
59     String          aDefaultTemplate;
60 
61 public:
62                     SfxFilter( const String &rName,
63                                const String &rWildCard,
64                                SfxFilterFlags nFormatType,
65                                sal_uInt32 lFormat,
66                                const String &rTypeName,
67                                sal_uInt16 nDocIcon,
68                                const String &rMimeType,
69                                const String &rUserData,
70                                const String& rServiceName );
71                     ~SfxFilter();
72 
IsAllowedAsTemplate() const73     bool IsAllowedAsTemplate() const { return nFormatType & SFX_FILTER_TEMPLATE; }
IsOwnFormat() const74     bool IsOwnFormat() const { return nFormatType & SFX_FILTER_OWN; }
IsOwnTemplateFormat() const75     bool IsOwnTemplateFormat() const { return nFormatType & SFX_FILTER_TEMPLATEPATH; }
IsAlienFormat() const76     bool IsAlienFormat() const { return nFormatType & SFX_FILTER_ALIEN; }
CanImport() const77     bool CanImport() const { return nFormatType & SFX_FILTER_IMPORT; }
CanExport() const78     bool CanExport() const { return nFormatType & SFX_FILTER_EXPORT; }
IsInternal() const79     bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; }
GetFilterFlags() const80     SfxFilterFlags  GetFilterFlags() const  { return nFormatType; }
GetFilterName() const81     const String&   GetFilterName() const { return aFilterName; }
GetMimeType() const82     const String&   GetMimeType() const { return aMimeType; }
GetName() const83     const String&   GetName() const { return  aFilterName; }
GetWildcard() const84     const WildCard& GetWildcard() const { return aWildCard; }
GetRealTypeName() const85     const String&   GetRealTypeName() const { return aTypeName; }
GetFormat() const86     sal_uIntPtr         GetFormat() const { return lFormat; }
GetTypeName() const87     const String&   GetTypeName() const { return aTypeName; }
GetUIName() const88     const String&   GetUIName() const { return aUIName; }
GetDocIconId() const89     sal_uInt16          GetDocIconId() const { return nDocIcon; }
GetUserData() const90     const String&   GetUserData() const { return aUserData; }
GetDefaultTemplate() const91     const String&   GetDefaultTemplate() const { return aDefaultTemplate; }
SetDefaultTemplate(const String & rStr)92     void            SetDefaultTemplate( const String& rStr ) { aDefaultTemplate = rStr; }
UsesStorage() const93     sal_Bool            UsesStorage() const { return GetFormat() != 0; }
SetURLPattern(const String & rStr)94     void            SetURLPattern( const String& rStr ) { aPattern = rStr; aPattern.ToLowerAscii(); }
GetURLPattern() const95     String          GetURLPattern() const { return aPattern; }
SetUIName(const String & rName)96     void            SetUIName( const String& rName ) { aUIName = rName; }
SetVersion(sal_uIntPtr nVersionP)97     void            SetVersion( sal_uIntPtr nVersionP ) { nVersion = nVersionP; }
GetVersion() const98     sal_uIntPtr           GetVersion() const { return nVersion; }
99     String          GetSuffixes() const;
100     String          GetDefaultExtension() const;
GetServiceName() const101     const String&   GetServiceName() const { return aServiceName; }
102 
103     static const SfxFilter* GetDefaultFilter( const String& rName );
104     static const SfxFilter* GetFilterByName( const String& rName );
105     static const SfxFilter* GetDefaultFilterFromFactory( const String& rServiceName );
106 
107     static String   GetTypeFromStorage( const SotStorage& rStg );
108     static String   GetTypeFromStorage( const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage,
109                                         sal_Bool bTemplate = sal_False,
110                                         String* pName=0 )
111                         throw ( ::com::sun::star::beans::UnknownPropertyException,
112                                 ::com::sun::star::lang::WrappedTargetException,
113                                 ::com::sun::star::uno::RuntimeException );
114 };
115 
116 #endif
117 
118