sw/source/uibase/docvw/edtwin.cxx | 4 ++-- sw/source/uibase/uiview/formatclipboard.cxx | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-)
New commits: commit e9bb17369dc6fd3064fce55a1afacaacea4faae2 Author: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de> AuthorDate: Mon Jul 31 09:15:28 2023 +0300 Commit: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de> CommitDate: Tue Aug 29 11:06:27 2023 +0200 related tdf#103706: sw: correct format paintbrush attribute reset Reset all direct formatting before applying **any** attributes. For instance, before this patch paragraph font colors were lost on apply. Change-Id: I62d202713e60e7e3690c67d63989179c3d5dc900 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155106 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de> diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx index 74fd772f5cfa..e722c04e9046 100644 --- a/sw/source/uibase/uiview/formatclipboard.cxx +++ b/sw/source/uibase/uiview/formatclipboard.cxx @@ -450,6 +450,15 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPo ItemVector aItemVector; + if (m_pItemSet_TextAttr && !( nSelectionType & SelectionType::DrawObject)) + { + // reset all direct formatting before applying anything + o3tl::sorted_vector<sal_uInt16> aAttrs; + for (sal_uInt16 nWhich = RES_CHRATR_BEGIN; nWhich < RES_CHRATR_END; nWhich++) + aAttrs.insert(nWhich); + rWrtShell.ResetAttr({ aAttrs }); + } + if( nSelectionType & SelectionType::Text ) { // apply the named text and paragraph formatting @@ -535,12 +544,6 @@ 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 ); commit 36aa809fbd3c44da1ed266104f175e8c872d38b3 Author: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de> AuthorDate: Thu Jul 27 21:38:34 2023 +0300 Commit: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de> CommitDate: Tue Aug 29 11:06:14 2023 +0200 tdf#103706: sw: Revert "Format paintbrush default behaviour" This reverts commit 1574c76ec20d1da479ed7e9c85a6cefacc132dfe. Reason for revert: The default behavior should copy *all* formatting. Change-Id: If3ae81d412374433f2d95a04345c651a788de4f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155103 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de> diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index c5cbee04c77f..aa97df53e8ab 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -5102,7 +5102,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) SwWrtShell& rWrtShell = m_rView.GetWrtShell(); SfxStyleSheetBasePool* pPool=nullptr; bool bNoCharacterFormats = false; - bool bNoParagraphFormats = true; + bool bNoParagraphFormats = false; { SwDocShell* pDocSh = m_rView.GetDocShell(); if(pDocSh) @@ -5113,7 +5113,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) bNoParagraphFormats = false; } else if( rMEvt.GetModifier() & KEY_MOD1 ) - bNoParagraphFormats = false; + bNoParagraphFormats = true; } //execute paste pFormatClipboard->Paste( rWrtShell, pPool, bNoCharacterFormats, bNoParagraphFormats );