summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-05-20 08:41:46 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-06-15 17:26:50 +0200
commitd0f8e4693120f9c7e7d4ec83cd6ad5d9af349587 (patch)
tree3dd76942522246fde9fd9f5126e6f89e4273e859
parent34dbd676ffb38fdd2f3a49dcff54925b98486eb2 (diff)
tdf#128195 Keep spacing below last paragraph in header (docx)
Add a layout compat option to keep the spacing below the last paragraph in the header in doc/docx files (cherry picked from commit 9b5805d1ef2b9e9c4e8f389c069807bf4489ea95) Conflicts: sw/inc/IDocumentSettingAccess.hxx sw/source/core/doc/DocumentSettingManager.cxx sw/source/core/inc/DocumentSettingManager.hxx sw/source/core/layout/flowfrm.cxx sw/source/filter/ww8/ww8par.cxx sw/source/uibase/uno/SwXDocumentSettings.cxx writerfilter/source/dmapper/DomainMapper.cxx Change-Id: I259511183a8252e04d9951357dbdd4f4832523ec
-rw-r--r--sw/inc/IDocumentSettingAccess.hxx1
-rw-r--r--sw/qa/core/layout/data/tdf128195.docxbin0 -> 14883 bytes
-rw-r--r--sw/qa/core/layout/layout.cxx11
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx8
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx1
-rw-r--r--sw/source/core/layout/flowfrm.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par.cxx3
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx19
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx2
9 files changed, 48 insertions, 1 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 56ff3ab04234..f182027ded95 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -103,6 +103,7 @@ enum class DocumentSettingId
EMBED_SYSTEM_FONTS,
APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
CONTINUOUS_ENDNOTES,
+ HEADER_SPACING_BELOW_LAST_PARA,
};
/** Provides access to settings of a document
diff --git a/sw/qa/core/layout/data/tdf128195.docx b/sw/qa/core/layout/data/tdf128195.docx
new file mode 100644
index 000000000000..16180654ce8d
--- /dev/null
+++ b/sw/qa/core/layout/data/tdf128195.docx
Binary files differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 4c16a3bbcd97..04b6cd0be900 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -43,6 +43,17 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlap)
CPPUNIT_ASSERT_GREATEREQUAL(nFlyBottom, nTableTop);
}
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTdf128195)
+{
+ // Load a document that has two paragraphs in the header.
+ // The second paragraph should have its bottom spacing applied.
+ load(DATA_DIRECTORY, "tdf128195.docx");
+ sal_Int32 nTxtHeight = parseDump("//header/txt[2]/infos/bounds", "height").toInt32();
+ sal_Int32 nTxtBottom = parseDump("//header/txt[2]/infos/bounds", "bottom").toInt32();
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2269), nTxtHeight);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3529), nTxtBottom);
+}
+
CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBorderCollapseCompat)
{
// Load a document with a border conflict: top cell has a dotted bottom border, bottom cell has
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 0d2a8fb99808..3d31102f602d 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -91,7 +91,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbSubtractFlys(false),
mApplyParagraphMarkFormatToNumbering(false),
mbLastBrowseMode( false ),
- mbDisableOffPagePositioning ( false )
+ mbDisableOffPagePositioning ( false ),
+ mbHeaderSpacingBelowLastPara(false)
// COMPATIBILITY FLAGS END
{
@@ -217,6 +218,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
case DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA: return mbEmptyDbFieldHidesPara;
case DocumentSettingId::CONTINUOUS_ENDNOTES:
return mbContinuousEndnotes;
+ case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA: return mbHeaderSpacingBelowLastPara;
default:
OSL_FAIL("Invalid setting id");
}
@@ -452,6 +454,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
case DocumentSettingId::CONTINUOUS_ENDNOTES:
mbContinuousEndnotes = value;
break;
+ case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA:
+ mbHeaderSpacingBelowLastPara = value;
+ break;
default:
OSL_FAIL("Invalid setting id");
}
@@ -595,6 +600,7 @@ void sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti
mbSubtractFlys = rSource.mbSubtractFlys;
mbMsWordCompTrailingBlanks = rSource.mbMsWordCompTrailingBlanks;
mbEmptyDbFieldHidesPara = rSource.mbEmptyDbFieldHidesPara;
+ mbHeaderSpacingBelowLastPara = rSource.mbHeaderSpacingBelowLastPara;
}
sal_uInt32 sw::DocumentSettingManager::Getn32DummyCompatibilityOptions1() const
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 1cfe2978ab3b..fe87b339307c 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -161,6 +161,7 @@ class DocumentSettingManager :
bool mbDisableOffPagePositioning; // tdf#112443
bool mbEmptyDbFieldHidesPara;
bool mbContinuousEndnotes = false;
+ bool mbHeaderSpacingBelowLastPara;
public:
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 1b8997cd6c2b..466e0e1855bc 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1696,6 +1696,10 @@ SwTwips SwFlowFrame::CalcLowerSpace( const SwBorderAttrs* _pAttrs ) const
nLowerSpace += CalcAddLowerSpaceAsLastInTableCell( _pAttrs );
}
+ // tdf#128195 Consider para spacing below last paragraph in header
+ if (!m_rThis.IsInFly() && m_rThis.FindFooterOrHeader() && !GetFollow() && !m_rThis.GetIndNext())
+ nLowerSpace += _pAttrs->GetULSpace().GetLower() + _pAttrs->CalcLineSpacing();
+
return nLowerSpace;
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b0ea96fc7f51..89b45849fe69 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1837,6 +1837,9 @@ void SwWW8ImplReader::ImportDop()
// tdf#117923
m_rDoc.getIDocumentSettingAccess().set(
DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, true);
+ // tdf#128195
+ m_rDoc.getIDocumentSettingAccess().set(
+ DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA, true);
// Import Default Tabs
long nDefTabSiz = m_xWDop->dxaTab;
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 93dc022cd9be..9887cdc11dc8 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -144,6 +144,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_DISABLE_OFF_PAGE_POSITIONING,
HANDLE_EMPTY_DB_FIELD_HIDES_PARA,
HANDLE_CONTINUOUS_ENDNOTES,
+ HANDLE_HEADER_SPACING_BELOW_LAST_PARA,
};
static MasterPropertySetInfo * lcl_createSettingsInfo()
@@ -229,6 +230,8 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ OUString("DisableOffPagePositioning"), HANDLE_DISABLE_OFF_PAGE_POSITIONING, cppu::UnoType<bool>::get(), 0},
{ OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 },
{ OUString("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, cppu::UnoType<bool>::get(), 0 },
+ { OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
+
/*
* As OS said, we don't have a view when we need to set this, so I have to
* find another solution before adding them to this property set - MTG
@@ -937,6 +940,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
}
}
break;
+ case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
+ {
+ bool bTmp;
+ if (rValue >>= bTmp)
+ {
+ mpDoc->getIDocumentSettingAccess().set(
+ DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA, bTmp);
+ }
+ }
+ break;
default:
throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
}
@@ -1399,6 +1412,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
<<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::CONTINUOUS_ENDNOTES);
}
break;
+ case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
+ {
+ rValue <<= mpDoc->getIDocumentSettingAccess().get(
+ DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA);
+ }
+ break;
default:
throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
}
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 8ef88ab320bb..f142ba7aa361 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -125,6 +125,8 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon
// Don't load the default style definitions to avoid weird mix
m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", uno::makeAny(true));
+ m_pImpl->SetDocumentSettingsProperty("HeaderSpacingBelowLastPara",
+ uno::makeAny(true));
m_pImpl->SetDocumentSettingsProperty("TabAtLeftIndentForParagraphsInList", uno::makeAny(true));