summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-09-23 15:14:08 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-09-25 03:37:50 +0200
commitd731b65d3c6b58ed98ee60488d07e5cba653ede0 (patch)
tree4683dd3dd8df5e925780fa9592a948afccc9b60c /sw/source/core
parent94d2bd907cb9472f78efaf2a355b8329447df97a (diff)
tdf#134782 sw: split AddParaSpacingToTableCells flag in 2
commit 3cccdabf19a99fd3f657985c1822436d7679df2b "extend AddParaSpacingToTableCells with line spacing" changed how the ADD_PARA_SPACING_TO_TABLE_CELLS compat flag works, to improve interop with Word. This commit splits out the change as a separate new compat flag ADD_PARA_LINE_SPACING_TO_TABLE_CELLS ("AddParaLineSpacingToTableCells"), to preserve compatibility with ODT documents that were produced by LO < 6.4 (via SwXMLImport::SetConfigurationSettings()). New documents and WW8/RTF/DOCX import have both flags enabled. The combination false/true is invalid, and treated as equivalent to false/false. Change-Id: Ida20df8fe4a8192a714f91da95345f9726fd7d98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103317 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 38aa699f265c17548769aaa4f20e1ae35d18f202) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103359 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx7
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx1
-rw-r--r--sw/source/core/layout/calcmove.cxx16
-rw-r--r--sw/source/core/layout/flowfrm.cxx12
-rw-r--r--sw/source/core/layout/frmtool.cxx2
5 files changed, 32 insertions, 6 deletions
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index b7f3af73d2af..a29c5bc6275f 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -112,6 +112,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbAddExternalLeading = !aOptions.GetDefault( SvtCompatibilityEntry::Index::NoExtLeading );
mbOldLineSpacing = aOptions.GetDefault( SvtCompatibilityEntry::Index::UseLineSpacing );
mbAddParaSpacingToTableCells = aOptions.GetDefault( SvtCompatibilityEntry::Index::AddTableSpacing );
+ mbAddParaLineSpacingToTableCells = aOptions.GetDefault( SvtCompatibilityEntry::Index::AddTableSpacing ); // FIXME? separate UI?
mbUseFormerObjectPos = aOptions.GetDefault( SvtCompatibilityEntry::Index::UseObjectPositioning );
mbUseFormerTextWrapping = aOptions.GetDefault( SvtCompatibilityEntry::Index::UseOurTextWrapping );
mbConsiderWrapOnObjPos = aOptions.GetDefault( SvtCompatibilityEntry::Index::ConsiderWrappingStyle );
@@ -131,6 +132,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbAddExternalLeading = true;
mbOldLineSpacing = false;
mbAddParaSpacingToTableCells = false;
+ mbAddParaLineSpacingToTableCells = false;
mbUseFormerObjectPos = false;
mbUseFormerTextWrapping = false;
mbConsiderWrapOnObjPos = false;
@@ -167,6 +169,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
case DocumentSettingId::OLD_NUMBERING: return mbOldNumbering;
case DocumentSettingId::OLD_LINE_SPACING: return mbOldLineSpacing;
case DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS: return mbAddParaSpacingToTableCells;
+ case DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS: return mbAddParaLineSpacingToTableCells;
case DocumentSettingId::USE_FORMER_OBJECT_POS: return mbUseFormerObjectPos;
case DocumentSettingId::USE_FORMER_TEXT_WRAPPING: return mbUseFormerTextWrapping;
case DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION: return mbConsiderWrapOnObjPos;
@@ -283,6 +286,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
case DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS:
mbAddParaSpacingToTableCells = value;
break;
+ case DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
+ mbAddParaLineSpacingToTableCells = value;
+ break;
case DocumentSettingId::USE_FORMER_OBJECT_POS:
mbUseFormerObjectPos = value;
break;
@@ -588,6 +594,7 @@ void sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti
mbAddExternalLeading = rSource.mbAddExternalLeading;
mbOldLineSpacing = rSource.mbOldLineSpacing;
mbAddParaSpacingToTableCells = rSource.mbAddParaSpacingToTableCells;
+ mbAddParaLineSpacingToTableCells = rSource.mbAddParaLineSpacingToTableCells;
mbUseFormerObjectPos = rSource.mbUseFormerObjectPos;
mbUseFormerTextWrapping = rSource.mbUseFormerTextWrapping;
mbConsiderWrapOnObjPos = rSource.mbConsiderWrapOnObjPos;
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index e548c55a26b2..5a19e930f664 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -157,6 +157,7 @@ class DocumentSettingManager :
bool mbPropLineSpacingShrinksFirstLine; // fdo#79602
bool mbSubtractFlys; // tdf#86578
bool mApplyParagraphMarkFormatToNumbering;
+ bool mbAddParaLineSpacingToTableCells; // tdf#125300 tdf#134782
bool mbLastBrowseMode : 1;
bool mbDisableOffPagePositioning; // tdf#112443
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index caa81ecbd182..b9687accdf90 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -134,7 +134,11 @@ bool SwContentFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool & )
{
SwBorderAttrAccess aAccess( SwFrame::GetCache(), pLastFrame );
const SwBorderAttrs& rAttrs = *aAccess.Get();
- nNewTop -= rAttrs.GetULSpace().GetLower() + rAttrs.CalcLineSpacing();
+ nNewTop -= rAttrs.GetULSpace().GetLower();
+ if (rIDSA.get(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS))
+ {
+ nNewTop -= rAttrs.CalcLineSpacing();
+ }
}
}
}
@@ -2147,10 +2151,16 @@ bool SwContentFrame::WouldFit_( SwTwips nSpace,
}
// Also consider lower spacing in table cells
+ IDocumentSettingAccess const& rIDSA(pNewUpper->GetFormat()->getIDocumentSettingAccess());
if ( bRet && IsInTab() &&
- pNewUpper->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) )
+ rIDSA.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS))
{
- nSpace -= rAttrs.GetULSpace().GetLower() + rAttrs.CalcLineSpacing();
+ nSpace -= rAttrs.GetULSpace().GetLower();
+
+ if (rIDSA.get(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS))
+ {
+ nSpace -= rAttrs.CalcLineSpacing();
+ }
if ( nSpace < 0 )
{
bRet = false;
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 6d83406583a7..d416b637c02f 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1716,7 +1716,8 @@ SwTwips SwFlowFrame::CalcAddLowerSpaceAsLastInTableCell(
{
SwTwips nAdditionalLowerSpace = 0;
- if ( m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) )
+ IDocumentSettingAccess const& rIDSA(m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess());
+ if (rIDSA.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS))
{
const SwFrame* pFrame = &m_rThis;
if ( pFrame->IsSctFrame() )
@@ -1741,7 +1742,14 @@ SwTwips SwFlowFrame::CalcAddLowerSpaceAsLastInTableCell(
}
if (_pAttrs)
- nAdditionalLowerSpace += _pAttrs->GetULSpace().GetLower() + _pAttrs->CalcLineSpacing();
+ {
+ nAdditionalLowerSpace += _pAttrs->GetULSpace().GetLower();
+
+ if (rIDSA.get(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS))
+ {
+ nAdditionalLowerSpace += _pAttrs->CalcLineSpacing();
+ }
+ }
}
return nAdditionalLowerSpace;
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index f839d0b946b4..a861dd60013b 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2525,7 +2525,7 @@ void SwBorderAttrs::GetBottomLine_( const SwFrame& _rFrame )
void SwBorderAttrs::CalcLineSpacing_()
{
- // tdf#125300 compatibility option AddParaSpacingToTableCells needs also line spacing
+ // tdf#125300 compatibility option AddParaLineSpacingToTableCells needs also line spacing
const SvxLineSpacingItem &rSpace = m_rAttrSet.GetLineSpacing();
if ( rSpace.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop && rSpace.GetPropLineSpace() > 100 )
{