sc/source/ui/inc/viewdata.hxx  |    2 ++
 sc/source/ui/view/viewdata.cxx |   20 +++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit e5e461dd60e7d104f6eb1187949c161372e7b02e
Author: Marco Cecchetti <marco.cecche...@collabora.com>
Date:   Wed Oct 12 21:41:26 2016 +0200

    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 <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 4986e1f..9323dad 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 a569559..b37af92 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];
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to