Blame SOURCES/0064-fdo-79578-Properly-update-formulas-upon-change-in-db.patch

f085be
From 155af162b260ee49e1c6603baa2c2a96d6e93b67 Mon Sep 17 00:00:00 2001
f085be
From: Kohei Yoshida <kohei.yoshida@collabora.com>
f085be
Date: Mon, 28 Jul 2014 21:34:40 -0400
f085be
Subject: [PATCH 064/137] fdo#79578: Properly update formulas upon change in db
f085be
 collection.
f085be
f085be
Update it to handle formula groups correctly.
f085be
f085be
(cherry picked from commit 300845922eec7a28bc1da337acd21f138685d759)
f085be
f085be
Conflicts:
f085be
	sc/source/ui/docshell/dbdocfun.cxx
f085be
	sc/source/ui/docshell/docfunc.cxx
f085be
	sc/source/ui/docshell/docsh5.cxx
f085be
	sc/source/ui/undo/undocell.cxx
f085be
	sc/source/ui/undo/undodat.cxx
f085be
	sc/source/ui/unoobj/nameuno.cxx
f085be
	sc/source/ui/view/viewfunc.cxx
f085be
	sc/source/ui/view/dbfunc.cxx
f085be
f085be
Change-Id: I009a7fcf3d3fb17ef6951c50534ca6bc1fffc259
f085be
Reviewed-on: https://gerrit.libreoffice.org/10605
f085be
Reviewed-by: Eike Rathke <erack@redhat.com>
f085be
Tested-by: Eike Rathke <erack@redhat.com>
f085be
---
f085be
 sc/inc/column.hxx                   |  6 +++--
f085be
 sc/inc/document.hxx                 |  8 ++----
f085be
 sc/inc/formulacell.hxx              |  1 -
f085be
 sc/inc/table.hxx                    |  6 +++--
f085be
 sc/source/core/data/column2.cxx     | 22 ----------------
f085be
 sc/source/core/data/column4.cxx     | 43 +++++++++++++++++++++----------
f085be
 sc/source/core/data/documen4.cxx    | 11 --------
f085be
 sc/source/core/data/document10.cxx  | 17 +++++++++++--
f085be
 sc/source/core/data/formulacell.cxx | 51 -------------------------------------
f085be
 sc/source/core/data/table4.cxx      |  6 -----
f085be
 sc/source/core/data/table7.cxx      | 11 ++++++--
f085be
 sc/source/ui/docshell/dbdocfun.cxx  | 14 +++++-----
f085be
 sc/source/ui/docshell/docfunc.cxx   |  4 +--
f085be
 sc/source/ui/docshell/docsh5.cxx    |  4 +--
f085be
 sc/source/ui/undo/undocell.cxx      |  2 +-
f085be
 sc/source/ui/undo/undodat.cxx       |  8 +++---
f085be
 sc/source/ui/undo/undorangename.cxx |  2 +-
f085be
 sc/source/ui/unoobj/nameuno.cxx     |  2 +-
f085be
 sc/source/ui/view/dbfunc.cxx        |  4 +--
f085be
 sc/source/ui/view/viewfunc.cxx      |  2 +-
f085be
 20 files changed, 85 insertions(+), 139 deletions(-)
f085be
f085be
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
f085be
index 1cac044..8962422 100644
f085be
--- a/sc/inc/column.hxx
f085be
+++ b/sc/inc/column.hxx
f085be
@@ -373,9 +373,12 @@ public:
f085be
     void PreprocessRangeNameUpdate(
f085be
         sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
f085be
 
f085be
-    void PostprocessRangeNameUpdate(
f085be
+    void CompileHybridFormula(
f085be
         sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt );
f085be
 
f085be
+    void PreprocessDBDataUpdate(
f085be
+        sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
f085be
+
f085be
     const SfxPoolItem*      GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
f085be
     const ScPatternAttr*    GetPattern( SCROW nRow ) const;
f085be
     const ScPatternAttr*    GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
f085be
@@ -480,7 +483,6 @@ public:
f085be
     void CollectListeners( std::vector<SvtListener*>& rListeners, SCROW nRow1, SCROW nRow2 );
f085be
 
f085be
     void CompileDBFormula( sc::CompileFormulaContext& rCxt );
f085be
-    void CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString );
f085be
     void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
f085be
 
f085be
     sal_Int32   GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
f085be
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
f085be
index c901af5..9d365cc 100644
f085be
--- a/sc/inc/document.hxx
f085be
+++ b/sc/inc/document.hxx
f085be
@@ -516,11 +516,8 @@ public:
f085be
      * Call this immediately before updating all named ranges.
f085be
      */
f085be
     SC_DLLPUBLIC void PreprocessRangeNameUpdate();
f085be
-
f085be
-    /**
f085be
-     * Call this immediately after all named ranges have been updated.
f085be
-     */
f085be
-    SC_DLLPUBLIC void PostprocessRangeNameUpdate();
f085be
+    SC_DLLPUBLIC void PreprocessDBDataUpdate();
f085be
+    SC_DLLPUBLIC void CompileHybridFormula();
f085be
 
f085be
     SCTAB           GetMaxTableNumber() { return static_cast<SCTAB>(maTabs.size()) - 1; }
f085be
     void            SetMaxTableNumber(SCTAB nNumber) { nMaxTableNumber = nNumber; }
f085be
@@ -1967,7 +1964,6 @@ public:
f085be
     void                StartTrackTimer();
f085be
 
f085be
     void            CompileDBFormula();
f085be
-    void            CompileDBFormula( bool bCreateFormulaString );
f085be
     void            CompileColRowNameFormula();
f085be
 
f085be
     /** Maximum string length of a column, e.g. for dBase export.
f085be
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
f085be
index 9c7cd10..0a43f49 100644
f085be
--- a/sc/inc/formulacell.hxx
f085be
+++ b/sc/inc/formulacell.hxx
f085be
@@ -310,7 +310,6 @@ public:
f085be
     bool            IsRunning() const;
f085be
     void            SetRunning( bool bVal );
f085be
     void CompileDBFormula( sc::CompileFormulaContext& rCxt );
f085be
-    void CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString );
f085be
     void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
f085be
     ScFormulaCell*  GetPrevious() const;
f085be
     ScFormulaCell*  GetNext() const;
f085be
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
f085be
index f8928de..9d36a1e 100644
f085be
--- a/sc/inc/table.hxx
f085be
+++ b/sc/inc/table.hxx
f085be
@@ -864,9 +864,12 @@ public:
f085be
     void PreprocessRangeNameUpdate(
f085be
         sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
f085be
 
f085be
-    void PostprocessRangeNameUpdate(
f085be
+    void CompileHybridFormula(
f085be
         sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt );
f085be
 
f085be
+    void PreprocessDBDataUpdate(
f085be
+        sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
f085be
+
f085be
     ScConditionalFormatList* GetCondFormList();
f085be
     const ScConditionalFormatList* GetCondFormList() const;
f085be
     void SetCondFormList( ScConditionalFormatList* pList );
f085be
@@ -1029,7 +1032,6 @@ private:
f085be
     bool        GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ) const;
f085be
     bool        TestTabRefAbs(SCTAB nTable) const;
f085be
     void CompileDBFormula( sc::CompileFormulaContext& rCxt );
f085be
-    void CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString );
f085be
     void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
f085be
     void        RebuildFormulaGroups();
f085be
 
f085be
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
f085be
index 63c5e0f..a8ba063 100644
f085be
--- a/sc/source/core/data/column2.cxx
f085be
+++ b/sc/source/core/data/column2.cxx
f085be
@@ -3218,21 +3218,6 @@ public:
f085be
     }
f085be
 };
f085be
 
f085be
-class CompileDBFormula2Handler
f085be
-{
f085be
-    sc::CompileFormulaContext& mrCxt;
f085be
-    bool mbCreateFormulaString;
f085be
-
f085be
-public:
f085be
-    CompileDBFormula2Handler( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString ) :
f085be
-        mrCxt(rCxt), mbCreateFormulaString(bCreateFormulaString) {}
f085be
-
f085be
-    void operator() (size_t, ScFormulaCell* p)
f085be
-    {
f085be
-        p->CompileDBFormula(mrCxt, mbCreateFormulaString);
f085be
-    }
f085be
-};
f085be
-
f085be
 struct CompileColRowNameFormulaHandler
f085be
 {
f085be
     sc::CompileFormulaContext& mrCxt;
f085be
@@ -3254,13 +3239,6 @@ void ScColumn::CompileDBFormula( sc::CompileFormulaContext& rCxt )
f085be
     RegroupFormulaCells();
f085be
 }
f085be
 
f085be
-void ScColumn::CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString )
f085be
-{
f085be
-    CompileDBFormula2Handler aFunc(rCxt, bCreateFormulaString);
f085be
-    sc::ProcessFormula(maCells, aFunc);
f085be
-    RegroupFormulaCells();
f085be
-}
f085be
-
f085be
 void ScColumn::CompileColRowNameFormula( sc::CompileFormulaContext& rCxt )
f085be
 {
f085be
     CompileColRowNameFormulaHandler aFunc(rCxt);
f085be
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
f085be
index 9a3ef12..bf3b817 100644
f085be
--- a/sc/source/core/data/column4.cxx
f085be
+++ b/sc/source/core/data/column4.cxx
f085be
@@ -135,15 +135,19 @@ void ScColumn::DeleteBeforeCopyFromClip( sc::CopyFromClipContext& rCxt, const Sc
f085be
 
f085be
 namespace {
f085be
 
f085be
-class PreRangeNameUpdateHandler
f085be
+class RecompileByOpcodeHandler
f085be
 {
f085be
     ScDocument* mpDoc;
f085be
+    const boost::unordered_set<OpCode>& mrOps;
f085be
     sc::EndListeningContext& mrEndListenCxt;
f085be
     sc::CompileFormulaContext& mrCompileFormulaCxt;
f085be
 
f085be
 public:
f085be
-    PreRangeNameUpdateHandler( ScDocument* pDoc, sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt ) :
f085be
+    RecompileByOpcodeHandler(
f085be
+        ScDocument* pDoc, const boost::unordered_set<OpCode>& rOps,
f085be
+        sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt ) :
f085be
         mpDoc(pDoc),
f085be
+        mrOps(rOps),
f085be
         mrEndListenCxt(rEndListenCxt),
f085be
         mrCompileFormulaCxt(rCompileCxt) {}
f085be
 
f085be
@@ -163,12 +167,7 @@ public:
f085be
             pTop = rEntry.mpCell;
f085be
 
f085be
         ScTokenArray* pCode = pTop->GetCode();
f085be
-
f085be
-        boost::unordered_set<OpCode> aOps;
f085be
-        aOps.insert(ocBad);
f085be
-        aOps.insert(ocColRowName);
f085be
-        aOps.insert(ocName);
f085be
-        bool bRecompile = pCode->HasOpCodes(aOps);
f085be
+        bool bRecompile = pCode->HasOpCodes(mrOps);
f085be
 
f085be
         if (bRecompile)
f085be
         {
f085be
@@ -204,14 +203,14 @@ public:
f085be
     }
f085be
 };
f085be
 
f085be
-class PostRangeNameUpdateHandler
f085be
+class CompileHybridFormulaHandler
f085be
 {
f085be
     ScDocument* mpDoc;
f085be
     sc::StartListeningContext& mrStartListenCxt;
f085be
     sc::CompileFormulaContext& mrCompileFormulaCxt;
f085be
 
f085be
 public:
f085be
-    PostRangeNameUpdateHandler( ScDocument* pDoc, sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt ) :
f085be
+    CompileHybridFormulaHandler( ScDocument* pDoc, sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt ) :
f085be
         mpDoc(pDoc),
f085be
         mrStartListenCxt(rStartListenCxt),
f085be
         mrCompileFormulaCxt(rCompileCxt) {}
f085be
@@ -277,17 +276,35 @@ void ScColumn::PreprocessRangeNameUpdate(
f085be
     // Collect all formula groups.
f085be
     std::vector<sc::FormulaGroupEntry> aGroups = GetFormulaGroupEntries();
f085be
 
f085be
-    PreRangeNameUpdateHandler aFunc(pDocument, rEndListenCxt, rCompileCxt);
f085be
+    boost::unordered_set<OpCode> aOps;
f085be
+    aOps.insert(ocBad);
f085be
+    aOps.insert(ocColRowName);
f085be
+    aOps.insert(ocName);
f085be
+    RecompileByOpcodeHandler aFunc(pDocument, aOps, rEndListenCxt, rCompileCxt);
f085be
+    std::for_each(aGroups.begin(), aGroups.end(), aFunc);
f085be
+}
f085be
+
f085be
+void ScColumn::PreprocessDBDataUpdate(
f085be
+    sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt )
f085be
+{
f085be
+    // Collect all formula groups.
f085be
+    std::vector<sc::FormulaGroupEntry> aGroups = GetFormulaGroupEntries();
f085be
+
f085be
+    boost::unordered_set<OpCode> aOps;
f085be
+    aOps.insert(ocBad);
f085be
+    aOps.insert(ocColRowName);
f085be
+    aOps.insert(ocDBArea);
f085be
+    RecompileByOpcodeHandler aFunc(pDocument, aOps, rEndListenCxt, rCompileCxt);
f085be
     std::for_each(aGroups.begin(), aGroups.end(), aFunc);
f085be
 }
f085be
 
f085be
-void ScColumn::PostprocessRangeNameUpdate(
f085be
+void ScColumn::CompileHybridFormula(
f085be
     sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt )
f085be
 {
f085be
     // Collect all formula groups.
f085be
     std::vector<sc::FormulaGroupEntry> aGroups = GetFormulaGroupEntries();
f085be
 
f085be
-    PostRangeNameUpdateHandler aFunc(pDocument, rStartListenCxt, rCompileCxt);
f085be
+    CompileHybridFormulaHandler aFunc(pDocument, rStartListenCxt, rCompileCxt);
f085be
     std::for_each(aGroups.begin(), aGroups.end(), aFunc);
f085be
 }
f085be
 
f085be
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
f085be
index 8a4e3ec..03ee3ef 100644
f085be
--- a/sc/source/core/data/documen4.cxx
f085be
+++ b/sc/source/core/data/documen4.cxx
f085be
@@ -548,17 +548,6 @@ void ScDocument::CompileDBFormula()
f085be
     }
f085be
 }
f085be
 
f085be
-void ScDocument::CompileDBFormula( bool bCreateFormulaString )
f085be
-{
f085be
-    sc::CompileFormulaContext aCxt(this);
f085be
-    TableContainer::iterator it = maTabs.begin();
f085be
-    for (;it != maTabs.end(); ++it)
f085be
-    {
f085be
-        if (*it)
f085be
-            (*it)->CompileDBFormula(aCxt, bCreateFormulaString);
f085be
-    }
f085be
-}
f085be
-
f085be
 void ScDocument::CompileColRowNameFormula()
f085be
 {
f085be
     sc::CompileFormulaContext aCxt(this);
f085be
diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx
f085be
index cb64221..26f34db 100644
f085be
--- a/sc/source/core/data/document10.cxx
f085be
+++ b/sc/source/core/data/document10.cxx
f085be
@@ -57,7 +57,20 @@ void ScDocument::PreprocessRangeNameUpdate()
f085be
     }
f085be
 }
f085be
 
f085be
-void ScDocument::PostprocessRangeNameUpdate()
f085be
+void ScDocument::PreprocessDBDataUpdate()
f085be
+{
f085be
+    sc::EndListeningContext aEndListenCxt(*this);
f085be
+    sc::CompileFormulaContext aCompileCxt(this);
f085be
+
f085be
+    TableContainer::iterator it = maTabs.begin(), itEnd = maTabs.end();
f085be
+    for (; it != itEnd; ++it)
f085be
+    {
f085be
+        ScTable* p = *it;
f085be
+        p->PreprocessDBDataUpdate(aEndListenCxt, aCompileCxt);
f085be
+    }
f085be
+}
f085be
+
f085be
+void ScDocument::CompileHybridFormula()
f085be
 {
f085be
     sc::StartListeningContext aStartListenCxt(*this);
f085be
     sc::CompileFormulaContext aCompileCxt(this);
f085be
@@ -65,7 +78,7 @@ void ScDocument::PostprocessRangeNameUpdate()
f085be
     for (; it != itEnd; ++it)
f085be
     {
f085be
         ScTable* p = *it;
f085be
-        p->PostprocessRangeNameUpdate(aStartListenCxt, aCompileCxt);
f085be
+        p->CompileHybridFormula(aStartListenCxt, aCompileCxt);
f085be
     }
f085be
 }
f085be
 
f085be
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
f085be
index 18194e1..bbaff4f 100644
f085be
--- a/sc/source/core/data/formulacell.cxx
f085be
+++ b/sc/source/core/data/formulacell.cxx
f085be
@@ -3496,57 +3496,6 @@ void ScFormulaCell::CompileDBFormula( sc::CompileFormulaContext& rCxt )
f085be
     }
f085be
 }
f085be
 
f085be
-void ScFormulaCell::CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString )
f085be
-{
f085be
-    // Two phases must be called after each other
f085be
-    // 1. Formula String with old generated names
f085be
-    // 2. Formula String with new generated names
f085be
-    if ( bCreateFormulaString )
f085be
-    {
f085be
-        bool bRecompile = false;
f085be
-        pCode->Reset();
f085be
-        for ( FormulaToken* p = pCode->First(); p && !bRecompile; p = pCode->Next() )
f085be
-        {
f085be
-            switch ( p->GetOpCode() )
f085be
-            {
f085be
-                case ocBad:             // DB Area eventually goes bad
f085be
-                case ocColRowName:      // in case of the same names
f085be
-                case ocDBArea:          // DB Area
f085be
-                    bRecompile = true;
f085be
-                break;
f085be
-                case ocName:
f085be
-                    if ( p->GetIndex() >= SC_START_INDEX_DB_COLL )
f085be
-                        bRecompile = true;  // DB Area
f085be
-                break;
f085be
-                default:
f085be
-                    ; // nothing
f085be
-            }
f085be
-        }
f085be
-        if ( bRecompile )
f085be
-        {
f085be
-            OUString aFormula = GetFormula(rCxt);
f085be
-            if ( GetMatrixFlag() != MM_NONE && !aFormula.isEmpty() )
f085be
-            {
f085be
-                if ( aFormula[ aFormula.getLength()-1 ] == '}' )
f085be
-                    aFormula = aFormula.copy( 0, aFormula.getLength()-1 );
f085be
-                if ( aFormula[0] == '{' )
f085be
-                    aFormula = aFormula.copy( 1 );
f085be
-            }
f085be
-            EndListeningTo( pDocument );
f085be
-            pDocument->RemoveFromFormulaTree( this );
f085be
-            pCode->Clear();
f085be
-            SetHybridFormula(aFormula, rCxt.getGrammar());
f085be
-        }
f085be
-    }
f085be
-    else if ( !pCode->GetLen() && !aResult.GetHybridFormula().isEmpty() )
f085be
-    {
f085be
-        rCxt.setGrammar(eTempGrammar);
f085be
-        Compile(rCxt, aResult.GetHybridFormula(), false);
f085be
-        aResult.SetToken( NULL);
f085be
-        SetDirty();
f085be
-    }
f085be
-}
f085be
-
f085be
 void ScFormulaCell::CompileColRowNameFormula( sc::CompileFormulaContext& rCxt )
f085be
 {
f085be
     pCode->Reset();
f085be
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
f085be
index bfefd30..aef4726 100644
f085be
--- a/sc/source/core/data/table4.cxx
f085be
+++ b/sc/source/core/data/table4.cxx
f085be
@@ -2062,12 +2062,6 @@ void ScTable::CompileDBFormula( sc::CompileFormulaContext& rCxt )
f085be
         aCol[i].CompileDBFormula(rCxt);
f085be
 }
f085be
 
f085be
-void ScTable::CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString )
f085be
-{
f085be
-    for (SCCOL i = 0; i <= MAXCOL; ++i)
f085be
-        aCol[i].CompileDBFormula(rCxt, bCreateFormulaString);
f085be
-}
f085be
-
f085be
 void ScTable::CompileColRowNameFormula( sc::CompileFormulaContext& rCxt )
f085be
 {
f085be
     for (SCCOL i = 0; i <= MAXCOL; ++i)
f085be
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
f085be
index b427617..1ede729 100644
f085be
--- a/sc/source/core/data/table7.cxx
f085be
+++ b/sc/source/core/data/table7.cxx
f085be
@@ -50,11 +50,18 @@ void ScTable::PreprocessRangeNameUpdate(
f085be
         aCol[i].PreprocessRangeNameUpdate(rEndListenCxt, rCompileCxt);
f085be
 }
f085be
 
f085be
-void ScTable::PostprocessRangeNameUpdate(
f085be
+void ScTable::PreprocessDBDataUpdate(
f085be
+    sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt )
f085be
+{
f085be
+    for (SCCOL i = 0; i <= MAXCOL; ++i)
f085be
+        aCol[i].PreprocessDBDataUpdate(rEndListenCxt, rCompileCxt);
f085be
+}
f085be
+
f085be
+void ScTable::CompileHybridFormula(
f085be
     sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt )
f085be
 {
f085be
     for (SCCOL i = 0; i <= MAXCOL; ++i)
f085be
-        aCol[i].PostprocessRangeNameUpdate(rStartListenCxt, rCompileCxt);
f085be
+        aCol[i].CompileHybridFormula(rStartListenCxt, rCompileCxt);
f085be
 }
f085be
 
f085be
 void ScTable::UpdateScriptTypes( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
f085be
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
f085be
index 900bf3e..29d2da1 100644
f085be
--- a/sc/source/ui/docshell/dbdocfun.cxx
f085be
+++ b/sc/source/ui/docshell/dbdocfun.cxx
f085be
@@ -79,7 +79,7 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, sal_
f085be
     bool bCompile = !pDoc->IsImportingXML();
f085be
     bool bOk;
f085be
     if ( bCompile )
f085be
-        pDoc->CompileDBFormula( sal_True );     // CreateFormulaString
f085be
+        pDoc->PreprocessDBDataUpdate();
f085be
     if ( rName == STR_DB_LOCAL_NONAME )
f085be
     {
f085be
         pDoc->SetAnonymousDBData(rRange.aStart.Tab() , pNew);
f085be
@@ -90,7 +90,7 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, sal_
f085be
         bOk = pDocColl->getNamedDBs().insert(pNew);
f085be
     }
f085be
     if ( bCompile )
f085be
-        pDoc->CompileDBFormula( false );    // CompileFormulaString
f085be
+        pDoc->CompileHybridFormula();
f085be
 
f085be
     if (!bOk)
f085be
     {
f085be
@@ -128,9 +128,9 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
f085be
         if (bUndo)
f085be
             pUndoColl = new ScDBCollection( *pDocColl );
f085be
 
f085be
-        pDoc->CompileDBFormula( true );     // CreateFormulaString
f085be
+        pDoc->PreprocessDBDataUpdate();
f085be
         rDBs.erase(*p);
f085be
-        pDoc->CompileDBFormula( false );    // CompileFormulaString
f085be
+        pDoc->CompileHybridFormula();
f085be
 
f085be
         if (bUndo)
f085be
         {
f085be
@@ -164,13 +164,13 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew )
f085be
 
f085be
         ScDBCollection* pUndoColl = new ScDBCollection( *pDocColl );
f085be
 
f085be
-        pDoc->CompileDBFormula(true);               // CreateFormulaString
f085be
+        pDoc->PreprocessDBDataUpdate();
f085be
         rDBs.erase(*pOld);
f085be
         bool bInserted = rDBs.insert(pNewData);
f085be
         if (!bInserted)                             // Fehler -> alten Zustand wiederherstellen
f085be
             pDoc->SetDBCollection(pUndoColl);       // gehoert dann dem Dokument
f085be
-                                                    //
f085be
-        pDoc->CompileDBFormula( false );            // CompileFormulaString
f085be
+
f085be
+        pDoc->CompileHybridFormula();
f085be
 
f085be
         if (bInserted)                              // Einfuegen hat geklappt
f085be
         {
f085be
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
f085be
index 2d85309..034f881 100644
f085be
--- a/sc/source/ui/docshell/docfunc.cxx
f085be
+++ b/sc/source/ui/docshell/docfunc.cxx
f085be
@@ -4871,7 +4871,7 @@ bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc, SCTA
f085be
     else
f085be
         pDoc->SetRangeName( pNewRanges );       // takes ownership
f085be
     if ( bCompile )
f085be
-        pDoc->PostprocessRangeNameUpdate();
f085be
+        pDoc->CompileHybridFormula();
f085be
 
f085be
     if (bModifyDoc)
f085be
     {
f085be
@@ -4897,7 +4897,7 @@ void ScDocFunc::ModifyAllRangeNames( const boost::ptr_map<OUString, ScRangeName>
f085be
 
f085be
     pDoc->PreprocessRangeNameUpdate();
f085be
     pDoc->SetAllRangeNames(rRangeMap);
f085be
-    pDoc->PostprocessRangeNameUpdate();
f085be
+    pDoc->CompileHybridFormula();
f085be
 
f085be
     aModificator.SetDocumentModified();
f085be
     SFX_APP()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED));
f085be
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
f085be
index ee63dcf..3c65fc0 100644
f085be
--- a/sc/source/ui/docshell/docsh5.cxx
f085be
+++ b/sc/source/ui/docshell/docsh5.cxx
f085be
@@ -256,7 +256,7 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe
f085be
             OUString aNewName;
f085be
             if (eMode==SC_DB_IMPORT)
f085be
             {
f085be
-                aDocument.CompileDBFormula( sal_True );         // CreateFormulaString
f085be
+                aDocument.PreprocessDBDataUpdate();
f085be
                 pUndoColl = new ScDBCollection( *pColl );   // Undo fuer Import1-Bereich
f085be
 
f085be
                 OUString aImport = ScGlobal::GetRscString( STR_DBNAME_IMPORT );
f085be
@@ -289,7 +289,7 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe
f085be
 
f085be
             if ( pUndoColl )
f085be
             {
f085be
-                aDocument.CompileDBFormula( false );        // CompileFormulaString
f085be
+                aDocument.CompileHybridFormula();
f085be
 
f085be
                 ScDBCollection* pRedoColl = new ScDBCollection( *pColl );
f085be
                 GetUndoManager()->AddUndoAction( new ScUndoDBData( this, pUndoColl, pRedoColl ) );
f085be
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
f085be
index 02f67a9..03f2288 100644
f085be
--- a/sc/source/ui/undo/undocell.cxx
f085be
+++ b/sc/source/ui/undo/undocell.cxx
f085be
@@ -1059,7 +1059,7 @@ void ScUndoRangeNames::DoChange( sal_Bool bUndo )
f085be
             pDoc->SetRangeName( new ScRangeName( *pNewRanges ) );
f085be
     }
f085be
 
f085be
-    pDoc->PostprocessRangeNameUpdate();
f085be
+    pDoc->CompileHybridFormula();
f085be
 
f085be
     SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
f085be
 }
f085be
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
f085be
index 57d0875..32af832 100644
f085be
--- a/sc/source/ui/undo/undodat.cxx
f085be
+++ b/sc/source/ui/undo/undodat.cxx
f085be
@@ -1133,9 +1133,9 @@ void ScUndoDBData::Undo()
f085be
 
f085be
     sal_Bool bOldAutoCalc = pDoc->GetAutoCalc();
f085be
     pDoc->SetAutoCalc( false );         // Avoid unnecessary calculations
f085be
-    pDoc->CompileDBFormula( sal_True );     // CreateFormulaString
f085be
+    pDoc->PreprocessDBDataUpdate();
f085be
     pDoc->SetDBCollection( new ScDBCollection(*pUndoColl), sal_True );
f085be
-    pDoc->CompileDBFormula( false );    // CompileFormulaString
f085be
+    pDoc->CompileHybridFormula();
f085be
     pDoc->SetAutoCalc( bOldAutoCalc );
f085be
 
f085be
     SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
f085be
@@ -1151,9 +1151,9 @@ void ScUndoDBData::Redo()
f085be
 
f085be
     sal_Bool bOldAutoCalc = pDoc->GetAutoCalc();
f085be
     pDoc->SetAutoCalc( false );         // Avoid unnecessary calculations
f085be
-    pDoc->CompileDBFormula( sal_True );     // CreateFormulaString
f085be
+    pDoc->PreprocessDBDataUpdate();
f085be
     pDoc->SetDBCollection( new ScDBCollection(*pRedoColl), sal_True );
f085be
-    pDoc->CompileDBFormula( false );    // CompileFormulaString
f085be
+    pDoc->CompileHybridFormula();
f085be
     pDoc->SetAutoCalc( bOldAutoCalc );
f085be
 
f085be
     SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
f085be
diff --git a/sc/source/ui/undo/undorangename.cxx b/sc/source/ui/undo/undorangename.cxx
f085be
index 172f802..9a92b77 100644
f085be
--- a/sc/source/ui/undo/undorangename.cxx
f085be
+++ b/sc/source/ui/undo/undorangename.cxx
f085be
@@ -79,7 +79,7 @@ void ScUndoAllRangeNames::DoChange(const boost::ptr_map<OUString, ScRangeName>&
f085be
 
f085be
     rDoc.PreprocessRangeNameUpdate();
f085be
     rDoc.SetAllRangeNames(rNames);
f085be
-    rDoc.PostprocessRangeNameUpdate();
f085be
+    rDoc.CompileHybridFormula();
f085be
 
f085be
     SFX_APP()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED));
f085be
 }
f085be
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
f085be
index 87ed766..3c3273c 100644
f085be
--- a/sc/source/ui/unoobj/nameuno.cxx
f085be
+++ b/sc/source/ui/unoobj/nameuno.cxx
f085be
@@ -751,7 +751,7 @@ void ScNamedRangesObj::lock()
f085be
 /** called from the XActionLockable interface methods on final unlock */
f085be
 void ScNamedRangesObj::unlock()
f085be
 {
f085be
-    pDocShell->GetDocument()->PostprocessRangeNameUpdate();
f085be
+    pDocShell->GetDocument()->CompileHybridFormula();
f085be
 }
f085be
 
f085be
 // document::XActionLockable
f085be
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
f085be
index e5ebd37..1cd3223 100644
f085be
--- a/sc/source/ui/view/dbfunc.cxx
f085be
+++ b/sc/source/ui/view/dbfunc.cxx
f085be
@@ -224,9 +224,9 @@ void ScDBFunc::NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const std::
f085be
 
f085be
     //  register target in SBA no longer necessary
f085be
 
f085be
-    pDoc->CompileDBFormula( sal_True );     // CreateFormulaString
f085be
+    pDoc->PreprocessDBDataUpdate();
f085be
     pDoc->SetDBCollection( new ScDBCollection( rNewColl ) );
f085be
-    pDoc->CompileDBFormula( false );    // CompileFormulaString
f085be
+    pDoc->CompileHybridFormula();
f085be
     pOldColl = NULL;
f085be
     pDocShell->PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PAINT_GRID);
f085be
     aModificator.SetDocumentModified();
f085be
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
f085be
index e308cad..13a785b 100644
f085be
--- a/sc/source/ui/view/viewfunc.cxx
f085be
+++ b/sc/source/ui/view/viewfunc.cxx
f085be
@@ -2805,7 +2805,7 @@ bool ScViewFunc::InsertName( const OUString& rName, const OUString& rSymbol,
f085be
             bOk = true;
f085be
         pNewEntry = NULL;   // never delete, insert took ownership
f085be
 
f085be
-        pDoc->PostprocessRangeNameUpdate();
f085be
+        pDoc->CompileHybridFormula();
f085be
 
f085be
         aModificator.SetDocumentModified();
f085be
         SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
f085be
-- 
f085be
1.9.3
f085be