sw/source/uibase/uiview/formatclipboard.cxx |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 02624d2bff8b5ae67d5861f6a987aacdfd82dd41
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Sep 1 16:37:30 2022 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Sep 29 09:41:40 2022 +0200

    sw: fix format brush to override old format
    
    It should not only add attributes but replace old direct
    formatting with new one (character format).
    
    Change-Id: Ieac5c3d8c00b93ee08c74a36ea2ce4938915a2b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139216
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    (cherry picked from commit 2515ada695e9dbb92c3a228d0466d76b23a6185d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140380
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140708

diff --git a/sw/source/uibase/uiview/formatclipboard.cxx 
b/sw/source/uibase/uiview/formatclipboard.cxx
index c0c61252b496..cbfc69193a05 100644
--- a/sw/source/uibase/uiview/formatclipboard.cxx
+++ b/sw/source/uibase/uiview/formatclipboard.cxx
@@ -550,6 +550,12 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, 
SfxStyleSheetBasePool* pPo
                 // copy the stored automatic text attributes in a temporary 
SfxItemSet
                 pTemplateItemSet->Put( *m_pItemSet_TextAttr );
 
+                // reset all direct formatting
+                o3tl::sorted_vector<sal_uInt16> aAttrs;
+                for( sal_uInt16 nWhich = RES_CHRATR_BEGIN; nWhich < 
RES_CHRATR_END; nWhich++ )
+                    aAttrs.insert( nWhich );
+                rWrtShell.ResetAttr( { aAttrs } );
+
                 // only attributes that were not apply by named style 
attributes and automatic
                 // paragraph attributes should be applied
                 lcl_RemoveEqualItems( *pTemplateItemSet, aItemVector );
@@ -559,15 +565,6 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, 
SfxStyleSheetBasePool* pPo
                     rWrtShell.SetFlyFrameAttr(*pTemplateItemSet);
                 else if ( !bNoCharacterFormats )
                 {
-                    const SfxPoolItem* pItem;
-                    SfxItemSet aSet(rWrtShell.GetAttrPool(),
-                        { { RES_CHRATR_CROSSEDOUT, RES_CHRATR_CROSSEDOUT } });
-                    rWrtShell.GetCurAttr(aSet);
-                    if (!pTemplateItemSet->HasItem(RES_CHRATR_CROSSEDOUT, 
&pItem))
-                    {
-                        rWrtShell.ResetAttr({ RES_CHRATR_CROSSEDOUT });
-                    }
-
                     rWrtShell.SetAttrSet(*pTemplateItemSet);
                 }
             }

Reply via email to