summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx8
-rw-r--r--sw/source/filter/html/css1atr.cxx21
2 files changed, 26 insertions, 3 deletions
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 6ca8c80699ea..bc0af92e93c0 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2266,10 +2266,14 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTableBackground)
pWrtShell->SetTabBackground(aBrush);
pWrtShell->Down(/*bSelect=*/false);
pWrtShell->SplitNode();
- pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/1, /*nCols=*/1);
+ pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/2, /*nCols=*/1);
pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
aBrush.SetColor(0x00ff00);
pWrtShell->SetRowBackground(aBrush);
+ pWrtShell->Down(/*bSelect=*/false);
+ // Second row has an explicit transparent background.
+ aBrush.SetColor(COL_TRANSPARENT);
+ pWrtShell->SetRowBackground(aBrush);
// When exporting to reqif-xhtml:
ExportToReqif();
@@ -2286,6 +2290,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTableBackground)
assertXPath(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "style",
"background: #00ff00");
assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "bgcolor");
+ // Second row has no explicit style, the default is not written.
+ assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[2]", "style");
}
CPPUNIT_TEST_FIXTURE(HtmlExportTest, testImageKeepRatio)
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 9619002314af..bc2449b865cc 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -185,9 +185,21 @@ OString lclConvToHex(sal_uInt16 nHex)
bool IgnorePropertyForReqIF(bool bReqIF, std::string_view rProperty, std::string_view rValue,
std::optional<sw::Css1Background> oMode)
{
- if (!bReqIF || (oMode.has_value() && *oMode != sw::Css1Background::TableCell))
+ if (!bReqIF)
return false;
+ if (oMode.has_value() && *oMode != sw::Css1Background::TableCell)
+ {
+ // Table or row.
+ if (rProperty == sCSS1_P_background && rValue == "transparent")
+ {
+ // This is the default already.
+ return true;
+ }
+
+ return false;
+ }
+
// Only allow these two keys, nothing else in ReqIF mode.
if (rProperty == sCSS1_P_text_decoration)
{
@@ -244,7 +256,12 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp,
const OUString *pSVal,
std::optional<sw::Css1Background> oMode )
{
- if (IgnorePropertyForReqIF(mbReqIF, pProp, sVal, oMode))
+ OString aPropertyValue(sVal);
+ if (aPropertyValue.isEmpty() && pSVal)
+ {
+ aPropertyValue = pSVal->toUtf8();
+ }
+ if (IgnorePropertyForReqIF(mbReqIF, pProp, aPropertyValue, oMode))
return;
OStringBuffer sOut;