sw/qa/extras/ooxmlexport/data/tdf120344_FontTypes.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 17 +++++++++++++++++ writerfilter/source/dmapper/NumberingManager.cxx | 15 ++++++++------- 3 files changed, 25 insertions(+), 7 deletions(-)
New commits: commit f8c12eca80b1faa65f130dfc64c303dcf88a3ac9 Author: Szabolcs Toth <szabolcs...@gmail.com> AuthorDate: Mon Jan 6 15:43:03 2020 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Jan 10 14:25:15 2020 +0100 tdf#120344 DOCX: fix font style of numbering (numbers and letters) when list items use different font type by direct formatting, solving also the mixed and changing numbering style during editing. Change-Id: I7ebf125bb1b67cbb33078a4e218798e7ffc06260 Co-Author: Balázs Nádasdy (NISZ) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86277 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf120344_FontTypes.docx b/sw/qa/extras/ooxmlexport/data/tdf120344_FontTypes.docx new file mode 100644 index 000000000000..74bcd59e24c6 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120344_FontTypes.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 48257077f0c3..478ee10310b7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1070,6 +1070,23 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorders, "tdf129452_BottomBorders.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); } +DECLARE_OOXMLEXPORT_TEST(testFontTypes, "tdf120344_FontTypes.docx") +{ + // tdf#120344: Font type of numbering symbols can be different than the font type of the text. + + // Check the font type of the text, should be Consolas. + xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + if (!pXmlDocument) + return; + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/w:rPr/w:rFonts [@w:ascii='Consolas']", 1); + + // Now the font type of the numbering symbols, should be Arial Black. + xmlDocPtr qXmlDocument = parseExport("word/numbering.xml"); + if (!qXmlDocument) + return; + assertXPath(qXmlDocument, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:rPr/w:rFonts [@w:ascii='Arial Black']", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index f55282f3df4f..33290f276be6 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -203,11 +203,15 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetProperties(bool bDefaults) return aLevelProps; } -static bool IgnoreForCharStyle(const OUString& aStr) +static bool IgnoreForCharStyle(const OUString& aStr, const bool bIsSymbol) { //Names found in PropertyIds.cxx, Lines 56-396 return (aStr=="Adjust" || aStr=="IndentAt" || aStr=="FirstLineIndent" - || aStr=="FirstLineOffset" || aStr=="LeftMargin" || aStr=="CharFontName" + || aStr=="FirstLineOffset" || aStr=="LeftMargin" + || aStr=="CharInteropGrabBag" || aStr=="ParaInteropGrabBag" || + // We need font names when they are different for the bullet and for the text. + // But leave symbols alone, we only want to keep the font style for letters and numbers. + (bIsSymbol && aStr=="CharFontName") ); } uno::Sequence< beans::PropertyValue > ListLevel::GetCharStyleProperties( ) @@ -217,13 +221,10 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetCharStyleProperties( ) uno::Sequence< beans::PropertyValue > vPropVals = PropertyMap::GetPropertyValues(); beans::PropertyValue* aValIter = vPropVals.begin(); beans::PropertyValue* aEndIter = vPropVals.end(); + const bool bIsSymbol(m_sBulletChar.getLength() <= 1); for( ; aValIter != aEndIter; ++aValIter ) - { - if (IgnoreForCharStyle(aValIter->Name)) - continue; - else if ( aValIter->Name != "CharInteropGrabBag" && aValIter->Name != "ParaInteropGrabBag" ) + if (! IgnoreForCharStyle(aValIter->Name, bIsSymbol)) rProperties.emplace_back(aValIter->Name, 0, aValIter->Value, beans::PropertyState_DIRECT_VALUE); - } return comphelper::containerToSequence(rProperties); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits