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

Kohei Yoshida kohei.yoshida at gmail.com
Fri Mar 22 06:40:25 PDT 2013


 sc/inc/document.hxx              |    2 --
 sc/source/core/data/cell2.cxx    |    2 +-
 sc/source/core/data/document.cxx |   22 ----------------------
 sc/source/core/data/table6.cxx   |   15 ++++++++++++---
 sc/source/ui/app/transobj.cxx    |    1 -
 sc/source/ui/undo/undocell.cxx   |    4 +++-
 6 files changed, 16 insertions(+), 30 deletions(-)

New commits:
commit 70af04307ad62f362a18318096a37d425bbd8f35
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Mar 22 09:41:42 2013 -0400

    Remove a variant of PutCell().
    
    Change-Id: I6100d30954536a3683be69363f1fc13d54cacfef

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 783281e..e0f19cd 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -744,8 +744,6 @@ public:
     SC_DLLPUBLIC void EnsureTable( SCTAB nTab );
 
     SC_DLLPUBLIC void           PutCell( const ScAddress&, ScBaseCell* pCell, bool bForceTab = false );
-    SC_DLLPUBLIC void           PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell,
-                            bool bForceTab = false );
     SC_DLLPUBLIC void           PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell,
                             sal_uLong nFormatIndex, bool bForceTab = false);
                     //  return TRUE = number format is set
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 5bd3846..0e217f2 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -1442,7 +1442,7 @@ void ScFormulaCell::UpdateTranspose( const ScRange& rSource, const ScAddress& rD
             ScFormulaCell* pFCell = new ScFormulaCell( pUndoDoc, aPos, pOld,
                     eTempGrammar, cMatrixFlag);
             pFCell->aResult.SetToken( NULL);  // to recognize it as changed later (Cut/Paste!)
-            pUndoDoc->PutCell( aPos.Col(), aPos.Row(), aPos.Tab(), pFCell );
+            pUndoDoc->SetFormulaCell(aPos, pFCell);
         }
 
         bCompile = true;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index d5ceb08..7064ee2 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2925,28 +2925,6 @@ void ScDocument::FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark,
     }
 }
 
-
-void ScDocument::PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell, bool bForceTab )
-{
-    if (ValidTab(nTab))
-    {
-        if ( bForceTab && ( nTab >= static_cast<SCTAB>(maTabs.size()) || !maTabs[nTab]) )
-        {
-            bool bExtras = !bIsUndo;        // Spaltenbreiten, Zeilenhoehen, Flags
-
-            if (nTab >= static_cast<SCTAB>(maTabs.size()))
-                maTabs.resize(nTab + 1,NULL);
-            maTabs[nTab] = new ScTable(this, nTab,
-                            OUString("temp"),
-                            bExtras, bExtras);
-        }
-
-        if (maTabs[nTab])
-            maTabs[nTab]->PutCell( nCol, nRow, pCell );
-    }
-}
-
-
 void ScDocument::PutCell( const ScAddress& rPos, ScBaseCell* pCell, bool bForceTab )
 {
     SCTAB nTab = rPos.Tab();
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 640ed59..6df2249 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -31,6 +31,7 @@
 #include "editutil.hxx"
 #include "detfunc.hxx"
 #include "postit.hxx"
+#include "stringutil.hxx"
 
 //--------------------------------------------------------------------------
 
@@ -966,10 +967,14 @@ bool ScTable::SearchRangeForAllEmptyCells(
                         {
                             aCol[nCol].Insert(i, new ScStringCell(rNewStr));
                             if (pUndoDoc)
+                            {
                                 // TODO: I'm using a string cell with empty content to
                                 // trigger deletion of cell instance on undo.  Maybe I
                                 // should create a new cell type for this?
-                                pUndoDoc->PutCell(nCol, i, nTab, new ScStringCell(String()));
+                                ScSetStringParam aParam;
+                                aParam.setTextInput();
+                                pUndoDoc->SetString(ScAddress(nCol, i, nTab), EMPTY_OUSTRING);
+                            }
                         }
                         rUndoStr = String();
                     }
@@ -999,10 +1004,14 @@ bool ScTable::SearchRangeForAllEmptyCells(
                 {
                     aCol[nCol].Insert(nRow, new ScStringCell(rSearchItem.GetReplaceString()));
                     if (pUndoDoc)
+                    {
                         // TODO: I'm using a string cell with empty content to
                         // trigger deletion of cell instance on undo.  Maybe I
                         // should create a new cell type for this?
-                        pUndoDoc->PutCell(nCol, nRow, nTab, new ScStringCell(String()));
+                        ScSetStringParam aParam;
+                        aParam.setTextInput();
+                        pUndoDoc->SetString(ScAddress(nCol, nRow, nTab), EMPTY_OUSTRING);
+                    }
                 }
             }
             else if (pCell->GetCellType() == CELLTYPE_NOTE)
@@ -1015,7 +1024,7 @@ bool ScTable::SearchRangeForAllEmptyCells(
                     if (pUndoDoc)
                     {
                         ScAddress aCellPos(nCol, nRow, nTab);
-                        pUndoDoc->PutCell(nCol, nRow, nTab, pCell->Clone(*pUndoDoc, aCellPos));
+                        pUndoDoc->PutCell(aCellPos, pCell->Clone(*pUndoDoc, aCellPos));
                         ScNotes* pNotes = pUndoDoc->GetNotes(nTab);
                         ScPostIt* pPostIt = maNotes.findByAddress(nCol, nRow);
                         if (pPostIt)
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index bb67eef..8807195 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -798,7 +798,6 @@ void ScTransferObj::StripRefs( ScDocument* pDoc,
                 SCCOL nCol = aIter.GetCol() - nSubX;
                 SCROW nRow = aIter.GetRow() - nSubY;
 
-                ScBaseCell* pNew = 0;
                 sal_uInt16 nErrCode = pFCell->GetErrCode();
                 ScAddress aPos(nCol, nRow, nDestTab);
                 if (nErrCode)
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 1f61639..d78ac09 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -250,7 +250,9 @@ void ScUndoEnterData::Undo()
     {
         Value& rVal = maOldValues[i];
         ScBaseCell* pNewCell = rVal.mpCell ? rVal.mpCell->Clone( *pDoc, SC_CLONECELL_STARTLISTENING ) : 0;
-        pDoc->PutCell(maPos.Col(), maPos.Row(), rVal.mnTab, pNewCell);
+        ScAddress aPos = maPos;
+        aPos.SetTab(rVal.mnTab);
+        pDoc->PutCell(aPos, pNewCell);
 
         if (rVal.mbHasFormat)
             pDoc->ApplyAttr(maPos.Col(), maPos.Row(), rVal.mnTab,


More information about the Libreoffice-commits mailing list