summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-04-30 14:31:06 +0200
committerCaolán McNamara <caolanm@redhat.com>2012-04-30 15:25:56 +0100
commit920de2d0f5bfc79b2570595d95495759c009a825 (patch)
treeb6794592ba53ff4820496b8b4f6a3d27df0a174d
parentb363a1aac10fad09d62d3c4aece5b2de5589947a (diff)
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) (cherry picked from commit 284b421f40078275e5e647a4f7e82e4ef7fec6a7) Signed-off-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/filter/html/css1atr.cxx12
-rw-r--r--sw/source/filter/html/htmltabw.cxx6
-rw-r--r--sw/source/filter/html/parcss1.cxx6
-rw-r--r--sw/source/filter/html/wrthtml.hxx1
4 files changed, 20 insertions, 5 deletions
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 97414c2e53ad..1a62162a6e00 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 ab13dfbe9171..0623d07ca2d8 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 5f9753e9bb86..506a88e90a3a 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -409,6 +409,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,