summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-07-11 18:07:32 +0300
committerAndras Timar <andras.timar@collabora.com>2016-07-13 21:15:00 +0200
commit1a90ab3feb9cf3c92e9b142778d4c88acbad1f21 (patch)
treedb17e1a76364f1559cac57fd092f504967aa97a3 /sw
parent6643c015abc586c914335af468a7d725b896360c (diff)
tdf#99090 docx export page-break only inside a paragraph
If a paragraph hadn't been started yet, a w:r was being written directly in the /document/body which caused MSWord to complain about a corrupt document. Reviewed-on: https://gerrit.libreoffice.org/26771 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 07fb94655f4745eb4e80bf6e8d4cdd95371f23bb) Change-Id: Ie7f629869aab0f3d2405660a033c3f23bbd6baca Reviewed-on: https://gerrit.libreoffice.org/27121 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit 28ded9c98837d6b6eefff73f396353b61b6b4017)
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx16
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx4
2 files changed, 19 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index f18858886c49..c59931b953cc 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1065,6 +1065,16 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
m_nColBreakStatus = COLBRK_NONE;
}
+ if ( m_bPostponedPageBreak )
+ {
+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_br,
+ FSNS( XML_w, XML_type ), "page", FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_r );
+
+ m_bPostponedPageBreak = false;
+ }
+
// merge the properties _before_ the run (strictly speaking, just
// after the start of the paragraph)
m_pSerializer->mergeTopMarks(Tag_StartParagraphProperties, sax_fastparser::MergeMarks::PREPEND);
@@ -5414,13 +5424,16 @@ void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, const WW8_SepInfo* pSectio
m_pSectionInfo.reset( new WW8_SepInfo( *pSectionInfo ));
}
}
- else
+ else if ( m_bParagraphOpened )
{
m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
m_pSerializer->singleElementNS( XML_w, XML_br,
FSNS( XML_w, XML_type ), "page", FSEND );
m_pSerializer->endElementNS( XML_w, XML_r );
}
+ else
+ m_bPostponedPageBreak = true;
+
break;
default:
OSL_TRACE( "Unknown section break to write: %d", nC );
@@ -8465,6 +8478,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_bAlternateContentChoiceOpen( false ),
m_bPostponedProcessingFly( false ),
m_nColBreakStatus( COLBRK_NONE ),
+ m_bPostponedPageBreak( false ),
m_nTextFrameLevel( 0 ),
m_closeHyperlinkInThisRun( false ),
m_closeHyperlinkInPreviousRun( false ),
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 4089d295eb44..0b2d4ad64fdb 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -810,6 +810,10 @@ private:
// beginning of the next paragraph
DocxColBreakStatus m_nColBreakStatus;
+ // Remember that a page break has to be opened at the
+ // beginning of the next paragraph
+ bool m_bPostponedPageBreak;
+
std::vector<ww8::Frame> m_aFramesOfParagraph;
sal_Int32 m_nTextFrameLevel;