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

New commits:
commit bc92028fdf7f52f555702386a6862631e08a3919
Author:     Balazs Santha <santha.bal...@simonyi.bme.hu>
AuthorDate: Thu Oct 14 15:53:06 2021 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Tue Oct 26 12:20:49 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>

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..acd89808179d
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf136715.py
@@ -0,0 +1,28 @@
+# -*- 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):
+        with self.ui_test.load_file(get_url_for_data_file("tdf136715.odt")) as 
writer_doc:
+            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")
+            with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog", 
close_button="cancel") as xDialog:
+                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")
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 5587dfeb9b1c..d3294b5446a3 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>
@@ -1757,7 +1758,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