dev/null |binary sw/qa/extras/ooxmlexport/data/tdf148956_directEndFormatting.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 31 ++++++++++ sw/qa/extras/uiwriter/uiwriter2.cxx | 21 ------ sw/source/uibase/shells/textsh1.cxx | 1 5 files changed, 32 insertions(+), 21 deletions(-)
New commits: commit 451b3f436f8babc26fea52a9742fde4549318ab4 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Wed May 3 08:55:46 2023 -0400 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri May 5 10:56:08 2023 +0200 tdf#148956 sw: clear RES_TXTATR_LIST_AUTOFMT in FN_FORMAT_RESET This is a relatively new "character style" that comes form importing MS formats. Character properties that apply to the whole paragraph as direct formatting are stored in here. So when direct formatting is cleared, this property should also be reset. make CppunitTest_sw_ooxmlexport18 \ CPPUNIT_TEST_NAME=testTdf148956_directEndFormatting Change-Id: Ic843da464c69050e989ae9be53ae58dde9c80948 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151329 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151391 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/data/tdf148956_directEndFormatting.docx b/sw/qa/extras/ooxmlexport/data/tdf148956_directEndFormatting.docx new file mode 100644 index 000000000000..0ed542643e9b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf148956_directEndFormatting.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 4740e195a8b7..a62c144938e1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -32,6 +32,7 @@ #include <unotxdoc.hxx> #include <docsh.hxx> +#include <ndtxt.hxx> #include <wrtsh.hxx> class Test : public SwModelTestBase @@ -71,6 +72,36 @@ CPPUNIT_TEST_FIXTURE(Test, testCellSdtRedline) loadAndSave("cell-sdt-redline.docx"); } +DECLARE_OOXMLEXPORT_TEST(testTdf148956_directEndFormatting, "tdf148956_directEndFormatting.docx") +{ + SwDoc* pDoc = getSwDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + + // pWrtShell->EndPara(/*bSelect=*/true); + dispatchCommand(mxComponent, ".uno:GotoEndOfPara", {}); + if (!isExported()) + { + CPPUNIT_ASSERT_MESSAGE( + "Has direct formatting", + pWrtShell->GetCursor()->GetPoint()->GetNode().GetTextNode()->GetpSwpHints()); + } + else + { + CPPUNIT_ASSERT_MESSAGE( + "Direct formatting cleared", + !pWrtShell->GetCursor()->GetPoint()->GetNode().GetTextNode()->GetpSwpHints()); + } + + pWrtShell->SttPara(/*bSelect=*/true); + dispatchCommand(mxComponent, ".uno:ResetAttributes", {}); + + dispatchCommand(mxComponent, ".uno:GotoEndOfPara", {}); + + CPPUNIT_ASSERT_MESSAGE( + "Direct formatting cleared", + !pWrtShell->GetCursor()->GetPoint()->GetNode().GetTextNode()->GetpSwpHints()); +} + DECLARE_OOXMLEXPORT_TEST(testTdf147646, "tdf147646_mergedCellNumbering.docx") { parseLayoutDump(); diff --git a/sw/qa/extras/uiwriter/data/tdf148956_directEndFormatting.docx b/sw/qa/extras/uiwriter/data/tdf148956_directEndFormatting.docx deleted file mode 100644 index 5c39c067231e..000000000000 Binary files a/sw/qa/extras/uiwriter/data/tdf148956_directEndFormatting.docx and /dev/null differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 9d8e7e082338..151a910a0bb0 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -100,27 +100,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground) getProperty<OUString>(getParagraph(3), "ParaStyleName")); } -CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf148956_directEndFormatting) -{ - createSwDoc("tdf148956_directEndFormatting.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - - pWrtShell->EndPara(/*bSelect=*/true); - CPPUNIT_ASSERT_MESSAGE( - "Has direct formatting", - pWrtShell->GetCursor()->GetMark()->GetNode().GetTextNode()->GetpSwpHints()); - - dispatchCommand(mxComponent, ".uno:ResetAttributes", {}); - - dispatchCommand(mxComponent, ".uno:GotoStartOfPara", {}); - dispatchCommand(mxComponent, ".uno:GotoEndOfPara", {}); - - CPPUNIT_ASSERT_MESSAGE( - "Direct formatting cleared", - !pWrtShell->GetCursor()->GetMark()->GetNode().GetTextNode()->GetpSwpHints()); -} - CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat) { createSwDoc("tdf117923.docx"); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index cd7349860658..2d7ba1e40ce4 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1004,6 +1004,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { RES_CHRATR_CJK_LANGUAGE + 1, RES_CHRATR_CTL_LANGUAGE - 1 }, { RES_CHRATR_CTL_LANGUAGE + 1, RES_CHRATR_END - 1 }, { RES_PARATR_BEGIN, RES_PARATR_END - 1 }, + { RES_PARATR_LIST_AUTOFMT, RES_PARATR_LIST_AUTOFMT }, { RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER }, { RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END - 1 }, };