sc/source/ui/app/inputhdl.cxx | 4 ++++ sc/source/ui/docshell/docfunc.cxx | 33 +++++++++++++++++++++++++++++++++ sc/source/ui/view/tabvwsh4.cxx | 13 ++++++++----- sc/source/ui/view/viewdata.cxx | 6 +----- sc/source/ui/view/viewfunc.cxx | 20 -------------------- 5 files changed, 46 insertions(+), 30 deletions(-)
New commits: commit 7db521284cfd15585334eb73023be8afb5aa701d Author: Marco Cecchetti <marco.cecche...@collabora.com> Date: Thu Jul 13 17:22:19 2017 +0200 lok: sc: edit view gets misplaced by other view actions on row/column Change-Id: I3f9301c31f38783083fb521d056d8088fc2e508b Reviewed-on: https://gerrit.libreoffice.org/40017 Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 5006d3787f7d..c2cb9d751ec4 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2585,6 +2585,10 @@ static void lcl_SelectionToEnd( EditView* pView ) void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) { + if (!mbDocumentDisposing && comphelper::LibreOfficeKit::isActive() + && pActiveViewSh != SfxViewShell::Current()) + return; + // Macro calls for validity can cause a lot of problems, so inhibit // nested calls of EnterHandler(). if (bInEnterHandler) return; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 7f9d67f62104..311eb6db307d 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2139,6 +2139,24 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, rDocShell.ErrorMessage(STR_INSERT_FULL); // Spalte/Zeile voll } + // The cursor position needs to be modified earlier than updating + // any enabled edit view which is triggered by SetDocumentModified below. + if (bSuccess) + { + bool bInsertCols = ( eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER); + bool bInsertRows = ( eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER ); + + if (bInsertCols) + { + pViewSh->OnLOKInsertDeleteColumn(rRange.aStart.Col(), 1); + } + + if (bInsertRows) + { + pViewSh->OnLOKInsertDeleteRow(rRange.aStart.Row(), 1); + } + } + aModificator.SetDocumentModified(); SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); @@ -2665,6 +2683,21 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, } } + // The cursor position needs to be modified earlier than updating + // any enabled edit view which is triggered by SetDocumentModified below. + ScTabViewShell* pViewSh = rDocShell.GetBestViewShell(); + if (pViewSh) + { + if (eCmd == DEL_DELCOLS) + { + pViewSh->OnLOKInsertDeleteColumn(rRange.aStart.Col(), -1); + } + if (eCmd == DEL_DELROWS) + { + pViewSh->OnLOKInsertDeleteRow(rRange.aStart.Row(), -1); + } + } + aModificator.SetDocumentModified(); SfxGetpApp()->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) ); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index e8f4491ae26e..058dbb2d953b 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1756,6 +1756,14 @@ ScTabViewShell::~ScTabViewShell() SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY"); SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY"); + // all to NULL, in case the TabView-dtor tries to access them + //! (should not really! ??!?!) + if (pInputHandler) + pInputHandler->SetDocumentDisposing(true); + // We end edit mode, before destroying the input handler and the edit engine + // and before end listening (in order to call ScTabViewShell::KillEditView()) + pInputHandler->EnterHandler(); + ScDocShell* pDocSh = GetViewData().GetDocShell(); EndListening(*pDocSh); EndListening(*GetViewFrame()); @@ -1766,11 +1774,6 @@ ScTabViewShell::~ScTabViewShell() RemoveSubShell(); // all SetWindow(nullptr); - // all to NULL, in case the TabView-dtor tries to access them - //! (should not really! ??!?!) - if (pInputHandler) - pInputHandler->SetDocumentDisposing(true); - DELETEZ(pFontworkBarShell); DELETEZ(pExtrusionBarShell); DELETEZ(pCellShell); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index d90886368522..a40413c3d1a5 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1253,10 +1253,6 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, ScEditEngineDefaulter* pNewEngine, vcl::Window* pWin, SCCOL nNewX, SCROW nNewY ) { - if (comphelper::LibreOfficeKit::isActive() - && GetViewShell() != SfxViewShell::Current()) - return; - bool bLayoutRTL = pDoc->IsLayoutRTL( nTabNo ); ScHSplitPos eHWhich = WhichH(eWhich); @@ -1292,7 +1288,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, } // add windows from other views - if (comphelper::LibreOfficeKit::isActive()) + if (!bWasThere && comphelper::LibreOfficeKit::isActive()) { ScTabViewShell* pThisViewShell = GetViewShell(); SCTAB nThisTabNo = GetTabNo(); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 3d5db7ee48db..61e8d27328e3 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1588,16 +1588,6 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste ) bool bInsertCols = ( eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER); bool bInsertRows = ( eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER ); - if (bInsertCols) - { - OnLOKInsertDeleteColumn(aRange.aStart.Col(), 1); - } - - if (bInsertRows) - { - OnLOKInsertDeleteRow(aRange.aStart.Row(), 1); - } - pDocSh->UpdateOle(&GetViewData()); CellContentChanged(); ResetAutoSpell(); @@ -1664,16 +1654,6 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd ) pDocSh->GetDocFunc().DeleteCells( aRange, &rMark, eCmd, false ); } - if (eCmd == DEL_DELCOLS) - { - OnLOKInsertDeleteColumn(aRange.aStart.Col(), -1); - } - - if (eCmd == DEL_DELROWS) - { - OnLOKInsertDeleteRow(aRange.aStart.Row(), -1); - } - pDocSh->UpdateOle(&GetViewData()); CellContentChanged(); ResetAutoSpell(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits