tdf#115026 sw tableAutoFormat: don't clear break/keep
If a table style HAS defined a page-break
or keep-with-next-paragraph, then apply it when
applying the style. But if the format just has a default
non-break/non-keep attribute, then don't apply that.
Kinda seems artificial/arbitrary, but it looks difficult
to change the break/keep property to be an optional component.
If it was optional, then it would be fine to take a
defined non-break and apply it, but since it is a
mandatory value, just ignore the default state.
Yes, this means that applying one style can introduce a
break/keep, but applying a different style cannot
remove it. None of the build-in styles has either of
these properties set. Since there is no way to identify
direct formatting, assuming the user intentionally
set these is the better policy by far...
I didn't do the same thing with shadow/collapsing borders
etc. Those seem more like table style properties than these
two flow items.
I still couldn't get the unit test to work.
I got access to the created document by removing
EnableKillingFile from swmodelbase, and from that I can see
that the autoformat is not affecting the table with
RestoreTableProperties.
I assume the Break is overwritten during the table creation
process because I can see the background being applied
in that case, but still no Break.
Change-Id: Ia2a4ff8a19158b1ea5d74ec3a21c688c53d66724
Reviewed-on: https://gerrit.libreoffice.org/83879
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 43f983d08d66520536980339f33ef44d5eec35f6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85838
Reviewed-by: Xisco FaulĂ <xiscofauli@libreoffice.org>
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 765154b3e..35e626a 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -685,11 +685,13 @@ void SwTableAutoFormat::RestoreTableProperties(SwTable &table) const
SfxItemSet rSet(pDoc->GetAttrPool(), aTableSetRange);
rSet.Put(*m_aBreak);
if ( m_aBreak->GetBreak() != SvxBreak::NONE )
rSet.Put(*m_aBreak);
rSet.Put(m_aPageDesc);
rSet.Put(SwFormatLayoutSplit(m_bLayoutSplit));
rSet.Put(SfxBoolItem(RES_COLLAPSING_BORDERS, m_bCollapsingBorders));
rSet.Put(*m_aKeepWithNextPara);
if ( m_aKeepWithNextPara->GetValue() )
rSet.Put(*m_aKeepWithNextPara);
rSet.Put(*m_aShadow);
pFormat->SetFormatAttr(rSet);
@@ -882,7 +884,7 @@ OUString SwTableAutoFormat::GetTableTemplateCellSubName(const SwBoxAutoFormat& r
* +-----------------------------------------------------------------------+
* 4 | | | | | | |
* +-----------------------------------------------------------------------+
* 5 | LRSC | LR | LRENC | | | LRENC |
* 5 | LRSC | LR | LREC | | | LRENC |
* +-----------+-----------+-----------+-----------+-----------+-----------+
* ODD = 1, 3, 5, ...
* EVEN = 2, 4, 6, ...