summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-08-30 17:51:07 +0300
committerMichael Stahl <mstahl@redhat.com>2016-08-30 20:00:31 +0000
commit93d7fc90b57bb08052299c94fa0a28bb8f494a9c (patch)
tree9225a477b6d038a29758d13cbbd987d26e30f01e
parent1fe51b19829d1393f0e376ec65b889b61d1b1ba1 (diff)
tdf#76349 writer: make 1column-as-page break a compatibility option
Unable to find/create a proof .doc document, so only implementing this for .docx Change-Id: I3a0cb2ddf7b3aeecc9200e595f70d8c88af4b122 Reviewed-on: https://gerrit.libreoffice.org/28501 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/inc/IDocumentSettingAccess.hxx1
-rw-r--r--sw/qa/extras/odfimport/data/tdf76349_1columnBreak.odtbin0 -> 8561 bytes
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx10
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx6
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx1
-rw-r--r--sw/source/core/layout/flowfrm.cxx4
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx13
-rw-r--r--writerfilter/source/filter/WriterFilter.cxx1
8 files changed, 35 insertions, 1 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index e02cbcecffb9..f16ae42f30dc 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -52,6 +52,7 @@ enum class DocumentSettingId
IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
+ TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK,
DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
OUTLINE_LEVEL_YIELDS_OUTLINE_RULE,
diff --git a/sw/qa/extras/odfimport/data/tdf76349_1columnBreak.odt b/sw/qa/extras/odfimport/data/tdf76349_1columnBreak.odt
new file mode 100644
index 000000000000..0ec4060520b7
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/tdf76349_1columnBreak.odt
Binary files differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index ad475a5106df..02fb8b1ba361 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -637,6 +637,16 @@ DECLARE_ODFIMPORT_TEST(testTdf76322_columnBreakInHeader, "tdf76322_columnBreakIn
CPPUNIT_ASSERT_EQUAL( OUString("Test1"), parseDump("/root/page[1]/header/section/column[2]/body/txt/text()") );
}
+DECLARE_ODFIMPORT_TEST(testTdf76349_1columnBreak, "tdf76349_1columnBreak.odt")
+{
+ //single-column breaks should only be treated as page breaks for MS formats - should be only one page here.
+ 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(1), xCursor->getPage());
+}
+
DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt")
{
// Background of the formula frame was white (0xffffff), not green.
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index bdcc1ea2e39a..5cf29c0a4e8a 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -81,6 +81,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbClippedPictures(false),
mbBackgroundParaOverDrawings(false),
mbTabOverMargin(false),
+ mbTreatSingleColumnBreakAsPageBreak(false),
mbSurroundTextWrapSmall(false),
mbPropLineSpacingShrinksFirstLine(true),
mbSubtractFlys(false),
@@ -175,6 +176,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
case DocumentSettingId::CLIPPED_PICTURES: return mbClippedPictures;
case DocumentSettingId::BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings;
case DocumentSettingId::TAB_OVER_MARGIN: return mbTabOverMargin;
+ case DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK: return mbTreatSingleColumnBreakAsPageBreak;
case DocumentSettingId::SURROUND_TEXT_WRAP_SMALL: return mbSurroundTextWrapSmall;
case DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE: return mbPropLineSpacingShrinksFirstLine;
case DocumentSettingId::SUBTRACT_FLYS: return mbSubtractFlys;
@@ -339,6 +341,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
mbTabOverMargin = value;
break;
+ case DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
+ mbTreatSingleColumnBreakAsPageBreak = value;
+ break;
+
case DocumentSettingId::SURROUND_TEXT_WRAP_SMALL:
mbSurroundTextWrapSmall = value;
break;
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index eebd1db35b39..b971cc568588 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -147,6 +147,7 @@ class DocumentSettingManager :
bool mbClippedPictures;
bool mbBackgroundParaOverDrawings;
bool mbTabOverMargin;
+ bool mbTreatSingleColumnBreakAsPageBreak;
bool mbSurroundTextWrapSmall;
bool mbPropLineSpacingShrinksFirstLine; // fdo#79602
bool mbSubtractFlys; // tdf#86578
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index ab4253e3190b..874733aae120 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1135,10 +1135,12 @@ bool SwFlowFrame::IsPageBreak( bool bAct ) const
}
//for compatibility, also break at column break if no columns exist
+ const IDocumentSettingAccess& rIDSA = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess();
+ const bool bTreatSingleColumnBreakAsPageBreak = rIDSA.get(DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK);
const SvxBreak eBreak = pSet->GetBreak().GetBreak();
if ( eBreak == SvxBreak::PageBefore ||
eBreak == SvxBreak::PageBoth ||
- (eBreak == SvxBreak::ColumnBefore && !m_rThis.FindColFrame()) )
+ ( bTreatSingleColumnBreakAsPageBreak && eBreak == SvxBreak::ColumnBefore && !m_rThis.FindColFrame() ))
return true;
else
{
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index d672a889ff3f..9918c9472969 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -130,6 +130,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_EMBED_FONTS,
HANDLE_EMBED_SYSTEM_FONTS,
HANDLE_TAB_OVER_MARGIN,
+ HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK,
HANDLE_SURROUND_TEXT_WRAP_SMALL,
HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
@@ -205,6 +206,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0},
{ OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0},
{ OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0},
+ { OUString("TreatSingleColumnBreakAsPageBreak"), HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, cppu::UnoType<bool>::get(), 0},
{ OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0},
{ OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
{ OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
@@ -817,6 +819,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_OVER_MARGIN, bTmp);
}
break;
+ case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
+ {
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
+ mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, bTmp);
+ }
+ break;
case HANDLE_SURROUND_TEXT_WRAP_SMALL:
{
bool bTmp = *o3tl::doAccess<bool>(rValue);
@@ -1242,6 +1250,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::TAB_OVER_MARGIN );
}
break;
+ case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
+ {
+ rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK );
+ }
+ break;
case HANDLE_SURROUND_TEXT_WRAP_SMALL:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::SURROUND_TEXT_WRAP_SMALL );
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index b96ed5e6f82e..ab7cdf417201 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -291,6 +291,7 @@ void WriterFilter::setTargetDocument(const uno::Reference< lang::XComponent >& x
xSettings->setPropertyValue("InvertBorderSpacing", uno::makeAny(true));
xSettings->setPropertyValue("CollapseEmptyCellPara", uno::makeAny(true));
xSettings->setPropertyValue("TabOverflow", uno::makeAny(true));
+ xSettings->setPropertyValue("TreatSingleColumnBreakAsPageBreak", uno::makeAny(true));
xSettings->setPropertyValue("UnbreakableNumberings", uno::makeAny(true));
xSettings->setPropertyValue("FloattableNomargins", uno::makeAny(true));