Kaydet (Commit) 27211114 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Miklos Vajna

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.

Change-Id: I0d974441d53243c4426048dd7cb60b3897b803f6
Reviewed-on: https://gerrit.libreoffice.org/26181Tested-by: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 4809fedd
...@@ -362,9 +362,15 @@ DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx") ...@@ -362,9 +362,15 @@ DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx")
* The <w:br w:type="column" /> was missing after roundtrip * The <w:br w:type="column" /> was missing after roundtrip
*/ */
xmlDocPtr pXmlDoc = parseExport("word/document.xml"); xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc) if (pXmlDoc)
return; assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column");
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(testIndentation, "test_indentation.docx") DECLARE_OOXMLEXPORT_TEST(testIndentation, "test_indentation.docx")
......
...@@ -1127,8 +1127,11 @@ bool SwFlowFrame::IsPageBreak( bool bAct ) const ...@@ -1127,8 +1127,11 @@ bool SwFlowFrame::IsPageBreak( bool bAct ) const
return false; return false;
} }
//for compatibility, also break at column break if no columns exist
const SvxBreak eBreak = pSet->GetBreak().GetBreak(); 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.FindColFrame()) )
return true; return true;
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment