summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorBalazs Santha <santha.balazs@simonyi.bme.hu>2021-07-14 15:18:47 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-07-15 16:04:56 +0200
commit554c3692b7e3b51ce6ce7772509ba7a2e8777d3a (patch)
treeedcb91346818a303de171fd94966001b3a931b00 /sw/source
parent0e7021de592b07894c57ab920acb40e10be8b26e (diff)
tdf#134452 sw: fix page break disappears after applying table style
After setting the break and pagedesc property of a table, applying a table style (autoformat) caused the loss of these settings. This was because, when applying a table style, the SwTableAutoFormat::RestoreTableProperties() overrid these settings with its own default settings. As the autoformats can never be modified, and they don't really use these two props, the easiest way to prevent any problem was to completely remove these properties and its uses. Unfortunately, m_aBreak couldn't be removed entirely, as the autoformats are stored in a binary file, and to be able to read and write these files the offset of the subsequent items must not be changed. Change-Id: Ieba439d3ba5da892b39f00f8b61c5c8467306635 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118662 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/doc/tblafmt.cxx22
1 files changed, 7 insertions, 15 deletions
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 558c8d6f827d..ec1e7b9ff993 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -366,7 +366,6 @@ bool SwBoxAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
SwTableAutoFormat::SwTableAutoFormat( const OUString& rName )
: m_aName( rName )
, m_nStrResId( USHRT_MAX )
- , m_aBreak(std::make_shared<SvxFormatBreakItem>(SvxBreak::NONE, RES_BREAK))
, m_aKeepWithNextPara(std::make_shared<SvxFormatKeepItem>(false, RES_KEEP))
, m_aRepeatHeading( 0 )
, m_bLayoutSplit( true )
@@ -385,8 +384,7 @@ SwTableAutoFormat::SwTableAutoFormat( const OUString& rName )
}
SwTableAutoFormat::SwTableAutoFormat( const SwTableAutoFormat& rNew )
- : m_aBreak()
- , m_aKeepWithNextPara()
+ : m_aKeepWithNextPara()
, m_aShadow(std::make_shared<SvxShadowItem>(RES_SHADOW))
{
for(SwBoxAutoFormat* & rp : m_aBoxAutoFormat)
@@ -420,8 +418,6 @@ SwTableAutoFormat& SwTableAutoFormat::operator=( const SwTableAutoFormat& rNew )
m_bInclValueFormat = rNew.m_bInclValueFormat;
m_bInclWidthHeight = rNew.m_bInclWidthHeight;
- m_aBreak.reset(rNew.m_aBreak->Clone());
- m_aPageDesc = rNew.m_aPageDesc;
m_aKeepWithNextPara.reset(rNew.m_aKeepWithNextPara->Clone());
m_aRepeatHeading = rNew.m_aRepeatHeading;
m_bLayoutSplit = rNew.m_bLayoutSplit;
@@ -683,9 +679,6 @@ void SwTableAutoFormat::RestoreTableProperties(SwTable &table) const
SfxItemSet rSet(pDoc->GetAttrPool(), aTableSetRange);
- 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));
if ( m_aKeepWithNextPara->GetValue() )
@@ -717,8 +710,6 @@ void SwTableAutoFormat::StoreTableProperties(const SwTable &table)
const SfxItemSet &rSet = pFormat->GetAttrSet();
- m_aBreak.reset(rSet.Get(RES_BREAK).Clone());
- m_aPageDesc = rSet.Get(RES_PAGEDESC);
const SwFormatLayoutSplit &layoutSplit = rSet.Get(RES_LAYOUT_SPLIT);
m_bLayoutSplit = layoutSplit.GetValue();
m_bCollapsingBorders = rSet.Get(RES_COLLAPSING_BORDERS).GetValue();
@@ -778,8 +769,9 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions )
if (nVal >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream))
{
- legacy::SvxFormatBreak::Create(*m_aBreak, rStream, AUTOFORMAT_FILE_VERSION);
-//unimplemented READ(m_aPageDesc, SwFormatPageDesc, AUTOFORMAT_FILE_VERSION);
+ //this only exists for file format compat
+ SvxFormatBreakItem aBreak(SvxBreak::NONE, RES_BREAK);
+ legacy::SvxFormatBreak::Create(aBreak, rStream, AUTOFORMAT_FILE_VERSION);
legacy::SvxFormatKeep::Create(*m_aKeepWithNextPara, rStream, AUTOFORMAT_FILE_VERSION);
rStream.ReadUInt16( m_aRepeatHeading ).ReadCharAsBool( m_bLayoutSplit ).ReadCharAsBool( m_bRowSplit ).ReadCharAsBool( m_bCollapsingBorders );
@@ -822,9 +814,9 @@ bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
{
WriterSpecificAutoFormatBlock block(rStream);
-
- legacy::SvxFormatBreak::Store(*m_aBreak, rStream, legacy::SvxFormatBreak::GetVersion(fileVersion));
-//unimplemented m_aPageDesc.Store(rStream, m_aPageDesc.GetVersion(fileVersion));
+ //this only exists for file format compat
+ SvxFormatBreakItem aBreak(SvxBreak::NONE, RES_BREAK);
+ legacy::SvxFormatBreak::Store(aBreak, rStream, legacy::SvxFormatBreak::GetVersion(fileVersion));
legacy::SvxFormatKeep::Store(*m_aKeepWithNextPara, rStream, legacy::SvxFormatKeep::GetVersion(fileVersion));
rStream.WriteUInt16( m_aRepeatHeading ).WriteBool( m_bLayoutSplit ).WriteBool( m_bRowSplit ).WriteBool( m_bCollapsingBorders );
legacy::SvxShadow::Store(*m_aShadow, rStream, legacy::SvxShadow::GetVersion(fileVersion));