diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-12-08 19:13:43 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-01-12 04:34:14 +0000 |
commit | 4ac0a27c7cb0e8d09e701aaf150414d136e58310 (patch) | |
tree | d4d74ef5dfbbdfe62f891781aad755b5f9352480 | |
parent | 92deea6301a02f5530f17263f58402344f82013c (diff) |
tdf#152425 Fix order in stiName array
Since their introduction in commit 552d05f57175ecdd0736dc257319bc30aa88d696
(INTEGRATION: CWS portlaoisefilterteam16 (1.1.2); FILE ADDED, 2003-12-09)
and commit 9ba054a180fe1fcd410a2887351c2ff1fcb30847 (INTEGRATION: CWS
portlaoisefilterteam16 (1.1.2); FILE ADDED, 2003-12-09), the enum sti
and GetStiNames were accidentally not matching each other.
commit 78284714b73a8307174c596295894e8f3951e09a (tdf#76817: fix missing
heading styles assigned to outline levels in ooxml, 2016-02-04) introduced
a use of ww::GetEnglishNameFromSti, and since then, the unmatched elements
started to get written to DOCX styles with wrong names, like
<w:style w:type="paragraph" w:styleId="List5">
<w:name w:val="List Number"/>
instead of original name "List 5".
Change-Id: I8888b3f117e0b7f57c2dbb90565475d529416c60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143828
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf152425.docx | bin | 0 -> 16904 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 14 | ||||
-rw-r--r-- | sw/source/filter/inc/wwstyles.hxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/styles.cxx | 185 |
4 files changed, 108 insertions, 92 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf152425.docx b/sw/qa/extras/ooxmlexport/data/tdf152425.docx Binary files differnew file mode 100644 index 000000000000..53a65cc63438 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf152425.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index a145a3054a4e..c9d7528f6297 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -258,6 +258,20 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126477) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeq2.getLength()); } +CPPUNIT_TEST_FIXTURE(Test, testTdf152425) +{ + loadAndReload("tdf152425.docx"); + + // Check that "List Number" and "List 5" styles don't get merged + const OUString Para3Style = getProperty<OUString>(getParagraph(3), "ParaStyleName"); + CPPUNIT_ASSERT_EQUAL(OUString("List Number"), Para3Style); + const OUString Para4Style = getProperty<OUString>(getParagraph(4), "ParaStyleName"); + // Eventually, we need to check this: + // CPPUNIT_ASSERT_EQUAL(OUString("List 5"), Para4Style); + // But for now, just make sure that the style names differ + CPPUNIT_ASSERT(Para4Style != Para3Style); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/inc/wwstyles.hxx b/sw/source/filter/inc/wwstyles.hxx index 32dce11e3692..7a253d87c508 100644 --- a/sw/source/filter/inc/wwstyles.hxx +++ b/sw/source/filter/inc/wwstyles.hxx @@ -24,6 +24,7 @@ namespace ww { + // When changing, make sure to update GetStiNames in sw/source/filter/ww8/styles.cxx accordingly enum sti : sal_uInt16 { stiNormal = 0, // 0x0000 diff --git a/sw/source/filter/ww8/styles.cxx b/sw/source/filter/ww8/styles.cxx index 86ec89a37798..c7a28e77e60b 100644 --- a/sw/source/filter/ww8/styles.cxx +++ b/sw/source/filter/ww8/styles.cxx @@ -25,102 +25,103 @@ namespace { const char **GetStiNames() noexcept { + // Matches enum ww::sti in sw/source/filter/inc/wwstyles.hxx static const char *stiName[] = { - "Normal", - "Heading 1", - "Heading 2", - "Heading 3", - "Heading 4", - "Heading 5", - "Heading 6", - "Heading 7", - "Heading 8", - "Heading 9", - "Index 1", - "Index 2", - "Index 3", - "Index 4", - "Index 5", - "Index 6", - "Index 7", - "Index 8", - "Index 9", - "TOC 1", - "TOC 2", - "TOC 3", - "TOC 4", - "TOC 5", - "TOC 6", - "TOC 7", - "TOC 8", - "TOC 9", - "Normal Indent", - "Footnote Text", - "Annotation Text", - "Header", - "Footer", - "Index Heading", - "Caption", - "Table of Figures", - "Envelope Address", - "Envelope Return", - "Footnote Reference", - "Annotation Reference", - "Line Number", - "Page Number", - "Endnote Reference", - "Endnote Text", - "Table of Authorities", - "Macro Text", - "TOC Heading", - "List", - "List 2", - "List 3", - "List 4", - "List 5", - "List Bullet", - "List Bullet 2", - "List Bullet 3", - "List Bullet 4", - "List Bullet 5", - "List Number", - "List Number 2", - "List Number 3", - "List Number 4", - "List Number 5", - "Title", - "Closing", - "Signature", - "Default Paragraph Font", - "Body Text", - "Body Text Indent", - "List Continue", - "List Continue 2", - "List Continue 3", - "List Continue 4", - "List Continue 5", - "Message Header", - "Subtitle", - "Salutation", - "Date", - "Body Text First Indent", - "Body Text First Indent 2", - "Note Heading", - "Body Text 2", - "Body Text 3", - "Body Text Indent 2", - "Body Text Indent 3", - "Block Text", - "Hyperlink", - "FollowedHyperlink", - "Strong", - "Emphasis", - "Document Map", - "Plain Text" + "Normal", // stiNormal + "Heading 1", // stiLev1 + "Heading 2", // stiLev2 + "Heading 3", // stiLev3 + "Heading 4", // stiLev4 + "Heading 5", // stiLev5 + "Heading 6", // stiLev6 + "Heading 7", // stiLev7 + "Heading 8", // stiLev8 + "Heading 9", // stiLev9 + "Index 1", // stiIndex1 + "Index 2", // stiIndex2 + "Index 3", // stiIndex3 + "Index 4", // stiIndex4 + "Index 5", // stiIndex5 + "Index 6", // stiIndex6 + "Index 7", // stiIndex7 + "Index 8", // stiIndex8 + "Index 9", // stiIndex9 + "TOC 1", // stiToc1 + "TOC 2", // stiToc2 + "TOC 3", // stiToc3 + "TOC 4", // stiToc4 + "TOC 5", // stiToc5 + "TOC 6", // stiToc6 + "TOC 7", // stiToc7 + "TOC 8", // stiToc8 + "TOC 9", // stiToc9 + "Normal Indent", // stiNormIndent + "Footnote Text", // stiFootnoteText + "Annotation Text", // stiAtnText + "Header", // stiHeader + "Footer", // stiFooter + "Index Heading", // stiIndexHeading + "Caption", // stiCaption + "Table of Figures", // stiToCaption + "Envelope Address", // stiEnvAddr + "Envelope Return", // stiEnvRet + "Footnote Reference", // stiFootnoteRef + "Annotation Reference", // stiAtnRef + "Line Number", // stiLnn + "Page Number", // stiPgn + "Endnote Reference", // stiEdnRef + "Endnote Text", // stiEdnText + "Table of Authorities", // stiToa + "Macro Text", // stiMacro + "TOC Heading", // stiToaHeading - tdf143726 + "List", // stiList + "List Bullet", // stiListBullet + "List Number", // stiListNumber + "List 2", // stiList2 + "List 3", // stiList3 + "List 4", // stiList4 + "List 5", // stiList5 + "List Bullet 2", // stiListBullet2 + "List Bullet 3", // stiListBullet3 + "List Bullet 4", // stiListBullet4 + "List Bullet 5", // stiListBullet5 + "List Number 2", // stiListNumber2 + "List Number 3", // stiListNumber3 + "List Number 4", // stiListNumber4 + "List Number 5", // stiListNumber5 + "Title", // stiTitle + "Closing", // stiClosing + "Signature", // stiSignature + "Default Paragraph Font", // stiNormalChar + "Body Text", // stiBodyText + "Body Text Indent", // stiBodyTextInd1 + "List Continue", // stiListCont + "List Continue 2", // stiListCont2 + "List Continue 3", // stiListCont3 + "List Continue 4", // stiListCont4 + "List Continue 5", // stiListCont5 + "Message Header", // stiMsgHeader + "Subtitle", // stiSubtitle + "Salutation", // stiSalutation + "Date", // stiDate + "Body Text First Indent", // stiBodyText1I + "Body Text First Indent 2", // stiBodyText1I2 + "Note Heading", // stiNoteHeading + "Body Text 2", // stiBodyText2 + "Body Text 3", // stiBodyText3 + "Body Text Indent 2", // stiBodyTextInd2 + "Body Text Indent 3", // stiBodyTextInd3 + "Block Text", // stiBlockQuote + "Hyperlink", // stiHyperlink + "FollowedHyperlink", // stiHyperlinkFollowed + "Strong", // stiStrong + "Emphasis", // stiEmphasis + "Document Map", // stiNavPane + "Plain Text", // stiPlainText }; - OSL_ENSURE( SAL_N_ELEMENTS(stiName) == ww::stiMax, "WrongSizeOfArray" ); + static_assert(SAL_N_ELEMENTS(stiName) == ww::stiMax, "WrongSizeOfArray"); return stiName; } |