summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2019-11-27 12:52:38 +0300
committerMiklos Vajna <vmiklos@collabora.com>2019-12-20 10:52:42 +0100
commit43f983d08d66520536980339f33ef44d5eec35f6 (patch)
treeb951c00a5340a474b8ac41c9bfb59cffaccf8306
parent76454e4d360bdc8466d46cc5d14613750fc7b327 (diff)
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>
-rw-r--r--sw/source/core/doc/tblafmt.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index ae7c3e6fadbb..58756cce6d7f 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -684,11 +684,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);
@@ -881,7 +883,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, ...