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

Michael Stahl mstahl at redhat.com
Tue Nov 4 15:18:19 PST 2014


 sw/qa/extras/rtfimport/data/fdo85812.rtf       |    8 ++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |   10 ++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    2 ++
 3 files changed, 20 insertions(+)

New commits:
commit 88d3f9e4cf64e4ef037063b26ddf347fd42d8d84
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 4 22:45:48 2014 +0100

    fdo#85812: RTF import: fix run type in new groups
    
    Apparently the run type resets to LTR in a new group.
    
    (regression from fc49c052dbdbb5ab3b0a02a13143705f769b9662)
    
    Change-Id: I61c0fcbe4e44b488a14cc78823063a1a1ad4f4b1

diff --git a/sw/qa/extras/rtfimport/data/fdo85812.rtf b/sw/qa/extras/rtfimport/data/fdo85812.rtf
new file mode 100644
index 0000000..2f3e10c
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo85812.rtf
@@ -0,0 +1,8 @@
+{\rtf1\ansi\deflang1049\deflangfe2052
+{\*\generator Microsoft Word 11.0.5604;}
+
+\pard\plain
+\lang1049\langfe2052\loch\hich\dbch\langnp1049\langfenp2052
+{\lang1033\langfe2052\dbch\langnp1033 \hich\dbch\loch This }
+{\lang1036\langfe2052\langnp1036 \par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 6639948..a4dd898 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -474,6 +474,16 @@ DECLARE_RTFIMPORT_TEST(testFdo48037, "fdo48037.rtf")
     CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo85812, "fdo85812.rtf")
+{
+    lang::Locale locale(getProperty<lang::Locale>(
+                getRun(getParagraph(1), 1, "This "), "CharLocale"));
+    // the \lang inside the group was applied to CJK not Western
+    CPPUNIT_ASSERT_EQUAL(OUString("en"), locale.Language);
+    CPPUNIT_ASSERT_EQUAL(OUString("US"), locale.Country);
+
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo47764, "fdo47764.rtf")
 {
     // \cbpat with zero argument should mean the auto (-1) color, not a default color (black)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 53460e5..99693f3 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4828,6 +4828,8 @@ int RTFDocumentImpl::pushState()
         m_aStates.push(m_aStates.top());
     }
     m_aStates.top().aDestinationText.setLength(0); // was copied: always reset!
+    m_aStates.top().isRightToLeft = false; // fdo#85812 group resets run type
+    m_aStates.top().eRunType = RTFParserState::LOCH;
 
     m_pTokenizer->pushGroup();
 


More information about the Libreoffice-commits mailing list