summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/rtfimport/data/tdf117246.rtf11
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx6
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx9
3 files changed, 26 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/tdf117246.rtf b/sw/qa/extras/rtfimport/data/tdf117246.rtf
new file mode 100644
index 000000000000..a6fc7cf94426
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf117246.rtf
@@ -0,0 +1,11 @@
+{\rtf1
+\sbknone\pard\plain
+{Page 1}
+{\par }
+{\page }
+{Page 2}
+{\par }
+{\page }
+{Page 3}
+{\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 18730e123084..5c7f39db475a 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -211,6 +211,12 @@ DECLARE_RTFIMPORT_TEST(testN695479, "n695479.rtf")
CPPUNIT_ASSERT(bDrawFound);
}
+DECLARE_RTFIMPORT_TEST(testTdf117246, "tdf117246.rtf")
+{
+ // This was 2, all but the last \page was lost.
+ CPPUNIT_ASSERT_EQUAL(3, getPages());
+}
+
DECLARE_RTFIMPORT_TEST(testFdo42465, "fdo42465.rtf")
{
CPPUNIT_ASSERT_EQUAL(3, getLength());
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 713cd3874d15..afc3bec2dc8b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3072,6 +3072,15 @@ RTFError RTFDocumentImpl::popState()
// don't do it again in the outer state later.
m_aStates.top().nTableRowWidthAfter = 0;
+ if (m_nResetBreakOnSectBreak != RTF_invalid && !m_aStates.empty())
+ {
+ // Section break type created for \page still has an effect in the
+ // outer state as well.
+ RTFValue::Pointer_t pType = aState.aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_type);
+ if (pType)
+ m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_type, pType);
+ }
+
return RTFError::OK;
}