Commits

Anonymous committed 9882f9a

fwk160: #i74950# let imported links be readonly

Comments (0)

Files changed (9)

comphelper/inc/comphelper/documentconstants.hxx

 #define ODFVER_012_TEXT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ODFVER_012_TEXT_ASCII ) )
 #endif
 
+// filter flags
+// TODO/LATER: The flags should be part of the UNO specification
+#define SFX_FILTER_IMPORT            0x00000001L
+#define SFX_FILTER_EXPORT            0x00000002L
+#define SFX_FILTER_TEMPLATE          0x00000004L
+#define SFX_FILTER_INTERNAL          0x00000008L
+#define SFX_FILTER_TEMPLATEPATH      0x00000010L
+#define SFX_FILTER_OWN 		         0x00000020L
+#define SFX_FILTER_ALIEN	         0x00000040L
+#define SFX_FILTER_USESOPTIONS       0x00000080L
+
+#define SFX_FILTER_DEFAULT           0x00000100L
+#define SFX_FILTER_EXECUTABLE        0x00000200L
+#define SFX_FILTER_SUPPORTSSELECTION 0x00000400L
+#define SFX_FILTER_MAPTOAPPPLUG      0x00000800L
+#define SFX_FILTER_NOTINFILEDLG      0x00001000L
+#define SFX_FILTER_NOTINCHOOSER      0x00002000L
+#define SFX_FILTER_ASYNC             0x00004000L
+#define SFX_FILTER_CREATOR           0x00008000L
+#define SFX_FILTER_OPENREADONLY      0x00010000L
+#define SFX_FILTER_MUSTINSTALL		 0x00020000L
+#define SFX_FILTER_CONSULTSERVICE	 0x00040000L
+
+#define SFX_FILTER_STARONEFILTER	 0x00080000L
+#define SFX_FILTER_PACKED	 		 0x00100000L
+#define SFX_FILTER_SILENTEXPORT      0x00200000L
+
+#define SFX_FILTER_BROWSERPREFERED   0x00400000L
+
+#define SFX_FILTER_ENCRYPTION        0x01000000L
+#define SFX_FILTER_PASSWORDTOMODIFY  0x02000000L
+
+#define SFX_FILTER_PREFERED          0x10000000L
+
+#define SFX_FILTER_VERSION_NONE      0
+#define SFX_FILTER_NOTINSTALLED		 SFX_FILTER_MUSTINSTALL | SFX_FILTER_CONSULTSERVICE
+
+

comphelper/inc/comphelper/mimeconfighelper.hxx

 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XContainerQuery.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/embed/VerbDescriptor.hpp>
 
 class COMPHELPER_DLLPUBLIC MimeConfigurationHelper
 {
-	::osl::Mutex m_aMutex;
-	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
+    ::osl::Mutex m_aMutex;
+    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
 
-	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xObjectConfig;
-	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xVerbsConfig;
-	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xMediaTypeConfig;
-	
+    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xObjectConfig;
+    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xVerbsConfig;
+    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xMediaTypeConfig;
+
+    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xFilterFactory;
+    
 public:
 
-	MimeConfigurationHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+    MimeConfigurationHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
 
 
-	static ::rtl::OUString GetStringClassIDRepresentation( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
+    static ::rtl::OUString GetStringClassIDRepresentation( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
 
-	static ::com::sun::star::uno::Sequence< sal_Int8 > GetSequenceClassIDRepresentation( const ::rtl::OUString& aClassID );
+    static ::com::sun::star::uno::Sequence< sal_Int8 > GetSequenceClassIDRepresentation( const ::rtl::OUString& aClassID );
 
 
-	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
-											GetConfigurationByPath( const ::rtl::OUString& aPath );
+    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+                                            GetConfigurationByPath( const ::rtl::OUString& aPath );
 
-	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetObjConfiguration();
-	
-	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetVerbsConfiguration();
-	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetMediaTypeConfiguration();
+    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetObjConfiguration();
+    
+    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetVerbsConfiguration();
+    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetMediaTypeConfiguration();
 
 
-	::rtl::OUString GetDocServiceNameFromFilter( const ::rtl::OUString& aFilterName );
+    ::rtl::OUString GetDocServiceNameFromFilter( const ::rtl::OUString& aFilterName );
 
-	::rtl::OUString GetDocServiceNameFromMediaType( const ::rtl::OUString& aMediaType );
+    ::rtl::OUString GetDocServiceNameFromMediaType( const ::rtl::OUString& aMediaType );
 
-	::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjPropsFromConfigEntry(
-						const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID,
-						const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xObjectProps );
+    ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjPropsFromConfigEntry(
+                        const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID,
+                        const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xObjectProps );
 
-	sal_Bool GetVerbByShortcut( const ::rtl::OUString& aVerbShortcut,
-								::com::sun::star::embed::VerbDescriptor& aDescriptor );
+    sal_Bool GetVerbByShortcut( const ::rtl::OUString& aVerbShortcut,
+                                ::com::sun::star::embed::VerbDescriptor& aDescriptor );
 
-	::rtl::OUString GetExplicitlyRegisteredObjClassID( const ::rtl::OUString& aMediaType );
+    ::rtl::OUString GetExplicitlyRegisteredObjClassID( const ::rtl::OUString& aMediaType );
 
 
-	// retrieving object description from configuration
-	::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByStringClassID(
-																const ::rtl::OUString& aStringClassID );
+    // retrieving object description from configuration
+    ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByStringClassID(
+                                                                const ::rtl::OUString& aStringClassID );
 
-	::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByClassID(
-												const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
+    ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByClassID(
+                                                const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
 
-	::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByMediaType(
-												const ::rtl::OUString& aMediaType );
+    ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByMediaType(
+                                                const ::rtl::OUString& aMediaType );
 
-	::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByFilter(
-												const ::rtl::OUString& aFilterName );
+    ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByFilter(
+                                                const ::rtl::OUString& aFilterName );
 
-	::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByDocumentName(
-												const ::rtl::OUString& aDocumentName );
+    ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByDocumentName(
+                                                const ::rtl::OUString& aDocumentName );
 
-	// retrieving object factory from configuration
-	::rtl::OUString GetFactoryNameByStringClassID( const ::rtl::OUString& aStringClassID );
-	::rtl::OUString GetFactoryNameByClassID( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
-	::rtl::OUString GetFactoryNameByDocumentName( const ::rtl::OUString& aDocName );
-	::rtl::OUString GetFactoryNameByMediaType( const ::rtl::OUString& aMediaType );
+    // retrieving object factory from configuration
+    ::rtl::OUString GetFactoryNameByStringClassID( const ::rtl::OUString& aStringClassID );
+    ::rtl::OUString GetFactoryNameByClassID( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
+    ::rtl::OUString GetFactoryNameByDocumentName( const ::rtl::OUString& aDocName );
+    ::rtl::OUString GetFactoryNameByMediaType( const ::rtl::OUString& aMediaType );
 
-	// typedetection related
-	::rtl::OUString UpdateMediaDescriptorWithFilterName(
-						::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr,
-						sal_Bool bIgnoreType );
-	::rtl::OUString UpdateMediaDescriptorWithFilterName(
-						::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr,
-						::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aObject );
-	sal_Bool AddFilterNameCheckOwnFile( 
-						::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr );
+    // typedetection related
+    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetFilterFactory();
 
-	::rtl::OUString GetDefaultFilterFromServiceName( const ::rtl::OUString& aServName, sal_Int32 nVersion );
+    sal_Int32 GetFilterFlags( const ::rtl::OUString& aFilterName );
 
-	static sal_Bool ClassIDsEqual( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID1,
-						const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID2 );
-	static ::com::sun::star::uno::Sequence< sal_Int8 > GetSequenceClassID( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
-												sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
-												sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
+    ::rtl::OUString UpdateMediaDescriptorWithFilterName(
+                        ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr,
+                        sal_Bool bIgnoreType );
+    ::rtl::OUString UpdateMediaDescriptorWithFilterName(
+                        ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr,
+                        ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aObject );
+    sal_Bool AddFilterNameCheckOwnFile( 
+                        ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr );
+
+    ::rtl::OUString GetDefaultFilterFromServiceName( const ::rtl::OUString& aServName, sal_Int32 nVersion );
+
+    ::rtl::OUString GetExportFilterFromImportFilter( const ::rtl::OUString& aImportFilterName );
+
+    static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SearchForFilter(
+                        const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery >& xFilterQuery,
+                        const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aSearchRequest,
+                        sal_Int32 nMustFlags,
+                        sal_Int32 nDontFlags );
+
+    static sal_Bool ClassIDsEqual( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID1,
+                        const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID2 );
+    static ::com::sun::star::uno::Sequence< sal_Int8 > GetSequenceClassID( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
+                                                sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
+                                                sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
 
     ::com::sun::star::uno::Sequence<sal_Int8> GetSequenceClassIDFromObjectName(const ::rtl::OUString& _sObjectName) ;
 

comphelper/source/misc/mimeconfighelper.cxx

 #include <comphelper/mimeconfighelper.hxx>
 #include <comphelper/classids.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/documentconstants.hxx>
 
 
 using namespace ::com::sun::star;
 MimeConfigurationHelper::MimeConfigurationHelper( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
 : m_xFactory( xFactory )
 {
-	if ( !m_xFactory.is() )
-		throw uno::RuntimeException();
+    if ( !m_xFactory.is() )
+        throw uno::RuntimeException();
 }
 
 //-----------------------------------------------------------------------
 ::rtl::OUString MimeConfigurationHelper::GetStringClassIDRepresentation( const uno::Sequence< sal_Int8 >& aClassID )
 {
-	::rtl::OUString aResult;
+    ::rtl::OUString aResult;
 
-	if ( aClassID.getLength() == 16 )
-	{
-		for ( sal_Int32 nInd = 0; nInd < aClassID.getLength(); nInd++ )
-		{
-			if ( nInd == 4 || nInd == 6 || nInd == 8 || nInd == 10 )
-				aResult += ::rtl::OUString::createFromAscii( "-" );
+    if ( aClassID.getLength() == 16 )
+    {
+        for ( sal_Int32 nInd = 0; nInd < aClassID.getLength(); nInd++ )
+        {
+            if ( nInd == 4 || nInd == 6 || nInd == 8 || nInd == 10 )
+                aResult += ::rtl::OUString::createFromAscii( "-" );
 
-			sal_Int32 nDigit1 = (sal_Int32)( (sal_uInt8)aClassID[nInd] / 16 );
-			sal_Int32 nDigit2 = (sal_uInt8)aClassID[nInd] % 16;
-			aResult += ::rtl::OUString::valueOf( nDigit1, 16 );
-			aResult += ::rtl::OUString::valueOf( nDigit2, 16 );
-		}
-	}
+            sal_Int32 nDigit1 = (sal_Int32)( (sal_uInt8)aClassID[nInd] / 16 );
+            sal_Int32 nDigit2 = (sal_uInt8)aClassID[nInd] % 16;
+            aResult += ::rtl::OUString::valueOf( nDigit1, 16 );
+            aResult += ::rtl::OUString::valueOf( nDigit2, 16 );
+        }
+    }
 
-	return aResult;
+    return aResult;
 }
 
 //-----------------------------------------------------------------------
 sal_uInt8 GetDigit_Impl( sal_Char aChar )
 {
-	if ( aChar >= '0' && aChar <= '9' )
-		return aChar - '0';
-	else if ( aChar >= 'a' && aChar <= 'f' )
-		return aChar - 'a' + 10;
-	else if ( aChar >= 'A' && aChar <= 'F' )
-		return aChar - 'A' + 10;
-	else
-		return 16;
+    if ( aChar >= '0' && aChar <= '9' )
+        return aChar - '0';
+    else if ( aChar >= 'a' && aChar <= 'f' )
+        return aChar - 'a' + 10;
+    else if ( aChar >= 'A' && aChar <= 'F' )
+        return aChar - 'A' + 10;
+    else
+        return 16;
 }
 
 //-----------------------------------------------------------------------
 uno::Sequence< sal_Int8 > MimeConfigurationHelper::GetSequenceClassIDRepresentation( const ::rtl::OUString& aClassID )
 {
-	sal_Int32 nLength = aClassID.getLength();
-	if ( nLength == 36 )
-	{
-		::rtl::OString aCharClassID = ::rtl::OUStringToOString( aClassID, RTL_TEXTENCODING_ASCII_US );
-		const sal_Char* pString = aCharClassID.getStr();
-		if ( pString )
-		{
-			uno::Sequence< sal_Int8 > aResult( 16 );
+    sal_Int32 nLength = aClassID.getLength();
+    if ( nLength == 36 )
+    {
+        ::rtl::OString aCharClassID = ::rtl::OUStringToOString( aClassID, RTL_TEXTENCODING_ASCII_US );
+        const sal_Char* pString = aCharClassID.getStr();
+        if ( pString )
+        {
+            uno::Sequence< sal_Int8 > aResult( 16 );
 
-			sal_Int32 nStrPointer = 0;
-			sal_Int32 nSeqInd = 0;
-			while( nSeqInd < 16 && nStrPointer + 1 < nLength )
-			{
-				sal_uInt8 nDigit1 = GetDigit_Impl( pString[nStrPointer++] );
-				sal_uInt8 nDigit2 = GetDigit_Impl( pString[nStrPointer++] );
+            sal_Int32 nStrPointer = 0;
+            sal_Int32 nSeqInd = 0;
+            while( nSeqInd < 16 && nStrPointer + 1 < nLength )
+            {
+                sal_uInt8 nDigit1 = GetDigit_Impl( pString[nStrPointer++] );
+                sal_uInt8 nDigit2 = GetDigit_Impl( pString[nStrPointer++] );
 
-				if ( nDigit1 > 15 || nDigit2 > 15 )
-					break;
+                if ( nDigit1 > 15 || nDigit2 > 15 )
+                    break;
 
-				aResult[nSeqInd++] = (sal_Int8)( nDigit1 * 16 + nDigit2 );
+                aResult[nSeqInd++] = (sal_Int8)( nDigit1 * 16 + nDigit2 );
 
-				if ( nStrPointer < nLength && pString[nStrPointer] == '-' )
-					nStrPointer++;
-			}
+                if ( nStrPointer < nLength && pString[nStrPointer] == '-' )
+                    nStrPointer++;
+            }
 
-			if ( nSeqInd == 16 && nStrPointer == nLength )
-				return aResult;
-		}
-	}
+            if ( nSeqInd == 16 && nStrPointer == nLength )
+                return aResult;
+        }
+    }
 
-	return uno::Sequence< sal_Int8 >();
+    return uno::Sequence< sal_Int8 >();
 }
 
 //-----------------------------------------------------------------------
 uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetConfigurationByPath( const ::rtl::OUString& aPath )
 {
-	osl::MutexGuard aGuard( m_aMutex );
+    osl::MutexGuard aGuard( m_aMutex );
 
-	uno::Reference< container::XNameAccess > xConfig;
+    uno::Reference< container::XNameAccess > xConfig;
 
-	try
-	{
-		if ( !m_xConfigProvider.is() )
-			m_xConfigProvider = uno::Reference< lang::XMultiServiceFactory >(
-				m_xFactory->createInstance(
-					::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ) ),
-				uno::UNO_QUERY_THROW );
+    try
+    {
+        if ( !m_xConfigProvider.is() )
+            m_xConfigProvider = uno::Reference< lang::XMultiServiceFactory >(
+                m_xFactory->createInstance(
+                    ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ) ),
+                uno::UNO_QUERY_THROW );
 
-		uno::Sequence< uno::Any > aArgs( 1 );
-		beans::PropertyValue aPathProp;
-		aPathProp.Name = ::rtl::OUString::createFromAscii( "nodepath" );
-		aPathProp.Value <<= aPath;
-		aArgs[0] <<= aPathProp;
+        uno::Sequence< uno::Any > aArgs( 1 );
+        beans::PropertyValue aPathProp;
+        aPathProp.Name = ::rtl::OUString::createFromAscii( "nodepath" );
+        aPathProp.Value <<= aPath;
+        aArgs[0] <<= aPathProp;
 
-		xConfig = uno::Reference< container::XNameAccess >(
-							m_xConfigProvider->createInstanceWithArguments(
-								::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ),
-								aArgs ),
-							uno::UNO_QUERY );
-	}
-	catch( uno::Exception& )
-	{}
+        xConfig = uno::Reference< container::XNameAccess >(
+                            m_xConfigProvider->createInstanceWithArguments(
+                                ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ),
+                                aArgs ),
+                            uno::UNO_QUERY );
+    }
+    catch( uno::Exception& )
+    {}
 
-	return xConfig;
+    return xConfig;
 }
 
 //-----------------------------------------------------------------------
 uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetObjConfiguration()
 {
-	osl::MutexGuard aGuard( m_aMutex );
+    osl::MutexGuard aGuard( m_aMutex );
 
-	if ( !m_xObjectConfig.is() )
-		m_xObjectConfig = GetConfigurationByPath(
-										::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/Objects" ) );
+    if ( !m_xObjectConfig.is() )
+        m_xObjectConfig = GetConfigurationByPath(
+                                        ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/Objects" ) );
 
-	return m_xObjectConfig;
+    return m_xObjectConfig;
 }
 
 //-----------------------------------------------------------------------
 uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetVerbsConfiguration()
 {
-	osl::MutexGuard aGuard( m_aMutex );
+    osl::MutexGuard aGuard( m_aMutex );
 
-	if ( !m_xVerbsConfig.is() )
-		m_xVerbsConfig = GetConfigurationByPath(
-										::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/Verbs" ) );
+    if ( !m_xVerbsConfig.is() )
+        m_xVerbsConfig = GetConfigurationByPath(
+                                        ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/Verbs" ) );
 
-	return m_xVerbsConfig;
+    return m_xVerbsConfig;
 }
 
 //-----------------------------------------------------------------------
 uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetMediaTypeConfiguration()
 {
-	osl::MutexGuard aGuard( m_aMutex );
+    osl::MutexGuard aGuard( m_aMutex );
 
-	if ( !m_xMediaTypeConfig.is() )
-		m_xMediaTypeConfig = GetConfigurationByPath(
-					::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/MimeTypeClassIDRelations" ) );
+    if ( !m_xMediaTypeConfig.is() )
+        m_xMediaTypeConfig = GetConfigurationByPath(
+                    ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/MimeTypeClassIDRelations" ) );
 
-	return m_xMediaTypeConfig;
+    return m_xMediaTypeConfig;
 }
+
+//-----------------------------------------------------------------------
+uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetFilterFactory()
+{
+    osl::MutexGuard aGuard( m_aMutex );
+
+    if ( !m_xFilterFactory.is() )
+        m_xFilterFactory.set(
+            m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ),
+            uno::UNO_QUERY );
+
+    return m_xFilterFactory;
+}
+
+//-----------------------------------------------------------------------
+sal_Int32 MimeConfigurationHelper::GetFilterFlags( const ::rtl::OUString& aFilterName )
+{
+    sal_Int32 nFlags = 0;
+    try
+    {
+        if ( aFilterName.getLength() )
+        {
+            uno::Reference< container::XNameAccess > xFilterFactory(
+                GetFilterFactory(),
+                uno::UNO_SET_THROW );
+
+            uno::Any aFilterAny = xFilterFactory->getByName( aFilterName );
+            uno::Sequence< beans::PropertyValue > aData;
+            if ( aFilterAny >>= aData )
+            {
+                SequenceAsHashMap aFilterHM( aData );
+                nFlags = aFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), (sal_Int32)0 );
+            }
+        }
+    } catch( uno::Exception& )
+    {}
+
+    return nFlags;
+}
+
 //-------------------------------------------------------------------------
 ::rtl::OUString MimeConfigurationHelper::GetDocServiceNameFromFilter( const ::rtl::OUString& aFilterName )
 {
-	::rtl::OUString aDocServiceName;
+    ::rtl::OUString aDocServiceName;
 
-	try
-	{
-		uno::Reference< container::XNameAccess > xFilterFactory(
-			m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ),
-			uno::UNO_QUERY_THROW );
+    try
+    {
+        uno::Reference< container::XNameAccess > xFilterFactory(
+            GetFilterFactory(),
+            uno::UNO_SET_THROW );
 
-		uno::Any aFilterAnyData = xFilterFactory->getByName( aFilterName );
-		uno::Sequence< beans::PropertyValue > aFilterData;
-		if ( aFilterAnyData >>= aFilterData )
-		{
-			for ( sal_Int32 nInd = 0; nInd < aFilterData.getLength(); nInd++ )
-				if ( aFilterData[nInd].Name.equalsAscii( "DocumentService" ) )
-					aFilterData[nInd].Value >>= aDocServiceName;
-		}
-	}
-	catch( uno::Exception& )
-	{}
+        uno::Any aFilterAnyData = xFilterFactory->getByName( aFilterName );
+        uno::Sequence< beans::PropertyValue > aFilterData;
+        if ( aFilterAnyData >>= aFilterData )
+        {
+            for ( sal_Int32 nInd = 0; nInd < aFilterData.getLength(); nInd++ )
+                if ( aFilterData[nInd].Name.equalsAscii( "DocumentService" ) )
+                    aFilterData[nInd].Value >>= aDocServiceName;
+        }
+    }
+    catch( uno::Exception& )
+    {}
 
-	return aDocServiceName;
+    return aDocServiceName;
 }
 
 //-------------------------------------------------------------------------
 ::rtl::OUString MimeConfigurationHelper::GetDocServiceNameFromMediaType( const ::rtl::OUString& aMediaType )
 {
     uno::Reference< container::XContainerQuery > xTypeCFG(
-			m_xFactory->createInstance(
-				::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ),
-			uno::UNO_QUERY );
+            m_xFactory->createInstance(
+                ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ),
+            uno::UNO_QUERY );
 
     if ( xTypeCFG.is() )
     {
-		try
-		{
-        	// make query for all types matching the properties
+        try
+        {
+            // make query for all types matching the properties
             uno::Sequence < beans::NamedValue > aSeq( 1 );
-			aSeq[0].Name = ::rtl::OUString::createFromAscii( "MediaType" );
-			aSeq[0].Value <<= aMediaType;
+            aSeq[0].Name = ::rtl::OUString::createFromAscii( "MediaType" );
+            aSeq[0].Value <<= aMediaType;
 
-        	uno::Reference < container::XEnumeration > xEnum = xTypeCFG->createSubSetEnumerationByProperties( aSeq );
-        	while ( xEnum->hasMoreElements() )
-        	{
+            uno::Reference < container::XEnumeration > xEnum = xTypeCFG->createSubSetEnumerationByProperties( aSeq );
+            while ( xEnum->hasMoreElements() )
+            {
                 uno::Sequence< beans::PropertyValue > aType;
-				if ( xEnum->nextElement() >>= aType )
-				{
-					for ( sal_Int32 nInd = 0; nInd < aType.getLength(); nInd++ )
-					{
-						::rtl::OUString aFilterName;
+                if ( xEnum->nextElement() >>= aType )
+                {
+                    for ( sal_Int32 nInd = 0; nInd < aType.getLength(); nInd++ )
+                    {
+                        ::rtl::OUString aFilterName;
                         if ( aType[nInd].Name.equalsAscii( "PreferredFilter" )
-						  && ( aType[nInd].Value >>= aFilterName ) && aFilterName.getLength() )
-						{
-							::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName );
-							if ( aDocumentName.getLength() )
-								return aDocumentName;
-						}
-					}
-				}
-			}
+                          && ( aType[nInd].Value >>= aFilterName ) && aFilterName.getLength() )
+                        {
+                            ::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName );
+                            if ( aDocumentName.getLength() )
+                                return aDocumentName;
+                        }
+                    }
+                }
+            }
         }
-		catch( uno::Exception& )
-		{}
+        catch( uno::Exception& )
+        {}
     }
 
     return ::rtl::OUString();
 
 //-------------------------------------------------------------------------
 sal_Bool MimeConfigurationHelper::GetVerbByShortcut( const ::rtl::OUString& aVerbShortcut,
-												embed::VerbDescriptor& aDescriptor )
+                                                embed::VerbDescriptor& aDescriptor )
 {
-	sal_Bool bResult = sal_False;
+    sal_Bool bResult = sal_False;
 
-	uno::Reference< container::XNameAccess > xVerbsConfig = GetVerbsConfiguration();
-	uno::Reference< container::XNameAccess > xVerbsProps;
-	try
-	{
-		if ( xVerbsConfig.is() && ( xVerbsConfig->getByName( aVerbShortcut ) >>= xVerbsProps ) && xVerbsProps.is() )
-		{
-			embed::VerbDescriptor aTempDescr;
-			if ( ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbID" ) ) >>= aTempDescr.VerbID )
-			  && ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbUIName" ) ) >>= aTempDescr.VerbName )
-			  && ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbFlags" ) ) >>= aTempDescr.VerbFlags )
-			  && ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbAttributes" ) ) >>= aTempDescr.VerbAttributes ) )
-			{
-			  	aDescriptor = aTempDescr;
-				bResult = sal_True;
-			}
-		}
-	}
-	catch( uno::Exception& )
-	{
-	}
+    uno::Reference< container::XNameAccess > xVerbsConfig = GetVerbsConfiguration();
+    uno::Reference< container::XNameAccess > xVerbsProps;
+    try
+    {
+        if ( xVerbsConfig.is() && ( xVerbsConfig->getByName( aVerbShortcut ) >>= xVerbsProps ) && xVerbsProps.is() )
+        {
+            embed::VerbDescriptor aTempDescr;
+            if ( ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbID" ) ) >>= aTempDescr.VerbID )
+              && ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbUIName" ) ) >>= aTempDescr.VerbName )
+              && ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbFlags" ) ) >>= aTempDescr.VerbFlags )
+              && ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbAttributes" ) ) >>= aTempDescr.VerbAttributes ) )
+            {
+                  aDescriptor = aTempDescr;
+                bResult = sal_True;
+            }
+        }
+    }
+    catch( uno::Exception& )
+    {
+    }
 
-	return bResult;
+    return bResult;
 }
 
 //-------------------------------------------------------------------------
 uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjPropsFromConfigEntry(
-											const uno::Sequence< sal_Int8 >& aClassID,
-											const uno::Reference< container::XNameAccess >& xObjectProps )
+                                            const uno::Sequence< sal_Int8 >& aClassID,
+                                            const uno::Reference< container::XNameAccess >& xObjectProps )
 {
-	uno::Sequence< beans::NamedValue > aResult;
+    uno::Sequence< beans::NamedValue > aResult;
 
-	if ( aClassID.getLength() == 16 )
-	{
-		try
-		{
-			uno::Sequence< ::rtl::OUString > aObjPropNames = xObjectProps->getElementNames();
+    if ( aClassID.getLength() == 16 )
+    {
+        try
+        {
+            uno::Sequence< ::rtl::OUString > aObjPropNames = xObjectProps->getElementNames();
 
-			aResult.realloc( aObjPropNames.getLength() + 1 );
-			aResult[0].Name = ::rtl::OUString::createFromAscii( "ClassID" );
-			aResult[0].Value <<= aClassID;
+            aResult.realloc( aObjPropNames.getLength() + 1 );
+            aResult[0].Name = ::rtl::OUString::createFromAscii( "ClassID" );
+            aResult[0].Value <<= aClassID;
 
-			for ( sal_Int32 nInd = 0; nInd < aObjPropNames.getLength(); nInd++ )
-			{
-				aResult[nInd + 1].Name = aObjPropNames[nInd];
+            for ( sal_Int32 nInd = 0; nInd < aObjPropNames.getLength(); nInd++ )
+            {
+                aResult[nInd + 1].Name = aObjPropNames[nInd];
 
-				if ( aObjPropNames[nInd].equalsAscii( "ObjectVerbs" ) )
-				{
-					uno::Sequence< ::rtl::OUString > aVerbShortcuts;
-					if ( xObjectProps->getByName( aObjPropNames[nInd] ) >>= aVerbShortcuts )
-					{
-						uno::Sequence< embed::VerbDescriptor > aVerbDescriptors( aVerbShortcuts.getLength() );
-						for ( sal_Int32 nVerbI = 0; nVerbI < aVerbShortcuts.getLength(); nVerbI++ )
-							if ( !GetVerbByShortcut( aVerbShortcuts[nVerbI], aVerbDescriptors[nVerbI] ) )
-								throw uno::RuntimeException();
+                if ( aObjPropNames[nInd].equalsAscii( "ObjectVerbs" ) )
+                {
+                    uno::Sequence< ::rtl::OUString > aVerbShortcuts;
+                    if ( xObjectProps->getByName( aObjPropNames[nInd] ) >>= aVerbShortcuts )
+                    {
+                        uno::Sequence< embed::VerbDescriptor > aVerbDescriptors( aVerbShortcuts.getLength() );
+                        for ( sal_Int32 nVerbI = 0; nVerbI < aVerbShortcuts.getLength(); nVerbI++ )
+                            if ( !GetVerbByShortcut( aVerbShortcuts[nVerbI], aVerbDescriptors[nVerbI] ) )
+                                throw uno::RuntimeException();
 
-						aResult[nInd+1].Value <<= aVerbDescriptors;
-					}
-					else
-						throw uno::RuntimeException();
-				}
-				else
-					aResult[nInd+1].Value = xObjectProps->getByName( aObjPropNames[nInd] );
-			}
-		}
-		catch( uno::Exception& )
-		{
-			aResult.realloc( 0 );
-		}
-	}
+                        aResult[nInd+1].Value <<= aVerbDescriptors;
+                    }
+                    else
+                        throw uno::RuntimeException();
+                }
+                else
+                    aResult[nInd+1].Value = xObjectProps->getByName( aObjPropNames[nInd] );
+            }
+        }
+        catch( uno::Exception& )
+        {
+            aResult.realloc( 0 );
+        }
+    }
 
-	return aResult;
+    return aResult;
 }
 
 //-----------------------------------------------------------------------
 ::rtl::OUString MimeConfigurationHelper::GetExplicitlyRegisteredObjClassID( const ::rtl::OUString& aMediaType )
 {
-	::rtl::OUString aStringClassID;
+    ::rtl::OUString aStringClassID;
 
-	uno::Reference< container::XNameAccess > xMediaTypeConfig = GetMediaTypeConfiguration();
-	try
-	{
-		if ( xMediaTypeConfig.is() )
-			xMediaTypeConfig->getByName( aMediaType ) >>= aStringClassID;
-	}
-	catch( uno::Exception& )
-	{
-	}
+    uno::Reference< container::XNameAccess > xMediaTypeConfig = GetMediaTypeConfiguration();
+    try
+    {
+        if ( xMediaTypeConfig.is() )
+            xMediaTypeConfig->getByName( aMediaType ) >>= aStringClassID;
+    }
+    catch( uno::Exception& )
+    {
+    }
 
-	return aStringClassID;
+    return aStringClassID;
 
 }
 
 //-----------------------------------------------------------------------
 uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByStringClassID(
-																const ::rtl::OUString& aStringClassID )
+                                                                const ::rtl::OUString& aStringClassID )
 {
-	uno::Sequence< beans::NamedValue > aObjProps;
+    uno::Sequence< beans::NamedValue > aObjProps;
 
-	uno::Sequence< sal_Int8 > aClassID = GetSequenceClassIDRepresentation( aStringClassID );
+    uno::Sequence< sal_Int8 > aClassID = GetSequenceClassIDRepresentation( aStringClassID );
     if ( ClassIDsEqual( aClassID, GetSequenceClassID( SO3_DUMMY_CLASSID ) ) )
     {
         aObjProps.realloc(2);
         return aObjProps;
     }
 
-	if ( aClassID.getLength() == 16 )
-	{
-		uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
-		uno::Reference< container::XNameAccess > xObjectProps;
-		try
-		{
-			// TODO/LATER: allow to provide ClassID string in any format, only digits are counted
-			if ( xObjConfig.is() && ( xObjConfig->getByName( aStringClassID.toAsciiUpperCase() ) >>= xObjectProps ) && xObjectProps.is() )
-				aObjProps = GetObjPropsFromConfigEntry( aClassID, xObjectProps );
-		}
-		catch( uno::Exception& )
-		{
-		}
-	}
+    if ( aClassID.getLength() == 16 )
+    {
+        uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
+        uno::Reference< container::XNameAccess > xObjectProps;
+        try
+        {
+            // TODO/LATER: allow to provide ClassID string in any format, only digits are counted
+            if ( xObjConfig.is() && ( xObjConfig->getByName( aStringClassID.toAsciiUpperCase() ) >>= xObjectProps ) && xObjectProps.is() )
+                aObjProps = GetObjPropsFromConfigEntry( aClassID, xObjectProps );
+        }
+        catch( uno::Exception& )
+        {
+        }
+    }
 
-	return aObjProps;
+    return aObjProps;
 }
 
 //-----------------------------------------------------------------------
 uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByClassID(
-																const uno::Sequence< sal_Int8 >& aClassID )
+                                                                const uno::Sequence< sal_Int8 >& aClassID )
 {
-	uno::Sequence< beans::NamedValue > aObjProps;
+    uno::Sequence< beans::NamedValue > aObjProps;
     if ( ClassIDsEqual( aClassID, GetSequenceClassID( SO3_DUMMY_CLASSID ) ) )
     {
         aObjProps.realloc(2);
         aObjProps[1].Value <<= aClassID;
     }
 
-	::rtl::OUString aStringClassID = GetStringClassIDRepresentation( aClassID );
-	if ( aStringClassID.getLength() )
-	{
-		uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
-		uno::Reference< container::XNameAccess > xObjectProps;
-		try
-		{
-			if ( xObjConfig.is() && ( xObjConfig->getByName( aStringClassID.toAsciiUpperCase() ) >>= xObjectProps ) && xObjectProps.is() )
-				aObjProps = GetObjPropsFromConfigEntry( aClassID, xObjectProps );
-		}
-		catch( uno::Exception& )
-		{
-		}
-	}
+    ::rtl::OUString aStringClassID = GetStringClassIDRepresentation( aClassID );
+    if ( aStringClassID.getLength() )
+    {
+        uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
+        uno::Reference< container::XNameAccess > xObjectProps;
+        try
+        {
+            if ( xObjConfig.is() && ( xObjConfig->getByName( aStringClassID.toAsciiUpperCase() ) >>= xObjectProps ) && xObjectProps.is() )
+                aObjProps = GetObjPropsFromConfigEntry( aClassID, xObjectProps );
+        }
+        catch( uno::Exception& )
+        {
+        }
+    }
 
-	return aObjProps;
+    return aObjProps;
 }
 
 //-----------------------------------------------------------------------
 uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByMediaType( const ::rtl::OUString& aMediaType )
 {
-	uno::Sequence< beans::NamedValue > aObject =
-									GetObjectPropsByStringClassID( GetExplicitlyRegisteredObjClassID( aMediaType ) );
-	if ( aObject.getLength() )
-		return aObject;
+    uno::Sequence< beans::NamedValue > aObject =
+                                    GetObjectPropsByStringClassID( GetExplicitlyRegisteredObjClassID( aMediaType ) );
+    if ( aObject.getLength() )
+        return aObject;
 
-	::rtl::OUString aDocumentName = GetDocServiceNameFromMediaType( aMediaType );
-	if ( aDocumentName.getLength() )
-		return GetObjectPropsByDocumentName( aDocumentName );
+    ::rtl::OUString aDocumentName = GetDocServiceNameFromMediaType( aMediaType );
+    if ( aDocumentName.getLength() )
+        return GetObjectPropsByDocumentName( aDocumentName );
 
-	return uno::Sequence< beans::NamedValue >();
+    return uno::Sequence< beans::NamedValue >();
 }
 
 //-----------------------------------------------------------------------
 uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByFilter( const ::rtl::OUString& aFilterName )
 {
-	::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName );
-	if ( aDocumentName.getLength() )
-		return GetObjectPropsByDocumentName( aDocumentName );
+    ::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName );
+    if ( aDocumentName.getLength() )
+        return GetObjectPropsByDocumentName( aDocumentName );
 
-	return uno::Sequence< beans::NamedValue >();
+    return uno::Sequence< beans::NamedValue >();
 }
 
 //-----------------------------------------------------------------------
 uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocumentName( const ::rtl::OUString& aDocName )
 {
-	if ( aDocName.getLength() )
-	{
-		uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
-		if ( xObjConfig.is() )
-		{
-			try
-			{
-				uno::Sequence< ::rtl::OUString > aClassIDs = xObjConfig->getElementNames();
-				for ( sal_Int32 nInd = 0; nInd < aClassIDs.getLength(); nInd++ )
-				{
-					uno::Reference< container::XNameAccess > xObjectProps;
-					::rtl::OUString aEntryDocName;
+    if ( aDocName.getLength() )
+    {
+        uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
+        if ( xObjConfig.is() )
+        {
+            try
+            {
+                uno::Sequence< ::rtl::OUString > aClassIDs = xObjConfig->getElementNames();
+                for ( sal_Int32 nInd = 0; nInd < aClassIDs.getLength(); nInd++ )
+                {
+                    uno::Reference< container::XNameAccess > xObjectProps;
+                    ::rtl::OUString aEntryDocName;
 
-					if ( ( xObjConfig->getByName( aClassIDs[nInd] ) >>= xObjectProps ) && xObjectProps.is()
-					  && ( xObjectProps->getByName(
-			  					::rtl::OUString::createFromAscii( "ObjectDocumentServiceName" ) ) >>= aEntryDocName )
-					  && aEntryDocName.equals( aDocName ) )
-					{
-						return GetObjPropsFromConfigEntry( GetSequenceClassIDRepresentation( aClassIDs[nInd] ),
-															xObjectProps );
-					}
-				}
-			}
-			catch( uno::Exception& )
-			{}
-		}
-	}
+                    if ( ( xObjConfig->getByName( aClassIDs[nInd] ) >>= xObjectProps ) && xObjectProps.is()
+                      && ( xObjectProps->getByName(
+                                  ::rtl::OUString::createFromAscii( "ObjectDocumentServiceName" ) ) >>= aEntryDocName )
+                      && aEntryDocName.equals( aDocName ) )
+                    {
+                        return GetObjPropsFromConfigEntry( GetSequenceClassIDRepresentation( aClassIDs[nInd] ),
+                                                            xObjectProps );
+                    }
+                }
+            }
+            catch( uno::Exception& )
+            {}
+        }
+    }
 
-	return uno::Sequence< beans::NamedValue >();
+    return uno::Sequence< beans::NamedValue >();
 }
 
 //-----------------------------------------------------------------------
 ::rtl::OUString MimeConfigurationHelper::GetFactoryNameByClassID( const uno::Sequence< sal_Int8 >& aClassID )
 {
-	return GetFactoryNameByStringClassID( GetStringClassIDRepresentation( aClassID ) );
+    return GetFactoryNameByStringClassID( GetStringClassIDRepresentation( aClassID ) );
 }
 
 //-----------------------------------------------------------------------
 ::rtl::OUString MimeConfigurationHelper::GetFactoryNameByStringClassID( const ::rtl::OUString& aStringClassID )
 {
-	::rtl::OUString aResult;
+    ::rtl::OUString aResult;
 
-	if ( aStringClassID.getLength() )
-	{
-		uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
-		uno::Reference< container::XNameAccess > xObjectProps;
-		try
-		{
-			if ( xObjConfig.is() && ( xObjConfig->getByName( aStringClassID.toAsciiUpperCase() ) >>= xObjectProps ) && xObjectProps.is() )
-				xObjectProps->getByName( ::rtl::OUString::createFromAscii( "ObjectFactory" ) ) >>= aResult;
-		}
-		catch( uno::Exception& )
-		{
+    if ( aStringClassID.getLength() )
+    {
+        uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
+        uno::Reference< container::XNameAccess > xObjectProps;
+        try
+        {
+            if ( xObjConfig.is() && ( xObjConfig->getByName( aStringClassID.toAsciiUpperCase() ) >>= xObjectProps ) && xObjectProps.is() )
+                xObjectProps->getByName( ::rtl::OUString::createFromAscii( "ObjectFactory" ) ) >>= aResult;
+        }
+        catch( uno::Exception& )
+        {
             uno::Sequence< sal_Int8 > aClassID = GetSequenceClassIDRepresentation( aStringClassID );
             if ( ClassIDsEqual( aClassID, GetSequenceClassID( SO3_DUMMY_CLASSID ) ) )
                 return ::rtl::OUString::createFromAscii("com.sun.star.embed.OOoSpecialEmbeddedObjectFactory");
-		}
-	}
+        }
+    }
 
-	return aResult;
+    return aResult;
 }
 
 //-----------------------------------------------------------------------
 ::rtl::OUString MimeConfigurationHelper::GetFactoryNameByDocumentName( const ::rtl::OUString& aDocName )
 {
-	::rtl::OUString aResult;
+    ::rtl::OUString aResult;
 
-	if ( aDocName.getLength() )
-	{
-		uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
-		if ( xObjConfig.is() )
-		{
-			try
-			{
-				uno::Sequence< ::rtl::OUString > aClassIDs = xObjConfig->getElementNames();
-				for ( sal_Int32 nInd = 0; nInd < aClassIDs.getLength(); nInd++ )
-				{
-					uno::Reference< container::XNameAccess > xObjectProps;
-					::rtl::OUString aEntryDocName;
+    if ( aDocName.getLength() )
+    {
+        uno::Reference< container::XNameAccess > xObjConfig = GetObjConfiguration();
+        if ( xObjConfig.is() )
+        {
+            try
+            {
+                uno::Sequence< ::rtl::OUString > aClassIDs = xObjConfig->getElementNames();
+                for ( sal_Int32 nInd = 0; nInd < aClassIDs.getLength(); nInd++ )
+                {
+                    uno::Reference< container::XNameAccess > xObjectProps;
+                    ::rtl::OUString aEntryDocName;
 
-					if ( ( xObjConfig->getByName( aClassIDs[nInd] ) >>= xObjectProps ) && xObjectProps.is()
-					  && ( xObjectProps->getByName(
-			  					::rtl::OUString::createFromAscii( "ObjectDocumentServiceName" ) ) >>= aEntryDocName )
-					  && aEntryDocName.equals( aDocName ) )
-					{
-						xObjectProps->getByName( ::rtl::OUString::createFromAscii( "ObjectFactory" ) ) >>= aResult;
+                    if ( ( xObjConfig->getByName( aClassIDs[nInd] ) >>= xObjectProps ) && xObjectProps.is()
+                      && ( xObjectProps->getByName(
+                                  ::rtl::OUString::createFromAscii( "ObjectDocumentServiceName" ) ) >>= aEntryDocName )
+                      && aEntryDocName.equals( aDocName ) )
+                    {
+                        xObjectProps->getByName( ::rtl::OUString::createFromAscii( "ObjectFactory" ) ) >>= aResult;
                         break;
-					}
-				}
-			}
-			catch( uno::Exception& )
-			{}
-		}
-	}
+                    }
+                }
+            }
+            catch( uno::Exception& )
+            {}
+        }
+    }
 
-	return aResult;
+    return aResult;
 }
 
 
 //-----------------------------------------------------------------------
 ::rtl::OUString MimeConfigurationHelper::GetFactoryNameByMediaType( const ::rtl::OUString& aMediaType )
 {
-	::rtl::OUString aResult = GetFactoryNameByStringClassID( GetExplicitlyRegisteredObjClassID( aMediaType ) );
+    ::rtl::OUString aResult = GetFactoryNameByStringClassID( GetExplicitlyRegisteredObjClassID( aMediaType ) );
 
-	if ( !aResult.getLength() )
-	{
-		::rtl::OUString aDocumentName = GetDocServiceNameFromMediaType( aMediaType );
-		if ( aDocumentName.getLength() )
-			aResult = GetFactoryNameByDocumentName( aDocumentName );
-	}
+    if ( !aResult.getLength() )
+    {
+        ::rtl::OUString aDocumentName = GetDocServiceNameFromMediaType( aMediaType );
+        if ( aDocumentName.getLength() )
+            aResult = GetFactoryNameByDocumentName( aDocumentName );
+    }
 
-	return aResult;
+    return aResult;
 }
 
 //-----------------------------------------------------------------------
 ::rtl::OUString MimeConfigurationHelper::UpdateMediaDescriptorWithFilterName(
-										uno::Sequence< beans::PropertyValue >& aMediaDescr,
-										sal_Bool bIgnoreType )
+                                        uno::Sequence< beans::PropertyValue >& aMediaDescr,
+                                        sal_Bool bIgnoreType )
 {
-	::rtl::OUString aFilterName;
+    ::rtl::OUString aFilterName;
 
-	for ( sal_Int32 nInd = 0; nInd < aMediaDescr.getLength(); nInd++ )
-		if ( aMediaDescr[nInd].Name.equalsAscii( "FilterName" ) )
-			aMediaDescr[nInd].Value >>= aFilterName;
+    for ( sal_Int32 nInd = 0; nInd < aMediaDescr.getLength(); nInd++ )
+        if ( aMediaDescr[nInd].Name.equalsAscii( "FilterName" ) )
+            aMediaDescr[nInd].Value >>= aFilterName;
 
-	if ( !aFilterName.getLength() )
-	{
-		// filter name is not specified, so type detection should be done
+    if ( !aFilterName.getLength() )
+    {
+        // filter name is not specified, so type detection should be done
 
-		uno::Reference< document::XTypeDetection > xTypeDetection(
-				m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ),
-				uno::UNO_QUERY );
+        uno::Reference< document::XTypeDetection > xTypeDetection(
+                m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ),
+                uno::UNO_QUERY );
 
-		if ( !xTypeDetection.is() )
-			throw uno::RuntimeException(); // TODO
+        if ( !xTypeDetection.is() )
+            throw uno::RuntimeException(); // TODO
 
-		// typedetection can change the mode, add a stream and so on, thus a copy should be used
-		uno::Sequence< beans::PropertyValue > aTempMD( aMediaDescr );
+        // typedetection can change the mode, add a stream and so on, thus a copy should be used
+        uno::Sequence< beans::PropertyValue > aTempMD( aMediaDescr );
 
-		// get TypeName
-		::rtl::OUString aTypeName = xTypeDetection->queryTypeByDescriptor( aTempMD, sal_True );
+        // get TypeName
+        ::rtl::OUString aTypeName = xTypeDetection->queryTypeByDescriptor( aTempMD, sal_True );
 
-		// get FilterName
-		for ( sal_Int32 nInd = 0; nInd < aTempMD.getLength(); nInd++ )
-			if ( aTempMD[nInd].Name.equalsAscii( "FilterName" ) )
-				aTempMD[nInd].Value >>= aFilterName;
+        // get FilterName
+        for ( sal_Int32 nInd = 0; nInd < aTempMD.getLength(); nInd++ )
+            if ( aTempMD[nInd].Name.equalsAscii( "FilterName" ) )
+                aTempMD[nInd].Value >>= aFilterName;
 
-		if ( aFilterName.getLength() )
-		{
-			sal_Int32 nOldLen = aMediaDescr.getLength();
-			aMediaDescr.realloc( nOldLen + 1 );
-			aMediaDescr[nOldLen].Name = ::rtl::OUString::createFromAscii( "FilterName" );
-			aMediaDescr[ nOldLen ].Value <<= aFilterName;
+        if ( aFilterName.getLength() )
+        {
+            sal_Int32 nOldLen = aMediaDescr.getLength();
+            aMediaDescr.realloc( nOldLen + 1 );
+            aMediaDescr[nOldLen].Name = ::rtl::OUString::createFromAscii( "FilterName" );
+            aMediaDescr[ nOldLen ].Value <<= aFilterName;
 
-		}
-		else if ( aTypeName.getLength() && !bIgnoreType )
-		{
-			uno::Reference< container::XNameAccess > xNameAccess( xTypeDetection, uno::UNO_QUERY );
-			uno::Sequence< beans::PropertyValue > aTypes;
+        }
+        else if ( aTypeName.getLength() && !bIgnoreType )
+        {
+            uno::Reference< container::XNameAccess > xNameAccess( xTypeDetection, uno::UNO_QUERY );
+            uno::Sequence< beans::PropertyValue > aTypes;
 
-			if ( xNameAccess.is() && ( xNameAccess->getByName( aTypeName ) >>= aTypes ) )
-			{
-				for ( sal_Int32 nInd = 0; nInd < aTypes.getLength(); nInd++ )
-				{
-					if ( aTypes[nInd].Name.equalsAscii( "PreferredFilter" ) && ( aTypes[nInd].Value >>= aFilterName ) )
-					{
-						sal_Int32 nOldLen = aMediaDescr.getLength();
-						aMediaDescr.realloc( nOldLen + 1 );
-						aMediaDescr[nOldLen].Name = ::rtl::OUString::createFromAscii( "FilterName" );
-						aMediaDescr[ nOldLen ].Value = aTypes[nInd].Value;
-						break;
-					}
-				}
-			}
-		}
-	}
+            if ( xNameAccess.is() && ( xNameAccess->getByName( aTypeName ) >>= aTypes ) )
+            {
+                for ( sal_Int32 nInd = 0; nInd < aTypes.getLength(); nInd++ )
+                {
+                    if ( aTypes[nInd].Name.equalsAscii( "PreferredFilter" ) && ( aTypes[nInd].Value >>= aFilterName ) )
+                    {
+                        sal_Int32 nOldLen = aMediaDescr.getLength();
+                        aMediaDescr.realloc( nOldLen + 1 );
+                        aMediaDescr[nOldLen].Name = ::rtl::OUString::createFromAscii( "FilterName" );
+                        aMediaDescr[ nOldLen ].Value = aTypes[nInd].Value;
+                        break;
+                    }
+                }
+            }
+        }
+    }
 
-	return aFilterName;
+    return aFilterName;
 }
 
 ::rtl::OUString MimeConfigurationHelper::UpdateMediaDescriptorWithFilterName(
-						uno::Sequence< beans::PropertyValue >& aMediaDescr,
-						uno::Sequence< beans::NamedValue >& aObject )
+                        uno::Sequence< beans::PropertyValue >& aMediaDescr,
+                        uno::Sequence< beans::NamedValue >& aObject )
 {
-	::rtl::OUString aDocName;
-	for ( sal_Int32 nInd = 0; nInd < aObject.getLength(); nInd++ )
-		if ( aObject[nInd].Name.equalsAscii( "ObjectDocumentServiceName" ) )
-		{
-			aObject[nInd].Value >>= aDocName;
-			break;
-		}
+    ::rtl::OUString aDocName;
+    for ( sal_Int32 nInd = 0; nInd < aObject.getLength(); nInd++ )
+        if ( aObject[nInd].Name.equalsAscii( "ObjectDocumentServiceName" ) )
+        {
+            aObject[nInd].Value >>= aDocName;
+            break;
+        }
 
-	OSL_ENSURE( aDocName.getLength(), "The name must exist at this point!\n" );
+    OSL_ENSURE( aDocName.getLength(), "The name must exist at this point!\n" );
 
 
-	sal_Bool bNeedsAddition = sal_True;
-	for ( sal_Int32 nMedInd = 0; nMedInd < aMediaDescr.getLength(); nMedInd++ )
-		if ( aMediaDescr[nMedInd].Name.equalsAscii( "DocumentService" ) )
-		{
-			aMediaDescr[nMedInd].Value <<= aDocName;
-			bNeedsAddition = sal_False;
-			break;
-		}
+    sal_Bool bNeedsAddition = sal_True;
+    for ( sal_Int32 nMedInd = 0; nMedInd < aMediaDescr.getLength(); nMedInd++ )
+        if ( aMediaDescr[nMedInd].Name.equalsAscii( "DocumentService" ) )
+        {
+            aMediaDescr[nMedInd].Value <<= aDocName;
+            bNeedsAddition = sal_False;
+            break;
+        }
 
-	if ( bNeedsAddition )
-	{
-		sal_Int32 nOldLen = aMediaDescr.getLength();
-		aMediaDescr.realloc( nOldLen + 1 );
-		aMediaDescr[nOldLen].Name = ::rtl::OUString::createFromAscii( "DocumentService" );
-		aMediaDescr[nOldLen].Value <<= aDocName;
-	}
+    if ( bNeedsAddition )
+    {
+        sal_Int32 nOldLen = aMediaDescr.getLength();
+        aMediaDescr.realloc( nOldLen + 1 );
+        aMediaDescr[nOldLen].Name = ::rtl::OUString::createFromAscii( "DocumentService" );
+        aMediaDescr[nOldLen].Value <<= aDocName;
+    }
 
-	return UpdateMediaDescriptorWithFilterName( aMediaDescr, sal_True );
+    return UpdateMediaDescriptorWithFilterName( aMediaDescr, sal_True );
 }
 
 sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile(
-						uno::Sequence< beans::PropertyValue >& aMediaDescr )
+                        uno::Sequence< beans::PropertyValue >& aMediaDescr )
 {
-	::rtl::OUString aFilterName = UpdateMediaDescriptorWithFilterName( aMediaDescr, sal_False );
-	if ( aFilterName.getLength() )
-	{
-		try
-		{
-			uno::Reference< container::XNameAccess > xFilterFactory(
-				m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ),
-				uno::UNO_QUERY_THROW );
+    sal_Bool bResult = sal_False;
 
-			uno::Any aFilterAnyData = xFilterFactory->getByName( aFilterName );
-			uno::Sequence< beans::PropertyValue > aFilterData;
-			if ( aFilterAnyData >>= aFilterData )
-			{
-				for ( sal_Int32 nInd = 0; nInd < aFilterData.getLength(); nInd++ )
-					if ( aFilterData[nInd].Name.equalsAscii( "Flags" ) )
-					{
-						uno::Any aVal = aFilterData[nInd].Value;
-						sal_Int32 nFlags = 0;
-						// check the OWN flag
-						if ( ( aFilterData[nInd].Value >>= nFlags ) && ( nFlags & 0x20 ) )
-							return sal_True;
-						break;
-					}
-			}
-		}
-		catch( uno::Exception& )
-		{}
-	}
+    ::rtl::OUString aFilterName = UpdateMediaDescriptorWithFilterName( aMediaDescr, sal_False );
+    if ( aFilterName.getLength() )
+    {
+        sal_Int32 nFlags = GetFilterFlags( aFilterName );
+        // check the OWN flag
+        bResult = ( nFlags & SFX_FILTER_OWN );
+    }
 
-	return sal_False;
+    return bResult;
 }
 
 //-----------------------------------------------------------
 ::rtl::OUString MimeConfigurationHelper::GetDefaultFilterFromServiceName( const ::rtl::OUString& aServiceName, sal_Int32 nVersion )
 {
-	rtl::OUString aResult;
+    rtl::OUString aResult;
 
-	if ( aServiceName.getLength() && nVersion )
-		try
-		{
-			uno::Reference< container::XContainerQuery > xFilterQuery(
-				m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ),
-				uno::UNO_QUERY_THROW );
+    if ( aServiceName.getLength() && nVersion )
+        try
+        {
+            uno::Reference< container::XContainerQuery > xFilterQuery(
+                GetFilterFactory(),
+                uno::UNO_QUERY_THROW );
 
-			uno::Sequence< beans::NamedValue > aSearchRequest( 2 );
-			aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "DocumentService" );
-			aSearchRequest[0].Value <<= aServiceName;
-			aSearchRequest[1].Name = ::rtl::OUString::createFromAscii( "FileFormatVersion" );
-			aSearchRequest[1].Value <<= nVersion;
+            uno::Sequence< beans::NamedValue > aSearchRequest( 2 );
+            aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "DocumentService" );
+            aSearchRequest[0].Value <<= aServiceName;
+            aSearchRequest[1].Name = ::rtl::OUString::createFromAscii( "FileFormatVersion" );
+            aSearchRequest[1].Value <<= nVersion;
 
-			uno::Sequence< beans::PropertyValue > aFilterProps;
-			uno::Reference< container::XEnumeration > xFilterEnum =
-											xFilterQuery->createSubSetEnumerationByProperties( aSearchRequest );
+            uno::Sequence< beans::PropertyValue > aFilterProps;
+            uno::Reference< container::XEnumeration > xFilterEnum =
+                                            xFilterQuery->createSubSetEnumerationByProperties( aSearchRequest );
 
-			// use the first filter that is found
-			if ( xFilterEnum.is() )
-				while ( xFilterEnum->hasMoreElements() )
-				{
-					uno::Sequence< beans::PropertyValue > aProps;
-					if ( xFilterEnum->nextElement() >>= aProps )
-					{
-						SequenceAsHashMap aPropsHM( aProps );
-						sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ),
-																				(sal_Int32)0 );
+            // use the first filter that is found
+            if ( xFilterEnum.is() )
+                while ( xFilterEnum->hasMoreElements() )
+                {
+                    uno::Sequence< beans::PropertyValue > aProps;
+                    if ( xFilterEnum->nextElement() >>= aProps )
+                    {
+                        SequenceAsHashMap aPropsHM( aProps );
+                        sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ),
+                                                                                (sal_Int32)0 );
 
-						// that should be import, export, own filter and not a template filter ( TemplatePath flag )
-						if ( ( ( nFlags & 0x23L ) == 0x23L ) && !( nFlags & 0x10 ) )
-						{
-							// if there are more than one filter the preffered one should be used
-							// if there is no preffered filter the first one will be used
-							if ( !aResult.getLength() || ( nFlags & 0x10000000L ) )
-								aResult = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Name" ),
-																				::rtl::OUString() );
-							if ( nFlags & 0x10000000L )
-								break; // the preffered filter was found
-						}
-					}
-				}
-		}
-		catch( uno::Exception& )
-		{}
-		
-	return aResult;
+                        // that should be import, export, own filter and not a template filter ( TemplatePath flag )
+                        sal_Int32 nRequired = ( SFX_FILTER_OWN | SFX_FILTER_EXPORT | SFX_FILTER_IMPORT );
+                        if ( ( ( nFlags & nRequired ) == nRequired ) && !( nFlags & SFX_FILTER_TEMPLATEPATH ) )
+                        {
+                            // if there are more than one filter the preffered one should be used
+                            // if there is no preffered filter the first one will be used
+                            if ( !aResult.getLength() || ( nFlags & SFX_FILTER_PREFERED ) )
+                                aResult = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Name" ),
+                                                                                ::rtl::OUString() );
+                            if ( nFlags & SFX_FILTER_PREFERED )
+                                break; // the preffered filter was found
+                        }
+                    }
+                }
+        }
+        catch( uno::Exception& )
+        {}
+        
+    return aResult;
 }
+
+//-------------------------------------------------------------------------
+::rtl::OUString MimeConfigurationHelper::GetExportFilterFromImportFilter( const ::rtl::OUString& aImportFilterName )
+{
+    ::rtl::OUString aExportFilterName;
+
+    try
+    {
+        if ( aImportFilterName.getLength() )
+        {
+            uno::Reference< container::XNameAccess > xFilterFactory(
+                GetFilterFactory(),
+                uno::UNO_SET_THROW );
+
+            uno::Any aImpFilterAny = xFilterFactory->getByName( aImportFilterName );
+            uno::Sequence< beans::PropertyValue > aImpData;
+            if ( aImpFilterAny >>= aImpData )
+            {
+                SequenceAsHashMap aImpFilterHM( aImpData );
+                sal_Int32 nFlags = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ),
+                                                                        (sal_Int32)0 );
+                
+                if ( !( nFlags & SFX_FILTER_IMPORT ) )
+                {
+                    OSL_ENSURE( sal_False, "This is no import filter!" );
+                    throw uno::Exception();
+                }
+
+                if ( nFlags & SFX_FILTER_EXPORT )
+                {
+                    aExportFilterName = aImportFilterName;
+                }
+                else
+                {
+                    ::rtl::OUString aDocumentServiceName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "DocumentService" ), ::rtl::OUString() );
+                    ::rtl::OUString aTypeName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Type" ), ::rtl::OUString() );
+
+                    OSL_ENSURE( aDocumentServiceName.getLength() && aTypeName.getLength(), "Incomplete filter data!" );
+                    if ( aDocumentServiceName.getLength() && aTypeName.getLength() )
+                    {
+                        uno::Sequence< beans::NamedValue > aSearchRequest( 2 );
+                        aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "Type" );
+                        aSearchRequest[0].Value <<= aTypeName;
+                        aSearchRequest[1].Name = ::rtl::OUString::createFromAscii( "DocumentService" );
+                        aSearchRequest[1].Value <<= aDocumentServiceName;
+                        
+                        uno::Sequence< beans::PropertyValue > aExportFilterProps = SearchForFilter( 
+                            uno::Reference< container::XContainerQuery >( xFilterFactory, uno::UNO_QUERY_THROW ),
+                            aSearchRequest,
+                            SFX_FILTER_EXPORT,
+                            SFX_FILTER_INTERNAL );
+
+                        if ( aExportFilterProps.getLength() )
+                        {
+                            SequenceAsHashMap aExpPropsHM( aExportFilterProps );
+                            aExportFilterName = aExpPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Name" ), ::rtl::OUString() );
+                        }
+                    }
+                }
+            }
+        }
+    }
+    catch( uno::Exception& )
+    {}
+
+    return aExportFilterName;
+}
+
+//-------------------------------------------------------------------------
+// static
+uno::Sequence< beans::PropertyValue > MimeConfigurationHelper::SearchForFilter(
+                                                        const uno::Reference< container::XContainerQuery >& xFilterQuery,
+                                                        const uno::Sequence< beans::NamedValue >& aSearchRequest,
+                                                        sal_Int32 nMustFlags,
+                                                        sal_Int32 nDontFlags )
+{
+    uno::Sequence< beans::PropertyValue > aFilterProps;
+    uno::Reference< container::XEnumeration > xFilterEnum =
+                                            xFilterQuery->createSubSetEnumerationByProperties( aSearchRequest );
+
+    // the first default filter will be taken,
+    // if there is no filter with flag default the first acceptable filter will be taken
+    if ( xFilterEnum.is() )
+    {
+        while ( xFilterEnum->hasMoreElements() )
+        {
+            uno::Sequence< beans::PropertyValue > aProps;
+            if ( xFilterEnum->nextElement() >>= aProps )
+            {
+                SequenceAsHashMap aPropsHM( aProps );
+                sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ),
+                                                                        (sal_Int32)0 );
+                if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) )
+                {
+                    if ( ( nFlags & SFX_FILTER_DEFAULT ) == SFX_FILTER_DEFAULT )
+                    {
+                        aFilterProps = aProps;
+                        break;
+                    }
+                    else if ( !aFilterProps.getLength() )
+                        aFilterProps = aProps;
+                }
+            }
+        }
+    }
+
+    return aFilterProps;
+}
+
+
 //-------------------------------------------------------------------------
 sal_Bool MimeConfigurationHelper::ClassIDsEqual( const uno::Sequence< sal_Int8 >& aClassID1, const uno::Sequence< sal_Int8 >& aClassID2 )
 {
-	if ( aClassID1.getLength() != aClassID2.getLength() )
-		return sal_False;
+    if ( aClassID1.getLength() != aClassID2.getLength() )
+        return sal_False;
 
-	for ( sal_Int32 nInd = 0; nInd < aClassID1.getLength(); nInd++ )
-		if ( aClassID1[nInd] != aClassID2[nInd] )
-			return sal_False;
+    for ( sal_Int32 nInd = 0; nInd < aClassID1.getLength(); nInd++ )
+        if ( aClassID1[nInd] != aClassID2[nInd] )
+            return sal_False;
 
-	return sal_True;
+    return sal_True;
 }
-//----------------------------------------------
+
+//-------------------------------------------------------------------------
 uno::Sequence< sal_Int8 > MimeConfigurationHelper::GetSequenceClassID( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
-												sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
-												sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 )
+                                                sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
+                                                sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 )
 {
-	uno::Sequence< sal_Int8 > aResult( 16 );
-	aResult[0] = (sal_Int8)( n1 >> 24 );
-	aResult[1] = (sal_Int8)( ( n1 << 8 ) >> 24 );
-	aResult[2] = (sal_Int8)( ( n1 << 16 ) >> 24 );
-	aResult[3] = (sal_Int8)( ( n1 << 24 ) >> 24 );
-	aResult[4] = (sal_Int8)( n2 >> 8 );
-	aResult[5] = (sal_Int8)( ( n2 << 8 ) >> 8 );
-	aResult[6] = (sal_Int8)( n3 >> 8 );
-	aResult[7] = (sal_Int8)( ( n3 << 8 ) >> 8 );
-	aResult[8] = b8;
-	aResult[9] = b9;
-	aResult[10] = b10;
-	aResult[11] = b11;
-	aResult[12] = b12;
-	aResult[13] = b13;
-	aResult[14] = b14;
-	aResult[15] = b15;
+    uno::Sequence< sal_Int8 > aResult( 16 );
+    aResult[0] = (sal_Int8)( n1 >> 24 );
+    aResult[1] = (sal_Int8)( ( n1 << 8 ) >> 24 );
+    aResult[2] = (sal_Int8)( ( n1 << 16 ) >> 24 );
+    aResult[3] = (sal_Int8)( ( n1 << 24 ) >> 24 );
+    aResult[4] = (sal_Int8)( n2 >> 8 );
+    aResult[5] = (sal_Int8)( ( n2 << 8 ) >> 8 );
+    aResult[6] = (sal_Int8)( n3 >> 8 );
+    aResult[7] = (sal_Int8)( ( n3 << 8 ) >> 8 );
+    aResult[8] = b8;
+    aResult[9] = b9;
+    aResult[10] = b10;
+    aResult[11] = b11;
+    aResult[12] = b12;
+    aResult[13] = b13;
+    aResult[14] = b14;
+    aResult[15] = b15;
 
-	return aResult;
+    return aResult;
 }
+
+//-------------------------------------------------------------------------
 uno::Sequence<sal_Int8> MimeConfigurationHelper::GetSequenceClassIDFromObjectName(const ::rtl::OUString& _sObjectName) 
 {
-	uno::Sequence<sal_Int8> aClassId;
-	uno::Reference< container::XNameAccess > xObjectNames = GetConfigurationByPath(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Embedding/ObjectNames")));
+    uno::Sequence<sal_Int8> aClassId;
+    uno::Reference< container::XNameAccess > xObjectNames = GetConfigurationByPath(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Embedding/ObjectNames")));
     uno::Reference< container::XNameAccess > xProps;
     if ( xObjectNames.is() && (xObjectNames->getByName(_sObjectName) >>= xProps) && xProps.is() )
     {
          xProps->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ClassID"))) >>= sValue;
          aClassId = GetSequenceClassIDRepresentation(sValue);
     }
-	return aClassId;
+    return aClassId;
 }
 

embeddedobj/source/commonembedding/miscobj.cxx

 
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/interfacecontainer.h>
+#include <comphelper/mimeconfighelper.hxx>
 
 #include "closepreventer.hxx"
 #include "intercept.hxx"
 
 	OSL_ENSURE( m_aLinkURL.getLength() && m_aLinkFilterName.getLength(), "Filter and URL must be provided!\n" );
 
+    m_bReadOnly = sal_True;
+    if ( m_aLinkFilterName.getLength() )
+    {
+		::comphelper::MimeConfigurationHelper aHelper( m_xFactory );
+        ::rtl::OUString aExportFilterName = aHelper.GetExportFilterFromImportFilter( m_aLinkFilterName );
+        m_bReadOnly = !( aExportFilterName.equals( m_aLinkFilterName ) );
+    }
+
 	m_aDocMediaDescriptor = GetValuableArgs_Impl( aMediaDescr, sal_False );
 
 	uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor;

embeddedobj/source/commonembedding/persistence.cxx

 		if ( !xStorable.is() )
 			throw uno::RuntimeException(); // TODO
 
-		// free the main mutex for the storing time
-		aGuard.clear();
+        // free the main mutex for the storing time
+        aGuard.clear();
 
-		xStorable->store();
+        xStorable->store();
 
-		aGuard.reset();
+        aGuard.reset();
 	}
 	else
 	{

sfx2/inc/guisaveas.hxx

                     ::rtl::OUString aUserSelectedName,
                     sal_uInt16 nDocumentSignatureState = SIGNATURESTATE_NOSIGNATURES );
 
-	static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SearchForFilter(
-					const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery >& xFilterQuery,
-					const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aSearchRequest,
-					sal_Int32 nMustFlags,
-					sal_Int32 nDontFlags );
-
 	static sal_Bool CheckFilterOptionsAppearence(
 					const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xFilterCFG,
 					const ::rtl::OUString& aFilterName );

sfx2/inc/sfx2/docfilt.hxx

 #include <com/sun/star/uno/RuntimeException.hpp>
 #include <tools/wldcrd.hxx>
 
-// TODO/LATER: The flags should be part of the UNO specification
-#define SFX_FILTER_IMPORT            0x00000001L
-#define SFX_FILTER_EXPORT            0x00000002L
-#define SFX_FILTER_TEMPLATE          0x00000004L
-#define SFX_FILTER_INTERNAL          0x00000008L
-#define SFX_FILTER_TEMPLATEPATH      0x00000010L
-#define SFX_FILTER_OWN 		         0x00000020L
-#define SFX_FILTER_ALIEN	         0x00000040L
-#define SFX_FILTER_USESOPTIONS       0x00000080L
-
-#define SFX_FILTER_DEFAULT           0x00000100L
-#define SFX_FILTER_EXECUTABLE        0x00000200L
-#define SFX_FILTER_SUPPORTSSELECTION 0x00000400L
-#define SFX_FILTER_MAPTOAPPPLUG      0x00000800L
-#define SFX_FILTER_NOTINFILEDLG      0x00001000L
-#define SFX_FILTER_NOTINCHOOSER      0x00002000L
-#define SFX_FILTER_ASYNC             0x00004000L
-// Legt Objekt nur an, kein Laden
-#define SFX_FILTER_CREATOR           0x00008000L
-#define SFX_FILTER_OPENREADONLY      0x00010000L
-#define SFX_FILTER_MUSTINSTALL		 0x00020000L
-#define SFX_FILTER_CONSULTSERVICE	 0x00040000L
-
-#define SFX_FILTER_STARONEFILTER	 0x00080000L
-#define SFX_FILTER_PACKED	 		 0x00100000L
-#define SFX_FILTER_SILENTEXPORT      0x00200000L
-
-#define SFX_FILTER_BROWSERPREFERED   0x00400000L
-
-#define SFX_FILTER_ENCRYPTION        0x01000000L
-#define SFX_FILTER_PASSWORDTOMODIFY  0x02000000L
-
-#define SFX_FILTER_PREFERED          0x10000000L
-
-#define SFX_FILTER_VERSION_NONE      0
-#define SFX_FILTER_NOTINSTALLED		 SFX_FILTER_MUSTINSTALL | SFX_FILTER_CONSULTSERVICE
+#include <comphelper/documentconstants.hxx>
 
 #include <sfx2/sfxdefs.hxx>
 

sfx2/source/doc/guisaveas.cxx

 #include <tools/urlobj.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/configurationhelper.hxx>
+#include <comphelper/mimeconfighelper.hxx>
 #include <vcl/msgbox.hxx>
 #include <vcl/window.hxx>
 #include <toolkit/awt/vclxwindow.hxx>
 	aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "DocumentService" );
 	aSearchRequest[0].Value <<= GetDocServiceName();
 
-	return SfxStoringHelper::SearchForFilter( m_pOwner->GetFilterQuery(), aSearchRequest, nMust, nDont );
+	return ::comphelper::MimeConfigurationHelper::SearchForFilter( m_pOwner->GetFilterQuery(), aSearchRequest, nMust, nDont );
 }
 
 //-------------------------------------------------------------------------
 		aSearchRequest[1].Name = ::rtl::OUString::createFromAscii( "DocumentService" );
 		aSearchRequest[1].Value <<= GetDocServiceName();
 
-		aFilterProps = SfxStoringHelper::SearchForFilter( m_pOwner->GetFilterQuery(), aSearchRequest, nMust, nDont );
+		aFilterProps = ::comphelper::MimeConfigurationHelper::SearchForFilter( m_pOwner->GetFilterQuery(), aSearchRequest, nMust, nDont );
 	}
 	else
 	{
 
 //-------------------------------------------------------------------------
 // static
-uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter(
-                                                        const uno::Reference< container::XContainerQuery >& xFilterQuery,
-                                                        const uno::Sequence< beans::NamedValue >& aSearchRequest,
-                                                        sal_Int32 nMustFlags,
-                                                        sal_Int32 nDontFlags )
-{
-    uno::Sequence< beans::PropertyValue > aFilterProps;
-    uno::Reference< container::XEnumeration > xFilterEnum =
-                                            xFilterQuery->createSubSetEnumerationByProperties( aSearchRequest );
-
-    // the first default filter will be taken,
-    // if there is no filter with flag default the first acceptable filter will be taken
-    if ( xFilterEnum.is() )
-    {
-        while ( xFilterEnum->hasMoreElements() )
-        {
-            uno::Sequence< beans::PropertyValue > aProps;
-            if ( xFilterEnum->nextElement() >>= aProps )
-            {
-                ::comphelper::SequenceAsHashMap aPropsHM( aProps );
-                sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ),
-                                                                        (sal_Int32)0 );
-                if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) )
-                {
-                    if ( ( nFlags & SFX_FILTER_DEFAULT ) == SFX_FILTER_DEFAULT )
-                    {
-                        aFilterProps = aProps;
-                        break;
-                    }
-                    else if ( !aFilterProps.getLength() )
-                        aFilterProps = aProps;
-                }
-            }
-        }
-    }
-
-    return aFilterProps;
-}
-
-//-------------------------------------------------------------------------
-// static
 sal_Bool SfxStoringHelper::CheckFilterOptionsAppearence(
 													const uno::Reference< container::XNameAccess >& xFilterCFG,
 													const ::rtl::OUString& aFilterName )

sfx2/source/doc/sfxbasemodel.cxx

 }
 
 // ---------------------------------
-void SAL_CALL SfxBaseModel::notifyDocumentEvent( const ::rtl::OUString& _EventName, const uno::Reference< frame::XController2 >& _ViewController, const uno::Any& _Supplement )
+void SAL_CALL SfxBaseModel::notifyDocumentEvent( const ::rtl::OUString&, const uno::Reference< frame::XController2 >&, const uno::Any& )
     throw ( lang::IllegalArgumentException, lang::NoSupportException, uno::RuntimeException )
 {
     throw lang::NoSupportException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SfxBaseModel controlls all the sent notifications itself!" ) ), uno::Reference< uno::XInterface >() );
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.