sw/inc/tblafmt.hxx              |    1 +
 sw/source/core/doc/tblafmt.cxx  |   10 ++++++++++
 sw/source/core/frmedt/fetab.cxx |    1 +
 sw/source/ui/table/instable.cxx |   14 ++------------
 4 files changed, 14 insertions(+), 12 deletions(-)

New commits:
commit 50d13c89f2420971047f25d40493b85c964fd54b
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Jul 18 13:21:50 2024 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Wed Jul 24 08:37:52 2024 +0200

    (related tdf#126008) sw: when removing table auto format, don't...
    
    ... change the formatting.
    
    Change-Id: I50fbb290f0a7f2cccc2559059859fa820d5c9aba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170688
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit 1e978fffddc3d7044f3def026340844b59d2d656)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170745
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index dbbec1909ae2..16f84d8ad42c 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -225,6 +225,7 @@ public:
     /// Check if style is defined by user.
     bool IsUserDefined() const  { return m_bUserDefined; }
 
+    void DisableAll();
     void SetFont( const bool bNew )         { m_bInclFont = bNew; }
     void SetJustify( const  bool bNew )     { m_bInclJustify = bNew; }
     void SetFrame( const bool bNew )        { m_bInclFrame = bNew; }
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 65bff647eb08..321378e1b084 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -441,6 +441,16 @@ SwTableAutoFormat::~SwTableAutoFormat()
             delete *ppFormat;
 }
 
+void SwTableAutoFormat::DisableAll()
+{
+    SetFont(false);
+    SetJustify(false);
+    SetFrame(false);
+    SetBackground(false);
+    SetValueFormat(false);
+    SetWidthHeight(false);
+}
+
 void SwTableAutoFormat::SetBoxFormat( const SwBoxAutoFormat& rNew, sal_uInt8 
nPos )
 {
     OSL_ENSURE( nPos < 16, "wrong area" );
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 25270568df52..21ad4fd4828a 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1447,6 +1447,7 @@ bool SwFEShell::UpdateTableStyleFormatting(SwTableNode 
*pTableNode,
     if (pStyleName && pStyleName->isEmpty())
     {
         pNone.reset(new 
SwTableAutoFormat(SwViewShell::GetShellRes()->aStrNone));
+        pNone->DisableAll();
         pTableStyle = pNone.get();
     }
     else
diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx
index a5aa4cd83853..887401fdfd69 100644
--- a/sw/source/ui/table/instable.cxx
+++ b/sw/source/ui/table/instable.cxx
@@ -171,16 +171,6 @@ sal_uInt8 SwInsTableDlg::lbIndexToTableIndex( const 
sal_uInt8 listboxIndex )
     return 255;
 }
 
-static void lcl_SetProperties( SwTableAutoFormat* pTableAutoFormat, bool bVal )
-{
-    pTableAutoFormat->SetFont( bVal );
-    pTableAutoFormat->SetJustify( bVal );
-    pTableAutoFormat->SetFrame( bVal );
-    pTableAutoFormat->SetBackground( bVal );
-    pTableAutoFormat->SetValueFormat( bVal );
-    pTableAutoFormat->SetWidthHeight( bVal );
-}
-
 IMPL_LINK_NOARG(SwInsTableDlg, SelFormatHdl, weld::TreeView&, void)
 {
     // Get index of selected item from the listbox
@@ -194,7 +184,7 @@ IMPL_LINK_NOARG(SwInsTableDlg, SelFormatHdl, 
weld::TreeView&, void)
     else
     {
         SwTableAutoFormat aTmp( SwViewShell::GetShellRes()->aStrNone );
-        lcl_SetProperties( &aTmp, false );
+        aTmp.DisableAll();
 
         m_aWndPreview.NotifyChange( aTmp );
     }
@@ -215,7 +205,7 @@ IMPL_LINK_NOARG(SwInsTableDlg, OKHdl, weld::Button&, void)
     else
     {
         m_xTAutoFormat.reset(new SwTableAutoFormat( 
SwViewShell::GetShellRes()->aStrNone ));
-        lcl_SetProperties( m_xTAutoFormat.get(), false );
+        m_xTAutoFormat->DisableAll();
     }
 
     m_xDialog->response(RET_OK);

Reply via email to