diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2020-02-03 00:28:04 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2020-02-05 10:11:17 +0100 |
commit | 7d08664be4d9a949718ce66e3bc974105a10284c (patch) | |
tree | 53f7ef660ebd436568e28a957166bb373c6848d6 /sw/qa/python | |
parent | 9811796aba7360fc5b7230a8b314a56fbf6ab27a (diff) |
tdf#129568 Rename the default table style
As it turns out, UI names of table styles are
leaking into documents, and changing those names
actually breaks the import of documents from
previous versions. The problem is that a table
style itself is saved using its programmatic name,
but is referenced by tables using its UI name. So
after changing the UI name, these no longer map.
It's still possible to manually reapply the style,
but if not doing this and just saving, the style
and its child cell styles will be silently lost.
Moreover, if the given document is of fodt type,
it's not even possible to save it (even not as
"save as" to odt).
Obviously, the issue isn't just with renaming.
The same happens also with documents created
with a different UI language (even English).
Fortunately, up to now English UI names were
identical to the programmatic ones. So the first
thing we can do is to accept both kinds of names
for table:template-name. This way, we solved the
problem for documents created in an English UI,
and in addition made them work in non-English UI
(unlike before). As for export, we want to always
writes programmatic names, so newly edited
documents will continue to work regardless of
future UI changes or UI language switching (and
also stay compatible with older versions).
For the fodt export failure, changed the order of
things in SwXTextTableStyle::replaceByName, as
setting a new box breaks SwXTextCellStyle::getName
in this specific case. Also changed cell styles
to be named using the parent style's programmatic
name, so new documents won't have this problem
when opened in older versions. This also fixed
part of the PythonTest_sw_python failure.
The remaining PythonTest_sw_python failure was
about the "TableTemplateName" UNO API property
of a table, which didn't work with programmatic
names. That's a real bug by itself, and was
fixed. Also an explicit test was added, to make
sure the API always returns the programmatic name.
Finally, an odf export test was added. It tests
files with both old-style UI names, and new-style
programmatic names. Styles should be correctly
imported, used by the table, and survive export.
Change-Id: I45dfda193813fea184dc42e5e75544ebc05d4a92
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87826
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Tested-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'sw/qa/python')
-rw-r--r-- | sw/qa/python/check_table.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py index 9cb3b829d4d3..b06f3caa4d7d 100644 --- a/sw/qa/python/check_table.py +++ b/sw/qa/python/check_table.py @@ -547,6 +547,11 @@ class CheckTable(unittest.TestCase): xDoc = CheckTable._uno.openEmptyWriterDoc() xTable = xDoc.createInstance("com.sun.star.text.TextTable") xTable.initialize(1, 1) + xCursor = xDoc.Text.createTextCursor() + xDoc.Text.insertTextContent(xCursor, xTable, True) + # should return programmatic name, even though UI name was set. + xTable.setPropertyValue("TableTemplateName", "Default Table Style") + self.assertEqual(xTable.getPropertyValue("TableTemplateName"), "Default Style") xTable.setPropertyValue("TableTemplateName", "Default") self.assertEqual(xTable.getPropertyValue("TableTemplateName"), "Default") xTable.setPropertyValue("TableTemplateName", "other_style") |