sw/qa/uitest/data/tdf136715.odt         |binary
 sw/qa/uitest/writer_tests7/tdf136715.py |   35 ++++++++++++++++++++++++++++++++
 sw/source/core/undo/untbl.cxx           |    3 +-
 3 files changed, 37 insertions(+), 1 deletion(-)

New commits:
commit aee6d4f8e028e0daee65611a0f94f1e4cc8325d1
Author:     Balazs Santha <santha.bal...@simonyi.bme.hu>
AuthorDate: Thu Oct 14 15:53:06 2021 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Oct 27 12:56:35 2021 +0200

    tdf#136715 sw: fix table Undo to update table style
    
    Applying table styles works by applying direct formatting
    on the table. Some of the built-in table styles, like
    "Box List Red" specifies boldness for the last row of
    the table. After selecting and deleting the last n rows
    of a table, which has a table style which specifies formatting
    for the last row, the new last row gets these formatting as
    expected. However before the fix, after undoing the deletion
    of the rows, this formatting were still applied on that row
    which previously became the last row.
    
    Change-Id: I3ad086dd9b5e4111b3f019ca3d23f1db8b348637
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123730
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124256
    Tested-by: Jenkins

diff --git a/sw/qa/uitest/data/tdf136715.odt b/sw/qa/uitest/data/tdf136715.odt
new file mode 100644
index 000000000000..ca5c89ce427c
Binary files /dev/null and b/sw/qa/uitest/data/tdf136715.odt differ
diff --git a/sw/qa/uitest/writer_tests7/tdf136715.py 
b/sw/qa/uitest/writer_tests7/tdf136715.py
new file mode 100644
index 000000000000..df9f37ecc86c
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf136715.py
@@ -0,0 +1,35 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+
+# Bug 136715 - Undoing table rows caused inconsistent table look when using 
table styles
+
+class tdf136715(UITestCase):
+    def test_tdf136715(self):
+        self.ui_test.load_file(get_url_for_data_file("tdf136715.odt"))
+
+        self.xUITest.executeCommand(".uno:GoDown")
+        self.xUITest.executeCommand(".uno:GoDown")
+        self.xUITest.executeCommand(".uno:LineDownSel")
+        self.xUITest.executeCommand(".uno:DeleteRows")
+        self.xUITest.executeCommand(".uno:Undo")
+
+        self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+        xDialog = self.xUITest.getTopFocusWindow()
+        xTabs = xDialog.getChild("tabcontrol")
+        select_pos(xTabs, "0")
+        xweststylebcjk = xDialog.getChild("weststylelb-cjk")
+        #without the fix in place, the row would have bold character formatting
+        self.assertEqual(get_state_as_dict(xweststylebcjk)["Text"], "Regular")
+        xOkBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOkBtn)
+
+        self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index ee509e6b602c..607b706f38d2 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -62,6 +62,7 @@
 #include <calbck.hxx>
 #include <frameformats.hxx>
 #include <osl/diagnose.h>
+#include <docsh.hxx>
 
 #include <memory>
 #include <utility>
@@ -1762,7 +1763,7 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & 
rContext)
 
     // TL_CHART2: need to inform chart of probably changed cell names
     rDoc.UpdateCharts( pTableNd->GetTable().GetFrameFormat()->GetName() );
-
+    rDoc.GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTableNd);
     if( IsDelBox() )
         m_nSttNode = pTableNd->GetIndex();
     ClearFEShellTabCols(rDoc, nullptr);

Reply via email to