editeng/source/misc/swafopt.cxx|2
officecfg/registry/schema/org/openoffice/Office/Writer.xcs |2
sw/qa/uitest/data/tdf156165.odt|binary
sw/qa/uitest/writer_tests/tdf156165.py | 80 +
4 files changed, 82 insertions(+), 2 deletions(-)
New commits:
commit e26aeb882dd236adf19679d5df9b7ba5da1ed226
Author: Baole Fang
AuthorDate: Thu Jul 6 12:03:31 2023 -0400
Commit: Mike Kaganski
CommitDate: Sat Jul 29 03:53:28 2023 +0200
tdf#156165: Fix replace custom styles while typing
Originally, Replace Custom Styles changes styles to text body by entering
BuiltText. Since styles change to text body is removed from BuiltTest, it is
converted independently.
Now, conversion is applied even during typing because m_aFlags.bChgUserColl
is true (its default value) during typing. Therefore, its default value is
changed to false.
Change-Id: I8ce067b311922b5e1bdcd84036229c369b50a977
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154144
Tested-by: Jenkins
Reviewed-by: Mike Kaganski
diff --git a/editeng/source/misc/swafopt.cxx b/editeng/source/misc/swafopt.cxx
index f6de4098d2e4..f5f79a45be97 100644
--- a/editeng/source/misc/swafopt.cxx
+++ b/editeng/source/misc/swafopt.cxx
@@ -27,7 +27,6 @@ SvxSwAutoFormatFlags::SvxSwAutoFormatFlags()
bAutoCorrect =
bCapitalStartSentence =
bCapitalStartWord =
-bChgUserColl =
bChgEnumNum =
bAddNonBrkSpace =
bChgOrdinalNumber =
@@ -42,6 +41,7 @@ SvxSwAutoFormatFlags::SvxSwAutoFormatFlags()
bAFormatByInpDelSpacesAtSttEnd =
bAFormatByInpDelSpacesBetweenLines = true;
+bChgUserColl =
bReplaceStyles =
bDelEmptyNode =
bWithRedlining =
diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index 5ac39808f1d0..ad2f1497a561 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -4235,7 +4235,7 @@
Specifies whether user-defined styles applied in the
document are replaced by predefined text document styles.
Replace user-defined styles
-true
+false
diff --git a/sw/qa/uitest/data/tdf156165.odt b/sw/qa/uitest/data/tdf156165.odt
new file mode 100644
index ..aabcfef91499
Binary files /dev/null and b/sw/qa/uitest/data/tdf156165.odt differ
diff --git a/sw/qa/uitest/writer_tests/tdf156165.py
b/sw/qa/uitest/writer_tests/tdf156165.py
new file mode 100644
index ..69d1928bb8ce
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/tdf156165.py
@@ -0,0 +1,80 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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 uitest.uihelper.common import select_pos
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from time import sleep
+
+class tdf156165(UITestCase):
+
+ def test_tdf156165(self):
+with self.ui_test.load_file(get_url_for_data_file("tdf156165.odt")):
+xMainWindow = self.xUITest.getTopFocusWindow()
+writer_edit = xMainWindow.getChild("writer_edit")
+style=xMainWindow.getChild('applystyle')
+
+with
self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog:
+xTabs = xDialog.getChild("tabcontrol")
+select_pos(xTabs, "2")
+options=xDialog.getChild('list')
+checkbox=options.getChild("16")
+self.assertEqual("Replace Custom Styles",
get_state_as_dict(checkbox)["Text"])
+
+# Replace Custom Styles is default to be false
+self.assertEqual("false",
get_state_as_dict(checkbox)["IsChecked"])
+
+# Replace Custom Styles when applying manully with it disabled,
should not change style
+writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS":
"0", "START_POS": "12"}))
+self.xUITest.executeCommand(".uno:AutoFormatApply")
+sleep(1)
+self.assertEqual(get_state_as_dict(style)["Text"], "eSelah")
+
+# Replace Custom Styles when typing with it disabled, should not
change style
+writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE":
"DOWN"}))
+writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS":
"12", "START_POS": "12"}))
+writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE":
"RETURN"}))
+