sw/source/core/doc/DocumentContentOperationsManager.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 6d30ef2d9418ff6d2bd89c20a61c757bc3abb9b2
Author:     Matt K <matt...@gmail.com>
AuthorDate: Thu Jul 6 17:11:48 2023 -0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Jul 7 11:00:22 2023 +0200

    tdf#69183 Pasting a table in Writer no longer inherits list formatting
    
    The entry point of the paste is in SwFEShell::Paste as stated in
    the bug comments.  This code calls
    "rClpDoc.getIDocumentContentOperations().CopyRange" which calls
    "DocumentContentOperationsManager::CopyImplImpl".  In that
    function, there is a check for whether to propagate the
    formatting of a previous list in the document.  All we do is
    add a check there to see if additionally it is a table we
    are pasting, and if so to ignore propagating the list format.
    
    Change-Id: I655f54c4df44385fc82976b37d3e21b5fabf45ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154149
    Tested-by: Mike Kaganski <mike.kagan...@collabora.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 1387ebfe65a9..0b51fc65e46e 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4968,10 +4968,13 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
     // Do not propagate previous found list, if
     // - destination is an empty paragraph which is not in a list and
     // - source contains at least one paragraph which is not in a list
+    // or
+    // - source is a table
     if ( pNumRuleToPropagate &&
-         pDestTextNd && !pDestTextNd->GetText().getLength() &&
+         ((pDestTextNd && !pDestTextNd->GetText().getLength() &&
          !pDestTextNd->IsInList() &&
-         !lcl_ContainsOnlyParagraphsInList( rPam ) )
+         !lcl_ContainsOnlyParagraphsInList(rPam)) ||
+         rPam.GetBound().nNode.GetNode().GetNodeType() == SwNodeType::Table) )
     {
         pNumRuleToPropagate = nullptr;
     }

Reply via email to