summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-24 07:40:14 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-09-24 07:40:58 +0200
commit0d7d6f242ef87c976095d22a7f5ebf751ba77ad8 (patch)
tree1ad3cb45e42b68caf18eefd18aa2c91dc796aee1
parent17cf36bf72afc4a22a6d917bfcee9cddfd29779b (diff)
Related: tdf#92521 RTF export: handle section break right after a table
Change-Id: Ibb6e612165ec6e5d771bdf9efa13a88a72233d6f
-rw-r--r--sw/qa/extras/rtfexport/data/tdf92521.odtbin0 -> 8891 bytes
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx7
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx13
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx7
-rw-r--r--sw/source/filter/ww8/rtfexport.hxx3
5 files changed, 29 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf92521.odt b/sw/qa/extras/rtfexport/data/tdf92521.odt
new file mode 100644
index 000000000000..8148e49a2275
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf92521.odt
Binary files differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 4abea4098101..4371ef5b63f9 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -936,6 +936,13 @@ DECLARE_RTFEXPORT_TEST(testTdf90421, "tdf90421.fodt")
}
}
+DECLARE_RTFEXPORT_TEST(testTdf92521, "tdf92521.odt")
+{
+ // There should be a page break that's in the middle of the document: right after the table.
+ // But there wasn't, so this was 1.
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 83219e973ced..3c9c5b508545 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -316,12 +316,12 @@ void RtfAttributeOutput::EmptyParagraph()
void RtfAttributeOutput::SectionBreaks(const SwNode& rNode)
{
+ SwNodeIndex aNextIndex(rNode, 1);
if (rNode.IsTextNode())
{
OSL_ENSURE(m_aStyles.getLength() == 0, "m_aStyles is not empty");
// output page/section breaks
- SwNodeIndex aNextIndex(rNode, 1);
m_rExport.Strm().WriteCharPtr(m_aSectionBreaks.makeStringAndClear().getStr());
m_bBufferSectionBreaks = true;
@@ -344,6 +344,17 @@ void RtfAttributeOutput::SectionBreaks(const SwNode& rNode)
}
m_bBufferSectionBreaks = false;
}
+ else if (rNode.IsEndNode())
+ {
+ // End of something: make sure that it's the end of a table.
+ assert(rNode.StartOfSectionNode()->IsTableNode());
+ if (aNextIndex.GetNode().IsTextNode())
+ {
+ // Handle section break between a table and a text node following it.
+ const SwTextNode* pTextNode = aNextIndex.GetNode().GetTextNode();
+ m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), *pTextNode);
+ }
+ }
}
void RtfAttributeOutput::StartParagraphProperties()
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 8fec63d80f17..8d79e044e91a 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -772,6 +772,13 @@ bool RtfExport::DisallowInheritingOutlineNumbering(const SwFormat& rFormat)
return bRet;
}
+void RtfExport::OutputEndNode(const SwEndNode& rEndNode)
+{
+ if (TXT_MAINTEXT == m_nTextTyp && rEndNode.StartOfSectionNode()->IsTableNode())
+ // End node of a table: see if a section break should be written after the table.
+ AttrOutput().SectionBreaks(rEndNode);
+}
+
void RtfExport::OutputGrfNode(const SwGrfNode&)
{
/* noop, see RtfAttributeOutput::FlyFrameGraphic */
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index 2103b6556935..b602d63a9e61 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -139,6 +139,9 @@ protected:
/// Output SwTextNode is depending on outline export mode
virtual void OutputTextNode(const SwTextNode&) SAL_OVERRIDE;
+ /// Output SwEndNode
+ virtual void OutputEndNode(const SwEndNode&) SAL_OVERRIDE;
+
/// Output SwGrfNode
virtual void OutputGrfNode(const SwGrfNode&) SAL_OVERRIDE;