summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-12-16 21:10:55 +0100
committerMichael Stahl <mstahl@redhat.com>2014-12-16 21:23:37 +0100
commit298e144f8235bb4fe48e204764ec0ba936f3b0c0 (patch)
treebc8598f9b99f5f19619f1367cc59a48735c7d6bd /sw
parent1c32b8747e0a2051b9abcb1e681c3ca08c039269 (diff)
fdo#86857: sw: fix HTML export of page style background color
SwPageDesc no longer contains RES_BACKGROUND but XATTR_FOO. Change-Id: Ie722b0279f9d9831338f6613a4722010afd1543e
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/htmlexport/data/fdo86857.html29
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx15
-rw-r--r--sw/source/filter/html/wrthtml.cxx6
3 files changed, 49 insertions, 1 deletions
diff --git a/sw/qa/extras/htmlexport/data/fdo86857.html b/sw/qa/extras/htmlexport/data/fdo86857.html
new file mode 100644
index 000000000000..dc1fd888666a
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/fdo86857.html
@@ -0,0 +1,29 @@
+<!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>
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index fd07c75ffe8d..d8c673c2e4ee 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -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")
{
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 0dd4142740d7..fdead9ace3fe 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -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 );