[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - 2 commits - sw/qa sw/source
Tamas Bunth
tamas.bunth at collabora.co.uk
Fri Dec 15 10:57:59 UTC 2017
sw/qa/extras/ooxmlexport/data/parasplit-on-section-border.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 13 +++++
sw/source/filter/ww8/wrtw8nds.cxx | 26 +++++++---
3 files changed, 33 insertions(+), 6 deletions(-)
New commits:
commit e516879cc5a17fab70aa421db30dfe7d7beadb88
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Fri Dec 15 01:00:00 2017 +0100
no section break after split paragraph
Change-Id: I08aa10527d6e5d8950a592334d01186cbd8cd355
Reviewed-on: https://gerrit.libreoffice.org/46495
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
Tested-by: Tamás Bunth <btomi96 at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/46524
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 63dda5004c09..c727ca145e18 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2628,7 +2628,7 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode )
PrepareNewPageDesc( rNode.GetpSwAttrSet(), rNode, nullptr , pNextPageDesc);
}
}
- else
+ else if (!bNeedParaSplit)
{
// else check if section break needed after the paragraph
AttrOutput().SectionBreaks(rNode);
commit f08de7c9e14907c86128f689e9ebe4e3f6e97167
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Thu Dec 14 15:20:29 2017 +0100
tdf#41650 doc(x) export split paragraph
Fix for documents with one paragraph only.
Add unit test for splitting paragraph on section border.
Change-Id: I224f60ed362deae7b67dde79e04f26f949de034a
Reviewed-on: https://gerrit.libreoffice.org/46457
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/46523
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/qa/extras/ooxmlexport/data/parasplit-on-section-border.odt b/sw/qa/extras/ooxmlexport/data/parasplit-on-section-border.odt
new file mode 100644
index 000000000000..1d0b96f8bb96
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/parasplit-on-section-border.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 40081112629d..60701a264805 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -99,6 +99,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf67207_MERGEFIELD, "mailmerge.docx")
CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.text.fieldmaster.DataBase.Name"), sValue);
}
+DECLARE_OOXMLEXPORT_TEST(testParagraphSplitOnSectionBorder, "parasplit-on-section-border.odt")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+
+ if(!pXmlDoc)
+ return;
+
+ // Test document has only one paragraph. After splitting, it should contain
+ // two of them.
+ assertXPath(pXmlDoc, "//w:sectPr", 2);
+ assertXPath(pXmlDoc, "//w:p", 2);
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf44832_testSectionWithDifferentHeader, "tdf44832_section_new_header.odt")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 3064f505d4ac..63dda5004c09 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2607,18 +2607,32 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode )
while ( nAktPos < nEnd );
// if paragraph is split, put the section break between the parts
- // else check if section break needed after the paragraph
- if( !bNeedParaSplit || *aBreakIt != rNode.GetText().getLength() )
+ if( bNeedParaSplit && *aBreakIt != rNode.GetText().getLength() )
{
- AttrOutput().SectionBreaks(rNode);
SwNodeIndex aNextIndex( rNode, 1 );
const SwNode& pNextNode = aNextIndex.GetNode();
- if( pNextNode.IsTextNode() && bNeedParaSplit )
+ // if there is a next node, use its attributes to create the new
+ // section
+ if( pNextNode.IsTextNode() )
+ {
+ const SwTextNode& rNextNode = *static_cast<SwTextNode*>(
+ &aNextIndex.GetNode() );
+ OutputSectionBreaks(rNextNode.GetpSwAttrSet(), rNextNode);
+ }
+ else if (pNextNode.IsEndNode() )
{
- SectionBreaksAndFrames( *static_cast<SwTextNode*>(
- &aNextIndex.GetNode() ));
+ // In this case the same paragraph holds the next page style
+ // too.
+ const SwPageDesc* pNextPageDesc = m_pAktPageDesc->GetFollow();
+ assert(pNextPageDesc);
+ PrepareNewPageDesc( rNode.GetpSwAttrSet(), rNode, nullptr , pNextPageDesc);
}
}
+ else
+ {
+ // else check if section break needed after the paragraph
+ AttrOutput().SectionBreaks(rNode);
+ }
AttrOutput().StartParagraphProperties();
More information about the Libreoffice-commits
mailing list