diff options
author | Tushar Bende <tushar.bende@synerzip.com> | 2014-01-14 21:34:32 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-22 09:41:21 +0100 |
commit | 92414c42cdd03d4eda5dbb4fe1a95cfe1ce3e7e9 (patch) | |
tree | 7c82b2cce3f5e6ac0ddf7df484d104413c25edf9 | |
parent | 53984191169232c3ff097a4661e19532faa6bf67 (diff) |
fdo#73534 : Table row data was getting displayed twice after RT
There was a problem for some documents(containing table on page spanning across multiple pages
& pages having different Header-Footer type), during export Invalid sectPr was getting added
because of wrong condition check in the code.
Because of this:
1)Table row data was getting displayed twice after RT.
2)Increased number of pages after RT.
3)Header & footer were also divided into sections (like: Header-Section1 Footer-Section1 & Header-Section2 Footer-Section2).
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7440
Change-Id: I6c07e47321353e84af306c6285702852303ccee0
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/table-row-data-displayed-twice.docx | bin | 0 -> 27239 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 17 |
5 files changed, 27 insertions, 7 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/table-row-data-displayed-twice.docx b/sw/qa/extras/ooxmlexport/data/table-row-data-displayed-twice.docx Binary files differnew file mode 100644 index 000000000000..00c63d8fcee1 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/table-row-data-displayed-twice.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 8bfc251cdfc1..cdb228e21206 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2570,6 +2570,18 @@ DECLARE_OOXMLEXPORT_TEST(testTOCFlag_u,"testTOCFlag_u.docx") CPPUNIT_ASSERT(contents.match(" TOC \\z \\o \"1-9\" \\u \\h")); } +DECLARE_OOXMLEXPORT_TEST(testTableRowDataDisplayedTwice,"table-row-data-displayed-twice.docx") +{ + // fdo#73534: There was a problem for some documents during export.Invalid sectPr getting added + // because of wrong condition in code. + // This was the reason for increasing number of pages after RT + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + xCursor->jumpToLastPage(); + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage()); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index c70a2a4a7a4a..98b36f66e1da 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -392,8 +392,9 @@ void DocxAttributeOutput::SectionBreaks(const SwTxtNode& rNode) { const SwTxtNode* pTxtNode = static_cast< SwTxtNode* >( &aNextIndex.GetNode() ); // If next node has no string - it is an empty node, so no need to output the section break + if (!pTxtNode->GetTxt().isEmpty()) - m_rExport.OutputSectionBreaks( pTxtNode->GetpSwAttrSet(), *pTxtNode ); + m_rExport.OutputSectionBreaks( pTxtNode->GetpSwAttrSet(), *pTxtNode, m_tableReference->m_bTableCellOpen ); } else if ( aNextIndex.GetNode().IsTableNode() ) { diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index df34b50fef3d..06bff4b81b9f 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -693,7 +693,7 @@ public: sal_uLong GetSectionLineNo( const SfxItemSet* pSet, const SwNode& rNd ) const; /// Start new section. - void OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd ); + void OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd, bool isCellOpen = false); /// Write section properties. /// diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 9dfc8dca0a73..82a05c56da7e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -396,13 +396,12 @@ bool MSWordExportBase::SetAktPageDescFromNode(const SwNode &rNd) // Es duerfen nur Funktionen gerufen werden, die nicht in den // Ausgabebereich pO schreiben, da dieser nur einmal fuer CHP und PAP existiert // und damit im falschen landen wuerden. -void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd ) +void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd, bool isCellOpen) { if ( bStyDef || bOutKF || bInWriteEscher || bOutPageDescs ) return; bBreakBefore = true; - bool bNewPageDesc = false; const SfxPoolItem* pItem=0; const SwFmtPageDesc *pPgDesc=0; @@ -415,11 +414,19 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode const SwPageDesc * pPageDesc = rNd.FindPageDesc(sal_False); + // Even if pAktPageDesc != pPageDesc ,it might be because of the different header & footer types. if (pAktPageDesc != pPageDesc) { - bBreakSet = true; - bNewPageDesc = true; - pAktPageDesc = pPageDesc; + if (isCellOpen && (pAktPageDesc->GetName() != pPageDesc->GetName())) + { + // Table cell is open and page header types are different,so do not output section break. + } + else + { + bBreakSet = true; + bNewPageDesc = true; + pAktPageDesc = pPageDesc; + } } if ( pSet && pSet->Count() ) |