[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Thu Jun 27 10:50:16 PDT 2013


 sc/source/core/data/formulacell.cxx |    1 
 sc/source/core/tool/compiler.cxx    |   56 ------------------------------------
 2 files changed, 1 insertion(+), 56 deletions(-)

New commits:
commit 2deeac0fd6a47981292d9045d9c5321b8078bfaa
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Jun 27 13:52:50 2013 -0400

    Remove this old attempt of shared formula code.
    
    We'll devise a brand-new solution for this.
    
    Change-Id: Ib4e04b3ce0b5d1ab511aecfab35f81e43dd4edf9

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 9fc515d..96efc40 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2055,7 +2055,6 @@ bool ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode,
     if ( pUndoCellPos )
         aUndoPos = *pUndoCellPos;
     ScAddress aOldPos( aPos );
-//  bool bPosChanged = false;           // if this cell was moved
     bool bIsInsert = (eUpdateRefMode == URM_INSDEL &&
                 nDx >= 0 && nDy >= 0 && nDz >= 0);
     if (eUpdateRefMode == URM_INSDEL && r.In( aPos ))
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index afd50e1..759eef2 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4267,14 +4267,6 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
     }
     else
     {
-/*
- * Set SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE to 1 if we wanted to preserve as
- * many shared formulas as possible instead of replacing them with direct code.
- * Note that this may produce shared formula usage Excel doesn't understand,
- * which would have to be adapted for in the export filter. Advisable as a long
- * term goal, since it could decrease memory footprint.
- */
-#define SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE 0
         ScRangeData* pRangeData = NULL;
         ScToken* t;
         pArr->Reset();
@@ -4286,9 +4278,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
                 if (pName && pName->HasType(RT_SHAREDMOD))
                 {
                     pRangeData = pName;     // maybe need a replacement of shared with own code
-#if ! SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE
                     rChanged = true;
-#endif
                 }
             }
             else if( t->GetType() != svIndex )  // it may be a DB area!!!
@@ -4335,24 +4325,11 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
                 }
             }
         }
-#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE
-        bool bEasyShared, bPosInRange;
-        if ( !pRangeData )
-            bEasyShared = bPosInRange = false;
-        else
-        {
-            bEasyShared = true;
-            bPosInRange = r.In( eUpdateRefMode == URM_MOVE ? aPos : rOldPos );
-        }
-#endif
         pArr->Reset();
         while ( (t = static_cast<ScToken*>(pArr->GetNextReferenceRPN())) != NULL )
         {
             if ( t->GetRef() != 1 )
             {
-#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE
-                bEasyShared = false;
-#endif
             }
             else
             {   // if nRefCnt>1 it's already updated in token code
@@ -4374,15 +4351,6 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
                             )
                             rChanged = true;
                     }
-#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE
-                    if ( bEasyShared )
-                    {
-                        const ScSingleRefData& rSRD = aMod.Ref().Ref1;
-                        ScAddress aRef( rSRD.nCol, rSRD.nRow, rSRD.nTab );
-                        if ( r.In( aRef ) != bPosInRange )
-                            bEasyShared = false;
-                    }
-#endif
                 }
                 else
                 {
@@ -4408,35 +4376,13 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
                                     rRef.Ref2.nTab - rRef.Ref1.nTab != nTabs)
                             {
                                 rRefSizeChanged = true;
-#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE
-                                bEasyShared = false;
-#endif
                             }
                         }
                     }
-#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE
-                    if ( bEasyShared )
-                    {
-                        ScRange aRef( rRef.Ref1.nCol, rRef.Ref1.nRow,
-                                rRef.Ref1.nTab, rRef.Ref2.nCol, rRef.Ref2.nRow,
-                                rRef.Ref2.nTab );
-                        if ( r.In( aRef ) != bPosInRange )
-                            bEasyShared = false;
-                    }
-#endif
                 }
             }
         }
-#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE
-        if ( pRangeData )
-        {
-            if ( bEasyShared )
-                pRangeData = 0;
-            else
-                rChanged = true;
-        }
-#endif
-#undef SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE
+
         return pRangeData;
     }
 }


More information about the Libreoffice-commits mailing list