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

New commits:
commit 004ca8f6558c71909551d15e077c4e835ebd6391
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/29741
    Reviewed-by: Marco Cecchetti <mrcek...@gmail.com>
    Tested-by: Marco Cecchetti <mrcek...@gmail.com>

diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 3ed3e7c..f61b0bf 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -216,6 +216,8 @@ private:
     bool                bSelCtrlMouseClick:1;       // special selection 
handling for ctrl-mouse-click
     bool                bMoveArea:1;
 
+    bool                bGrowing;
+
     long                m_nLOKPageUpDownOffset;
 
     DECL_DLLPRIVATE_LINK_TYPED( EditEngineHdl, EditStatus&, void );
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index b14d846..dc9a48c 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -60,10 +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>
@@ -352,6 +352,7 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* 
pViewSh ) :
         bPagebreak  ( false ),
         bSelCtrlMouseClick( false ),
         bMoveArea ( false ),
+        bGrowing (false),
         m_nLOKPageUpDownOffset( 0 )
 {
     mpMarkData->SelectOneTable(0); // Sync with nTabNo
@@ -443,6 +444,7 @@ ScViewData::ScViewData( const ScViewData& rViewData ) :
         bPagebreak  ( rViewData.bPagebreak ),
         bSelCtrlMouseClick( rViewData.bSelCtrlMouseClick ),
         bMoveArea ( rViewData.bMoveArea ),
+        bGrowing( rViewData.bGrowing ),
         m_nLOKPageUpDownOffset( rViewData.m_nLOKPageUpDownOffset )
 {
 
@@ -1175,6 +1177,16 @@ IMPL_LINK_TYPED( 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();
@@ -1360,6 +1372,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