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 <jluth@mail.com>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
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 0000000..0ed5426
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf148956_directEndFormatting.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 22e1f21..fc608f5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -33,6 +33,7 @@
#include <unotxdoc.hxx>
#include <docsh.hxx>
#include <ndtxt.hxx>
#include <wrtsh.hxx>
class Test : public SwModelTestBase
@@ -72,6 +73,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 5c39c06..0000000
--- a/sw/qa/extras/uiwriter/data/tdf148956_directEndFormatting.docx
+++ /dev/null
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 9b40b34..1833b12 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -85,27 +85,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 4f2a362..cdef2ec 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1008,6 +1008,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 },
};