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 <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>
31 :
32 : #include <comphelper/documentconstants.hxx>
33 : #define SFX_FILTER_STARTPRESENTATION 0x20000000L
34 :
35 : #include <sfx2/sfxdefs.hxx>
36 :
37 : //========================================================================
38 : class SfxFilterContainer;
39 : class SotStorage;
40 : class SFX2_DLLPUBLIC SfxFilter
41 : {
42 : friend class SfxFilterContainer;
43 :
44 : WildCard aWildCard;
45 : sal_uIntPtr lFormat;
46 : String aTypeName;
47 : rtl::OUString aUserData;
48 : SfxFilterFlags nFormatType;
49 : sal_uInt16 nDocIcon;
50 : rtl::OUString aServiceName;
51 : rtl::OUString aMimeType;
52 : String aFilterName;
53 : String aPattern;
54 : sal_uIntPtr nVersion;
55 : String aUIName;
56 : String aDefaultTemplate;
57 :
58 : public:
59 : SfxFilter( const String &rName,
60 : const String &rWildCard,
61 : SfxFilterFlags nFormatType,
62 : sal_uInt32 lFormat,
63 : const String &rTypeName,
64 : sal_uInt16 nDocIcon,
65 : const String &rMimeType,
66 : const String &rUserData,
67 : const String& rServiceName );
68 : ~SfxFilter();
69 :
70 8 : bool IsAllowedAsTemplate() const { return nFormatType & SFX_FILTER_TEMPLATE; }
71 : bool IsOwnFormat() const { return nFormatType & SFX_FILTER_OWN; }
72 16 : bool IsOwnTemplateFormat() const { return nFormatType & SFX_FILTER_TEMPLATEPATH; }
73 5143 : bool IsAlienFormat() const { return nFormatType & SFX_FILTER_ALIEN; }
74 : bool CanImport() const { return nFormatType & SFX_FILTER_IMPORT; }
75 0 : bool CanExport() const { return nFormatType & SFX_FILTER_EXPORT; }
76 : bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; }
77 0 : SfxFilterFlags GetFilterFlags() const { return nFormatType; }
78 39 : const String& GetFilterName() const { return aFilterName; }
79 4319 : const ::rtl::OUString& GetMimeType() const { return aMimeType; }
80 15 : const String& GetName() const { return aFilterName; }
81 0 : const WildCard& GetWildcard() const { return aWildCard; }
82 0 : const String& GetRealTypeName() const { return aTypeName; }
83 0 : sal_uIntPtr GetFormat() const { return lFormat; }
84 141 : const String& GetTypeName() const { return aTypeName; }
85 0 : const String& GetUIName() const { return aUIName; }
86 : sal_uInt16 GetDocIconId() const { return nDocIcon; }
87 341 : const rtl::OUString& GetUserData() const { return aUserData; }
88 37 : const String& GetDefaultTemplate() const { return aDefaultTemplate; }
89 : void SetDefaultTemplate( const String& rStr ) { aDefaultTemplate = rStr; }
90 : sal_Bool UsesStorage() const { return GetFormat() != 0; }
91 : void SetURLPattern( const String& rStr ) { aPattern = rStr; aPattern.ToLowerAscii(); }
92 : String GetURLPattern() const { return aPattern; }
93 : void SetUIName( const String& rName ) { aUIName = rName; }
94 111 : void SetVersion( sal_uIntPtr nVersionP ) { nVersion = nVersionP; }
95 : sal_uIntPtr GetVersion() const { return nVersion; }
96 : String GetSuffixes() const;
97 : String GetDefaultExtension() const;
98 194 : const rtl::OUString& GetServiceName() const { return aServiceName; }
99 :
100 : static const SfxFilter* GetDefaultFilter( const String& rName );
101 : static const SfxFilter* GetFilterByName( const String& rName );
102 : static const SfxFilter* GetDefaultFilterFromFactory( const String& rServiceName );
103 :
104 : static String GetTypeFromStorage( const SotStorage& rStg );
105 : static String GetTypeFromStorage( const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage,
106 : sal_Bool bTemplate = sal_False,
107 : String* pName=0 )
108 : throw ( ::com::sun::star::beans::UnknownPropertyException,
109 : ::com::sun::star::lang::WrappedTargetException,
110 : ::com::sun::star::uno::RuntimeException );
111 : };
112 :
113 : #endif
114 :
115 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|