Kaydet (Commit) a20d53af authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst dbab26d1
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment