diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-04-30 14:31:06 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-04-30 14:58:22 +0200 |
commit | 284b421f40078275e5e647a4f7e82e4ef7fec6a7 (patch) | |
tree | e3ae8d4a13801f9740ea3e569690bb3c01a31f21 /sw | |
parent | fdo#41796: sw: HTML: import CSS STYLE border on TD: (diff) | |
download | core-284b421f40078275e5e647a4f7e82e4ef7fec6a7.tar.gz core-284b421f40078275e5e647a4f7e82e4ef7fec6a7.zip |
fdo#41796: sw: HTML: spurious semicolons in STYLE:
The STYLE attributes on TD elements (except for the first) start with a
spurious semicolon, because the bFirstCSS1Prop variable is not reset.
Apparently the semicolon is a separator in STYLE attributes, so it is
probably invalid to write a spurious one, but Mozilla can still render
the borders right, so add a workaround to CSS1Parser::ParseStyleOption
to skip initial semicolons.
Fix the export by using the SwCSS1OutMode to set the mode (also turning
on encoding while at it), which is the only way to reset bFirstCSS1Prop.
(regression from d18feffd49f4481626417daac7984b2a7e70c3bf)
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/html/css1atr.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/html/htmltabw.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/html/parcss1.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.hxx | 1 |
4 files changed, 20 insertions, 5 deletions
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 46598df63ed1..9e45ebfa40c0 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -2301,6 +2301,18 @@ void SwHTMLWriter::OutCSS1_TableFrmFmtOptions( const SwFrmFmt& rFrmFmt ) Strm() << '\"'; } +void SwHTMLWriter::OutCSS1_TableCellBorderHack(SwFrmFmt const& rFrmFmt) +{ + SwCSS1OutMode const aMode(*this, + CSS1_OUTMODE_STYLE_OPT_ON|CSS1_OUTMODE_ENCODE|CSS1_OUTMODE_TABLEBOX, + true, 0); + OutCSS1_SvxBox(*this, rFrmFmt.GetBox()); + if (!bFirstCSS1Property) + { + this->Strm() << cCSS1_style_opt_end; + } +} + void SwHTMLWriter::OutCSS1_SectionFmtOptions( const SwFrmFmt& rFrmFmt ) { SwCSS1OutMode aMode( *this, CSS1_OUTMODE_STYLE_OPT_ON | diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index f33cf53e5d49..1f9cc92153ba 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -442,11 +442,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, OutCSS1_TableBGStyleOpt( rWrt, *pBrushItem ); } - sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_style). - append(RTL_CONSTASCII_STRINGPARAM("=\"")); - rWrt.Strm() << sOut.makeStringAndClear().getStr(); - OutCSS1_SvxBox( rWrt, pBox->GetFrmFmt()->GetBox() ); - sOut.append('"'); + rWrt.OutCSS1_TableCellBorderHack(*pBox->GetFrmFmt()); sal_uInt32 nNumFmt = 0; double nValue = 0.0; diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx index 67f519da5885..cf2adc6597b1 100644 --- a/sw/source/filter/html/parcss1.cxx +++ b/sw/source/filter/html/parcss1.cxx @@ -1181,6 +1181,12 @@ sal_Bool CSS1Parser::ParseStyleOption( const String& rIn ) InitRead( rIn ); + // fdo#41796: skip over spurious semicolons + while (CSS1_SEMICOLON == nToken) + { + nToken = GetNextToken(); + } + String aProperty; CSS1Expression *pExpr = ParseDeclaration( aProperty ); if( !pExpr ) diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 96e2d06ef2ec..9ebbb2692b4d 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -406,6 +406,7 @@ public: rtl::OString OutFrmFmtOptions( const SwFrmFmt& rFrmFmt, const String& rAltTxt, sal_uInt32 nFrmOpts, const rtl::OString& rEndTags = rtl::OString() ); void OutCSS1_TableFrmFmtOptions( const SwFrmFmt& rFrmFmt ); + void OutCSS1_TableCellBorderHack(const SwFrmFmt& rFrmFmt); void OutCSS1_SectionFmtOptions( const SwFrmFmt& rFrmFmt ); void OutCSS1_FrmFmtOptions( const SwFrmFmt& rFrmFmt, sal_uInt32 nFrmOpts, const SdrObject *pSdrObj=0, |