summaryrefslogtreecommitdiff
path: root/sc/source/core/data/documentimport.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-05-24 11:52:18 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-06-24 16:51:25 -0400
commitc008dc483f8c6840803983e7e351cec6fdd32070 (patch)
tree7c88eeabde57ea4a3c1a760d1c02ea2fd37bd721 /sc/source/core/data/documentimport.cxx
parent75dec25730c88bdb8eb5e2a3f92689460fa89d29 (diff)
Switch to using multi_type_vector for cell storage.
The old style cell storage is no more. Currently the code is buildable, but crashes during unit test. Change-Id: Ie688e22e95c7fb02b9e97b23df0fc1883a97945f
Diffstat (limited to 'sc/source/core/data/documentimport.cxx')
-rw-r--r--sc/source/core/data/documentimport.cxx47
1 files changed, 25 insertions, 22 deletions
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index ec5b1c498d24..c3be0338ccda 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -75,32 +75,51 @@ void ScDocumentImport::setOriginDate(sal_uInt16 nYear, sal_uInt16 nMonth, sal_uI
void ScDocumentImport::setAutoInput(const ScAddress& rPos, const OUString& rStr)
{
- if (!mpImpl->mrDoc.TableExists(rPos.Tab()))
+ ScTable* pTab = mpImpl->mrDoc.FetchTable(rPos.Tab());
+ if (!pTab)
return;
- mpImpl->mrDoc.maTabs[rPos.Tab()]->aCol[rPos.Col()].SetString(
+ pTab->aCol[rPos.Col()].SetString(
rPos.Row(), rPos.Tab(), rStr, mpImpl->mrDoc.GetAddressConvention());
}
void ScDocumentImport::setNumericCell(const ScAddress& rPos, double fVal)
{
- insertCell(rPos, new ScValueCell(fVal));
+ ScTable* pTab = mpImpl->mrDoc.FetchTable(rPos.Tab());
+ if (!pTab)
+ return;
+
+ pTab->aCol[rPos.Col()].SetValue(rPos.Row(), fVal);
}
void ScDocumentImport::setStringCell(const ScAddress& rPos, const OUString& rStr)
{
- insertCell(rPos, new ScStringCell(rStr));
+ ScTable* pTab = mpImpl->mrDoc.FetchTable(rPos.Tab());
+ if (!pTab)
+ return;
+
+ pTab->aCol[rPos.Col()].SetRawString(rPos.Row(), rStr);
}
void ScDocumentImport::setFormulaCell(
const ScAddress& rPos, const OUString& rFormula, formula::FormulaGrammar::Grammar eGrammar)
{
- insertCell(rPos, new ScFormulaCell(&mpImpl->mrDoc, rPos, rFormula, eGrammar));
+ ScTable* pTab = mpImpl->mrDoc.FetchTable(rPos.Tab());
+ if (!pTab)
+ return;
+
+ pTab->aCol[rPos.Col()].SetFormulaCell(
+ rPos.Row(), new ScFormulaCell(&mpImpl->mrDoc, rPos, rFormula, eGrammar));
}
void ScDocumentImport::setFormulaCell(const ScAddress& rPos, const ScTokenArray& rArray)
{
- insertCell(rPos, new ScFormulaCell(&mpImpl->mrDoc, rPos, &rArray));
+ ScTable* pTab = mpImpl->mrDoc.FetchTable(rPos.Tab());
+ if (!pTab)
+ return;
+
+ pTab->aCol[rPos.Col()].SetFormulaCell(
+ rPos.Row(), new ScFormulaCell(&mpImpl->mrDoc, rPos, &rArray));
}
void ScDocumentImport::finalize()
@@ -123,20 +142,4 @@ void ScDocumentImport::finalize()
}
}
-void ScDocumentImport::insertCell(const ScAddress& rPos, ScBaseCell* pCell)
-{
- if (!mpImpl->mrDoc.TableExists(rPos.Tab()))
- {
- pCell->Delete();
- return;
- }
-
- ScColumn& rCol = mpImpl->mrDoc.maTabs[rPos.Tab()]->aCol[rPos.Col()];
- sc::ColumnBlockPosition* p = mpImpl->maBlockPosSet.getBlockPosition(rPos.Tab(), rPos.Col());
- if (p)
- rCol.SetCell(*p, rPos.Row(), pCell);
- else
- rCol.SetCell(rPos.Row(), pCell);
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */