summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-09-23 15:14:08 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2020-09-29 15:33:37 +0200
commitd92c5b8c153a83997fc109b5ea7347d91bdcfd41 (patch)
treeb133f4629004c1e4254c8be024aa775fb95d3ea3
parent60723da529bbbac7067a86715752e4dbe7c6a291 (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/+/103331 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit dc1ce5130a8df5017662c83be26bdada6098ee37) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103443 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sw/inc/IDocumentSettingAccess.hxx1
-rw-r--r--sw/qa/extras/layout/layout.cxx7
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx11
-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
-rw-r--r--sw/source/filter/ww8/ww8par.cxx1
-rw-r--r--sw/source/filter/xml/xmlimp.cxx7
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx13
-rw-r--r--writerfilter/source/filter/WriterFilter.cxx1
11 files changed, 62 insertions, 10 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 737e1f8d5902..2388b3ad45d5 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -47,6 +47,7 @@ enum class DocumentSettingId
USE_HIRES_VIRTUAL_DEVICE,
OLD_LINE_SPACING,
ADD_PARA_SPACING_TO_TABLE_CELLS,
+ ADD_PARA_LINE_SPACING_TO_TABLE_CELLS,
USE_FORMER_OBJECT_POS,
USE_FORMER_TEXT_WRAPPING,
CONSIDER_WRAP_ON_OBJECT_POSITION,
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 44512e2ce8a2..038ee2812785 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1140,10 +1140,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableOverlapFooterFly)
assertXPath(pLayout, "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/Text", "Portion",
"Abc def ghi jkl mno pqr stu vwx yz.");
// height was: 1517
- assertXPath(
- pLayout, "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/infos/bounds", "height",
- // "253"); // FIXME: this is correct but 3cccdabf19a99fd3f657985c1822436d7679df2b breaks it
- "379");
+ // tdf#134782 height was: 379
+ assertXPath(pLayout, "/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/infos/bounds", "height",
+ "253");
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277)
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 6cc92e62daf3..0a8f465e1736 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -116,6 +116,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 );
@@ -135,6 +136,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbAddExternalLeading = true;
mbOldLineSpacing = false;
mbAddParaSpacingToTableCells = false;
+ mbAddParaLineSpacingToTableCells = false;
mbUseFormerObjectPos = false;
mbUseFormerTextWrapping = false;
mbConsiderWrapOnObjPos = false;
@@ -171,6 +173,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;
@@ -287,6 +290,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;
@@ -607,6 +613,7 @@ void sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti
mbUseHiResolutionVirtualDevice = rSource.mbUseHiResolutionVirtualDevice;
mbOldLineSpacing = rSource.mbOldLineSpacing;
mbAddParaSpacingToTableCells = rSource.mbAddParaSpacingToTableCells;
+ mbAddParaLineSpacingToTableCells = rSource.mbAddParaLineSpacingToTableCells;
mbUseFormerObjectPos = rSource.mbUseFormerObjectPos;
mbUseFormerTextWrapping = rSource.mbUseFormerTextWrapping;
mbConsiderWrapOnObjPos = rSource.mbConsiderWrapOnObjPos;
@@ -753,6 +760,10 @@ void sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
BAD_CAST(OString::boolean(mbAddParaSpacingToTableCells).getStr()));
xmlTextWriterEndElement(pWriter);
+ xmlTextWriterStartElement(pWriter, BAD_CAST("mbAddParaLineSpacingToTableCells"));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+ BAD_CAST(OString::boolean(mbAddParaLineSpacingToTableCells).getStr()));
+ xmlTextWriterEndElement(pWriter);
xmlTextWriterStartElement(pWriter, BAD_CAST("mbUseFormerObjectPos"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index ef404de0ba8b..958a2fcaacb0 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -158,6 +158,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 5094c145c217..6fb4ac868ce7 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 73c939ec1a40..576e32d908f4 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1731,7 +1731,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() )
@@ -1756,7 +1757,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 f5b2cc813e4a..295000c0aa64 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 )
{
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b733cad8ce83..d83e47ebb52c 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1899,6 +1899,7 @@ void SwWW8ImplReader::ImportDop()
// #i25901# - set new compatibility option
// 'Add paragraph and table spacing at bottom of table cells'
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, true);
+ m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, true);
// #i11860# - set new compatibility option
// 'Use former object positioning' to <false>
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 0ea3690eddac..19e7b1323a7d 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1337,6 +1337,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
bool bUseOldNumbering = false;
bool bAddExternalLeading = false;
bool bAddParaSpacingToTableCells = false;
+ bool bAddParaLineSpacingToTableCells = false;
bool bUseFormerLineSpacing = false;
bool bUseFormerObjectPositioning = false;
bool bUseFormerTextWrapping = false;
@@ -1409,6 +1410,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
bAddExternalLeading = true;
else if ( rValue.Name == "AddParaSpacingToTableCells" )
bAddParaSpacingToTableCells = true;
+ else if ( rValue.Name == "AddParaLineSpacingToTableCells" )
+ bAddParaLineSpacingToTableCells = true;
else if ( rValue.Name == "UseFormerLineSpacing" )
bUseFormerLineSpacing = true;
else if ( rValue.Name == "UseFormerObjectPositioning" )
@@ -1511,6 +1514,10 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
xProps->setPropertyValue( "AddParaSpacingToTableCells",
makeAny( false ) );
}
+ if (!bAddParaLineSpacingToTableCells)
+ {
+ xProps->setPropertyValue("AddParaLineSpacingToTableCells", makeAny(false));
+ }
if( !bUseFormerTextWrapping )
{
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 7b94387500ac..a644a019c416 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -94,6 +94,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_ALLOW_PRINTJOB_CANCEL,
HANDLE_USE_FORMER_LINE_SPACING,
HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS,
+ HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS,
HANDLE_USE_FORMER_OBJECT_POSITIONING,
HANDLE_USE_FORMER_TEXT_WRAPPING,
HANDLE_CHANGES_PASSWORD,
@@ -185,6 +186,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
{ OUString("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, cppu::UnoType<bool>::get(), 0},
{ OUString("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, cppu::UnoType<bool>::get(), 0},
{ OUString("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
+ { OUString("AddParaLineSpacingToTableCells"), HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
{ OUString("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, cppu::UnoType<bool>::get(), 0},
{ OUString("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, cppu::UnoType<bool>::get(), 0},
{ OUString("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
@@ -632,6 +634,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, bTmp);
}
break;
+ case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
+ {
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
+ mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, bTmp);
+ }
+ break;
case HANDLE_USE_FORMER_OBJECT_POSITIONING:
{
bool bTmp = *o3tl::doAccess<bool>(rValue);
@@ -1210,6 +1218,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS);
}
break;
+ case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
+ {
+ rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS);
+ }
+ break;
case HANDLE_USE_FORMER_OBJECT_POSITIONING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_OBJECT_POS);
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index 5cc8cc745d95..0f0fcdb63391 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -311,6 +311,7 @@ void WriterFilter::setTargetDocument(const uno::Reference<lang::XComponent>& xDo
xSettings->setPropertyValue("DoNotResetParaAttrsForNumFont", uno::makeAny(false));
xSettings->setPropertyValue("UseFormerLineSpacing", uno::makeAny(false));
xSettings->setPropertyValue("AddParaSpacingToTableCells", uno::makeAny(true));
+ xSettings->setPropertyValue("AddParaLineSpacingToTableCells", uno::makeAny(true));
xSettings->setPropertyValue("UseFormerObjectPositioning", uno::makeAny(false));
xSettings->setPropertyValue("ConsiderTextWrapOnObjPos", uno::makeAny(true));
xSettings->setPropertyValue("UseFormerTextWrapping", uno::makeAny(false));