[Libreoffice-commits] core.git: sw/qa sw/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Tue May 28 14:39:38 UTC 2019


 sw/qa/extras/ooxmlexport/data/tdf92335.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx   |    9 +++++++++
 sw/source/filter/ww8/wrtw8sty.cxx           |    5 +++++
 3 files changed, 14 insertions(+)

New commits:
commit 7376a47680b65cbdfd747a736f288e06f51f7f2d
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Tue May 28 13:49:01 2019 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Tue May 28 16:38:44 2019 +0200

    tdf#92335 DOCX: fix multiplying of "ListLabel" styles
    
    by removing the redundant export of the temporary
    DOCX import character styles for bullets of bulleted lists.
    
    Note: this commit will fix the older documents – sometimes
    with thousands of unused styles – by the next export.
    
    The problem was escalated from the commit
    f9c8d97d82a85b897520a2fe897352ee5ad879d9
    "tdf#95213 DOCX import: don't reuse list label styles"
    
    Change-Id: I90590352c0c85a92dbad19a45e82339e1201f1e9
    Reviewed-on: https://gerrit.libreoffice.org/73098
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf92335.docx b/sw/qa/extras/ooxmlexport/data/tdf92335.docx
new file mode 100644
index 000000000000..28cf521c2a0b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf92335.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
index 90ae3b0ca1e9..1bba64ee0ccf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
@@ -1122,6 +1122,15 @@ DECLARE_OOXMLEXPORT_TEST(testFlipAndRotateCustomShape, "flip_and_rotate.odt")
 #endif
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf92335, "tdf92335.docx")
+{
+    // Don't export redundant ListLabel character styles
+    xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
+    if (!pXmlStyles)
+        return;
+
+    assertXPath(pXmlStyles, "//w:style[@w:styleId='ListLabel1']", 0);
+}
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 1ec391a298b8..6651baaa15b0 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -618,6 +618,11 @@ void MSWordStyles::OutputStyle( SwFormat* pFormat, sal_uInt16 nPos )
                 aName = aBaseName + OUString::number(++nSuffix);
             }
         }
+        else if (!bFormatColl && m_rExport.m_pStyles->GetStyleId(nPos).startsWith("ListLabel"))
+        {
+            // tdf#92335 don't export redundant DOCX import style "ListLabel"
+            return;
+        }
 
         m_rExport.AttrOutput().StartStyle( aName, (bFormatColl ? STYLE_TYPE_PARA : STYLE_TYPE_CHAR),
                 nBase, nWwNext, GetWWId( *pFormat ), nPos,


More information about the Libreoffice-commits mailing list