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 0f4a3823a6bab01723f2a958d44159d39d137b97
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Wed May 3 08:55:46 2023 -0400
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu May 4 10:34:37 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>

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 22e1f21f5707..fc608f5cc6f2 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 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 9b40b3420c9e..1833b1220dbd 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 4f2a3629101f..cdef2ec7d2bb 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 },
             };

Reply via email to