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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include + +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(getParagraph(1), "FillStyle")); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty(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 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 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();