From bdf7857602c16959b9ebdccdcb866a61bf46765f Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Thu, 7 Mar 2024 12:47:22 +0100 Subject: tdf#159726 Improve Clone formatting Paragraph attributes and lists are copied if there is no source selection or the source selection includes at least a full paragraph. They are only applied to an empty or a paragraph selection. As in tdf#160069 requested the clone formatting function is only enabled in text edit mode. Change-Id: I789402a7928837bb85ec941fd6f958d12585ac40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164533 Tested-by: Thorsten Behrens Reviewed-by: Thorsten Behrens (cherry picked from commit 456d0216aae69c39b12a5df749525589871272a7) --- sd/source/ui/func/fuformatpaintbrush.cxx | 4 +++- svx/source/svdraw/svdedxv.cxx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sd/source/ui/func/fuformatpaintbrush.cxx b/sd/source/ui/func/fuformatpaintbrush.cxx index 9bbd30939d53..ef1ea258c78f 100644 --- a/sd/source/ui/func/fuformatpaintbrush.cxx +++ b/sd/source/ui/func/fuformatpaintbrush.cxx @@ -290,7 +290,9 @@ void FuFormatPaintBrush::Paste( bool bNoCharacterFormats, bool bNoParagraphForma if( rMarkList.GetMarkCount() == 1 ) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if( pObj && SdrObjEditView::SupportsFormatPaintbrush(pObj->GetObjInventor(),pObj->GetObjIdentifier()) ) + const OutlinerView* pOLV = rDrawViewShell.GetDrawView()->GetTextEditOutlinerView(); + if( pObj && pOLV && + SdrObjEditView::SupportsFormatPaintbrush(pObj->GetObjInventor(),pObj->GetObjIdentifier()) ) return; } rSet.DisableItem( SID_FORMATPAINTBRUSH ); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 486b9e338cc8..ce801f796d4a 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2896,7 +2896,9 @@ sal_Int32 SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr& rFor OutlinerView* pOLV = GetTextEditOutlinerView(); - bool isParaSelection = pOLV ? pOLV->GetEditView().IsSelectionFullPara() : false; + bool isParaSelection + = pOLV ? !pOLV->GetEditView().HasSelection() || pOLV->GetEditView().IsSelectionFullPara() + : false; rFormatSet = std::make_shared(GetModel().GetItemPool(), GetFormatRangeImpl(pOLV != nullptr, isParaSelection)); if (pOLV) -- cgit