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

Patrick J patj at mail.de
Mon Feb 6 22:06:04 UTC 2017


 sw/qa/extras/ooxmlimport/data/tdf101626.docx     |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx         |   21 +++++++++++++++++++++
 writerfilter/source/dmapper/NumberingManager.cxx |    8 +++++++-
 3 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit b322fbc548479e09db8a437764a4089652ffbca2
Author: Patrick J <patj at mail.de>
Date:   Mon Jan 30 17:02:49 2017 +0100

    tdf#101626: replace soft-hyphen by hard-hyphen in ooxml import
    
    If a list bulletChar is a soft-hyphen, it will disappear in PDF export.
    Therefore, replace it by a hard-hyphen.
    
    Change-Id: If0b535e7d2e23454136f25a2b7acf4b294b8dd27
    Reviewed-on: https://gerrit.libreoffice.org/33707
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf101626.docx b/sw/qa/extras/ooxmlimport/data/tdf101626.docx
new file mode 100644
index 0000000..8cbf803
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf101626.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 58d0677..ce71175 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1374,6 +1374,27 @@ DECLARE_OOXMLIMPORT_TEST(testTdf96218, "tdf96218.docx")
     CPPUNIT_ASSERT(!getProperty<bool>(getShape(1), "IsFollowingTextFlow"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf101626, "tdf101626.docx")
+{
+    // Transform soft-hyphen to hard-hyphen as list bulletChar to avoid missing ymbols in export
+    uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+    uno::Sequence<beans::PropertyValue> aProps;
+    xLevels->getByIndex(0) >>= aProps; // 1st level
+
+    for (int i = 0; i < aProps.getLength(); ++i)
+    {
+        const beans::PropertyValue& rProp = aProps[i];
+
+        if (rProp.Name == "BulletChar")
+        {
+            // the bulletChar has to be 0x2d!
+            CPPUNIT_ASSERT_EQUAL(OUString("\x2d", 1, RTL_TEXTENCODING_UTF8), rProp.Value.get<OUString>());
+            return;
+        }
+    }
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 3867b00..965fd27 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -724,7 +724,13 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal )
             //the Writer supports only a number of upper levels to show, separators is always a dot
             //and each level can have a prefix and a suffix
             if(pCurrentLvl.get())
-                pCurrentLvl->SetBulletChar( rVal.getString() );
+            {
+                //if the BulletChar is a soft-hyphen (0xad)
+                //replace it with a hard-hyphen (0x2d)
+                //-> this fixes missing hyphen export in PDF etc.
+                // see tdf#101626
+                pCurrentLvl->SetBulletChar( rVal.getString().replace( 0xad, 0x2d ) );
+            }
         }
         break;
         case NS_ooxml::LN_CT_Lvl_start:


More information about the Libreoffice-commits mailing list