From 1b2cf579105d8a1e44b5e2a8aafb79c274fc8455 Mon Sep 17 00:00:00 2001 From: Tushar Bende Date: Tue, 26 Nov 2013 16:38:31 +0530 Subject: fdo#71784: Invalid Sections getting added to the document after RT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: There was a problem for some documents, during export Invalid sectPr were getting added. The root cause was faulty calculation of PageDesc value. This was the reason for increasing number of pages in RT doc. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed-on: https://gerrit.libreoffice.org/6813 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara This fixes crash on export to DOCX too for the bugdoc on rhbz#1074205 (cherry picked from commit 9a37ce189881f12d678fdb054219b13c3e4c7e40) Signed-off-by: Miklos Vajna Change-Id: I0700c735545614730d26be187d9047fd20ebf134 --- sw/qa/extras/ooxmlexport/data/1_page.docx | Bin 0 -> 20552 bytes sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 ++++++++++++ sw/source/filter/ww8/wrtww8.cxx | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/ooxmlexport/data/1_page.docx diff --git a/sw/qa/extras/ooxmlexport/data/1_page.docx b/sw/qa/extras/ooxmlexport/data/1_page.docx new file mode 100644 index 000000000000..9b8638dd3fda Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/1_page.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 88e681105db8..b8b104b5f540 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2030,6 +2030,18 @@ DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula. assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pStyle", "val", "Normal"); } +DECLARE_OOXMLEXPORT_TEST(testExtraSectionBreak, "1_page.docx") +{ + // There was a problem for some documents during export.Invalid sectPr getting added + // because of faulty calculation of PageDesc value + // This was the reason for increasing number of pages after RT + uno::Reference xModel(mxComponent, uno::UNO_QUERY); + uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + xCursor->jumpToLastPage(); + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage()); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 2716a79b3431..7530668a0926 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2511,7 +2511,7 @@ void MSWordExportBase::WriteText() { SwCntntNode* pCNd = (SwCntntNode*)pNd; - const SwPageDesc* pTemp = pCNd->GetSwAttrSet().GetPageDesc().GetPageDesc(); + const SwPageDesc* pTemp = pNd->FindPageDesc(sal_False); if ( pTemp ) pAktPageDesc = pTemp; -- cgit v1.2.3