summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-11-04 22:45:48 +0100
committerMichael Stahl <mstahl@redhat.com>2014-11-05 00:13:21 +0100
commit88d3f9e4cf64e4ef037063b26ddf347fd42d8d84 (patch)
treedd68e5659c87d49a0c1511e71c49ec03adfe4b37
parent8e19b7a0b3dc57fce7e2caf05af2c0451123c5be (diff)
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
-rw-r--r--sw/qa/extras/rtfimport/data/fdo85812.rtf8
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx10
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx2
3 files changed, 20 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo85812.rtf b/sw/qa/extras/rtfimport/data/fdo85812.rtf
new file mode 100644
index 000000000000..2f3e10c96a34
--- /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 6639948ce305..a4dd898c0236 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 53460e599188..99693f3fe564 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();