diff options
author | luigiiucci <luigi.iucci@collabora.com> | 2023-06-15 23:31:26 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-07-10 08:18:51 +0200 |
commit | c1cfe85f8bba10d367ef9ef1d6d569f53969dd34 (patch) | |
tree | c01b5658a980fe3947e6c67c293513edc729a6d7 /sw | |
parent | 81726f5af5fda25f0d92ffc8458d7f24eb16f408 (diff) |
tdf#62032 use style list level when changing style
If a style S1 has a list level L1, and we
change the style to S1 in a text node that
has list level L2, the new text node
list level must be L1
Change-Id: Ic25b222202cb2da3153fc5c3723998c9f7f01247
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153161
Reviewed-by: Ashod Nakashian <ash@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt | bin | 0 -> 10951 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter8.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 5 |
3 files changed, 26 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt b/sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt Binary files differnew file mode 100644 index 000000000000..86cda167ee8a --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf62032_apply_style.odt diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 28eaf3e9f1b0..48b17ef211ea 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -2653,6 +2653,27 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf73483) assertXPath(pXml, para_style_path, "master-page-name", "Right_20_Page"); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf62032ApplyStyle) +{ + createSwDoc("tdf62032_apply_style.odt"); + SwDoc* pDoc = getSwDoc(); + SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + + pWrtSh->Down(/*bSelect=*/false); + + uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence({ + { "Style", uno::Any(OUString("A 2")) }, + { "FamilyName", uno::Any(OUString("ParagraphStyles")) }, + }); + dispatchCommand(mxComponent, ".uno:StyleApply", aPropertyValues); + + // Without the fix in place, it fails with: + // - Expected: 1.1 + // - Actual : 2 + CPPUNIT_ASSERT_EQUAL(OUString("1.1"), + getProperty<OUString>(getParagraph(2), "ListLabelString").trim()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 655925f434ae..3f52628fed21 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1072,6 +1072,11 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* pArgs ) pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED ); pCNd->ResetAttr( RES_PARATR_LIST_ID ); } + else + { + // forcing reset of list level from parapgaph + pCNd->SetAttr(pFormat->GetFormatAttr(RES_PARATR_LIST_LEVEL)); + } } } |