sw/qa/extras/uiwriter/data/tdf162326_list.odt |binary
 sw/qa/extras/uiwriter/uiwriter9.cxx           |   28 +++++++++++++++++++++++++-
 sw/source/core/doc/docfmt.cxx                 |    2 -
 3 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 29a95e4b9051ee35b063b88ac4d80d81f78eca85
Author:     Oliver Specht <oliver.spe...@cib.de>
AuthorDate: Mon Nov 25 14:59:59 2024 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Mon Nov 25 23:16:05 2024 +0100

    tdf#163870 remove list attribute on style apply
    
    Follow-up to 075560420a7aa238182e2d80dfe1c5fbaad3edbd
    Removes hard list attribute also if the applied paragraph
    style is applied again.
    
    Change-Id: Ic08241b5e244690825dfe79c419298c5d5f7c17e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177270
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>

diff --git a/sw/qa/extras/uiwriter/data/tdf162326_list.odt 
b/sw/qa/extras/uiwriter/data/tdf162326_list.odt
new file mode 100755
index 000000000000..324ac884337c
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf162326_list.odt 
differ
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 2de82268ae84..66ef51e47102 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -744,7 +744,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf144752)
     CPPUNIT_ASSERT_EQUAL(u"Word"_ustr, pWrtShell->GetSelText());
 }
 
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Pargraph)
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Paragraph)
 {
     createSwDoc("tdf162326.odt");
     SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
@@ -800,6 +800,32 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, 
testTdf162326_Character)
     CPPUNIT_ASSERT_EQUAL(short(1),
                          getProperty<short>(getRun(getParagraph(3), 2), 
u"CharUnderline"_ustr));
 }
+
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_List)
+{
+    createSwDoc("tdf162326_list.odt");
+    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<text::XParagraphCursor> 
xParaCursor(xTextDocument->getText()->createTextCursor(),
+                                                       uno::UNO_QUERY);
+
+    CPPUNIT_ASSERT_EQUAL(u"A)"_ustr, getProperty<OUString>(xParaCursor, 
u"ListLabelString"_ustr));
+
+    dispatchCommand(mxComponent, u".uno:StyleApply"_ustr,
+                    { comphelper::makePropertyValue(u"FamilyName"_ustr, 
u"ParagraphStyles"_ustr),
+                      comphelper::makePropertyValue(u"Style"_ustr, 
u"Footnote"_ustr) });
+
+    //hard list attribute unchanged
+    CPPUNIT_ASSERT_EQUAL(u"A)"_ustr, getProperty<OUString>(xParaCursor, 
u"ListLabelString"_ustr));
+
+    dispatchCommand(mxComponent, u".uno:StyleApply"_ustr,
+                    { comphelper::makePropertyValue(u"FamilyName"_ustr, 
u"ParagraphStyles"_ustr),
+                      comphelper::makePropertyValue(u"Style"_ustr, 
u"Footnote"_ustr),
+                      comphelper::makePropertyValue(u"KeyModifier"_ustr, 
uno::Any(KEY_MOD1)) });
+
+    //list replaced by para style list setting
+    CPPUNIT_ASSERT_EQUAL(u"1."_ustr, getProperty<OUString>(xParaCursor, 
u"ListLabelString"_ustr));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf163340)
 {
     createSwDoc("tdf163340.odt");
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 6b755eafc1af..fe20483d963e 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1018,7 +1018,7 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* 
pArgs )
 
         // #i62675# check, if paragraph style has changed
         if ( pPara->bResetListAttrs &&
-             pFormat != pCNd->GetFormatColl()
+             (pPara->bResetAllCharAttrs || pFormat != pCNd->GetFormatColl())
             && pCNd->GetTextNode()->IsInList() )
         {
             // Check, if the list style of the paragraph will change.

Reply via email to