sw/qa/extras/ooxmlexport/data/decimal-numbering-no-leveltext.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx                         |    7 +++
 sw/qa/extras/rtfimport/rtfimport.cxx                              |    5 ++
 sw/source/filter/ww8/docxattributeoutput.cxx                      |    7 +++
 writerfilter/source/dmapper/NumberingManager.cxx                  |   19 
++++++++++
 writerfilter/source/ooxml/OOXMLParserState.hxx                    |    4 --
 6 files changed, 36 insertions(+), 6 deletions(-)

New commits:
commit e155e05ab70f1744d296dbee8c61564a5b7d346c
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Fri Dec 19 16:26:59 2014 +0100

    DOCX filter: handle decimal number format with no level text correctly
    
    The first problem was that no level text means no list text in Word, but
    Writer only does that for the "none" numbering format.
    
    Also, when the numbering format is "none", then Writer doesn't show the
    follow character (typically a tab), either, but Word does: add a zero
    width space as a suffix to mimic the Word behavior on DOCX import.
    
    Adapt CppunitTest_sw_rtfimport accordingly, that effectively tested that
    LabelFollowedBy is lost on import.
    
    Change-Id: I7d5c7e62ba3d02da4a750ba5afad07e68b0b8c38

diff --git a/sw/qa/extras/ooxmlexport/data/decimal-numbering-no-leveltext.docx 
b/sw/qa/extras/ooxmlexport/data/decimal-numbering-no-leveltext.docx
new file mode 100644
index 0000000..d7ec479
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/decimal-numbering-no-leveltext.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 89ead20..c65e546 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -99,6 +99,13 @@ DECLARE_OOXMLEXPORT_TEST(testfdo76589 , "fdo76589.docx")
     assertXPath ( pXmlDoc, 
"/w:numbering/w:abstractNum[1]/w:lvl[1]/w:lvlText","val","%1" );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testDecimalNumberingNoLeveltext, 
"decimal-numbering-no-leveltext.docx")
+{
+    // This was "%1", not empty: we turned a kind-of-none numbering into a 
decimal one.
+    if (xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"))
+        assertXPath (pXmlDoc, 
"/w:numbering/w:abstractNum[1]/w:lvl[1]/w:lvlText","val", "");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testfdo79008, "fdo79008.docx")
 {
     /* File getting crash while saving in LO.
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 0e651d0..4a07fd0 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -582,7 +582,10 @@ DECLARE_RTFIMPORT_TEST(testFdo49692, "fdo49692.rtf")
         const beans::PropertyValue& rProp = aProps[i];
 
         if (rProp.Name == "Suffix")
-            CPPUNIT_ASSERT_EQUAL(sal_Int32(0), 
rProp.Value.get<OUString>().getLength());
+        {
+            OUString aExpected(static_cast<sal_Unicode>(0x200B));
+            CPPUNIT_ASSERT_EQUAL(aExpected, rProp.Value.get<OUString>());
+        }
     }
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b45371b..4386d5b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5955,7 +5955,12 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 
nLevel,
     }
     else
     {
-        m_pSerializer->singleElementNS( XML_w, XML_lvlText,FSNS( XML_w, 
XML_val ), OUStringToOString( aBuffer.makeStringAndClear(), 
RTL_TEXTENCODING_UTF8 ).getStr(), FSEND );
+        // Writer's "zero width space" suffix is necessary, so that 
LabelFollowedBy shows up, but Word doesn't require that.
+        OUString aLevelText = aBuffer.makeStringAndClear();
+        static OUString aZeroWidthSpace(static_cast<sal_Unicode>(0x200B));
+        if (aLevelText == aZeroWidthSpace)
+            aLevelText.clear();
+        m_pSerializer->singleElementNS(XML_w, XML_lvlText, FSNS(XML_w, 
XML_val), aLevelText.toUtf8(), FSEND);
     }
 
     // bullet
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 0a1c52f..cae1b6a 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -33,6 +33,7 @@
 
 #include <osl/diagnose.h>
 #include <rtl/ustring.hxx>
+#include <comphelper/sequenceashashmap.hxx>
 
 #include "dmapperLoggers.hxx"
 
@@ -273,6 +274,10 @@ uno::Sequence< beans::PropertyValue > 
ListLevel::GetLevelProperties( )
     {
         if (!m_sGraphicURL.isEmpty() || m_sGraphicBitmap.is())
             nNumberFormat = style::NumberingType::BITMAP;
+        else if (m_sBulletChar.isEmpty() && nNumberFormat != 
style::NumberingType::CHAR_SPECIAL)
+            // w:lvlText is empty, that means no numbering in Word.
+            // CHAR_SPECIAL is handled separately below.
+            nNumberFormat = style::NumberingType::NUMBER_NONE;
         aNumberingProperties.push_back( MAKE_PROPVAL(PROP_NUMBERING_TYPE, 
nNumberFormat ));
     }
 
@@ -619,6 +624,20 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
 
                 aLvlProps.realloc( aLvlProps.getLength( ) + 4 );
                 
aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 4] = 
MAKE_PROPVAL( PROP_PREFIX, rPrefix );
+
+                if (sText.isEmpty())
+                {
+                    // Empty <w:lvlText>? Then put a Unicode "zero width 
space" as a suffix, so LabelFollowedBy is still shown, as in Word.
+                    // With empty suffix, Writer does not show 
LabelFollowedBy, either.
+                    comphelper::SequenceAsHashMap aMap(aLvlProps);
+                    if (aMap.find("NumberingType") != aMap.end())
+                    {
+                        sal_Int16 nNumberFormat = 
aMap["NumberingType"].get<sal_Int16>();
+                        if (nNumberFormat == style::NumberingType::NUMBER_NONE)
+                            rSuffix = 
OUString(static_cast<sal_Unicode>(0x200B));
+                    }
+                }
+
                 
aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 3] = 
MAKE_PROPVAL( PROP_SUFFIX, rSuffix );
                 
aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 2] = 
MAKE_PROPVAL( PROP_PARENT_NUMBERING, nParentNum );
 
commit f3d54642672b4a4fb6cca0c2439744189de5f0bc
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Fri Dec 19 13:08:33 2014 +0100

    writerfilter: unused include
    
    Change-Id: Ibde8c193c9558b297e7afe71cd87390143b6f25b

diff --git a/writerfilter/source/ooxml/OOXMLParserState.hxx 
b/writerfilter/source/ooxml/OOXMLParserState.hxx
index 5e22257..513b468 100644
--- a/writerfilter/source/ooxml/OOXMLParserState.hxx
+++ b/writerfilter/source/ooxml/OOXMLParserState.hxx
@@ -23,10 +23,6 @@
 #include "OOXMLDocumentImpl.hxx"
 #include "OOXMLPropertySetImpl.hxx"
 
-#ifdef DEBUG_WRITERFILTER
-#include <resourcemodel/TagLogger.hxx>
-#endif
-
 namespace writerfilter {
 namespace ooxml
 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to