summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-04-14 08:52:59 +0200
committerMichael Stahl <mstahl@redhat.com>2014-04-15 20:30:42 +0000
commitb84fed9967cb3364c5f9eb1064ab04336cf4e822 (patch)
tree9e15d852f6a9011ba0105ebefe082e6a77aaf3cf
parenta9e669b7948ab734bcbbd76a0919ba91cca2850e (diff)
fdo#77267 RTF import: pard should reset current paragraph style
Change-Id: I8d78ce262a4e57161325231a78e48750909b1bad (cherry picked from commit 904630a2272ac4dd540939f8a462bff5d636f066) Reviewed-on: https://gerrit.libreoffice.org/9055 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-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 5bcdcb47ee6a..4d61147eaa65 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1622,6 +1622,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 4bf522f2c88d..b5a5f1333975 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2522,6 +2522,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aParagraphSprms.set(NS_sprm::LN_PFInTable, 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:
{