summaryrefslogtreecommitdiff
path: root/sw/source/filter/html/wrthtml.cxx
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2016-03-18 15:57:17 +0100
committerOliver Specht <oliver.specht@cib.de>2016-03-23 13:57:16 +0000
commit46fa816aa0a713c54836b9689fa7a1c9ff55ef5a (patch)
tree8dad103eca59e741a51a2b761c9bfd69a24f95fc /sw/source/filter/html/wrthtml.cxx
parentf9cf53a082f1d99b313ebd09c8791541859eac40 (diff)
tdf#63211: saving embedded images to HTML optional
This change re-introduces linked images in HTML export but keeps embedded image export in mailmerge e-Mail function Change-Id: I9e956b590f4c675b5954e19e4d3948c36b55f1e6 Reviewed-on: https://gerrit.libreoffice.org/23359 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Diffstat (limited to 'sw/source/filter/html/wrthtml.cxx')
-rw-r--r--sw/source/filter/html/wrthtml.cxx39
1 files changed, 31 insertions, 8 deletions
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 57978fbe53d8..1bb9512046bd 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -155,6 +155,7 @@ SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL )
, m_bCfgNetscape4( false )
, mbSkipImages(false)
, mbSkipHeaderFooter(false)
+ , mbEmbedImages(false)
, m_bCfgPrintLayout( false )
, m_bParaDotLeaders( false )
{
@@ -186,6 +187,10 @@ void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium)
{
mbSkipHeaderFooter = true;
}
+ else if (sFilterOptions == "EmbedImages" )
+ {
+ mbEmbedImages = true;
+ }
}
sal_uLong SwHTMLWriter::WriteStream()
@@ -1057,8 +1062,10 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
OutDirection( m_nDirection );
if( m_bCfgOutStyles )
- OutCSS1_BodyTagStyleOpt( *this, rItemSet );
-
+ {
+ OUString dummy;
+ OutCSS1_BodyTagStyleOpt( *this, rItemSet, dummy );
+ }
// Events anhaengen
if( pDoc->GetDocShell() ) // nur mit DocShell ist Basic moeglich
OutBasicBodyEvents();
@@ -1230,15 +1237,31 @@ void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, bool bGraphic
OUString aGraphicInBase64;
const Graphic* pGrf = pBrushItem->GetGraphic();
- if( pGrf )
+ OUString GraphicURL = pBrushItem->GetGraphicLink();
+ if( mbEmbedImages || GraphicURL.isEmpty())
{
- if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) )
+ if( pGrf )
{
- m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE;
+ if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) )
+ {
+ m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE;
+ }
+ Strm().WriteCharPtr( " " OOO_STRING_SVTOOLS_HTML_O_background "=\"" );
+ Strm().WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_data ":" );
+ HTMLOutFuncs::Out_String( Strm(), aGraphicInBase64, m_eDestEnc, &m_aNonConvertableCharacters ).WriteChar( '\"' );
}
- Strm().WriteCharPtr( " " OOO_STRING_SVTOOLS_HTML_O_background "=\"" );
- Strm().WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_data ":" );
- HTMLOutFuncs::Out_String( Strm(), aGraphicInBase64, m_eDestEnc, &m_aNonConvertableCharacters ).WriteChar( '\"' );
+ }
+ else
+ {
+ if( m_bCfgCpyLinkedGrfs )
+ {
+ CopyLocalFileToINet( GraphicURL );
+ }
+ OUString s( URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), GraphicURL));
+ Strm().WriteCharPtr(" " OOO_STRING_SVTOOLS_HTML_O_background "=\"" );
+ HTMLOutFuncs::Out_String( Strm(), s, m_eDestEnc, &m_aNonConvertableCharacters );
+ Strm().WriteCharPtr("\"");
+
}
}