[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source
Justin Luth
justin_luth at sil.org
Tue Aug 30 20:00:55 UTC 2016
sw/inc/IDocumentSettingAccess.hxx | 1 +
sw/qa/extras/odfimport/data/tdf76349_1columnBreak.odt |binary
sw/qa/extras/odfimport/odfimport.cxx | 10 ++++++++++
sw/source/core/doc/DocumentSettingManager.cxx | 6 ++++++
sw/source/core/inc/DocumentSettingManager.hxx | 1 +
sw/source/core/layout/flowfrm.cxx | 4 +++-
sw/source/uibase/uno/SwXDocumentSettings.cxx | 13 +++++++++++++
writerfilter/source/filter/WriterFilter.cxx | 1 +
8 files changed, 35 insertions(+), 1 deletion(-)
New commits:
commit 93d7fc90b57bb08052299c94fa0a28bb8f494a9c
Author: Justin Luth <justin_luth at sil.org>
Date: Tue Aug 30 17:51:07 2016 +0300
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 at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index e02cbce..f16ae42 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 0000000..0ec4060
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf76349_1columnBreak.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index ad475a5..02fb8b1 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 bdcc1ea..5cf29c0 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 eebd1db..b971cc5 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 ab4253e..874733a 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 d672a88..9918c94 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 b96ed5e..ab7cdf4 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));
More information about the Libreoffice-commits
mailing list