summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf92521.odtbin0 -> 8891 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx7
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx2
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx31
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx2
-rw-r--r--sw/source/filter/ww8/docxexport.cxx3
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx47
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.hxx2
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx2
9 files changed, 62 insertions, 34 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf92521.odt b/sw/qa/extras/ooxmlexport/data/tdf92521.odt
new file mode 100644
index 000000000000..8148e49a2275
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf92521.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 3a273f3766b3..44865025a2fc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -815,6 +815,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf83227, "tdf83227.docx")
CPPUNIT_ASSERT_EQUAL(false, bool(xNameAccess->hasByName("word/media/image2.png")));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf92521, "tdf92521.odt")
+{
+ if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
+ // There should be a section break that's in the middle of the document: right after the table.
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr", 1);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 6d16f55623c0..7b463dadaca9 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -156,7 +156,7 @@ public:
virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner ) = 0;
/// Called in order to output section breaks.
- virtual void SectionBreaks(const SwTextNode& rNode) = 0;
+ virtual void SectionBreaks(const SwNode& rNode) = 0;
/// Called before we start outputting the attributes.
virtual void StartParagraphProperties() = 0;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 00aeb75bd4f3..3f6fbcfeec83 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -774,7 +774,7 @@ void DocxAttributeOutput::EmptyParagraph()
m_pSerializer->singleElementNS( XML_w, XML_p, FSEND );
}
-void DocxAttributeOutput::SectionBreaks(const SwTextNode& rNode)
+void DocxAttributeOutput::SectionBreaks(const SwNode& rNode)
{
// output page/section breaks
// Writer can have them at the beginning of a paragraph, or at the end, but
@@ -782,16 +782,31 @@ void DocxAttributeOutput::SectionBreaks(const SwTextNode& rNode)
// paragraph in a section. To get it right, we have to switch to the next
// paragraph, and detect the section breaks there.
SwNodeIndex aNextIndex( rNode, 1 );
- if ( aNextIndex.GetNode().IsTextNode() )
+
+ if (rNode.IsTextNode())
{
- const SwTextNode* pTextNode = static_cast< SwTextNode* >( &aNextIndex.GetNode() );
- m_rExport.OutputSectionBreaks( pTextNode->GetpSwAttrSet(), *pTextNode, m_tableReference->m_bTableCellOpen, pTextNode->GetText().isEmpty() );
+ if (aNextIndex.GetNode().IsTextNode())
+ {
+ const SwTextNode* pTextNode = static_cast<SwTextNode*>(&aNextIndex.GetNode());
+ m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), *pTextNode, m_tableReference->m_bTableCellOpen, pTextNode->GetText().isEmpty());
+ }
+ else if (aNextIndex.GetNode().IsTableNode())
+ {
+ const SwTableNode* pTableNode = static_cast<SwTableNode*>(&aNextIndex.GetNode());
+ const SwFrameFormat *pFormat = pTableNode->GetTable().GetFrameFormat();
+ m_rExport.OutputSectionBreaks(&(pFormat->GetAttrSet()), *pTableNode);
+ }
}
- else if ( aNextIndex.GetNode().IsTableNode() )
+ else if (rNode.IsEndNode())
{
- const SwTableNode* pTableNode = static_cast< SwTableNode* >( &aNextIndex.GetNode() );
- const SwFrameFormat *pFormat = pTableNode->GetTable().GetFrameFormat();
- m_rExport.OutputSectionBreaks( &(pFormat->GetAttrSet()), *pTableNode );
+ // 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, m_tableReference->m_bTableCellOpen, pTextNode->GetText().isEmpty());
+ }
}
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 4dbc29fb346b..e4c68e987ae6 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -155,7 +155,7 @@ public:
virtual void EmptyParagraph() SAL_OVERRIDE;
/// Called in order to output section breaks.
- virtual void SectionBreaks(const SwTextNode& rNode) SAL_OVERRIDE;
+ virtual void SectionBreaks(const SwNode& rNode) SAL_OVERRIDE;
/// Called before we start outputting the attributes.
virtual void StartParagraphProperties() SAL_OVERRIDE;
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 58d9d0b61227..1525eaa2cdf9 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -499,6 +499,9 @@ void DocxExport::OutputEndNode( const SwEndNode& rEndNode )
m_pSections->AppendSection( m_pAktPageDesc, pParentFormat, nRstLnNum );
}
}
+ else 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 DocxExport::OutputGrfNode( const SwGrfNode& )
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 1f85fa83d40f..cac6eb187fd7 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -310,33 +310,36 @@ void RtfAttributeOutput::EmptyParagraph()
m_rExport.Strm().WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PAR).WriteChar(' ');
}
-void RtfAttributeOutput::SectionBreaks(const SwTextNode& rNode)
+void RtfAttributeOutput::SectionBreaks(const SwNode& rNode)
{
- OSL_ENSURE(m_aStyles.getLength() == 0, "m_aStyles is not empty");
+ 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;
+ // output page/section breaks
+ SwNodeIndex aNextIndex(rNode, 1);
+ m_rExport.Strm().WriteCharPtr(m_aSectionBreaks.makeStringAndClear().getStr());
+ m_bBufferSectionBreaks = true;
- // output section headers / footers
- if (!m_bBufferSectionHeaders)
- m_rExport.Strm().WriteCharPtr(m_aSectionHeaders.makeStringAndClear().getStr());
+ // output section headers / footers
+ if (!m_bBufferSectionHeaders)
+ m_rExport.Strm().WriteCharPtr(m_aSectionHeaders.makeStringAndClear().getStr());
- if (aNextIndex.GetNode().IsTextNode())
- {
- const SwTextNode* pTextNode = static_cast< SwTextNode* >(&aNextIndex.GetNode());
- m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), *pTextNode);
- // Save the current page description for now, so later we will be able to access the previous one.
- m_pPrevPageDesc = pTextNode->FindPageDesc(false);
- }
- else if (aNextIndex.GetNode().IsTableNode())
- {
- const SwTableNode* pTableNode = static_cast< SwTableNode* >(&aNextIndex.GetNode());
- const SwFrameFormat* pFormat = pTableNode->GetTable().GetFrameFormat();
- m_rExport.OutputSectionBreaks(&(pFormat->GetAttrSet()), *pTableNode);
+ if (aNextIndex.GetNode().IsTextNode())
+ {
+ const SwTextNode* pTextNode = static_cast< SwTextNode* >(&aNextIndex.GetNode());
+ m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), *pTextNode);
+ // Save the current page description for now, so later we will be able to access the previous one.
+ m_pPrevPageDesc = pTextNode->FindPageDesc(false);
+ }
+ else if (aNextIndex.GetNode().IsTableNode())
+ {
+ const SwTableNode* pTableNode = static_cast< SwTableNode* >(&aNextIndex.GetNode());
+ const SwFrameFormat* pFormat = pTableNode->GetTable().GetFrameFormat();
+ m_rExport.OutputSectionBreaks(&(pFormat->GetAttrSet()), *pTableNode);
+ }
+ m_bBufferSectionBreaks = false;
}
- m_bBufferSectionBreaks = false;
}
void RtfAttributeOutput::StartParagraphProperties()
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index d58b2caeb70a..03902ba8e2c6 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -53,7 +53,7 @@ public:
virtual void EmptyParagraph() SAL_OVERRIDE;
/// Called in order to output section breaks.
- virtual void SectionBreaks(const SwTextNode& rNode) SAL_OVERRIDE;
+ virtual void SectionBreaks(const SwNode& rNode) SAL_OVERRIDE;
/// Called before we start outputting the attributes.
virtual void StartParagraphProperties() SAL_OVERRIDE;
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 903e6da50c47..f64f788d294c 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -36,7 +36,7 @@ public:
virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner ) SAL_OVERRIDE;
/// Called in order to output section breaks.
- virtual void SectionBreaks(const SwTextNode& /*rNode*/) SAL_OVERRIDE {}
+ virtual void SectionBreaks(const SwNode& /*rNode*/) SAL_OVERRIDE {}
/// Called before we start outputting the attributes.
virtual void StartParagraphProperties() SAL_OVERRIDE {}