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

Miklos Vajna vmiklos at suse.cz
Wed Jul 10 12:46:04 PDT 2013


 sw/qa/extras/rtfexport/data/fdo66682.rtf       |   25 +++++++++++++++++++++++++
 sw/qa/extras/rtfexport/rtfexport.cxx           |   21 +++++++++++++++++++++
 sw/source/filter/ww8/rtfattributeoutput.cxx    |    2 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    7 +++++--
 4 files changed, 52 insertions(+), 3 deletions(-)

New commits:
commit 044e55fd7367c09cfff64765fd5d32047d4e5365
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jul 10 12:12:55 2013 +0200

    fdo#66682 RTF export: fix level text of SVX_NUM_ARABIC
    
    Even if level text is not ASCII, we should just write the placeholder
    values (0x00, 0x01, etc.) in a hex encoded form, without Unicode.
    Regression from 07d01742c69f1c0335bc7e1b57abd8341ce255e7.
    
    Also, fix the import side, so the previous bad output now looks bad in
    Writer as well.
    
    (cherry picked from commit 8422d1f5042de08e8b090a907889b41e133bda40)
    
    Conflicts:
    	sw/qa/extras/rtfexport/rtfexport.cxx
    	writerfilter/source/rtftok/rtfdocumentimpl.cxx
    
    Change-Id: I2f93892006c07eec243ec7dfcb23372d243a2db4
    Reviewed-on: https://gerrit.libreoffice.org/4815
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/rtfexport/data/fdo66682.rtf b/sw/qa/extras/rtfexport/data/fdo66682.rtf
new file mode 100644
index 0000000..76128a2
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/fdo66682.rtf
@@ -0,0 +1,25 @@
+{\rtf1\ansi\deff4\adeflang1025
+{\*\listtable
+{\list\listtemplateid1
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0
+{\leveltext \'03 \'00 ;}
+{\levelnumbers\'02;}
+\fi-360\li720}
+\listid1}
+}
+{\listoverridetable
+{\listoverride\listid1\listoverridecount0\ls1}
+}
+\pard\plain \s0\sb0\sa113\nowidctlpar
+\ilvl0\ls1 \li720\ri0\lin720\rin0\fi-360
+{\rtlch \ltrch\loch
+This should be 1}
+\par \pard\plain \s0\sb0\sa113\nowidctlpar
+\ilvl0\ls1 \li720\ri0\lin720\rin0\fi-360
+{\rtlch \ltrch\loch
+and 2}
+\par \pard\plain \s0\sb0\sa113\nowidctlpar
+\ilvl0\ls1 \li720\ri0\lin720\rin0\fi-360\sb0\sa113
+{\rtlch \ltrch\loch
+and 3}
+\par }
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 0610516..d1092d0 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -73,6 +73,7 @@ public:
     void testFdo52286();
     void testFdo61507();
     void testFdo30983();
+    void testFdo66682();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -119,6 +120,7 @@ void Test::run()
         {"fdo52286.odt", &Test::testFdo52286},
         {"fdo61507.rtf", &Test::testFdo61507},
         {"fdo30983.rtf", &Test::testFdo30983},
+        {"fdo66682.rtf", &Test::testFdo66682},
     };
     // Don't test the first import of these, for some reason those tests fail
     const char* aBlacklist[] = {
@@ -501,6 +503,25 @@ void Test::testFdo30983()
     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(0), "VertOrientRelation"));
 }
 
+void Test::testFdo66682()
+{
+    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
+
+    OUString aSuffix;
+    for (int i = 0; i < aProps.getLength(); ++i)
+    {
+        const beans::PropertyValue& rProp = aProps[i];
+
+        if (rProp.Name == "Suffix")
+            aSuffix = rProp.Value.get<OUString>();
+    }
+    // Suffix was '\0' instead of ' '.
+    CPPUNIT_ASSERT_EQUAL(OUString(" "), aSuffix);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 33032b1..15ab89a 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1383,7 +1383,7 @@ void RtfAttributeOutput::NumberingLevel( sal_uInt8 nLevel,
     else
     {
         m_rExport.Strm() << "\\'" << msfilter::rtfutil::OutHex( rNumberingString.Len(), 2 ).getStr();
-        m_rExport.Strm() << msfilter::rtfutil::OutString( rNumberingString, m_rExport.eDefaultEncoding ).getStr();
+        m_rExport.Strm() << msfilter::rtfutil::OutString( rNumberingString, m_rExport.eDefaultEncoding, /*bUnicode =*/ false ).getStr();
     }
 
     m_rExport.Strm() << ";}";
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 959833c..e4cea73 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1656,7 +1656,9 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
 int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
 {
     if (nKeyword != RTF_HEXCHAR)
-        checkUnicode();
+        checkUnicode(/*bUnicode =*/ true, /*bHex =*/ true);
+    else
+        checkUnicode(/*bUnicode =*/ true, /*bHex =*/ false);
     setNeedSect();
     RTFSkipDestination aSkip(*this);
 
@@ -2977,7 +2979,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
             if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16))
             {
                 m_aUnicodeBuffer.append(static_cast<sal_Unicode>(nParam));
-                m_aStates.top().nCharsToSkip = m_aStates.top().nUc;
+                if (m_aStates.top().nDestinationState != DESTINATION_LEVELTEXT)
+                    m_aStates.top().nCharsToSkip = m_aStates.top().nUc;
             }
             break;
         case RTF_LEVELFOLLOW:


More information about the Libreoffice-commits mailing list