diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-05-04 15:50:02 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-05-04 16:12:14 +0200 |
commit | ed85e11a1bb2e8913e5efc9257ff74bf7543a1df (patch) | |
tree | 3ed4f49edef48303f8fd2f34c42d915ab469f0d9 /embeddedobj/source | |
parent | e1b1f18a6e9f7b2feb5b74d1e80d410be07c294b (diff) |
embeddedobj: allow creating objects lacking a FileFormatVersion=6800 filter
dbaccess::ODatabaseDocument::loadFromStorage() is still not implemented,
though.
Change-Id: I1be11f2a2274f67dd0a11f96a718394d5f72605f
Diffstat (limited to 'embeddedobj/source')
-rw-r--r-- | embeddedobj/source/commonembedding/persistence.cxx | 4 | ||||
-rw-r--r-- | embeddedobj/source/commonembedding/xfactory.cxx | 6 | ||||
-rw-r--r-- | embeddedobj/source/general/xcreator.cxx | 7 |
3 files changed, 17 insertions, 0 deletions
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index b2cd8ecc6717..10a4485f4bbf 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -447,6 +447,10 @@ OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 nVersion ) const try { ::comphelper::MimeConfigurationHelper aHelper( m_xContext ); aFilterName = aHelper.GetDefaultFilterFromServiceName( GetDocumentServiceName(), nVersion ); + + // If no filter is found, fall back to the FileFormatVersion=6200 filter, Base only has that. + if (aFilterName.isEmpty() && nVersion == SOFFICE_FILEFORMAT_CURRENT) + aFilterName = aHelper.GetDefaultFilterFromServiceName(GetDocumentServiceName(), SOFFICE_FILEFORMAT_60); } catch( const uno::Exception& ) {} } diff --git a/embeddedobj/source/commonembedding/xfactory.cxx b/embeddedobj/source/commonembedding/xfactory.cxx index 42ddfb3464f2..9a6477d22492 100644 --- a/embeddedobj/source/commonembedding/xfactory.cxx +++ b/embeddedobj/source/commonembedding/xfactory.cxx @@ -26,6 +26,7 @@ #include <comphelper/processfactory.hxx> #include <cppuhelper/supportsservice.hxx> +#include <comphelper/documentconstants.hxx> #include "xfactory.hxx" #include "commonembobj.hxx" @@ -114,6 +115,11 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta xSubStorage = uno::Reference< embed::XStorage >(); uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByMediaType( aMediaType ); + + // If the sequence is empty, fall back to the FileFormatVersion=6200 filter, Base only has that. + if (!aObject.hasElements() && aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII) + aObject = m_aConfigHelper.GetObjectPropsByMediaType(MIMETYPE_VND_SUN_XML_BASE_ASCII); + if ( !aObject.getLength() ) throw io::IOException(); // unexpected mimetype of the storage diff --git a/embeddedobj/source/general/xcreator.cxx b/embeddedobj/source/general/xcreator.cxx index 4f301d407ce0..8ccff0c81074 100644 --- a/embeddedobj/source/general/xcreator.cxx +++ b/embeddedobj/source/general/xcreator.cxx @@ -31,6 +31,7 @@ #include <comphelper/processfactory.hxx> #include <cppuhelper/supportsservice.hxx> +#include <comphelper/documentconstants.hxx> #include <xcreator.hxx> #include <dummyobject.hxx> @@ -200,8 +201,14 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta OSL_ENSURE( !aMediaType.isEmpty(), "No media type is specified for the object!" ); if ( !aMediaType.isEmpty() && aEmbedFactory.isEmpty() ) + { aEmbedFactory = m_aConfigHelper.GetFactoryNameByMediaType( aMediaType ); + // If no factory is found, fall back to the FileFormatVersion=6200 filter, Base only has that. + if (aEmbedFactory.isEmpty() && aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII) + aEmbedFactory = m_aConfigHelper.GetFactoryNameByMediaType(MIMETYPE_VND_SUN_XML_BASE_ASCII); + } + if ( !aEmbedFactory.isEmpty() ) { uno::Reference< uno::XInterface > xFact = m_xContext->getServiceManager()->createInstanceWithContext(aEmbedFactory, m_xContext); |