summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-02-15 17:50:38 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-08-13 11:06:55 +0200
commitde6355afa4bf89199c7281ddb43a141e192d43d6 (patch)
tree7c349d3e4249c8fa82e4d7b1374f1403507dc221 /ucb
parent44a40b38d881fd2b9cfbedfc630290d1927fd72f (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> (cherry picked from commit 0a5ca5768f56db481dd3b947b3dddaab7ed96450) Reviewed-on: https://gerrit.libreoffice.org/69101 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 98b99ef61c6d725962cdbaa05ff90c9d1aa72d57) Reviewed-on: https://gerrit.libreoffice.org/75963 Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/tdoc/tdoc_provider.cxx27
-rw-r--r--ucb/source/ucp/tdoc/tdoc_provider.hxx13
2 files changed, 29 insertions, 11 deletions
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx
index 58f2652a4dc0..08590131231a 100644
--- a/ucb/source/ucp/tdoc/tdoc_provider.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx
@@ -85,6 +85,7 @@ css::uno::Any SAL_CALL ContentProvider::queryInterface( const css::uno::Type & r
static_cast< lang::XTypeProvider* >(this),
static_cast< lang::XServiceInfo* >(this),
static_cast< ucb::XContentProvider* >(this),
+ static_cast< frame::XTransientDocumentsDocumentContentIdentifierFactory* >(this),
static_cast< frame::XTransientDocumentsDocumentContentFactory* >(this)
);
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
@@ -93,10 +94,11 @@ css::uno::Any SAL_CALL ContentProvider::queryInterface( const css::uno::Type & r
// XTypeProvider methods.
-XTYPEPROVIDER_IMPL_4( ContentProvider,
+XTYPEPROVIDER_IMPL_5( ContentProvider,
lang::XTypeProvider,
lang::XServiceInfo,
ucb::XContentProvider,
+ frame::XTransientDocumentsDocumentContentIdentifierFactory,
frame::XTransientDocumentsDocumentContentFactory );
@@ -161,13 +163,11 @@ ContentProvider::queryContent(
}
-// XTransientDocumentsDocumentContentFactory methods.
-
+// XTransientDocumentsDocumentContentIdentifierFactory methods.
-// virtual
-uno::Reference< ucb::XContent > SAL_CALL
-ContentProvider::createDocumentContent(
- const uno::Reference< frame::XModel >& Model )
+uno::Reference<ucb::XContentIdentifier> SAL_CALL
+ContentProvider::createDocumentContentIdentifier(
+ uno::Reference<frame::XModel> const& xModel)
{
// model -> id -> content identifier -> queryContent
if ( !m_xDocsMgr.is() )
@@ -178,7 +178,7 @@ ContentProvider::createDocumentContent(
1 );
}
- OUString aDocId = tdoc_ucp::OfficeDocumentsManager::queryDocumentId( Model );
+ OUString aDocId = tdoc_ucp::OfficeDocumentsManager::queryDocumentId(xModel);
if ( aDocId.isEmpty() )
{
throw lang::IllegalArgumentException(
@@ -193,6 +193,17 @@ ContentProvider::createDocumentContent(
uno::Reference< ucb::XContentIdentifier > xId
= new ::ucbhelper::ContentIdentifier( aBuffer.makeStringAndClear() );
+ return xId;
+}
+
+// XTransientDocumentsDocumentContentFactory methods.
+
+uno::Reference< ucb::XContent > SAL_CALL
+ContentProvider::createDocumentContent(
+ uno::Reference<frame::XModel> const& xModel)
+{
+ uno::Reference<ucb::XContentIdentifier> const xId(
+ createDocumentContentIdentifier(xModel));
osl::MutexGuard aGuard( m_aMutex );
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.hxx b/ucb/source/ucp/tdoc/tdoc_provider.hxx
index 3501bd4d8ec9..f8c2fb701e83 100644
--- a/ucb/source/ucp/tdoc/tdoc_provider.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_provider.hxx
@@ -22,6 +22,7 @@
#include <rtl/ref.hxx>
#include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp>
+#include <com/sun/star/frame/XTransientDocumentsDocumentContentIdentifierFactory.hpp>
#include <com/sun/star/packages/WrongPasswordException.hpp>
#include <ucbhelper/providerhelper.hxx>
#include "tdoc_uri.hxx"
@@ -51,9 +52,10 @@ namespace tdoc_ucp {
class StorageElementFactory;
-class ContentProvider :
- public ::ucbhelper::ContentProviderImplHelper,
- public css::frame::XTransientDocumentsDocumentContentFactory
+class ContentProvider
+ : public ::ucbhelper::ContentProviderImplHelper
+ , public css::frame::XTransientDocumentsDocumentContentIdentifierFactory
+ , public css::frame::XTransientDocumentsDocumentContentFactory
{
public:
explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
@@ -86,6 +88,11 @@ public:
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
+ // XTransientDocumentsDocumentContentIdentifierFactory
+ virtual css::uno::Reference<css::ucb::XContentIdentifier> SAL_CALL
+ createDocumentContentIdentifier(
+ css::uno::Reference<css::frame::XModel> const& xModel) override;
+
// XTransientDocumentsDocumentContentFactory
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
createDocumentContent( const css::uno::Reference<