From c14b39084f596ed3a12057c85c27f2e900d6cced Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Thu, 18 Jul 2024 07:32:57 +0200 Subject: tdf#162065 Fix format paintbrush in draw/impress With tdf#160069 the format paintbrush was disabled outside of text selection and with tdf#160069 target selection was reduced to text only. The change of tdf#160069 is mostly undone with this patch. Change-Id: I8e23ef56206c6749913e2c95870537c3e378f946 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170672 Tested-by: Jenkins Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen (cherry picked from commit f828a9fe44bfef9af58035340b6d6afd67d5a870) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172125 Reviewed-by: Christian Lohmaier --- sd/source/ui/func/fuformatpaintbrush.cxx | 13 ++++++++++--- svx/source/svdraw/svdedxv.cxx | 5 +---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sd/source/ui/func/fuformatpaintbrush.cxx b/sd/source/ui/func/fuformatpaintbrush.cxx index 8f41b6344d53..f41b4278c28f 100644 --- a/sd/source/ui/func/fuformatpaintbrush.cxx +++ b/sd/source/ui/func/fuformatpaintbrush.cxx @@ -62,7 +62,7 @@ FuFormatPaintBrush::FuFormatPaintBrush( ViewShell* pViewSh, ::sd::Window* pWin, : FuText(pViewSh, pWin, pView, pDoc, rReq) , mnDepth(-1) , mbPermanent( false ) -, mbOldIsQuickTextEditMode( true ) + , mbOldIsQuickTextEditMode(true) { } @@ -145,6 +145,14 @@ bool FuFormatPaintBrush::MouseButtonDown(const MouseEvent& rMEvt) } unmarkimpl( mpView ); + + if (aVEvt.mpObj) + { + sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() ); + mpView->MarkObj(mpWindow->PixelToLogic( rMEvt.GetPosPixel() ), nHitLog, false/*bToggle*/); + return true; + } + } return false; } @@ -282,8 +290,7 @@ void FuFormatPaintBrush::Paste( bool bNoCharacterFormats, bool bNoParagraphForma if( rMarkList.GetMarkCount() == 1 ) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - const OutlinerView* pOLV = rDrawViewShell.GetDrawView()->GetTextEditOutlinerView(); - if( pObj && pOLV && + if (pObj && SdrObjEditView::SupportsFormatPaintbrush(pObj->GetObjInventor(),pObj->GetObjIdentifier()) ) return; } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 6071fbc042bd..6eea9d2a6292 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2909,10 +2909,7 @@ sal_Int32 SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr& rFor return nDepth; OutlinerView* pOLV = GetTextEditOutlinerView(); - - bool isParaSelection - = pOLV ? !pOLV->GetEditView().HasSelection() || pOLV->GetEditView().IsSelectionFullPara() - : false; + bool isParaSelection = pOLV ? pOLV->GetEditView().IsSelectionFullPara() : false; rFormatSet = std::make_shared(GetModel().GetItemPool(), GetFormatRangeImpl(pOLV != nullptr, isParaSelection)); if (pOLV) -- cgit