related tdf#162884 writerfilter: map to built-in Internet link, etc.

This partial revert fixes a 24.2.4 regression from
commit 72ea1005b9
Author: Michael Stahl on Mon May 6 15:58:36 2024 +0200
    tdf#160402 writerfilter: extend StyleMap with all Word styles

By using the English localization name,
the style was imported, used, and exported as English
instead of being mapped to the built-in style
whose name depends on the UI language in use.
So, revert back to using the internal version of the style names.

For English -> Dutch, that means that
Internet Link -> (MS Word's) Hyperlink -> Internetkoppeling
instead of remaining as the English "Internet Link"

For non-English UIs, the Internet Link character style
was duplicating on each file save (or perhaps each language switch).

I didn't notice the endless duplication for the other styles,
because they aren't used very much,
and are only written if used.
At worst, each localized versions was written once.

Change-Id: Icf58d7d716ac40f05f170c31787d8a8a9942868e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173230
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
This commit is contained in:
Justin Luth
2024-09-11 14:07:39 -04:00
committed by Justin Luth
parent ced420ca70
commit cd141a97c3
2 changed files with 9 additions and 13 deletions

View File

@@ -688,7 +688,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109310_endnoteStyleForMSO)
{
loadAndSave("tdf109310_endnoteStyleForMSO.docx");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/endnotes.xml"_ustr);
// Check w:rStyle element has w:val attribute - note that w: is not specified for attribute
// It is important that EndnoteCharacters exists, and is not duplicated on each round-trip
assertXPath(pXmlDoc, "/w:endnotes/w:endnote[@w:id='2']/w:p/w:r[1]/w:rPr/w:rStyle"_ostr, "val"_ostr,
u"EndnoteCharacters"_ustr);
}

View File

@@ -1567,8 +1567,6 @@ StyleSheetTable::ConvertStyleName(const OUString& rWWName)
// These are from the w:latentStyles in the styles.xml of a Word 15.0 DOCX,
// plus some pre-existing additions and variants.
static const std::map< OUString, OUString> StyleNameMap {
// FIXME: testFdo77716, testTdf129575_docDefault etc. fail with correct mapping
// { "Normal", "Default Paragraph Style" }, // RES_POOLCOLL_STANDARD
{ "Normal", "Standard" }, // RES_POOLCOLL_STANDARD
{ "heading 1", "Heading 1" }, // RES_POOLCOLL_HEADLINE1
{ "heading 2", "Heading 2" }, // RES_POOLCOLL_HEADLINE2
@@ -1656,8 +1654,8 @@ StyleSheetTable::ConvertStyleName(const OUString& rWWName)
{ "Footnote Reference", "Footnote Symbol" }, // RES_POOLCHR_FOOTNOTE; tdf#82173 tdf#162884
{ "Annotation Reference", "" },
{ "annotation reference", "" },
{ "Line Number", "Line Numbering" }, // RES_POOLCHR_LINENUM
{ "line number", "Line Numbering" }, // RES_POOLCHR_LINENUM
{ "Line Number", "Line numbering" }, // RES_POOLCHR_LINENUM
{ "line number", "Line numbering" }, // RES_POOLCHR_LINENUM
{ "Page Number", "Page Number" }, // RES_POOLCHR_PAGENO
{ "page number", "Page Number" }, // RES_POOLCHR_PAGENO
{ "PageNumber", "Page Number" }, // RES_POOLCHR_PAGENO
@@ -1690,13 +1688,11 @@ StyleSheetTable::ConvertStyleName(const OUString& rWWName)
{ "Signature", "Signature" }, // RES_POOLCOLL_SIGNATURE
{ "Default Paragraph Font", "" },
{ "DefaultParagraphFont", "" },
// FIXME: testTdf118947_tableStyle fails with correct mapping
// { "Body Text", "Body Text" }, // RES_POOLCOLL_TEXT
{ "Body Text", "Text body" }, // RES_POOLCOLL_TEXT
{ "BodyText", "Body Text" }, // RES_POOLCOLL_TEXT
{ "BodyText", "Text body" }, // RES_POOLCOLL_TEXT
{ "BodyTextIndentItalic", "" },
{ "Body Text Indent", "Body Text, Indented" }, // RES_POOLCOLL_TEXT_MOVE
{ "BodyTextIndent", "Body Text, Indented" }, // RES_POOLCOLL_TEXT_MOVE
{ "Body Text Indent", "Text body indent" }, // RES_POOLCOLL_TEXT_MOVE
{ "BodyTextIndent", "Text body indent" }, // RES_POOLCOLL_TEXT_MOVE
{ "BodyTextIndent2", "" },
{ "List Continue", "List 1 Cont." }, // RES_POOLCOLL_BULLET_NONUM1
{ "List Continue 2", "List 2 Cont." }, // RES_POOLCOLL_BULLET_NONUM2
@@ -1705,9 +1701,9 @@ StyleSheetTable::ConvertStyleName(const OUString& rWWName)
{ "List Continue 5", "List 5 Cont." }, // RES_POOLCOLL_BULLET_NONUM5
{ "Message Header", "" },
{ "Subtitle", "Subtitle" }, // RES_POOLCOLL_DOC_SUBTITLE
{ "Salutation", "Complimentary Close" }, // RES_POOLCOLL_GREETING
{ "Salutation", "Salutation" }, // RES_POOLCOLL_GREETING
{ "Date", "" },
{ "Body Text First Indent", "First Line Indent" }, // RES_POOLCOLL_TEXT_IDENT
{ "Body Text First Indent", "First line indent" }, // RES_POOLCOLL_TEXT_IDENT
{ "Body Text First Indent 2", "" },
{ "Note Heading", "" },
{ "Body Text 2", "" },
@@ -1715,7 +1711,7 @@ StyleSheetTable::ConvertStyleName(const OUString& rWWName)
{ "Body Text Indent 2", "" },
{ "Body Text Indent 3", "" },
{ "Block Text", "" },
{ "Hyperlink", "Internet Link" }, // RES_POOLCHR_INET_NORMAL
{ "Hyperlink", "Internet link" }, // RES_POOLCHR_INET_NORMAL
{ "FollowedHyperlink", "Visited Internet Link" }, // RES_POOLCHR_INET_VISIT
{ "Strong", "Strong Emphasis" }, // RES_POOLCHR_HTML_STRONG
{ "Emphasis", "Emphasis" }, // RES_POOLCHR_HTML_EMPHASIS