summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-10-19 10:35:45 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-10-20 08:38:23 +0000
commit8cca66b47ca6d94b21d740089b2a3bae1c0566ff (patch)
treed62feeb549980d4a7692b5aee2e157e2e744d42e
parentf9050536650835b776b9aa022ae1b47315cd5e14 (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. (cherry picked from commit 69bf37136c1386c7220f38a896aa9865bdae665f) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx writerfilter/source/rtftok/rtfdocumentimpl.cxx Change-Id: Ia6b0bdf25563dd5300e108b46731751f0886f67d Reviewed-on: https://gerrit.libreoffice.org/12034 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-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 cc51a42184e4..24afe987b031 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1898,6 +1898,15 @@ DECLARE_RTFIMPORT_TEST(testFdo84679, "fdo84679.rtf")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin"));
}
+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 3fdc5ef275d0..9339c5111f57 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2812,6 +2812,8 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms;
m_aStates.top().nCurrentEncoding = getEncoding(getFontIndex(m_nDefaultFontIndex));
m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes;
+ m_aStates.top().isRightToLeft = false;
+ m_aStates.top().eRunType = RTFParserState::LOCH;
}
break;
case RTF_PARD: