dbaccess/source/core/dataaccess/databasecontext.cxx | 10 +++++++++- dbaccess/source/filter/xml/xmlfilter.cxx | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-)
New commits: commit a20d53afb97a278a16ad604cb65f107d33ab4fb9 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri May 8 11:14:12 2015 +0200 dbaccess: handle URL mark as StreamRelPath in ODatabaseContext With this, dbaccess can not only load .odb files, but also other ODF packages as well, as long as the URL's mark (the part after the "#") contains under what namespace the real .odb is. This will be used for embedding data source definitions into .odt documents by Writer in a bit. Change-Id: Ic1e922418c185fd6ec49d442a3419b80c9a6c76a diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index e4fb8e6..4e6c185 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -310,9 +310,15 @@ Reference< XInterface > ODatabaseContext::getRegisteredObject(const OUString& _ return loadObjectFromURL( _rName, sURL ); } -Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rName,const OUString& _sURL) +Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rName,const OUString& rURL) { + OUString _sURL(rURL); INetURLObject aURL( _sURL ); + + OUString aMark = aURL.GetMark(INetURLObject::DECODE_WITH_CHARSET); + if (!aMark.isEmpty()) + _sURL = aURL.GetURLNoMark(); + if ( aURL.GetProtocol() == INetProtocol::NotValid ) throw NoSuchElementException( _rName, *this ); @@ -361,6 +367,8 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa aArgs.put( "URL", _sURL ); aArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG ); aArgs.put( "InteractionHandler", task::InteractionHandler::createWithParent(m_aContext, 0) ); + if (!aMark.isEmpty()) + aArgs.put("StreamRelPath", aMark); Sequence< PropertyValue > aResource( aArgs.getPropertyValues() ); xLoad->load( aResource ); commit dbab26d1fdcc0891a0f3e098f10a5c98e328a48b Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri May 8 11:13:27 2015 +0200 dbaccess: handle StreamRelPath in ODBFilter::implImport() Change-Id: I8a4d21f8bef272a6cdb5a72da274e65516c36617 diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 4d2e8cc..60fd9f3 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -457,6 +457,10 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) try { xStorage.set(pMedium->GetStorage(false), UNO_QUERY_THROW); + + OUString sStreamRelPath = aMediaDescriptor.getOrDefault("StreamRelPath", OUString()); + if (!sStreamRelPath.isEmpty()) + xStorage = xStorage->openStorageElement(sStreamRelPath, embed::ElementModes::READ); } catch (const Exception&) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits