sw/source/core/doc/tblafmt.cxx | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-)
New commits: commit fadd1c9791a8dca3b7c03bbeae02cd3053056373 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sat Mar 15 19:54:35 2025 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sun Mar 16 14:49:25 2025 +0100 make all on-demand s_pDefaultBoxAutoFormat use existing GetDefaultBoxFormat Change-Id: I75c0d73b48484540be0a728599eaf1e177dcefbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182971 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 3e0e68d25940..1042be78d23e 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -470,13 +470,8 @@ const SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos ) const SwBoxAutoFormat* pFormat = m_aBoxAutoFormat[ nPos ]; if( pFormat ) // if is set -> copy return *pFormat; - else // else return the default - { - // If it doesn't exist yet: - if( !s_pDefaultBoxAutoFormat ) - s_pDefaultBoxAutoFormat = new SwBoxAutoFormat; - return *s_pDefaultBoxAutoFormat; - } + // else return the default + return SwTableAutoFormat::GetDefaultBoxFormat(); } SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos ) @@ -485,12 +480,7 @@ SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos ) SwBoxAutoFormat** pFormat = &m_aBoxAutoFormat[ nPos ]; if( !*pFormat ) - { - // If default doesn't exist yet: - if( !s_pDefaultBoxAutoFormat ) - s_pDefaultBoxAutoFormat = new SwBoxAutoFormat(); - *pFormat = new SwBoxAutoFormat(*s_pDefaultBoxAutoFormat); - } + *pFormat = new SwBoxAutoFormat(SwTableAutoFormat::GetDefaultBoxFormat()); return **pFormat; } @@ -846,14 +836,9 @@ bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const for( int i = 0; bRet && i < 16; ++i ) { - SwBoxAutoFormat* pFormat = m_aBoxAutoFormat[ i ]; - if( !pFormat ) // if not set -> write default - { - // If it doesn't exist yet: - if( !s_pDefaultBoxAutoFormat ) - s_pDefaultBoxAutoFormat = new SwBoxAutoFormat; - pFormat = s_pDefaultBoxAutoFormat; - } + const SwBoxAutoFormat* pFormat = m_aBoxAutoFormat[ i ]; + if (!pFormat) // if not set -> write default + pFormat = &SwTableAutoFormat::GetDefaultBoxFormat(); bRet = pFormat->Save( rStream, fileVersion ); } return bRet;