diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-03-28 15:00:10 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-03-28 17:55:17 +0200 |
commit | 6a189b2ac72d5fb83199bdb09e41f7d088440cc9 (patch) | |
tree | 980a682eb9435c5573d794dac97ea6a1451f4c6f /sw/source/filter/html/wrthtml.cxx | |
parent | e74578ed67d42036646fb575a3c3d5d50147abc0 (diff) |
tdf#108122 HTML export: fix lost images on copy
As in the copy part of copy&paste. The problem was that the document has
an empty base URL during copy, and this was images were not exported at
all.
An alternative fix would be to use embedded images, but sadly Word's
HTML import doesn't understand that markup, so use tempfiles instead.
Change-Id: Iab8c555ac244d943c4958f24f8ac61cba4ec3aba
Reviewed-on: https://gerrit.libreoffice.org/52003
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/source/filter/html/wrthtml.cxx')
-rw-r--r-- | sw/source/filter/html/wrthtml.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 0bfd00b08f17..0d993fcde3d6 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -80,6 +80,7 @@ #include <tools/urlobj.hxx> #include <osl/file.hxx> #include <comphelper/scopeguard.hxx> +#include <unotools/tempfile.hxx> #define MAX_INDENT_LEVEL 20 @@ -156,6 +157,14 @@ SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL ) , m_bParaDotLeaders( false ) { SetBaseURL(rBaseURL); + + if (rBaseURL.isEmpty()) + { + // Paste: set base URL to a tempfile, so images are not lost. + mpTempBaseURL.reset(new utl::TempFile()); + mpTempBaseURL->EnableKillingFile(); + SetBaseURL(mpTempBaseURL->GetURL()); + } } SwHTMLWriter::~SwHTMLWriter() |