sd/source/ui/func/fuformatpaintbrush.cxx |    7 ++++++-
 svx/source/svdraw/svdedxv.cxx            |    4 +++-
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit dbb05dc818afb08b3e05ac62bd92389a5cf90fa7
Author:     Oliver Specht <oliver.spe...@cib.de>
AuthorDate: Thu Mar 7 12:47:22 2024 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Mar 7 21:48:37 2024 +0100

    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 <thorsten.behr...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sd/source/ui/func/fuformatpaintbrush.cxx 
b/sd/source/ui/func/fuformatpaintbrush.cxx
index 930e75233f32..89eecc13f989 100644
--- a/sd/source/ui/func/fuformatpaintbrush.cxx
+++ b/sd/source/ui/func/fuformatpaintbrush.cxx
@@ -45,6 +45,9 @@ bool ShouldPasteParaFormatPerSelection(const OutlinerView* 
pOLV)
     if(!pOLV)
         return true;
 
+    if(!pOLV->GetEditView().HasSelection())
+        return true;
+
     if(!pOLV->GetEditView().IsSelectionWithinSinglePara())
         return false;
 
@@ -286,7 +289,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 fb130a16a212..c0e1b715ea31 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -2896,7 +2896,9 @@ sal_Int32 
SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr<SfxItemSet>& 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<SfxItemSet>(GetModel().GetItemPool(),
                                               GetFormatRangeImpl(pOLV != 
nullptr, isParaSelection));
     if (pOLV)

Reply via email to