Kaydet (Commit) 298e144f authored tarafından Michael Stahl's avatar Michael Stahl

fdo#86857: sw: fix HTML export of page style background color

SwPageDesc no longer contains RES_BACKGROUND but XATTR_FOO.

Change-Id: Ie722b0279f9d9831338f6613a4722010afd1543e
üst 1c32b874
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title></title>
<meta name="generator" content="LibreOfficeDev 4.3.6.0.0 (Linux)"/>
<style type="text/css">
@page { margin: 2cm }
p { margin-bottom: 0.25cm; line-height: 120% }
td p { margin-bottom: 0cm }
a:link { so-language: zxx }
</style>
</head>
<body lang="de-DE" bgcolor="#ff0000" dir="ltr" style="background: #ff0000">
<table width="100%" cellpadding="4" cellspacing="0">
<col width="256*">
<tr>
<td width="100%" valign="top" bgcolor="#66ffff" style="border: 1px solid #000000; padding: 0.1cm">
<p><br/>
</p>
</td>
</tr>
</table>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>
</p>
</body>
</html>
......@@ -89,6 +89,21 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testFdo62336, "fdo62336.docx")
// If either of no-calc-layout or no-test-import is enabled, the crash does not occur
}
DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testFdo86857, "fdo86857.html")
{
// problem was that background color on page style was not exported
uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles"));
uno::Reference<beans::XPropertySet> xStyle(xPageStyles->getByName("HTML"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff0000), getProperty<sal_Int32>(xStyle, "BackColor"));
// check that table background color works, which still uses RES_BACKGROUND
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x66ffff), getProperty<sal_Int32>(xCell, "BackColor"));
}
DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testCharacterBorder, "charborder.odt")
{
......
......@@ -30,6 +30,7 @@
#include <i18nlangtag/languagetag.hxx>
#include <sfx2/frmhtmlw.hxx>
#include <svx/xoutbmp.hxx>
#include <svx/unobrushitemhelper.hxx>
#include <sfx2/htmlmode.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/colritem.hxx>
......@@ -1047,7 +1048,10 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
const SfxItemSet& rItemSet = pPageDesc->GetMaster().GetAttrSet();
OutBackground( rItemSet, true );
// fdo#86857 page styles now contain the XATTR_*, not RES_BACKGROUND
SvxBrushItem const aBrushItem(
getSvxBrushItemFromSourceSet(rItemSet, RES_BACKGROUND));
OutBackground(&aBrushItem, true);
nDirection = GetHTMLDirection( rItemSet );
OutDirection( nDirection );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment