diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2016-10-12 21:41:26 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-10-14 15:58:11 +0000 |
commit | e5e461dd60e7d104f6eb1187949c161372e7b02e (patch) | |
tree | 5ef55b32e7628ff3a37764363327248a4f7304f0 | |
parent | cf43ff5262a111f9fbebe58d254b704ec057cbf6 (diff) |
tdf#103211 Calc: it is insane to call EditGrowX/Y while the edit view is growing.
That could occur because of the call to SetDefaultItem later.
We end up with wrong start/end edit columns and the changes
to the output area performed by the inner call to EditGrowX are
useless since they are discarded by the outer call.
In the inner call the output area is not the new one computed by the
outer call, on the contrary the data field `nEditStartCol` and
`nEditEndCol` have been already modified, so the inner call would
modify them using the wrong output area width.
Maybe the call to SetDefaultItem should be performed in another place,
anyway the outer call takes into account the correct horizontal adjust
when computing the new start/end edit columns and the new left/right
output area.
Change-Id: I56d038f33ab9d1933c4c6cd1db6d9cd012fb6db1
Reviewed-on: https://gerrit.libreoffice.org/29784
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | sc/source/ui/inc/viewdata.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index 4986e1fe2a1e..9323dad65133 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -227,6 +227,8 @@ private: bool bSelCtrlMouseClick:1; // special selection handling for ctrl-mouse-click bool bMoveArea:1; + bool bGrowing; + long m_nLOKPageUpDownOffset; DECL_DLLPRIVATE_LINK( EditEngineHdl, EditStatus&, void ); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index a569559536fd..b37af9289cef 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -60,9 +60,10 @@ #include <gridwin.hxx> #include <rtl/ustrbuf.hxx> #include <boost/checked_delete.hpp> +#include <comphelper/flagguard.hxx> +#include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> -#include <comphelper/lok.hxx> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/document/NamedPropertyValues.hpp> @@ -356,6 +357,7 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) : bPagebreak ( false ), bSelCtrlMouseClick( false ), bMoveArea ( false ), + bGrowing (false), m_nLOKPageUpDownOffset( 0 ) { mpMarkData->SelectOneTable(0); // Sync with nTabNo @@ -447,6 +449,7 @@ ScViewData::ScViewData( const ScViewData& rViewData ) : bPagebreak ( rViewData.bPagebreak ), bSelCtrlMouseClick( rViewData.bSelCtrlMouseClick ), bMoveArea ( rViewData.bMoveArea ), + bGrowing( rViewData.bGrowing ), m_nLOKPageUpDownOffset( rViewData.m_nLOKPageUpDownOffset ) { @@ -1201,6 +1204,16 @@ IMPL_LINK( ScViewData, EditEngineHdl, EditStatus&, rStatus, void ) void ScViewData::EditGrowX() { + // It is insane to call EditGrowX while the output area is already growing. + // That could occur because of the call to SetDefaultItem later. + // We end up with wrong start/end edit columns and the changes + // to the output area performed by the inner call to this method are + // useless since they are discarded by the outer call. + if (bGrowing) + return; + + comphelper::FlagRestorationGuard aFlagGuard(bGrowing, true); + ScDocument* pLocalDoc = GetDocument(); ScSplitPos eWhich = GetActivePart(); @@ -1387,6 +1400,11 @@ void ScViewData::EditGrowX() void ScViewData::EditGrowY( bool bInitial ) { + if (bGrowing) + return; + + comphelper::FlagRestorationGuard aFlagGuard(bGrowing, true); + ScSplitPos eWhich = GetActivePart(); ScVSplitPos eVWhich = WhichV(eWhich); EditView* pCurView = pEditView[eWhich]; |