summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-04-14 08:52:59 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-04-14 09:06:23 +0200
commit904630a2272ac4dd540939f8a462bff5d636f066 (patch)
tree5836fc7f7d3c9e07e175629c58b549c71e63cd46
parentc1e563f6efd09cd3463f1b92a3022ae288c92087 (diff)
fdo#77267 RTF import: pard should reset current paragraph style
Change-Id: I8d78ce262a4e57161325231a78e48750909b1bad
-rw-r--r--sw/qa/extras/rtfimport/data/fdo77267.rtf12
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx6
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx3
3 files changed, 21 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo77267.rtf b/sw/qa/extras/rtfimport/data/fdo77267.rtf
new file mode 100644
index 000000000000..f9b9060f6719
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo77267.rtf
@@ -0,0 +1,12 @@
+{\rtf1\ansi\ansicpg1250\uc1 \deff0\deflang1045\deflangfe1045
+{\stylesheet
+{
+\li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1045\langfe1045\cgrid\langnp1045\langfenp1045 \snext0 Normal;}
+{\s4\qc \li0\ri0\sl360\slmult1
+\keepn\nowidctlpar\faauto\outlinelevel3\rin0\lin0\itap0 \b\fs52\lang1045\langfe1045\cgrid\langnp1045\langfenp1045 \sbasedon0 \snext0 heading 4;}
+}
+\pard\plain \s4\qc \li0\ri0\sl360\slmult1\keepn\nowidctlpar\faauto\outlinelevel3\rin0\lin0\itap0
+\pard \qc
+l
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 67f86bdeca93..7ebd83ef43c1 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1648,6 +1648,12 @@ DECLARE_RTFIMPORT_TEST(testFdo74599, "fdo74599.rtf")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), getProperty<sal_Int32>(xPropertySet, "CharColor"));
}
+DECLARE_RTFIMPORT_TEST(testFdo77267, "fdo77267.rtf")
+{
+ // Paragraph was aligned to left, should be center.
+ CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust")));
+}
+
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 b9b99fe93764..1a0fd1ad4891 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2536,6 +2536,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_inTbl, RTFValue::Pointer_t(new RTFValue(1)));
}
m_aStates.top().resetFrame();
+
+ // Reset currently selected paragraph style as well.
+ m_aStates.top().nCurrentStyleIndex = -1;
break;
case RTF_SECTD:
{