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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 30 09:43:08 PDT 2012


 sw/qa/extras/rtfimport/data/fdo56512.rtf       |    5 +++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |   11 +++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    6 +++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 2f6097e677dbb7e5387599f3bed4aa2d40755c88
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Oct 30 17:39:31 2012 +0100

    fdo#56512 testcase
    
    Change-Id: Ib075209a2b61041ed40685093bc277243a0bef04

diff --git a/sw/qa/extras/rtfimport/data/fdo56512.rtf b/sw/qa/extras/rtfimport/data/fdo56512.rtf
new file mode 100644
index 0000000..bc400cf
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo56512.rtf
@@ -0,0 +1,5 @@
+{\rtf1\ansi\ansicpg1255
+{\*\do\dobxpage\dobypara\dodhgt8192\dptxbx\dptxbxmar0
+{\dptxbxtext\ltrpar\f0\fs20\cf1\vertalc\qr\rtlch òåñ÷ îåøùä \par}
+\dpx929\dpy1700\dpxsize10556\dpysize221\dplinehollow0}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index ba09889..4da71c6 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -121,6 +121,7 @@ public:
     void testDplinehollow();
     void testLeftmarginDefault();
     void testDppolyline();
+    void testFdo56512();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -193,6 +194,7 @@ void Test::run()
         {"dplinehollow.rtf", &Test::testDplinehollow},
         {"leftmargin-default.rtf", &Test::testLeftmarginDefault},
         {"dppolyline.rtf", &Test::testDppolyline},
+        {"fdo56512.rtf", &Test::testFdo56512},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -884,6 +886,15 @@ void Test::testDppolyline()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount());
 }
 
+void Test::testFdo56512()
+{
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xTextRange(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+    OUString aExpected("עוסק מורשה ", 20, RTL_TEXTENCODING_UTF8);
+    CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit b99b91763f96dcd5ff24c2d4cd9233a493b58aa0
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Oct 30 16:41:24 2012 +0100

    fdo#56512 fix RTF import of non-unicode Hebrew text
    
    The trick here is that we can't just fall back to Hebrew encoding for
    the whole document, as that would mirror shapes as well. Instead, check
    where \rtlch is used, and there fall back to the default encoding.
    
    Change-Id: Iaf155912fab6a559ed165870b8524c23cabcb86d

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f350a7f..2333f52 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2064,8 +2064,11 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
             }
             break;
         case RTF_LTRCH:
+            // dmapper does not support this.
+            break;
         case RTF_RTLCH:
-            // dmapper does not support these.
+            if (m_aDefaultState.nCurrentEncoding == RTL_TEXTENCODING_MS_1255)
+                m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding;
             break;
         case RTF_ULNONE:
             {
@@ -2587,6 +2590,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
             }
             break;
         case RTF_ANSICPG:
+            m_aDefaultState.nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(nParam);
             m_aStates.top().nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(nParam);
             break;
         case RTF_CPG:


More information about the Libreoffice-commits mailing list