sw/source/uibase/uiview/formatclipboard.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
New commits: commit d818fbc65db108ee74d695b4a6cd1bce190a0cfe 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 22 16:06:19 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> diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx index 881a3f0109b5..c9c2a01b995c 100644 --- a/sw/source/uibase/uiview/formatclipboard.cxx +++ b/sw/source/uibase/uiview/formatclipboard.cxx @@ -542,6 +542,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 ); @@ -551,14 +557,6 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPo rWrtShell.SetFlyFrameAttr(*pTemplateItemSet); else if ( !bNoCharacterFormats ) { - const SfxPoolItem* pItem; - SfxItemSetFixed<RES_CHRATR_CROSSEDOUT, RES_CHRATR_CROSSEDOUT> aSet(rWrtShell.GetAttrPool()); - rWrtShell.GetCurAttr(aSet); - if (!pTemplateItemSet->HasItem(RES_CHRATR_CROSSEDOUT, &pItem)) - { - rWrtShell.ResetAttr({ RES_CHRATR_CROSSEDOUT }); - } - rWrtShell.SetAttrSet(*pTemplateItemSet); } }