fdo#77812 :FILESAVE :DOCX : Extra Section Break gets added in file

Issue :
	LO was exporting DOCX containing MultiColumns with additional
	Section break Continuos.

	Implementation :
	1] Added check for Column_count in MSWordExportBase::WriteText()
	   If Column_count > 1 and Text node is empty then do not
	   export Section Break.
	2] Written Export unit test case.

Conflicts:
	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
	https://gerrit.libreoffice.org/9200

Change-Id: Ibf3e6bd2d4827aa77a659b1600939cc56d65a63b
This commit is contained in:
Pallavi Jadhav
2014-04-29 18:44:16 +05:30
committed by Miklos Vajna
parent 65f127f687
commit f6eb92406b
3 changed files with 32 additions and 0 deletions

Binary file not shown.

View File

@@ -3215,7 +3215,24 @@ DECLARE_OOXMLEXPORT_TEST(testFDO77725, "fdo77725.docx")
assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[1]", 0);
assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[2]", 0);
assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[3]", 0);
}
DECLARE_OOXMLEXPORT_TEST(testFDO77812, "fdo77812.docx")
{
/* Additional sectPr was getting inserted and hence Column properties
* were getting added into this additional sectPr instead of Default setPr.
*/
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
// Check no additional section break is inserted.
assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:pPr/w:sectPr", 0);
// Check w:cols comes under Default sectPr
assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols", "num", "2");
assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[1]", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[2]", 1);
}
DECLARE_OOXMLEXPORT_TEST(testContentTypeOLE, "fdo77759.docx")

View File

@@ -114,6 +114,7 @@
#include <editeng/charrotateitem.hxx>
#include "WW8FibData.hxx"
#include "numrule.hxx"
#include "fmtclds.hxx"
using namespace css;
using namespace sw::util;
@@ -2597,6 +2598,20 @@ void MSWordExportBase::WriteText()
}
}
}
else
{
/* Do not export Section Break in case DOCX containing MultiColumn and
* aIdx.GetNode().IsTxtNode() is False i.e. Text node is NULL.
*/
const SwFrmFmt* pPgFmt = rSect.GetFmt();
const SwFmtCol& rCol = pPgFmt->GetCol();
sal_uInt16 nColumnCount = rCol.GetNumCols();
if(nColumnCount > 1)
{
bNeedExportBreakHere = sal_False;
}
}
if (bNeedExportBreakHere) //#120140# End of check
{
ReplaceCr( (char)0xc ); // indicator for Page/Section-Break