diff options
author | umeshkadam <umesh.kadam@synerzip.com> | 2014-05-02 13:25:15 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-09 08:34:30 +0200 |
commit | e9b2787c2ece4c8260fbac6359257e1829c917d4 (patch) | |
tree | 20982335024dcba85c7e44efef6ea511caf6a12b | |
parent | e891afeccba8f20f8bdaeacb20f2215cfcb1abfd (diff) |
fdo#77890: page break exported as section break if different 1st page is set
- Page break was getting exported as section break in case if the different
first page was set.
- Fixed this issue and added a UT.
- For additional details regarding the issue please check the following
https://www.libreoffice.org/bugzilla/show_bug.cgi?id=77890#c2
Reviewed on:
https://gerrit.libreoffice.org/9234
Change-Id: I6799b204c0d1c80a7e07119e2e3aac337520cb08
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo77890.docx | bin | 0 -> 31759 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 16 |
5 files changed, 27 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo77890.docx b/sw/qa/extras/ooxmlexport/data/fdo77890.docx Binary files differnew file mode 100644 index 000000000000..ac90174fffc5 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo77890.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index e1f8d95ed1d2..42e25c789469 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3135,6 +3135,19 @@ DECLARE_OOXMLEXPORT_TEST(testFDO76587 , "fdo76587.docx") assertXPath(pXmlDoc, "/w:styles/w:style[8]/w:pPr/w:spacing", "lineRule", "auto"); } +DECLARE_OOXMLEXPORT_TEST(testFDO77890 , "fdo77890.docx") +{ + /* + Ensure that the page break is preserved i.e it should not be converted to a section break, in case + if the different first page is set for the pages in the document. + For additional comments pls refer https://www.libreoffice.org/bugzilla/show_bug.cgi?id=77890#c2 + */ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:br", "type", "page"); +} + DECLARE_OOXMLEXPORT_TEST(testNumberedList,"NumberedList.docx") { //fdo74150:In document.xml, for pStyle = "NumberedList1", iLvl and numId was not preserved diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index bbf5af05a98d..1fc1105ce796 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3475,6 +3475,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM , mnHdFtIndex(0) , mnRedlineMode(0) , pAktPageDesc(0) + , bPrevTextNodeIsEmpty(false) , pPapPlc(0) , pChpPlc(0) , pChpIter(0) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index d607c8c4e3d8..9229fa5fcc71 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -479,6 +479,7 @@ public: SwImplBookmarks maImplicitBookmarks; sw::Frames maFrames; // The floating frames in this document const SwPageDesc *pAktPageDesc; + bool bPrevTextNodeIsEmpty; WW8_WrPlcPn* pPapPlc; WW8_WrPlcPn* pChpPlc; MSWordAttrIter* pChpIter; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index f2df0f1314b3..de2ab6a515a0 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -422,11 +422,18 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode // Even if pAktPageDesc != pPageDesc ,it might be because of the different header & footer types. if (pAktPageDesc != pPageDesc) { - if ( (isCellOpen && (pAktPageDesc->GetName() != pPageDesc->GetName())) || isTextNodeEmpty ) + if ( ( isCellOpen && ( pAktPageDesc->GetName() != pPageDesc->GetName() )) || + ( isTextNodeEmpty || bPrevTextNodeIsEmpty )) { - // Table cell is open and page header types are different,so do not output section break OR - // PageBreak is present but text node has no string - it is an empty node, do not prepare - // new page descriptor i.e. bNewPageDesc should be false. + /* Do not output a section break in the following scenarios. + 1) Table cell is open and page header types are different + 2) PageBreak is present but text node has no string - it is an empty node. + 3) If the previous node was an empty text node and current node is a non empty text node or vice versa. + 4) If previous node and current node both are empty text nodes. + Converting a page break to section break would cause serious issues while importing + the RT files with different first page being set. + */ + bNewPageDesc = false; } else { @@ -539,6 +546,7 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode PrepareNewPageDesc( pSet, rNd, pPgDesc, pAktPageDesc ); } bBreakBefore = false; + bPrevTextNodeIsEmpty = isTextNodeEmpty ; } // #i76300# |