summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-10-19 10:35:45 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-10-19 10:57:42 +0200
commit69bf37136c1386c7220f38a896aa9865bdae665f (patch)
tree67ba9f2f616cdbf531810a47aebc1eeb92088fc3
parent9cf46f217424921e35aa7458c7cfd6b2a87bd2a9 (diff)
fdo#83464 RTF import: \plain should reset \rtlch and \hich as well
Regression from 36246aa9fb57c9fe4e546c91a8274d8828b1424e (RTF import: fix handling of \loch \hich \dbch \ltrch \rtlch, 2014-06-03), now that \f no longer means the ascii font name, \plain should reset a few more parser state members. Change-Id: Ia6b0bdf25563dd5300e108b46731751f0886f67d
-rw-r--r--sw/qa/extras/rtfimport/data/fdo83464.rtf24
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx9
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx2
3 files changed, 35 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo83464.rtf b/sw/qa/extras/rtfimport/data/fdo83464.rtf
new file mode 100644
index 000000000000..28c9202c957e
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo83464.rtf
@@ -0,0 +1,24 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs1025
+{\fonttbl
+{\f0\fbidi \froman\fcharset0\fprq2 Times New Roman;}
+{\f39\fbidi \fswiss\fcharset0\fprq2 Verdana;}
+}
+{\stylesheet
+{\s43\ql \f39\fs16 Table Text;}
+}
+\pard\plain \ltrpar\ql \li0\ri0\sb60\sa60\widctlpar\tx360\jclisttab\tx720\tx1080\tx1440\tx1800\tx2160\tx2520\tx2880\tx3240\tx3600\tx3960\tx4320\tx4680\tx5040\tx5400\tx5760\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid10449364 \rtlch\fcs1 \af0\afs18\alang1037 \ltrch\fcs0 \fs16\lang1024\langfe1024\loch\af2\hich\af2\dbch\af35\cgrid\noproof\langnp1033\langfenp1033
+\par
+{\rtlch\fcs1 \ltrch\fcs0 \insrsid11419963
+{\shp
+{\*\shpinst\shpleft-90\shptop720\shpright9405\shpbottom2940\shpfhdr0\shpbxcolumn\shpbxignore\shpbymargin\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz2\shplid1027
+{\sp
+{\sn shapeType}
+{\sv 202}
+}
+{\shptxt \pard\plain\f39\fs16 Hello\par
+}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 5969c6676b8e..b3cfec969e78 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1974,6 +1974,15 @@ DECLARE_RTFIMPORT_TEST(testFdo82071, "fdo82071.rtf")
CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::NONE, getProperty<sal_Int16>(xRun, "CharUnderline"));
}
+DECLARE_RTFIMPORT_TEST(testFdo83464, "fdo83464.rtf")
+{
+ // Problem was that the text in the textfrme had wrong font.
+ uno::Reference<text::XTextRange> xFrameText(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("Hello"), xFrameText->getString());
+ // This was Times New Roman.
+ CPPUNIT_ASSERT_EQUAL(OUString("Verdana"), getProperty<OUString>(getRun(getParagraphOfText(1, xFrameText->getText()), 1), "CharFontName"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 70dae1f6075e..d01f85c1d733 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2850,6 +2850,8 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().nCurrentEncoding = getEncoding(getFontIndex(m_nDefaultFontIndex));
m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes;
m_aStates.top().nCurrentCharacterStyleIndex = -1;
+ m_aStates.top().isRightToLeft = false;
+ m_aStates.top().eRunType = RTFParserState::LOCH;
}
break;
case RTF_PARD: