[Libreoffice-commits] core.git: sw/CppunitTest_sw_ooxmlexport11.mk sw/Module_sw.mk sw/qa sw/source
Justin Luth
justin_luth at sil.org
Mon Oct 30 05:16:47 UTC 2017
sw/CppunitTest_sw_ooxmlexport11.mk | 14 +++++
sw/Module_sw.mk | 1
sw/qa/extras/ooxmlexport/data/tdf92524_autoColor.doc |binary
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 51 +++++++++++++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 6 +-
5 files changed, 71 insertions(+), 1 deletion(-)
New commits:
commit 9b8a99a1886997f91535ed613e50b3691c716ea1
Author: Justin Luth <justin_luth at sil.org>
Date: Sat Oct 28 09:14:32 2017 +0300
tdf#92524 ooxmlexport: recognize COL_AUTO for RES_BACKGROUND
FormatBackground was always returning the actual color
instead of AUTO when the color was COL_AUTO because ConvertColor
is being passed Color.GetRGBColor() instead of just Color.
There are three sections here:
-XML_fillcolor: looks like it accepts values like "green" and
"teal". Unclear from documenation whether auto is allowed.
-XML_srgbClr: only accepts rgb number, not auto
-XML_fill: needs this fix - test document available.
Since the section can't globally handle "auto", I left XML_fillcolor
alone, waiting for a proof bug report.
Change-Id: Idecb6a32fba814a6fb3aeb6cc015d793ba6f8cf9
Reviewed-on: https://gerrit.libreoffice.org/43975
Reviewed-by: Justin Luth <justin_luth at sil.org>
Tested-by: Justin Luth <justin_luth at sil.org>
diff --git a/sw/CppunitTest_sw_ooxmlexport11.mk b/sw/CppunitTest_sw_ooxmlexport11.mk
new file mode 100644
index 000000000000..654ab04fbc1b
--- /dev/null
+++ b/sw/CppunitTest_sw_ooxmlexport11.mk
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call sw_ooxmlexport_test,11))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 57ebc6d7d333..f15d928b0c46 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -65,6 +65,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_ooxmlexport8 \
CppunitTest_sw_ooxmlexport9 \
CppunitTest_sw_ooxmlexport10 \
+ CppunitTest_sw_ooxmlexport11 \
CppunitTest_sw_ooxmlfieldexport \
CppunitTest_sw_ooxmlw14export \
CppunitTest_sw_ooxmlencryption \
diff --git a/sw/qa/extras/ooxmlexport/data/tdf92524_autoColor.doc b/sw/qa/extras/ooxmlexport/data/tdf92524_autoColor.doc
new file mode 100644
index 000000000000..147e9c133b46
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf92524_autoColor.doc differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
new file mode 100644
index 000000000000..861f863cc54d
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+#include <com/sun/star/text/XTextFramesSupplier.hpp>
+#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <svx/xfillit0.hxx>
+
+class Test : public SwModelTestBase
+{
+public:
+ Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
+
+protected:
+ /**
+ * Blacklist handling
+ */
+ bool mustTestImportOf(const char* filename) const override {
+ // If the testcase is stored in some other format, it's pointless to test.
+ return OString(filename).endsWith(".docx");
+ }
+};
+
+DECLARE_OOXMLEXPORT_TEST(testTdf92524_autoColor, "tdf92524_autoColor.doc")
+{
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle"));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<sal_uInt32>(getParagraph(1), "ParaBackColor"));
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index a9ef70d22119..6cbd0a6cdc18 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -8109,7 +8109,8 @@ boost::optional<sal_Int32> lcl_getDmlAlpha(const SvxBrushItem& rBrush)
void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
{
- OString sColor = msfilter::util::ConvertColor( rBrush.GetColor().GetRGBColor() );
+ const Color aColor = rBrush.GetColor();
+ OString sColor = msfilter::util::ConvertColor( aColor.GetRGBColor() );
boost::optional<sal_Int32> oAlpha = lcl_getDmlAlpha(rBrush);
if (m_rExport.SdrExporter().getTextFrameSyntax())
{
@@ -8159,6 +8160,9 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
OString sOriginalFill = OUStringToOString(
m_sOriginalBackgroundColor, RTL_TEXTENCODING_UTF8 );
+ if ( aColor == COL_AUTO )
+ sColor = "auto";
+
if( !m_pBackgroundAttrList.is() )
{
m_pBackgroundAttrList = FastSerializerHelper::createAttrList();
More information about the Libreoffice-commits
mailing list