filter/source/msfilter/util.cxx                   |   51 +++++
 sw/qa/extras/ooxmlexport/data/special_styles.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx        |    4 
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx        |  191 ++++++++++++++++++++++
 sw/source/core/crsr/crsrsh.cxx                    |   16 +
 sw/source/filter/ww8/styles.cxx                   |   89 +++++-----
 sw/source/uibase/wrtsh/move.cxx                   |    9 -
 test/source/xmltesttools.cxx                      |   10 -
 8 files changed, 318 insertions(+), 52 deletions(-)

New commits:
commit 6f666713a823eec4d97087222813ba6262649263
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Mon Jun 10 14:41:13 2024 -0400
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Jun 13 22:36:29 2024 +0200

    lok: sw: fix PageDown position when cursor is not visible
    
    If PageDown key is pressed and the cursor is not visible,
    in the PageDown increment the new cursor position will not update,
    cause the Visible area is the full document.
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: I57b9ae1e80cb8aaaa78867ee215d7e80de990aff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168646
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168746
    Tested-by: Jenkins
    (cherry picked from commit c69b0d3b58523a1c981e973d1c9d3107257dd84c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168729
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index db1e6cfd7e47..a092c19a6e68 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -78,6 +78,7 @@
 #include <hints.hxx>
 #include <tools/json_writer.hxx>
 #include <redline.hxx>
+#include <boost/property_tree/ptree.hpp>
 
 using namespace com::sun::star;
 
@@ -1792,6 +1793,21 @@ void SwCursorShell::VisPortChgd( const SwRect & rRect )
     if( m_bSVCursorVis && bVis ) // show SV cursor again
         m_pVisibleCursor->Show();
 
+    if( comphelper::LibreOfficeKit::isActive() && !rRect.Overlaps( m_aCharRect 
))
+    {
+        boost::property_tree::ptree aParams;
+        tools::Rectangle aRect(rRect.TopLeft(), Size(1, 1));
+
+        aParams.put("rectangle", aRect.toString());
+        aParams.put("scroll", true);
+        aParams.put("hyperlink", "");
+
+        SfxLokHelper::notifyOtherView(GetSfxViewShell(),
+                                      GetSfxViewShell(),
+                                      LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR,
+                                      aParams);
+    }
+
     if( m_nCursorMove )
         m_bInCMvVisportChgd = true;
 
diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx
index 673a52091687..f68e08010f9a 100644
--- a/sw/source/uibase/wrtsh/move.cxx
+++ b/sw/source/uibase/wrtsh/move.cxx
@@ -27,6 +27,7 @@
 #include <drawdoc.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svdview.hxx>
+#include <comphelper/lok.hxx>
 
 /**
    Always:
@@ -454,7 +455,13 @@ bool SwWrtShell::PushCursor(SwTwips lOffset, bool bSelect)
     {
         Point aPt( aOldRect.Center() );
 
-        if( !IsCursorVisible() )
+        if (SfxViewShell* pKitView = comphelper::LibreOfficeKit::isActive() ? 
GetSfxViewShell() : nullptr)
+        {
+            SwRect aLOKVis(pKitView->getLOKVisibleArea());
+            if (!aLOKVis.Overlaps(aOldRect))
+                aPt.setY( aLOKVis.Top() + aLOKVis.Height() / 2 );
+        }
+        else if( !IsCursorVisible() )
             // set CursorPos to top-/bottom left pos. So the pagescroll is not
             // be dependent on the current cursor, but on the visarea.
             aPt.setY( aTmpArea.Top() + aTmpArea.Height() / 2 );
commit b3f503c5d88b2314fca9fc9124f918090c8c427b
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Jun 13 01:32:03 2024 +0500
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Jun 13 22:36:25 2024 +0200

    tdf#161509: Output the same special style names and identifiers as Word
    
    Take care to match the case of the names. Some tools rely on specific
    case; so standardize on what Word outputs.
    
    getXPath is modified to tell which XPath has failed (needed for the
    unit test).
    
    Change-Id: I3e71f5905b26d7e784d68ba11ff205eefedaaa2c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168755
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit e74c94c1a6ae47eb507eec610e231ebb6b02a8be)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168726
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index dfab43283600..2415f3ea4bcb 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -314,6 +314,57 @@ const ApiPaperSize& 
PaperSizeConv::getApiSizeForMSPaperSizeIndex( sal_Int32 nMSO
 
 OUString CreateDOCXStyleId(std::u16string_view const aName)
 {
+    // tdf#161509: some special style names have standard style IDs that don't 
match case
+    static constexpr std::pair<std::u16string_view, OUString> specialCases[] = 
{
+        { u"heading 1", u"Heading1"_ustr },
+        { u"heading 2", u"Heading2"_ustr },
+        { u"heading 3", u"Heading3"_ustr },
+        { u"heading 4", u"Heading4"_ustr },
+        { u"heading 5", u"Heading5"_ustr },
+        { u"heading 6", u"Heading6"_ustr },
+        { u"heading 7", u"Heading7"_ustr },
+        { u"heading 8", u"Heading8"_ustr },
+        { u"heading 9", u"Heading9"_ustr },
+        { u"index 1", u"Index1"_ustr },
+        { u"index 2", u"Index2"_ustr },
+        { u"index 3", u"Index3"_ustr },
+        { u"index 4", u"Index4"_ustr },
+        { u"index 5", u"Index5"_ustr },
+        { u"index 6", u"Index6"_ustr },
+        { u"index 7", u"Index7"_ustr },
+        { u"index 8", u"Index8"_ustr },
+        { u"index 9", u"Index9"_ustr },
+        { u"toc 1", u"TOC1"_ustr },
+        { u"toc 2", u"TOC2"_ustr },
+        { u"toc 3", u"TOC3"_ustr },
+        { u"toc 4", u"TOC4"_ustr },
+        { u"toc 5", u"TOC5"_ustr },
+        { u"toc 6", u"TOC6"_ustr },
+        { u"toc 7", u"TOC7"_ustr },
+        { u"toc 8", u"TOC8"_ustr },
+        { u"toc 9", u"TOC9"_ustr },
+        { u"footnote text", u"FootnoteText"_ustr },
+        { u"annotation text", u"CommentText"_ustr },
+        { u"header", u"Header"_ustr },
+        { u"footer", u"Footer"_ustr },
+        { u"index heading", u"IndexHeading"_ustr },
+        { u"caption", u"Caption"_ustr },
+        { u"table of figures", u"TableofFigures"_ustr },
+        { u"envelope address", u"EnvelopeAddress"_ustr },
+        { u"envelope return", u"EnvelopeReturn"_ustr },
+        { u"footnote reference", u"FootnoteReference"_ustr },
+        { u"annotation reference", u"CommentReference"_ustr },
+        { u"line number", u"LineNumber"_ustr },
+        { u"page number", u"PageNumber"_ustr },
+        { u"endnote reference", u"EndnoteReference"_ustr },
+        { u"endnote text", u"EndnoteText"_ustr },
+        { u"table of authorities", u"TableofAuthorities"_ustr },
+        { u"macro", u"MacroText"_ustr },
+    };
+    for (const auto& [stiName, id] : specialCases)
+        if (aName == stiName)
+            return id;
+
     OUStringBuffer aStyleIdBuf(aName.size());
     for (size_t i = 0; i < aName.size(); ++i)
     {
diff --git a/sw/qa/extras/ooxmlexport/data/special_styles.docx 
b/sw/qa/extras/ooxmlexport/data/special_styles.docx
new file mode 100644
index 000000000000..08ed5c029355
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/special_styles.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index df196a5496fc..58f833d85732 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -831,9 +831,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf153664)
     CPPUNIT_ASSERT(pXmlStyles);
     // Without the fix this was styleId='FigureIndex1' and name was "Figure 
Index 1"
     // This led to style settings being reset when ToF was updated in Word
-    // TOF's paragraph style should be exported as "Table of Figures" as 
that's the default Word style name
+    // TOF's paragraph style should be exported as "table of figures" as 
that's the default Word style name
     assertXPath(pXmlStyles, "/w:styles/w:style[12]"_ostr, "styleId"_ostr, 
u"TableofFigures"_ustr);
-    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TableofFigures']/w:name"_ostr, "val"_ostr, 
u"Table of Figures"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TableofFigures']/w:name"_ostr, "val"_ostr, 
u"table of figures"_ustr);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf124472_hyperlink, "tdf124472.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 18dfc8e758e1..a2636ef97e8a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -614,6 +614,197 @@ CPPUNIT_TEST_FIXTURE(Test, testEmptyObjectRange)
     loadAndSave("cloud.docx");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf161509)
+{
+    loadAndReload("special_styles.docx");
+    xmlDocUniquePtr pXmlStyles = parseExport(u"word/styles.xml"_ustr);
+    CPPUNIT_ASSERT(pXmlStyles);
+
+    // Check the mapping of standard style names to their IDs
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Normal']/w:name"_ostr, "val"_ostr,
+                u"Normal"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Heading1']/w:name"_ostr, "val"_ostr,
+                u"heading 1"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Heading2']/w:name"_ostr, "val"_ostr,
+                u"heading 2"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Heading3']/w:name"_ostr, "val"_ostr,
+                u"heading 3"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Heading4']/w:name"_ostr, "val"_ostr,
+                u"heading 4"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Heading5']/w:name"_ostr, "val"_ostr,
+                u"heading 5"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Heading6']/w:name"_ostr, "val"_ostr,
+                u"heading 6"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Heading7']/w:name"_ostr, "val"_ostr,
+                u"heading 7"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Heading8']/w:name"_ostr, "val"_ostr,
+                u"heading 8"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Heading9']/w:name"_ostr, "val"_ostr,
+                u"heading 9"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Index1']/w:name"_ostr, "val"_ostr,
+                u"index 1"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Index2']/w:name"_ostr, "val"_ostr,
+                u"index 2"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Index3']/w:name"_ostr, "val"_ostr,
+                u"index 3"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Index4']/w:name"_ostr, "val"_ostr,
+                u"index 4"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Index5']/w:name"_ostr, "val"_ostr,
+                u"index 5"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Index6']/w:name"_ostr, "val"_ostr,
+                u"index 6"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Index7']/w:name"_ostr, "val"_ostr,
+                u"index 7"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Index8']/w:name"_ostr, "val"_ostr,
+                u"index 8"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Index9']/w:name"_ostr, "val"_ostr,
+                u"index 9"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TOC1']/w:name"_ostr, "val"_ostr,
+                u"toc 1"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TOC2']/w:name"_ostr, "val"_ostr,
+                u"toc 2"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TOC3']/w:name"_ostr, "val"_ostr,
+                u"toc 3"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TOC4']/w:name"_ostr, "val"_ostr,
+                u"toc 4"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TOC5']/w:name"_ostr, "val"_ostr,
+                u"toc 5"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TOC6']/w:name"_ostr, "val"_ostr,
+                u"toc 6"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TOC7']/w:name"_ostr, "val"_ostr,
+                u"toc 7"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TOC8']/w:name"_ostr, "val"_ostr,
+                u"toc 8"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TOC9']/w:name"_ostr, "val"_ostr,
+                u"toc 9"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='NormalIndent']/w:name"_ostr, "val"_ostr,
+                u"Normal Indent"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='FootnoteText']/w:name"_ostr, "val"_ostr,
+                u"footnote text"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='CommentText']/w:name"_ostr, "val"_ostr,
+                u"annotation text"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Header']/w:name"_ostr, "val"_ostr,
+                u"header"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Footer']/w:name"_ostr, "val"_ostr,
+                u"footer"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='IndexHeading']/w:name"_ostr, "val"_ostr,
+                u"index heading"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Caption']/w:name"_ostr, "val"_ostr,
+                u"caption"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TableofFigures']/w:name"_ostr,
+                "val"_ostr, u"table of figures"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='EnvelopeAddress']/w:name"_ostr,
+                "val"_ostr, u"envelope address"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='EnvelopeReturn']/w:name"_ostr,
+                "val"_ostr, u"envelope return"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='FootnoteReference']/w:name"_ostr,
+                "val"_ostr, u"footnote reference"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='CommentReference']/w:name"_ostr,
+                "val"_ostr, u"annotation reference"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='LineNumber']/w:name"_ostr, "val"_ostr,
+                u"line number"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='PageNumber']/w:name"_ostr, "val"_ostr,
+                u"page number"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='EndnoteReference']/w:name"_ostr,
+                "val"_ostr, u"endnote reference"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='EndnoteText']/w:name"_ostr, "val"_ostr,
+                u"endnote text"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TableofAuthorities']/w:name"_ostr,
+                "val"_ostr, u"table of authorities"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='MacroText']/w:name"_ostr, "val"_ostr,
+                u"macro"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='TOCHeading']/w:name"_ostr, "val"_ostr,
+                u"TOC Heading"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='List']/w:name"_ostr, "val"_ostr,
+                u"List"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListBullet']/w:name"_ostr, "val"_ostr,
+                u"List Bullet"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListNumber']/w:name"_ostr, "val"_ostr,
+                u"List Number"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='List2']/w:name"_ostr, "val"_ostr,
+                u"List 2"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='List3']/w:name"_ostr, "val"_ostr,
+                u"List 3"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='List4']/w:name"_ostr, "val"_ostr,
+                u"List 4"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='List5']/w:name"_ostr, "val"_ostr,
+                u"List 5"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListBullet2']/w:name"_ostr, "val"_ostr,
+                u"List Bullet 2"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListBullet3']/w:name"_ostr, "val"_ostr,
+                u"List Bullet 3"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListBullet4']/w:name"_ostr, "val"_ostr,
+                u"List Bullet 4"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListBullet5']/w:name"_ostr, "val"_ostr,
+                u"List Bullet 5"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListNumber2']/w:name"_ostr, "val"_ostr,
+                u"List Number 2"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListNumber3']/w:name"_ostr, "val"_ostr,
+                u"List Number 3"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListNumber4']/w:name"_ostr, "val"_ostr,
+                u"List Number 4"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListNumber5']/w:name"_ostr, "val"_ostr,
+                u"List Number 5"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Title']/w:name"_ostr, "val"_ostr,
+                u"Title"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Closing']/w:name"_ostr, "val"_ostr,
+                u"Closing"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Signature']/w:name"_ostr, "val"_ostr,
+                u"Signature"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='DefaultParagraphFont']/w:name"_ostr,
+                "val"_ostr, u"Default Paragraph Font"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='BodyText']/w:name"_ostr, "val"_ostr,
+                u"Body Text"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='BodyTextIndent']/w:name"_ostr,
+                "val"_ostr, u"Body Text Indent"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListContinue']/w:name"_ostr, "val"_ostr,
+                u"List Continue"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListContinue2']/w:name"_ostr, "val"_ostr,
+                u"List Continue 2"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListContinue3']/w:name"_ostr, "val"_ostr,
+                u"List Continue 3"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListContinue4']/w:name"_ostr, "val"_ostr,
+                u"List Continue 4"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='ListContinue5']/w:name"_ostr, "val"_ostr,
+                u"List Continue 5"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='MessageHeader']/w:name"_ostr, "val"_ostr,
+                u"Message Header"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Subtitle']/w:name"_ostr, "val"_ostr,
+                u"Subtitle"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Salutation']/w:name"_ostr, "val"_ostr,
+                u"Salutation"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Date']/w:name"_ostr, "val"_ostr,
+                u"Date"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='BodyTextFirstIndent']/w:name"_ostr,
+                "val"_ostr, u"Body Text First Indent"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='BodyTextFirstIndent2']/w:name"_ostr,
+                "val"_ostr, u"Body Text First Indent 2"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='NoteHeading']/w:name"_ostr, "val"_ostr,
+                u"Note Heading"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='BodyText2']/w:name"_ostr, "val"_ostr,
+                u"Body Text 2"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='BodyText3']/w:name"_ostr, "val"_ostr,
+                u"Body Text 3"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='BodyTextIndent2']/w:name"_ostr,
+                "val"_ostr, u"Body Text Indent 2"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='BodyTextIndent3']/w:name"_ostr,
+                "val"_ostr, u"Body Text Indent 3"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='BlockText']/w:name"_ostr, "val"_ostr,
+                u"Block Text"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Hyperlink']/w:name"_ostr, "val"_ostr,
+                u"Hyperlink"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='FollowedHyperlink']/w:name"_ostr,
+                "val"_ostr, u"FollowedHyperlink"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Strong']/w:name"_ostr, "val"_ostr,
+                u"Strong"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Emphasis']/w:name"_ostr, "val"_ostr,
+                u"Emphasis"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='DocumentMap']/w:name"_ostr, "val"_ostr,
+                u"Document Map"_ustr);
+    assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='PlainText']/w:name"_ostr, "val"_ostr,
+                u"Plain Text"_ustr);
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/ww8/styles.cxx b/sw/source/filter/ww8/styles.cxx
index 33d0ad3dec5f..dc8f7e33d321 100644
--- a/sw/source/filter/ww8/styles.cxx
+++ b/sw/source/filter/ww8/styles.cxx
@@ -27,54 +27,55 @@ namespace
     const char **GetStiNames() noexcept
     {
         // Matches enum ww::sti in sw/source/filter/inc/wwstyles.hxx
+        // tdf#161509: The case of the names must match Word-generated 
document's w:latentStyles
         static const char *stiName[] =
         {
             "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
+            "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
+            "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",                    // stiMacro
             "TOC Heading",              // stiToaHeading - tdf143726
             "List",                     // stiList
             "List Bullet",              // stiListBullet
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 06678b1f33f1..a86e39e4b778 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -90,16 +90,16 @@ OUString XmlTestTools::getXPath(const xmlDocUniquePtr& 
pXmlDoc, const OString& r
 {
     CPPUNIT_ASSERT(pXmlDoc);
     xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath);
-    CPPUNIT_ASSERT(pXmlObj);
+    OString docAndXPath = OString::Concat("In <") + pXmlDoc->name + ">, XPath 
'" + rXPath;
+    CPPUNIT_ASSERT_MESSAGE(docAndXPath.getStr(), pXmlObj);
     xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
-    CPPUNIT_ASSERT(pXmlNodes);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + 
pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is 
incorrect").getStr(),
+    CPPUNIT_ASSERT_MESSAGE(OString(docAndXPath + "' not found").getStr(), 
pXmlNodes);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(docAndXPath + "' number of nodes is 
incorrect").getStr(),
                                  1, xmlXPathNodeSetGetLength(pXmlNodes));
     CPPUNIT_ASSERT(!rAttribute.isEmpty());
     xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
     xmlChar * prop = xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()));
-    OString sAttAbsent = OString::Concat("In <") + pXmlDoc->name + ">, XPath 
'" + rXPath
-                         + "' no attribute '" + rAttribute + "' exist";
+    OString sAttAbsent = docAndXPath + "' no attribute '" + rAttribute + "' 
exist";
     CPPUNIT_ASSERT_MESSAGE(sAttAbsent.getStr(), prop);
     OUString s(convert(prop));
     xmlFree(prop);

Reply via email to