summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-09-01 16:37:30 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2022-09-29 09:41:40 +0200
commit02624d2bff8b5ae67d5861f6a987aacdfd82dd41 (patch)
treefada59640734919098bba2513593b25aa5dfeb09
parent7f0261e1d14df2e0a44e527134c8506750ee7b5d (diff)
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.klos@collabora.com> (cherry picked from commit 2515ada695e9dbb92c3a228d0466d76b23a6185d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140380 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140708
-rw-r--r--sw/source/uibase/uiview/formatclipboard.cxx15
1 files changed, 6 insertions, 9 deletions
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);
}
}