summaryrefslogtreecommitdiff
path: root/sc/source/filter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-08-25 14:44:48 +0200
committerMichael Meeks <michael.meeks@collabora.com>2014-08-27 10:35:08 -0500
commitf29c5f742e8be13b5ee7d03ebf1bcaf2a4adfef9 (patch)
treecbb17a7ad4c1423f96cbb6a1d7ef63b0380f5f1f /sc/source/filter
parentfbcb191c4302bcf1c3163fe3ed7a8bb04ffdac50 (diff)
sw HTML export: avoid loosing embedded objects when skipping images
(cherry picked from commit 971ffe10583dcdd195f429816760bc0acfb6297f) Also squash in 3 fixes on top of that: 1) HTML export: avoid invalid output for embedded spreadsheets When the sc document is embedded inside an sw one, then the sc HTML export should just write what's inside the <body>. Add a filter option for that in sc and use it from sw. (cherry picked from commit 1ee98159f7749b2c1ad47de60a9b3057b9e9720e) 2) sw HTML export: avoid <table> directly inside <p> Wrapping the embedded object output in a <span> at least makes the parser errors go away. (cherry picked from commit 58fc5c6a5153b68470f7de8229b76dca04267ab7) 3) CppunitTest_sw_htmlexport: tinderbox says scfilt dependency is missing (cherry picked from commit 9f482b596195a2948a8f7f14664a7a870d348e95) Change-Id: I308e411e4abb938fe08b47aaf21d6fd747bb758e Reviewed-on: https://gerrit.libreoffice.org/11148 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source/filter')
-rw-r--r--sc/source/filter/html/htmlexp.cxx19
-rw-r--r--sc/source/filter/inc/htmlexp.hxx2
2 files changed, 18 insertions, 3 deletions
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index db086107dc89..afd453a11f3d 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -218,7 +218,8 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocume
bCalcAsShown( pDocP->GetDocOptions().IsCalcAsShown() ),
bTableDataWidth( true ),
bTableDataHeight( true ),
- mbSkipImages ( false )
+ mbSkipImages ( false ),
+ mbSkipHeaderFooter( false )
{
strcpy( sIndent, sIndentSource );
sIndent[0] = 0;
@@ -232,6 +233,10 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocume
{
mbSkipImages = true;
}
+ else if (rFilterOptions == "SkipHeaderFooter")
+ {
+ mbSkipHeaderFooter = true;
+ }
for ( sal_uInt16 j=0; j < SC_HTML_FONTSIZES; j++ )
{
@@ -319,14 +324,18 @@ Size ScHTMLExport::MMToPixel( const Size& rSize )
sal_uLong ScHTMLExport::Write()
{
+ if (!mbSkipHeaderFooter)
+ {
rStrm.WriteChar( '<' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_doctype ).WriteChar( ' ' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_doctype40 ).WriteChar( '>' )
.WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( SAL_NEWLINE_STRING );
TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_html );
WriteHeader();
OUT_LF();
+ }
WriteBody();
OUT_LF();
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_html );
+ if (!mbSkipHeaderFooter)
+ TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_html );
return rStrm.GetError();
}
@@ -562,6 +571,8 @@ void ScHTMLExport::WriteBody()
const SvxBrushItem* pBrushItem = (const SvxBrushItem*)&rSet.Get( ATTR_BACKGROUND );
// default text color black
+ if (!mbSkipHeaderFooter)
+ {
rStrm.WriteChar( '<' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_body );
if (!mbSkipImages)
@@ -626,13 +637,15 @@ void ScHTMLExport::WriteBody()
}
rStrm.WriteChar( '>' ); OUT_LF();
+ }
if ( bAll )
WriteOverview();
WriteTables();
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_body );
+ if (!mbSkipHeaderFooter)
+ TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_body );
}
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index d1ff1ebb008a..b71211c58e63 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -126,6 +126,8 @@ class ScHTMLExport : public ScExportBase
bool bTableDataWidth;
bool bTableDataHeight;
bool mbSkipImages;
+ /// If HTML header and footer should be written as well, or just the content itself.
+ bool mbSkipHeaderFooter;
const SfxItemSet& PageDefaults( SCTAB nTab );