solenv/clang-format/blacklist | 1 sw/CppunitTest_sw_ooxmlexport14.mk | 14 +++ sw/Module_sw.mk | 1 sw/qa/extras/ooxmlexport/data/tdf108350_noFontdefaults.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 45 ++++++++++++ writerfilter/source/dmapper/StyleSheetTable.cxx | 8 ++ 6 files changed, 69 insertions(+)
New commits: commit 4d4e36173857e948b700c5796552724b23ee775f Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Tue Oct 15 20:49:07 2019 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Oct 17 09:06:09 2019 +0200 tdf#108350 writerfilter: restore TimesNewRoman as default font Followup for LO 5.4 commit 6f2ad89b33d972f9642bb53eeb91f41df3b6b0e6 which set Calibri/11pt as default. That is true if there is no style.xml file, or more specifically if there is no DocDefaults rPrDefault node. But if that node exists, then the age-old defaults are still valid. Earlier in LO 4.3, the default templates changed to use Liberation fonts by default. But in the same vein as using Calibri (and depending on LO to fallback to Carlito), set Word's default Times New Roman font and depend on LO to fallback to Liberation. That will make it better for MSWord users who share the document and who have less likelihood of knowing about Liberation/Carlito. Note that 10pt fontsize was already added to m_pDefaultCharProps earlier, so that part was already reset long ago. Change-Id: I3ba8a529fe95b05fbe2889cf1ebdbabb25963e8b Reviewed-on: https://gerrit.libreoffice.org/80854 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-on: https://gerrit.libreoffice.org/80927 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 5f24a5461c4e..09e0c490d1f6 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -14924,6 +14924,7 @@ sw/qa/extras/ooxmlexport/ooxmlexport.cxx sw/qa/extras/ooxmlexport/ooxmlexport10.cxx sw/qa/extras/ooxmlexport/ooxmlexport11.cxx sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +sw/qa/extras/ooxmlexport/ooxmlexport14.cxx sw/qa/extras/ooxmlexport/ooxmlexport2.cxx sw/qa/extras/ooxmlexport/ooxmlexport3.cxx sw/qa/extras/ooxmlexport/ooxmlexport4.cxx diff --git a/sw/CppunitTest_sw_ooxmlexport14.mk b/sw/CppunitTest_sw_ooxmlexport14.mk new file mode 100644 index 000000000000..b582b317c064 --- /dev/null +++ b/sw/CppunitTest_sw_ooxmlexport14.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,14)) + +# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index c6a0c5f4fa0f..b20207c117ef 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -79,6 +79,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_ooxmlexport11 \ CppunitTest_sw_ooxmlexport12 \ CppunitTest_sw_ooxmlexport13 \ + CppunitTest_sw_ooxmlexport14 \ CppunitTest_sw_ooxmlexport_template \ CppunitTest_sw_ooxmlfieldexport \ CppunitTest_sw_ooxmllinks \ diff --git a/sw/qa/extras/ooxmlexport/data/tdf108350_noFontdefaults.docx b/sw/qa/extras/ooxmlexport/data/tdf108350_noFontdefaults.docx new file mode 100644 index 000000000000..ea81722799eb Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf108350_noFontdefaults.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx new file mode 100644 index 000000000000..b06b342c7071 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -0,0 +1,45 @@ +/* -*- 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/beans/XPropertySet.hpp> +#include <IDocumentSettingAccess.hxx> + +#include <editsh.hxx> +#include <frmatr.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(testTdf108350_noFontdefaults, "tdf108350_noFontdefaults.docx") +{ + uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles"); + uno::Reference< beans::XPropertySet > xStyleProps(paragraphStyles->getByName("NoParent"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), getProperty<OUString>(xStyleProps, "CharFontName")); + //CPPUNIT_ASSERT_EQUAL_MESSAGE("Font size", 10.f, getProperty<float>(xStyleProps, "CharHeight")); +} + + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 2c6de04a011a..00e0dca56d60 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1461,6 +1461,8 @@ void StyleSheetTable::applyDefaults(bool bParaProperties) m_pImpl->m_rDMapper.GetTextFactory()->createInstance("com.sun.star.text.Defaults"), uno::UNO_QUERY_THROW ); } + + // WARNING: these defaults only take effect IF there is a DocDefaults style section. Normally there is, but not always. if( bParaProperties && m_pImpl->m_pDefaultParaProps.get()) { // tdf#87533 LO will have different defaults here, depending on the locale. Import with documented defaults @@ -1495,6 +1497,12 @@ void StyleSheetTable::applyDefaults(bool bParaProperties) } if( !bParaProperties && m_pImpl->m_pDefaultCharProps.get()) { + // tdf#108350: Earlier in DomainMapper for DOCX, Calibri/11pt was set to match MSWord 2007+, + // but that is valid only if DocDefaults_rPrDefault is omitted. + // Now that DocDefaults_rPrDefault is known, the defaults should be reset to Times New Roman/10pt. + if ( m_pImpl->m_rDMapper.IsOOXMLImport() ) + m_pImpl->m_xTextDefaults->setPropertyValue( getPropertyName(PROP_CHAR_FONT_NAME), css::uno::Any(OUString("Times New Roman")) ); + uno::Sequence< beans::PropertyValue > aPropValues = m_pImpl->m_pDefaultCharProps->GetPropertyValues(); for( sal_Int32 i = 0; i < aPropValues.getLength(); ++i ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits