include/svx/svdedtv.hxx | 5 -- sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 2 svx/source/svdraw/svddrgmt.cxx | 3 - svx/source/svdraw/svdedtv.cxx | 13 ++--- svx/source/svdraw/svdedtv1.cxx | 42 +++++++++++------ svx/source/svdraw/svdedxv.cxx | 3 - 6 files changed, 44 insertions(+), 24 deletions(-)
New commits: commit e6c7a018a0cfee395ce2886d41c908a2447ef5cc Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Jul 2 00:01:01 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Jul 3 09:18:41 2019 +0200 tdf#126180: EndTextEdit on all views before delete/cut slide This also reworks the fixes tdf#125824 and tdf#111522 to use EndTextEdit instead of blocking the undoing Change-Id: I73c2289a9d950465f020f684e9e736148380f5c5 Reviewed-on: https://gerrit.libreoffice.org/74989 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx index 0305b7fb144c..87fd275b187d 100644 --- a/include/svx/svdedtv.hxx +++ b/include/svx/svdedtv.hxx @@ -186,10 +186,9 @@ public: bool IsUndoEnabled() const; /** - * Checks if this or other views have an active text edit, in which case object undos are not - * created. + * Checks if this or other views have an active text edit, if true, end them. */ - bool CanDoSdrUndo() const; + void EndTextEditAllViews() const; std::vector< std::unique_ptr<SdrUndoAction> > CreateConnectorUndo( SdrObject& rO ); void AddUndoActions( std::vector< std::unique_ptr<SdrUndoAction> > ); diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 55b58e197f1c..17b4adeeb958 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -234,6 +234,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) // (DEL -> accelerator -> SID_CUT). if (mrSlideSorter.GetModel().GetPageCount() > 1) { + mrSlideSorter.GetView().EndTextEditAllViews(); mrSlideSorter.GetController().GetSelectionManager()->DeleteSelectedPages(); } @@ -371,6 +372,7 @@ void SlotManager::FuSupport (SfxRequest& rRequest) case SID_CUT: case SID_COPY: case SID_DELETE: + mrSlideSorter.GetView().EndTextEditAllViews(); mrSlideSorter.GetController().GetClipboard().HandleSlotCall(rRequest); break; diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index f41a7991ccec..400cab8f936b 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -1366,10 +1366,11 @@ bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/) { std::unique_ptr<SdrUndoAction> pUndo; std::unique_ptr<SdrUndoAction> pUndo2; - const bool bUndo = getSdrDragView().IsUndoEnabled() && getSdrDragView().CanDoSdrUndo(); + const bool bUndo = getSdrDragView().IsUndoEnabled(); if( bUndo ) { + getSdrDragView().EndTextEditAllViews(); if(!getSdrDragView().IsInsObjPoint() && pObj->IsInserted() ) { if (DragStat().IsEndDragChangesAttributes()) diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index e424276da087..d83910a86746 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -973,8 +973,11 @@ bool SdrEditView::InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, SdrInser if (!pObj->IsInserted()) { rPV.GetObjList()->InsertObject(pObj, SAL_MAX_SIZE); } - if( IsUndoEnabled() && CanDoSdrUndo()) + if( IsUndoEnabled()) + { + EndTextEditAllViews(); AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj)); + } if (!(nOptions & SdrInsertFlags::DONTMARK)) { if (!(nOptions & SdrInsertFlags::ADDMARK)) UnmarkAllObj(); @@ -1029,20 +1032,18 @@ bool SdrEditView::IsUndoEnabled() const return mpModel->IsUndoEnabled(); } -bool SdrEditView::CanDoSdrUndo() const +void SdrEditView::EndTextEditAllViews() const { size_t nViews = mpModel->GetListenerCount(); for (size_t nView = 0; nView < nViews; ++nView) { - SdrEditView* pView = dynamic_cast<SdrEditView*>(mpModel->GetListener(nView)); + SdrObjEditView* pView = dynamic_cast<SdrObjEditView*>(mpModel->GetListener(nView)); if (!pView) continue; if (pView->IsTextEdit()) - return false; + pView->SdrEndTextEdit(); } - - return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 47e05a0ad5e4..44c4b2fe5201 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -88,9 +88,12 @@ void SdrEditView::SetMarkedObjRect(const tools::Rectangle& rRect) long w1=rRect.Right()-x1; long h1=rRect.Bottom()-y1; - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) + { + EndTextEditAllViews(); BegUndo(ImpGetDescriptionString(STR_EditPosSize)); + } for (size_t nm=0; nm<nCount; ++nm) { @@ -175,10 +178,11 @@ void SdrEditView::AddUndoActions( std::vector< std::unique_ptr<SdrUndoAction> > void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy) { - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); OUString aStr(SvxResId(STR_EditMove)); if (bCopy) aStr += SvxResId(STR_EditWithCopy); @@ -208,9 +212,10 @@ void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy) void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy) { - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); OUString aStr {ImpGetDescriptionString(STR_EditResize)}; if (bCopy) aStr+=SvxResId(STR_EditWithCopy); @@ -242,9 +247,10 @@ void SdrEditView::ResizeMultMarkedObj(const Point& rRef, const bool bWdh, const bool bHgt) { - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); BegUndo(ImpGetDescriptionString(STR_EditResize)); } @@ -302,9 +308,10 @@ long SdrEditView::GetMarkedObjRotate() const void SdrEditView::RotateMarkedObj(const Point& rRef, long nAngle, bool bCopy) { - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); OUString aStr {ImpGetDescriptionString(STR_EditRotate)}; if (bCopy) aStr+=SvxResId(STR_EditWithCopy); BegUndo(aStr); @@ -357,10 +364,11 @@ void SdrEditView::RotateMarkedObj(const Point& rRef, long nAngle, bool bCopy) void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy) { - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); OUString aStr; Point aDif(rRef2-rRef1); if (aDif.X()==0) @@ -456,10 +464,11 @@ long SdrEditView::GetMarkedObjShear() const void SdrEditView::ShearMarkedObj(const Point& rRef, long nAngle, bool bVShear, bool bCopy) { - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); OUString aStr {ImpGetDescriptionString(STR_EditShear)}; if (bCopy) aStr+=SvxResId(STR_EditWithCopy); @@ -569,12 +578,13 @@ void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookM bool bVertical, bool bNoContortion, bool bCopy) { tools::Rectangle aMarkRect(GetMarkedObjRect()); - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); bool bRotate=bNoContortion && eMode==SdrCrookMode::Rotate && IsRotateAllowed(); if( bUndo ) { + EndTextEditAllViews(); OUString aStr {ImpGetDescriptionString(bNoContortion ? STR_EditCrook : STR_EditCrookContortion)}; if (bCopy) aStr+=SvxResId(STR_EditWithCopy); @@ -644,10 +654,11 @@ void SdrEditView::ImpDistortObj(SdrObject* pO, const tools::Rectangle& rRef, con void SdrEditView::DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion, bool bCopy) { - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); OUString aStr {ImpGetDescriptionString(STR_EditDistort)}; if (bCopy) aStr+=SvxResId(STR_EditWithCopy); @@ -753,7 +764,9 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr) ShearMarkedObj(aAllSnapRect.Center(),nAngle,true); } - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); + if( bUndo ) + EndTextEditAllViews(); // TODO: check if WhichRange is necessary. const size_t nMarkCount=GetMarkedObjectCount(); @@ -1001,9 +1014,10 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) nWhich = aIter.NextWhich(); } - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); BegUndo(ImpGetDescriptionString(STR_EditSetAttributes)); } @@ -1179,10 +1193,11 @@ void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRe { if (AreObjectsMarked()) { - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); OUString aStr; if (pStyleSheet!=nullptr) aStr = ImpGetDescriptionString(STR_EditSetStylesheet); @@ -1741,9 +1756,10 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert) if (!GetMarkedObjectCount()) return; - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); OUString aStr(GetDescriptionOfMarkedObjects()); if (eHor==SdrHorAlign::NONE) { diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 5163f943e8bb..d37f7db235ee 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1475,9 +1475,10 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) pTEOutliner->SetBeginPasteOrDropHdl(Link<PasteOrDropInfos*,void>()); pTEOutliner->SetEndPasteOrDropHdl(Link<PasteOrDropInfos*,void>()); - const bool bUndo = IsUndoEnabled() && CanDoSdrUndo(); + const bool bUndo = IsUndoEnabled(); if( bUndo ) { + EndTextEditAllViews(); OUString aObjName(pTEObj->TakeObjNameSingul()); BegUndo(SvxResId(STR_UndoObjSetText),aObjName); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits