summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2019-07-02 00:01:01 +0200
committerXisco FaulĂ­ <xiscofauli@libreoffice.org>2019-07-03 12:36:16 +0200
commit1aa93766ee3994af9975e96e8ea60e02078de2d8 (patch)
treeeaf6510a0712f7975333d2840fc6d3b27445a6bc
parentupdate groupedbar NB layouts for more consistent between different apps (diff)
downloadcore-1aa93766ee3994af9975e96e8ea60e02078de2d8.tar.gz
core-1aa93766ee3994af9975e96e8ea60e02078de2d8.zip
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 <vmiklos@collabora.com> (cherry picked from commit e6c7a018a0cfee395ce2886d41c908a2447ef5cc) Reviewed-on: https://gerrit.libreoffice.org/75027 Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
-rw-r--r--include/svx/svdedtv.hxx5
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx2
-rw-r--r--svx/source/svdraw/svddrgmt.cxx3
-rw-r--r--svx/source/svdraw/svdedtv.cxx13
-rw-r--r--svx/source/svdraw/svdedtv1.cxx42
-rw-r--r--svx/source/svdraw/svdedxv.cxx3
6 files changed, 44 insertions, 24 deletions
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 5883eab62640..919001bfb7a9 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -972,8 +972,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();
@@ -1028,20 +1031,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 cb9deae0ed19..de573fcfd3b9 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);
}