sw/qa/extras/ooxmlimport/data/tdf92124.docx      |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx         |   12 ++++++++++++
 writerfilter/source/dmapper/NumberingManager.cxx |   13 ++++++++++++-
 3 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 3e27df1035677c7cca5200858d5d8e8283bf7aa9
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Wed Sep 23 07:49:49 2015 +0200

    tdf#92124 DOCX import: don't add a dummy Suffix for an empty LabelFollowedBy
    
    Change-Id: I0c4366ad0a2f81a198860869f670767343a392be

diff --git a/sw/qa/extras/ooxmlimport/data/tdf92124.docx 
b/sw/qa/extras/ooxmlimport/data/tdf92124.docx
new file mode 100644
index 0000000..2999311
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf92124.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 2345c5c..4f41751 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2828,6 +2828,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92454, "tdf92454.docx")
     CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, 
xParagraph->getPropertyState("ParaFirstLineIndent"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf92124, "tdf92124.docx")
+{
+    // Get the second paragraph's numbering style's 1st level's suffix.
+    uno::Reference<text::XTextRange> xParagraph = getParagraph(2);
+    auto xLevels = getProperty< uno::Reference<container::XIndexAccess> 
>(xParagraph, "NumberingRules");
+    uno::Sequence<beans::PropertyValue> aLevel;
+    xLevels->getByIndex(0) >>= aLevel; // 1st level
+    OUString aSuffix = std::find_if(aLevel.begin(), aLevel.end(), [](const 
beans::PropertyValue& rValue) { return rValue.Name == "Suffix"; 
})->Value.get<OUString>();
+    // Make sure it's empty as the source document contains <w:suff 
w:val="nothing"/>.
+    CPPUNIT_ASSERT(aSuffix.isEmpty());
+}
+
 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 67c25c8..befce73 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -603,7 +603,18 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
                     if (it != aLvlProps.end())
                     {
                         sal_Int16 nNumberFormat = it->Value.get<sal_Int16>();
-                        if (nNumberFormat == style::NumberingType::NUMBER_NONE)
+
+                        // No need for a zero width space without a real 
LabelFollowedBy.
+                        bool bLabelFollowedBy = true;
+                        it = std::find_if(aLvlProps.begin(), aLvlProps.end(), 
[](const beans::PropertyValue& rValue) { return rValue.Name == 
"LabelFollowedBy"; });
+                        if (it != aLvlProps.end())
+                        {
+                            sal_Int16 nValue;
+                            if (it->Value >>= nValue)
+                                bLabelFollowedBy = nValue != 
SvxNumberFormat::NOTHING;
+                        }
+
+                        if (bLabelFollowedBy && nNumberFormat == 
style::NumberingType::NUMBER_NONE)
                             rSuffix = 
OUString(static_cast<sal_Unicode>(0x200B));
                     }
                 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to