sw/source/uibase/uiview/formatclipboard.cxx |   31 ++++++++++++++++++----------
 1 file changed, 20 insertions(+), 11 deletions(-)

New commits:
commit a5e2f4a8419a09d3a7d4118328824a5ea7ed2d6b
Author:     Oliver Specht <oliver.spe...@cib.de>
AuthorDate: Tue Jan 23 16:51:14 2024 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Mon Jan 29 12:05:04 2024 +0100

    tdf#159342 switch off lists in clone formatting
    
    When paragraph attributes are cloned
    then lists are not only switched on but also switched off
    depending on the list state at the source paragraph
    
    Change-Id: I4299f4d75d61dd0def0fe6212f58bcce68f13dbf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162470
    Tested-by: Jenkins
    Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/source/uibase/uiview/formatclipboard.cxx 
b/sw/source/uibase/uiview/formatclipboard.cxx
index e722c04e9046..9dfcb06ba030 100644
--- a/sw/source/uibase/uiview/formatclipboard.cxx
+++ b/sw/source/uibase/uiview/formatclipboard.cxx
@@ -483,19 +483,28 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, 
SfxStyleSheetBasePool* pPo
                 }
             }
 
-            // if there is a named paragraph format recorded and the user 
wants to apply it
-            if(!m_aParaStyle.isEmpty() && !bNoParagraphFormats )
+            if (!bNoParagraphFormats)
             {
-                // look for the named paragraph format in the pool
-                SwDocStyleSheet* pStyle = 
static_cast<SwDocStyleSheet*>(pPool->Find(m_aParaStyle, SfxStyleFamily::Para));
-                if( pStyle )
+                const SwNumRule* pNumRule
+                    = rWrtShell.GetNumRuleAtCurrCursorPos();
+                if (pNumRule && !pNumRule->IsOutlineRule())
                 {
-                    // store the attributes from this style in aItemVector in 
order
-                    // not to apply them as automatic formatting attributes 
later in the code
-                    lcl_AppendSetItems( aItemVector, 
pStyle->GetCollection()->GetAttrSet());
-
-                    // apply the named format
-                    rWrtShell.SetTextFormatColl( pStyle->GetCollection() );
+                    rWrtShell.NumOrBulletOff();
+                }
+                // if there is a named paragraph format recorded and the user 
wants to apply it
+                if(!m_aParaStyle.isEmpty())
+                {
+                    // look for the named paragraph format in the pool
+                    SwDocStyleSheet* pStyle = 
static_cast<SwDocStyleSheet*>(pPool->Find(m_aParaStyle, SfxStyleFamily::Para));
+                    if( pStyle )
+                    {
+                        // store the attributes from this style in aItemVector 
in order
+                        // not to apply them as automatic formatting 
attributes later in the code
+                        lcl_AppendSetItems( aItemVector, 
pStyle->GetCollection()->GetAttrSet());
+
+                        // apply the named format
+                        rWrtShell.SetTextFormatColl( pStyle->GetCollection() );
+                    }
                 }
             }
         }

Reply via email to