[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/qa sw/source
Michael Stahl
mstahl at redhat.com
Tue Dec 16 12:30:55 PST 2014
sw/qa/extras/htmlexport/data/fdo86857.html | 29 +++++++++++++++++++++++++++++
sw/qa/extras/htmlexport/htmlexport.cxx | 15 +++++++++++++++
sw/source/filter/html/wrthtml.cxx | 6 +++++-
3 files changed, 49 insertions(+), 1 deletion(-)
New commits:
commit 8275fd953666198e67e82e517bd1bab8bf742683
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Dec 16 21:10:55 2014 +0100
fdo#86857: sw: fix HTML export of page style background color
SwPageDesc no longer contains RES_BACKGROUND but XATTR_FOO.
Change-Id: Ie722b0279f9d9831338f6613a4722010afd1543e
(cherry picked from commit 298e144f8235bb4fe48e204764ec0ba936f3b0c0)
diff --git a/sw/qa/extras/htmlexport/data/fdo86857.html b/sw/qa/extras/htmlexport/data/fdo86857.html
new file mode 100644
index 0000000..dc1fd88
--- /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 fd07c75..d8c673c 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 28049c2..13add63 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 );
More information about the Libreoffice-commits
mailing list