svx/source/svdraw/svdedxv.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
New commits: commit 178d8a38e133aebd4cff1af2d2c49aec60468c92 Author: Oliver Specht <oliver.spe...@cib.de> AuthorDate: Mon Feb 19 09:52:46 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Tue Feb 20 16:49:37 2024 +0100 Make Clone Formatting in Impress similar to PP In Powerpoint paragraph attributes are only applied from and to fully/multiple selected paragraphs. Change-Id: I7c1f3afb6c0d6fd9b3f8acf34cb5f5b3dcaf22d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163583 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index dbcc73a63cf1..f3f5d4818f20 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2780,7 +2780,7 @@ bool SdrObjEditView::SupportsFormatPaintbrush(SdrInventor nObjectInventor, } } -static const WhichRangesContainer& GetFormatRangeImpl(bool bTextOnly) +static const WhichRangesContainer& GetFormatRangeImpl(bool bTextOnly, bool withParagraphAttr = true) { static const WhichRangesContainer gFull( svl::Items<XATTR_LINE_FIRST, XATTR_LINE_LAST, XATTR_FILL_FIRST, XATTRSET_FILL, @@ -2791,10 +2791,13 @@ static const WhichRangesContainer& GetFormatRangeImpl(bool bTextOnly) SDRATTR_SOFTEDGE_LAST, EE_PARA_START, EE_PARA_END, EE_CHAR_START, EE_CHAR_END>); static const WhichRangesContainer gTextOnly( + svl::Items<SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, EE_CHAR_START, EE_CHAR_END>); + + static const WhichRangesContainer gParaTextOnly( svl::Items<SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, EE_PARA_START, EE_PARA_END, EE_CHAR_START, EE_CHAR_END>); - return bTextOnly ? gTextOnly : gFull; + return bTextOnly ? withParagraphAttr ? gParaTextOnly : gTextOnly : gFull; } sal_Int32 SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr<SfxItemSet>& rFormatSet) @@ -2806,12 +2809,14 @@ sal_Int32 SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr<SfxItemSet>& rFor OutlinerView* pOLV = GetTextEditOutlinerView(); + bool isParaSelection = pOLV ? pOLV->GetEditView().IsSelectionFullPara() : false; rFormatSet = std::make_shared<SfxItemSet>(GetModel().GetItemPool(), - GetFormatRangeImpl(pOLV != nullptr)); + GetFormatRangeImpl(pOLV != nullptr, isParaSelection)); if (pOLV) { rFormatSet->Put(pOLV->GetAttribs()); - nDepth = pOLV->GetDepth(); + if (isParaSelection) + nDepth = pOLV->GetDepth(); } else { @@ -2979,10 +2984,11 @@ void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, sal_Int16 nDe const EditEngine& rEditEngine = pOutliner->GetEditEngine(); ESelection aSel(pOLV->GetSelection()); + bool fullParaSelection + = aSel.nEndPara != aSel.nStartPara || pOLV->GetEditView().IsSelectionFullPara(); if (!aSel.HasRange()) pOLV->SetSelection(rEditEngine.GetWord(aSel, css::i18n::WordType::DICTIONARY_WORD)); - - const bool bRemoveParaAttribs = !bNoParagraphFormats; + const bool bRemoveParaAttribs = !bNoParagraphFormats && !fullParaSelection; pOLV->RemoveAttribsKeepLanguages(bRemoveParaAttribs); SfxItemSet aSet(pOLV->GetAttribs()); SfxItemSet aPaintSet(CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(),