1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _SFX_DOCFILT_HACK_HXX
20 #define _SFX_DOCFILT_HACK_HXX
22 #include "sal/config.h"
23 #include "sfx2/dllapi.h"
24 #include "sal/types.h"
25 #include <com/sun/star/plugin/PluginDescription.hpp>
26 #include <com/sun/star/embed/XStorage.hpp>
27 #include <com/sun/star/beans/UnknownPropertyException.hpp>
28 #include <com/sun/star/lang/WrappedTargetException.hpp>
29 #include <com/sun/star/uno/RuntimeException.hpp>
30 #include <tools/wldcrd.hxx>
32 #include <comphelper/documentconstants.hxx>
33 #define SFX_FILTER_STARTPRESENTATION 0x20000000L
35 #include <sfx2/sfxdefs.hxx>
37 class SfxFilterContainer
;
40 class SFX2_DLLPUBLIC SfxFilter
42 friend class SfxFilterContainer
;
48 OUString aServiceName
;
50 OUString maFilterName
;
53 OUString aDefaultTemplate
;
56 * Custom provider name in case the filter is provided via external
57 * libraries. Empty for conventional filter types.
61 SfxFilterFlags nFormatType
;
67 SfxFilter( const OUString
& rProvider
, const OUString
& rFilterName
);
69 SfxFilter( const OUString
&rName
,
70 const OUString
&rWildCard
,
71 SfxFilterFlags nFormatType
,
73 const OUString
&rTypeName
,
75 const OUString
&rMimeType
,
76 const OUString
&rUserData
,
77 const OUString
& rServiceName
);
80 bool IsAllowedAsTemplate() const { return nFormatType
& SFX_FILTER_TEMPLATE
; }
81 bool IsOwnFormat() const { return nFormatType
& SFX_FILTER_OWN
; }
82 bool IsOwnTemplateFormat() const { return nFormatType
& SFX_FILTER_TEMPLATEPATH
; }
83 bool IsAlienFormat() const { return nFormatType
& SFX_FILTER_ALIEN
; }
84 bool CanImport() const { return nFormatType
& SFX_FILTER_IMPORT
; }
85 bool CanExport() const { return nFormatType
& SFX_FILTER_EXPORT
; }
86 bool IsInternal() const { return nFormatType
& SFX_FILTER_INTERNAL
; }
87 SfxFilterFlags
GetFilterFlags() const { return nFormatType
; }
88 const OUString
& GetFilterName() const { return maFilterName
; }
89 const OUString
& GetMimeType() const { return aMimeType
; }
90 const OUString
& GetName() const { return maFilterName
; }
91 const WildCard
& GetWildcard() const { return aWildCard
; }
92 const OUString
& GetRealTypeName() const { return aTypeName
; }
93 sal_uIntPtr
GetFormat() const { return lFormat
; }
94 const OUString
& GetTypeName() const { return aTypeName
; }
95 const OUString
& GetUIName() const { return aUIName
; }
96 sal_uInt16
GetDocIconId() const { return nDocIcon
; }
97 const OUString
& GetUserData() const { return aUserData
; }
98 const OUString
& GetDefaultTemplate() const { return aDefaultTemplate
; }
99 void SetDefaultTemplate( const String
& rStr
) { aDefaultTemplate
= rStr
; }
100 bool UsesStorage() const { return GetFormat() != 0; }
101 void SetURLPattern( const OUString
& rStr
);
102 OUString
GetURLPattern() const { return aPattern
; }
103 void SetUIName( const String
& rName
) { aUIName
= rName
; }
104 void SetVersion( sal_uIntPtr nVersionP
) { nVersion
= nVersionP
; }
105 sal_uIntPtr
GetVersion() const { return nVersion
; }
106 OUString
GetSuffixes() const;
107 OUString
GetDefaultExtension() const;
108 const OUString
& GetServiceName() const { return aServiceName
; }
109 const OUString
& GetProviderName() const;
111 static const SfxFilter
* GetDefaultFilter( const String
& rName
);
112 static const SfxFilter
* GetFilterByName( const String
& rName
);
113 static const SfxFilter
* GetDefaultFilterFromFactory( const String
& rServiceName
);
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
);
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */