summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-07-25 14:24:33 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-07-26 08:41:04 +0200
commit08b6daa63e7b5aac6c301da3224af3f31c9434f9 (patch)
tree3181232358beab60113ec6472bbcab92a626ce0b /xmloff
parentcfbdbfdc9964f77b447a2b200398b3ab00cec1d7 (diff)
HACK to survive missing target storage
...during e.g. `convert-to fodt doc/ooo108999-1.doc` (i.e., the attachment tytret2010.doc at <https://bz.apache.org/ooo/show_bug.cgi?id=108999#c2>). It appears that the call to SwXMLWriter::Write_ to set the "TargetStorage" property is missing in this scenario (which is done for convert-to odt), but it is unclear what a proper fix should look like. Change-Id: I4beab4d8891fc0222bc0867ea53c3d9307be20dd Reviewed-on: https://gerrit.libreoffice.org/76314 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/txtparae.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 1cbc325f604d..5a9ebfcb3dfd 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -476,20 +476,24 @@ void FieldParamExporter::Export()
{
// Save the OLE object
Reference< embed::XStorage > xTargetStg = m_pExport->GetTargetStorage();
- Reference< embed::XStorage > xDstStg = xTargetStg->openStorageElement(
+ if (xTargetStg.is()) {
+ Reference< embed::XStorage > xDstStg = xTargetStg->openStorageElement(
"OLELinks", embed::ElementModes::WRITE );
- if ( !xDstStg->hasByName( sValue ) ) {
- Reference< XStorageBasedDocument > xStgDoc (
+ if ( !xDstStg->hasByName( sValue ) ) {
+ Reference< XStorageBasedDocument > xStgDoc (
m_pExport->GetModel( ), UNO_QUERY );
- Reference< embed::XStorage > xDocStg = xStgDoc->getDocumentStorage();
- Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
+ Reference< embed::XStorage > xDocStg = xStgDoc->getDocumentStorage();
+ Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
"OLELinks", embed::ElementModes::READ );
- xOleStg->copyElementTo( sValue, xDstStg, sValue );
- Reference< embed::XTransactedObject > xTransact( xDstStg, UNO_QUERY );
- if ( xTransact.is( ) )
- xTransact->commit( );
+ xOleStg->copyElementTo( sValue, xDstStg, sValue );
+ Reference< embed::XTransactedObject > xTransact( xDstStg, UNO_QUERY );
+ if ( xTransact.is( ) )
+ xTransact->commit( );
+ }
+ } else {
+ SAL_WARN("xmloff", "no target storage");
}
}
}