1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _SFX_DOCFILT_HACK_HXX 28 #define _SFX_DOCFILT_HACK_HXX 29 30 #include "sal/config.h" 31 #include "sfx2/dllapi.h" 32 #include "sal/types.h" 33 #include <com/sun/star/plugin/PluginDescription.hpp> 34 #include <com/sun/star/embed/XStorage.hpp> 35 #include <com/sun/star/beans/UnknownPropertyException.hpp> 36 #include <com/sun/star/lang/WrappedTargetException.hpp> 37 #include <com/sun/star/uno/RuntimeException.hpp> 38 #include <tools/wldcrd.hxx> 39 40 #include <comphelper/documentconstants.hxx> 41 42 #include <sfx2/sfxdefs.hxx> 43 44 //======================================================================== 45 class SfxFilterContainer; 46 class SotStorage; 47 class SFX2_DLLPUBLIC SfxFilter 48 { 49 friend class SfxFilterContainer; 50 51 WildCard aWildCard; 52 sal_uIntPtr lFormat; 53 String aTypeName; 54 String aUserData; 55 SfxFilterFlags nFormatType; 56 sal_uInt16 nDocIcon; 57 String aServiceName; 58 String aMimeType; 59 String aFilterName; 60 String aPattern; 61 sal_uIntPtr nVersion; 62 String aUIName; 63 String aDefaultTemplate; 64 65 public: 66 SfxFilter( const String &rName, 67 const String &rWildCard, 68 SfxFilterFlags nFormatType, 69 sal_uInt32 lFormat, 70 const String &rTypeName, 71 sal_uInt16 nDocIcon, 72 const String &rMimeType, 73 const String &rUserData, 74 const String& rServiceName ); 75 ~SfxFilter(); 76 77 bool IsAllowedAsTemplate() const { return nFormatType & SFX_FILTER_TEMPLATE; } 78 bool IsOwnFormat() const { return nFormatType & SFX_FILTER_OWN; } 79 bool IsOwnTemplateFormat() const { return nFormatType & SFX_FILTER_TEMPLATEPATH; } 80 bool IsAlienFormat() const { return nFormatType & SFX_FILTER_ALIEN; } 81 bool CanImport() const { return nFormatType & SFX_FILTER_IMPORT; } 82 bool CanExport() const { return nFormatType & SFX_FILTER_EXPORT; } 83 bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; } 84 SfxFilterFlags GetFilterFlags() const { return nFormatType; } 85 const String& GetFilterName() const { return aFilterName; } 86 const String& GetMimeType() const { return aMimeType; } 87 const String& GetName() const { return aFilterName; } 88 const WildCard& GetWildcard() const { return aWildCard; } 89 const String& GetRealTypeName() const { return aTypeName; } 90 sal_uIntPtr GetFormat() const { return lFormat; } 91 const String& GetTypeName() const { return aTypeName; } 92 const String& GetUIName() const { return aUIName; } 93 sal_uInt16 GetDocIconId() const { return nDocIcon; } 94 const String& GetUserData() const { return aUserData; } 95 const String& GetDefaultTemplate() const { return aDefaultTemplate; } 96 void SetDefaultTemplate( const String& rStr ) { aDefaultTemplate = rStr; } 97 sal_Bool UsesStorage() const { return GetFormat() != 0; } 98 void SetURLPattern( const String& rStr ) { aPattern = rStr; aPattern.ToLowerAscii(); } 99 String GetURLPattern() const { return aPattern; } 100 void SetUIName( const String& rName ) { aUIName = rName; } 101 void SetVersion( sal_uIntPtr nVersionP ) { nVersion = nVersionP; } 102 sal_uIntPtr GetVersion() const { return nVersion; } 103 String GetSuffixes() const; 104 String GetDefaultExtension() const; 105 const String& GetServiceName() const { return aServiceName; } 106 107 static const SfxFilter* GetDefaultFilter( const String& rName ); 108 static const SfxFilter* GetFilterByName( const String& rName ); 109 static const SfxFilter* GetDefaultFilterFromFactory( const String& rServiceName ); 110 111 static String GetTypeFromStorage( const SotStorage& rStg ); 112 static String GetTypeFromStorage( const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage, 113 sal_Bool bTemplate = sal_False, 114 String* pName=0 ) 115 throw ( ::com::sun::star::beans::UnknownPropertyException, 116 ::com::sun::star::lang::WrappedTargetException, 117 ::com::sun::star::uno::RuntimeException ); 118 }; 119 120 #endif 121 122