diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-02-15 17:50:38 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-02-20 07:54:42 +0100 |
commit | 0a5ca5768f56db481dd3b947b3dddaab7ed96450 (patch) | |
tree | 59eb8e570e98485aaf0d3587a1876f0fe9add6e9 /sw | |
parent | b95fa8525d42574ecce2c04f92b602c022adbd92 (diff) |
tdf#123293 sfx2: fix metadata loss when loading from stream
The problem is that when loading from a stream, there is no BaseURL and
also no storage for the document.
Due to the lack of BaseURL, the sfx2::createBaseURI() throws and loading
RDF metadata fails, which also pops up an annoying warning dialog.
Try to handle this in a similar way than a newly created document (see
GetDMA()), by using the vnd.sun.star.tdoc scheme URL for the document;
this however currently requires that the document has a XStorage, which
is also not the case here.
So add another UNO method to tdoc UCP's tdoc_ucp::ContentProvider,
to split out the creation of the tdoc schema URL from the creation of
the ucb Content, to get rid of the XStorage requirement.
Change-Id: Ica62743f9d21db0b1464b70db1a62ebc61989ef8
Reviewed-on: https://gerrit.libreoffice.org/67882
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/xml/swxml.cxx | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index eb685c83edd0..4db2aaf145ff 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4921,10 +4921,11 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss) // Initialize RDF metadata, to be able to add statements during the import. try { - uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW); + uno::Reference<frame::XModel> const xModel(m_rDoc.GetDocShell()->GetBaseModel()); + uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(xModel, uno::UNO_QUERY_THROW); uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext()); uno::Reference<embed::XStorage> xStorage = comphelper::OStorageHelper::GetTemporaryStorage(); - const uno::Reference<rdf::XURI> xBaseURI(sfx2::createBaseURI(xComponentContext, xStorage, m_sBaseURL)); + const uno::Reference<rdf::XURI> xBaseURI(sfx2::createBaseURI(xComponentContext, xModel, m_sBaseURL)); uno::Reference<task::XInteractionHandler> xHandler; xDocumentMetadataAccess->loadMetadataFromStorage(xStorage, xBaseURI, xHandler); } diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 01fe0ef9eefa..0aec06ae11d0 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -796,8 +796,10 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con { const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(xModelComp, uno::UNO_QUERY_THROW); + const uno::Reference<frame::XModel> xModel(xModelComp, + uno::UNO_QUERY_THROW); const uno::Reference<rdf::XURI> xBaseURI( ::sfx2::createBaseURI( - xContext, xStorage, rBaseURL, StreamPath) ); + xContext, xModel, rBaseURL, StreamPath) ); const uno::Reference<task::XInteractionHandler> xHandler( pDocSh->GetMedium()->GetInteractionHandler() ); xDMA->loadMetadataFromStorage(xStorage, xBaseURI, xHandler); |