sw/source/core/doc/tblafmt.cxx |   27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

New commits:
commit 9dc779a747637074274113c9a2dd34ff4ddb9c20
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Mar 15 19:54:35 2025 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Mar 18 11:26:34 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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183004
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index b73e195a6bbc..bb7f1f2d324d 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -469,13 +469,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 )
@@ -484,12 +479,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;
 }
 
@@ -845,14 +835,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;

Reply via email to