summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-06-11 10:30:18 +0300
committerAndras Timar <andras.timar@collabora.com>2016-07-04 17:34:41 +0200
commite4197fbec8abe21a8bb0d222ac6e06664798ce1d (patch)
treed79c264b926c3424dacaaa936a25673bece2f476 /sw
parente6e962a2db0b82efe1054bb85e56406ada4f4c69 (diff)
tdf#76349 writer: treat single-column break as page break
Writerfilter imports docx-defined column breaks that exist without being in a column. Word treats these as if they were a page break. Writer basically just preserved and ignored them. I limited the fix to only consider SVX_BREAK_COLUMN_BEFORE since writerfilter is only given “column break” and treats it as column_before. Reviewed-on: https://gerrit.libreoffice.org/26181 Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 2721111437706372eaac9bf1d748723196c573ac) Change-Id: I0d974441d53243c4426048dd7cb60b3897b803f6
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx12
-rw-r--r--sw/source/core/layout/flowfrm.cxx5
2 files changed, 13 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 0174e70a1da5..41eeb9d3bff1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -363,9 +363,15 @@ DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx")
* The <w:br w:type="column" /> was missing after roundtrip
*/
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
- if (!pXmlDoc)
- return;
- assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column");
+ if (pXmlDoc)
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column");
+
+ //tdf76349 match Word's behavior of treating breaks in single columns as page breaks.
+ 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());
}
DECLARE_OOXMLEXPORT_TEST(testTdf90697_complexBreaksHeaders,"tdf90697_complexBreaksHeaders.docx")
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 2a4c1f426e09..5320fd1fa410 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1120,8 +1120,11 @@ bool SwFlowFrm::IsPageBreak( bool bAct ) const
return false;
}
+ //for compatibility, also break at column break if no columns exist
const SvxBreak eBreak = pSet->GetBreak().GetBreak();
- if ( eBreak == SVX_BREAK_PAGE_BEFORE || eBreak == SVX_BREAK_PAGE_BOTH )
+ if ( eBreak == SVX_BREAK_PAGE_BEFORE ||
+ eBreak == SVX_BREAK_PAGE_BOTH ||
+ (eBreak == SVX_BREAK_COLUMN_BEFORE && !m_rThis.FindColFrm()) )
return true;
else
{