summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-01-31 15:05:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2023-02-08 14:56:30 +0000
commit8e3eb90ffc50bb1b53214d6953765ebb4ce47690 (patch)
tree27c5471a29e2090595a06bb5a209a839629660da /sw
parent6947d03d89d95f7eaf537b0cbfc089061c84738a (diff)
tdf#153083 writerfilter: import locale-dependent TOC \t style names, 2
There was a problem with commit ecbad22fdf81c6f072b6c9f9c16dbba47fe4748c while it now worked in Writer, the roundtripped DOCX with the en-US built-in style name in the TOC field no longer worked in Word in the original locale (but started to work in en-US locale). Let's try a slightly different approach: use the same style name as-is from the TOC field, and if it doesn't exist as a style, then clone the en-US built-in style with that name, and at the end of the import, iterate all paragraphs in the document and replace any application of the en-US style with the localised style. So both the en-US style and the localised style exist, and for references that aren't fields (e.g. basedOn in other styles) it should hopefully not matter which one is referenced. The DOCX exported from Writer now has a TOC field that works in Word in the original locale. Change-Id: Ibcc3c5899e31295b5704ebefb548f40b67eda9bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146414 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit ca71482237d31703454062b8b2f544a8bacd2831) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146420 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport17.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 0e000bff9641..7b31df3395cf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -716,8 +716,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153082_semicolon, "custom-styles-TOC-semicolon.d
xParaStyles->getByIndex(1) >>= styles;
CPPUNIT_ASSERT_EQUAL(uno::Sequence<OUString>{}, styles);
xParaStyles->getByIndex(2) >>= styles;
- // the first one is built-in Word style that was localised DE "Intensives Zitat" in the file
- CPPUNIT_ASSERT_EQUAL((uno::Sequence<OUString>{"Intense Quote", "Custom1", "_MyStyle0"}), styles);
+ // the first one is built-in Word style "Intense Quote" that was localised DE "Intensives Zitat" in the file
+ CPPUNIT_ASSERT_EQUAL((uno::Sequence<OUString>{"Intensives Zitat", "Custom1", "_MyStyle0"}), styles);
xTOC->update();
OUString const tocContent(xTOC->getAnchor()->getString());
CPPUNIT_ASSERT(tocContent.startsWith("Table of Contents"));
@@ -740,8 +740,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153082_comma, "custom-styles-TOC-comma.docx")
xParaStyles->getByIndex(1) >>= styles;
CPPUNIT_ASSERT_EQUAL(uno::Sequence<OUString>{"Custom1"}, styles);
xParaStyles->getByIndex(2) >>= styles;
- // the first one is built-in Word style that was localised DE "Intensives Zitat" in the file
- CPPUNIT_ASSERT_EQUAL(uno::Sequence<OUString>{"Intense Quote"}, styles);
+ // the first one is built-in Word style "Intense Quote" that was localised DE "Intensives Zitat" in the file
+ CPPUNIT_ASSERT_EQUAL(uno::Sequence<OUString>{"Intensives Zitat"}, styles);
xTOC->update();
OUString const tocContent(xTOC->getAnchor()->getString());
CPPUNIT_ASSERT(tocContent.startsWith("Table of Contents"));