[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 26 12:21:18 UTC 2021


 sw/qa/extras/ooxmlexport/data/tdf134619_numberingProps.doc |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx                 |   14 +++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx               |    8 +++----
 3 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit 2f40c8f59cb23106e36071082d2570e2dbca4d22
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Wed Jan 27 22:56:04 2021 +0300
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Fri Feb 26 13:19:49 2021 +0100

    tdf#134619 docxexport: don't skip font properties in NumberingLevel
    
    This partially reverts LO 6.4.5
    commit 598ca431de96d8bfcf18fa2945e9e30f98387474
    
    The output set can contain more than just the font name.
    Things like colour and fontsize were being lost when
    the "else" clause was added.
    
    Since it looks like the main intent of the else clause was
    to avoid specifying a font name twice, erase that from the
    property set before writing out the rest of the font properties.
    There is a unit test that enforces that.
    
    (I was not able to reproduce the original problem that
    this was trying to fix. The entire commit is hard to
    revert, and I will assume that the rest of the commit
    is useful/accurate, so just fix up a careless portion
    of the commit.)
    
    Change-Id: I772e40e8bd75c0589f3308d4d7470229855aed8f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110034
    Tested-by: Jenkins
    Reviewed-by: Vasily Melenchuk <vasily.melenchuk at cib.de>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110169
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 5031a2932e9146db8b163ecfcaaf29e59cc4cc9d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110558
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf134619_numberingProps.doc b/sw/qa/extras/ooxmlexport/data/tdf134619_numberingProps.doc
new file mode 100644
index 000000000000..742b45ce6563
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf134619_numberingProps.doc differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index c300f7068110..04c4975056e4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -38,6 +38,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138892_noNumbering, "tdf138892_noNumbering.docx"
     CPPUNIT_ASSERT_MESSAGE("Para3: <blank line>", getProperty<OUString>(getParagraph(3), "NumberingStyleName").isEmpty());
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134619_numberingProps, "tdf134619_numberingProps.doc")
+{
+    // Get the third paragraph's numbering style's 1st level's bullet size
+    uno::Reference<text::XTextRange> xParagraph = getParagraph(3);
+    auto xLevels = getProperty< uno::Reference<container::XIndexAccess> >(xParagraph, "NumberingRules");
+    uno::Sequence<beans::PropertyValue> aLevel;
+    xLevels->getByIndex(0) >>= aLevel; // 1st level
+    OUString aCharStyleName = std::find_if(aLevel.begin(), aLevel.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "CharStyleName"; })->Value.get<OUString>();
+
+    // Make sure that the blue bullet's font size is 72 points, not 12 points.
+    uno::Reference<beans::XPropertySet> xStyle(getStyles("CharacterStyles")->getByName(aCharStyleName), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(72.f, getProperty<float>(xStyle, "CharHeight"));
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFooterMarginLost, "footer-margin-lost.docx")
 {
     xmlDocUniquePtr pXmlDoc = parseExport();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 018a00c27392..013068e99335 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7127,6 +7127,7 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel,
     {
         m_pSerializer->startElementNS(XML_w, XML_rPr);
 
+        SfxItemSet aTempSet(*pOutSet);
         if ( pFont )
         {
             GetExport().GetId( *pFont ); // ensure font info is written to fontTable.xml
@@ -7136,11 +7137,10 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel,
                     FSNS( XML_w, XML_hAnsi ), aFamilyName,
                     FSNS( XML_w, XML_cs ), aFamilyName,
                     FSNS( XML_w, XML_hint ), "default" );
+            aTempSet.ClearItem(RES_CHRATR_FONT);
+            aTempSet.ClearItem(RES_CHRATR_CTL_FONT);
         }
-        else
-        {
-            m_rExport.OutputItemSet(*pOutSet, false, true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF);
-        }
+        m_rExport.OutputItemSet(aTempSet, false, true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF);
 
         WriteCollectedRunProperties();
 


More information about the Libreoffice-commits mailing list