summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-04-13 11:17:06 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-13 16:39:16 -0400
commitc03d5def337a112939b9864391f7b246c4e13fb5 (patch)
treea494e9f0bbfe881e71e6df179e37bc7d9d206c15
parent860d6a1995253c758bc9431049d26d9c80f8be37 (diff)
ScDocumentImport accessor to provide efficient means to fill document.
Import filters should be using this class to populate ScDocument, instead of filling it directly to ScDocument, and do all the broadcasting etc only once at the end of each import session. Change-Id: Ifc663e3dcf6b2ec96aaa185006af7ae9b9940af3
-rw-r--r--sc/Library_sc.mk1
-rw-r--r--sc/inc/column.hxx4
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/inc/documentimport.hxx67
-rw-r--r--sc/inc/table.hxx2
-rw-r--r--sc/source/core/data/column2.cxx46
-rw-r--r--sc/source/core/data/column3.cxx41
-rw-r--r--sc/source/core/data/documentimport.cxx104
-rw-r--r--sc/source/filter/inc/orcusinterface.hxx13
-rw-r--r--sc/source/filter/orcus/interface.cxx57
10 files changed, 260 insertions, 77 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 527d0d7a1206..5b82620939bc 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -124,6 +124,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/data/documen8 \
sc/source/core/data/documen9 \
sc/source/core/data/document \
+ sc/source/core/data/documentimport \
sc/source/core/data/dpdimsave \
sc/source/core/data/dpfilteredcache \
sc/source/core/data/dpglobal \
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index e872d87ec5b8..8e076eed0608 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -74,6 +74,7 @@ struct ScColWidthParam;
class ScColumnTextWidthIterator;
struct ScFormulaCellGroup;
struct ScRefCellValue;
+class ScDocumentImport;
typedef ::boost::intrusive_ptr<ScFormulaCellGroup> ScFormulaCellGroupRef;
@@ -140,6 +141,7 @@ friend class ScCellIterator;
friend class ScHorizontalCellIterator;
friend class ScHorizontalAttrIterator;
friend class ScColumnTextWidthIterator;
+friend class ScDocumentImport;
ScColumn(const ScColumn&); // disabled
ScColumn& operator= (const ScColumn&); // disabled
@@ -463,6 +465,8 @@ private:
void CellStorageModified();
void CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const;
+
+ void SetCell(SCROW nRow, ScBaseCell* pNewCell);
};
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a6438adcb429..030dd21d40eb 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -145,6 +145,7 @@ class ScNotes;
class ScEditDataArray;
class EditTextObject;
struct ScRefCellValue;
+class ScDocumentImport;
namespace com { namespace sun { namespace star {
namespace lang {
@@ -219,6 +220,7 @@ friend class ScColumnTextWidthIterator;
friend class ScFormulaCell;
friend class ScTable;
friend struct ScRefCellValue;
+friend class ScDocumentImport;
typedef ::std::vector<ScTable*> TableContainer;
private:
diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
new file mode 100644
index 000000000000..eca8021e1728
--- /dev/null
+++ b/sc/inc/documentimport.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SC_DOCUMENTIMPORT_HXX
+#define SC_DOCUMENTIMPORT_HXX
+
+#include "scdllapi.h"
+#include "address.hxx"
+
+#include "rtl/ustring.hxx"
+
+class ScDocument;
+class ScAddress;
+class ScTokenArray;
+class ScBaseCell;
+
+/**
+ * Accessor class to ScDocument. Its purpose is to allow import filter to
+ * fill the document model and nothing but that. Filling the document via
+ * this class does not trigger any kind of broadcasting, drawing object
+ * position calculation, or anything else that requires expensive
+ * computation which are unnecessary and undesirable during import.
+ */
+class SC_DLLPUBLIC ScDocumentImport
+{
+ ScDocument& mrDoc;
+
+ ScDocumentImport(); // disabled
+
+public:
+ ScDocumentImport(ScDocument& rDoc);
+ ScDocumentImport(const ScDocumentImport& r);
+
+ ScDocument& getDoc();
+ const ScDocument& getDoc() const;
+
+ /**
+ * @param rName sheet name.
+ *
+ * @return 0-based sheet index, or -1 in case no sheet is found by
+ * specified name.
+ */
+ SCTAB getSheetIndex(const OUString& rName) const;
+ SCTAB getSheetCount() const;
+ bool appendSheet(const OUString& rName);
+
+ void setOriginDate(sal_uInt16 nYear, sal_uInt16 nMonth, sal_uInt16 nDay);
+
+ void setAutoInput(const ScAddress& rPos, const OUString& rStr);
+ void setNumericCell(const ScAddress& rPos, double fVal);
+ void setStringCell(const ScAddress& rPos, const OUString& rStr);
+ void setFormulaCell(const ScAddress& rPos, const OUString& rFormula, formula::FormulaGrammar::Grammar eGrammar);
+ void setFormulaCell(const ScAddress& rPos, const ScTokenArray& rArray);
+
+private:
+ void insertCell(const ScAddress& rPos, ScBaseCell* pCell);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index f238b432b777..d46a44755b29 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -80,6 +80,7 @@ struct ScColWidthParam;
struct ScColWidthParam;
class ScRangeName;
class ScDBData;
+class ScDocumentImport;
class ScTable : boost::noncopyable
{
@@ -189,6 +190,7 @@ friend class ScHorizontalAttrIterator;
friend class ScDocAttrIterator;
friend class ScAttrRectIterator;
friend class ScColumnTextWidthIterator;
+friend class ScDocumentImport;
public:
ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 946676ad5e9a..c818c49da7ca 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -56,6 +56,7 @@
#include "docparam.hxx"
#include "cellvalue.hxx"
#include "tokenarray.hxx"
+#include "globalnames.hxx"
#include <math.h>
@@ -1502,6 +1503,51 @@ void ScColumn::CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDe
}
}
+void ScColumn::SetCell(SCROW nRow, ScBaseCell* pNewCell)
+{
+ bool bIsAppended = false;
+ if ( !maItems.empty() )
+ {
+ if (maItems.back().nRow < nRow)
+ {
+ Append(nRow, pNewCell);
+ bIsAppended = true;
+ }
+ }
+ if (!bIsAppended)
+ {
+ SCSIZE nIndex;
+ if (Search(nRow, nIndex))
+ {
+ ScBaseCell* pOldCell = maItems[nIndex].pCell;
+
+ // move broadcaster and note to new cell, if not existing in new cell
+ if (pOldCell->HasBroadcaster() && !pNewCell->HasBroadcaster())
+ pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
+
+ if ( pOldCell->GetCellType() == CELLTYPE_FORMULA && !pDocument->IsClipOrUndo() )
+ {
+ static_cast<ScFormulaCell*>(pOldCell)->EndListeningTo( pDocument );
+ // If in EndListening NoteCell is destroyed in same Col
+ if ( nIndex >= maItems.size() || maItems[nIndex].nRow != nRow )
+ Search(nRow, nIndex);
+ }
+ pOldCell->Delete();
+ maItems[nIndex].pCell = pNewCell;
+ }
+ else
+ {
+ maItems.insert(maItems.begin() + nIndex, ColEntry());
+ maItems[nIndex].pCell = pNewCell;
+ maItems[nIndex].nRow = nRow;
+ }
+
+ maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
+ maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN);
+ CellStorageModified();
+ }
+}
+
unsigned short ScColumn::GetTextWidth(SCROW nRow) const
{
return maTextWidths.get<unsigned short>(nRow);
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index e66f74deecbe..abbcd99701e3 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -62,47 +62,8 @@ using namespace formula;
void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
{
- bool bIsAppended = false;
- if ( !maItems.empty() )
- {
- if (maItems.back().nRow < nRow)
- {
- Append(nRow, pNewCell);
- bIsAppended = true;
- }
- }
- if ( !bIsAppended )
- {
- SCSIZE nIndex;
- if (Search(nRow, nIndex))
- {
- ScBaseCell* pOldCell = maItems[nIndex].pCell;
+ SetCell(nRow, pNewCell);
- // move broadcaster and note to new cell, if not existing in new cell
- if (pOldCell->HasBroadcaster() && !pNewCell->HasBroadcaster())
- pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
-
- if ( pOldCell->GetCellType() == CELLTYPE_FORMULA && !pDocument->IsClipOrUndo() )
- {
- static_cast<ScFormulaCell*>(pOldCell)->EndListeningTo( pDocument );
- // If in EndListening NoteCell is destroyed in same Col
- if ( nIndex >= maItems.size() || maItems[nIndex].nRow != nRow )
- Search(nRow, nIndex);
- }
- pOldCell->Delete();
- maItems[nIndex].pCell = pNewCell;
- }
- else
- {
- maItems.insert(maItems.begin() + nIndex, ColEntry());
- maItems[nIndex].pCell = pNewCell;
- maItems[nIndex].nRow = nRow;
- }
-
- maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
- maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN);
- CellStorageModified();
- }
// When we insert from the Clipboard we still have wrong (old) References!
// First they are rewired in CopyBlockFromClip via UpdateReference and the
// we call StartListeningFromClip and BroadcastFromClip.
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
new file mode 100644
index 000000000000..3a3218c1759e
--- /dev/null
+++ b/sc/source/core/data/documentimport.cxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "documentimport.hxx"
+#include "document.hxx"
+#include "table.hxx"
+#include "column.hxx"
+#include "cell.hxx"
+#include "formulacell.hxx"
+#include "docoptio.hxx"
+
+ScDocumentImport::ScDocumentImport(ScDocument& rDoc) : mrDoc(rDoc) {}
+ScDocumentImport::ScDocumentImport(const ScDocumentImport& r) : mrDoc(r.mrDoc) {}
+
+ScDocument& ScDocumentImport::getDoc()
+{
+ return mrDoc;
+}
+
+const ScDocument& ScDocumentImport::getDoc() const
+{
+ return mrDoc;
+}
+
+SCTAB ScDocumentImport::getSheetIndex(const OUString& rName) const
+{
+ SCTAB nTab = -1;
+ if (!mrDoc.GetTable(rName, nTab))
+ return -1;
+
+ return nTab;
+}
+
+SCTAB ScDocumentImport::getSheetCount() const
+{
+ return mrDoc.maTabs.size();
+}
+
+bool ScDocumentImport::appendSheet(const OUString& rName)
+{
+ SCTAB nTabCount = mrDoc.maTabs.size();
+ if (!ValidTab(nTabCount))
+ return false;
+
+ mrDoc.maTabs.push_back(new ScTable(&mrDoc, nTabCount, rName));
+ return true;
+}
+
+void ScDocumentImport::setOriginDate(sal_uInt16 nYear, sal_uInt16 nMonth, sal_uInt16 nDay)
+{
+ if (!mrDoc.pDocOptions)
+ mrDoc.pDocOptions = new ScDocOptions;
+
+ mrDoc.pDocOptions->SetDate(nDay, nMonth, nYear);
+}
+
+void ScDocumentImport::setAutoInput(const ScAddress& rPos, const OUString& rStr)
+{
+ if (!mrDoc.TableExists(rPos.Tab()))
+ return;
+
+ mrDoc.maTabs[rPos.Tab()]->aCol[rPos.Col()].SetString(rPos.Row(), rPos.Tab(), rStr, mrDoc.GetAddressConvention());
+}
+
+void ScDocumentImport::setNumericCell(const ScAddress& rPos, double fVal)
+{
+ insertCell(rPos, new ScValueCell(fVal));
+}
+
+void ScDocumentImport::setStringCell(const ScAddress& rPos, const OUString& rStr)
+{
+ insertCell(rPos, new ScStringCell(rStr));
+}
+
+void ScDocumentImport::setFormulaCell(
+ const ScAddress& rPos, const OUString& rFormula, formula::FormulaGrammar::Grammar eGrammar)
+{
+ insertCell(rPos, new ScFormulaCell(&mrDoc, rPos, rFormula, eGrammar));
+}
+
+void ScDocumentImport::setFormulaCell(const ScAddress& rPos, const ScTokenArray& rArray)
+{
+ insertCell(rPos, new ScFormulaCell(&mrDoc, rPos, &rArray));
+}
+
+void ScDocumentImport::insertCell(const ScAddress& rPos, ScBaseCell* pCell)
+{
+ if (!mrDoc.TableExists(rPos.Tab()))
+ {
+ pCell->Delete();
+ return;
+ }
+
+ ScColumn& rCol = mrDoc.maTabs[rPos.Tab()]->aCol[rPos.Col()];
+ rCol.SetCell(rPos.Row(), pCell);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 862a4cb944a0..6e6f2db94726 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -11,6 +11,7 @@
#define __SC_ORCUSINTERFACE_HXX__
#include "address.hxx"
+#include "documentimport.hxx"
#include "rtl/strbuf.hxx"
#define __ORCUS_STATIC_LIB
@@ -21,7 +22,7 @@
#include <map>
-class ScDocument;
+class ScDocumentImport;
class ScOrcusSheet;
class ScOrcusFactory;
class ScRangeData;
@@ -34,10 +35,10 @@ class XStatusIndicator;
class ScOrcusGlobalSettings : public orcus::spreadsheet::iface::import_global_settings
{
- ScDocument& mrDoc;
+ ScDocumentImport& mrDoc;
public:
- ScOrcusGlobalSettings(ScDocument& rDoc);
+ ScOrcusGlobalSettings(ScDocumentImport& rDoc);
virtual void set_origin_date(int year, int month, int day);
};
@@ -64,7 +65,7 @@ public:
class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
{
- ScDocument& mrDoc;
+ ScDocumentImport& mrDoc;
SCTAB mnTab;
ScOrcusFactory& mrFactory;
@@ -76,7 +77,7 @@ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
void cellInserted();
public:
- ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusFactory& rFactory);
+ ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& rFactory);
// Orcus import interface
virtual void set_auto(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
@@ -190,7 +191,7 @@ class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
typedef boost::unordered_map<OUString, size_t, OUStringHash> StringHashType;
typedef std::vector<StringCellCache> StringCellCaches;
- ScDocument& mrDoc;
+ ScDocumentImport maDoc;
std::vector<OUString> maStrings;
StringHashType maStringHash;
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 99ea336ea225..2929e140a555 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -13,7 +13,6 @@
#include "formulacell.hxx"
#include "rangenam.hxx"
#include "tokenarray.hxx"
-#include "stringutil.hxx"
#include "globalnames.hxx"
#include "docoptio.hxx"
#include "globstr.hrc"
@@ -29,32 +28,30 @@ using orcus::spreadsheet::row_t;
using orcus::spreadsheet::col_t;
using orcus::spreadsheet::formula_grammar_t;
-ScOrcusGlobalSettings::ScOrcusGlobalSettings(ScDocument& rDoc) : mrDoc(rDoc) {}
+ScOrcusGlobalSettings::ScOrcusGlobalSettings(ScDocumentImport& rDoc) : mrDoc(rDoc) {}
void ScOrcusGlobalSettings::set_origin_date(int year, int month, int day)
{
- ScDocOptions aOpt = mrDoc.GetDocOptions();
- aOpt.SetDate(day, month, year);
- mrDoc.SetDocOptions(aOpt);
+ mrDoc.setOriginDate(year, month, day);
}
ScOrcusFactory::StringCellCache::StringCellCache(const ScAddress& rPos, size_t nIndex) :
maPos(rPos), mnIndex(nIndex) {}
ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) :
- mrDoc(rDoc),
- maGlobalSettings(mrDoc),
+ maDoc(rDoc),
+ maGlobalSettings(maDoc),
maSharedStrings(*this),
mnProgress(0) {}
orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
{
OUString aTabName(sheet_name, sheet_name_length, RTL_TEXTENCODING_UTF8);
- if (!mrDoc.InsertTab(SC_TAB_APPEND, aTabName))
+ if (!maDoc.appendSheet(aTabName))
return NULL;
- SCTAB nTab = mrDoc.GetTableCount() - 1;
- maSheets.push_back(new ScOrcusSheet(mrDoc, nTab, *this));
+ SCTAB nTab = maDoc.getSheetCount() - 1;
+ maSheets.push_back(new ScOrcusSheet(maDoc, nTab, *this));
return &maSheets.back();
}
@@ -72,8 +69,8 @@ public:
orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* sheet_name, size_t sheet_name_length)
{
OUString aTabName(sheet_name, sheet_name_length, RTL_TEXTENCODING_UTF8);
- SCTAB nTab = -1;
- if (!mrDoc.GetTable(aTabName, nTab))
+ SCTAB nTab = maDoc.getSheetIndex(aTabName);
+ if (nTab < 0)
// Sheet by that name not found.
return NULL;
@@ -86,7 +83,7 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* s
return &(*it);
// Create a new orcus sheet instance for this.
- maSheets.push_back(new ScOrcusSheet(mrDoc, nTab, *this));
+ maSheets.push_back(new ScOrcusSheet(maDoc, nTab, *this));
return &maSheets.back();
}
@@ -107,8 +104,6 @@ orcus::spreadsheet::iface::import_styles* ScOrcusFactory::get_styles()
void ScOrcusFactory::finalize()
{
- ScSetStringParam aParam;
- aParam.setTextInput();
int nCellCount = 0;
StringCellCaches::const_iterator it = maStringCells.begin(), itEnd = maStringCells.end();
for (; it != itEnd; ++it)
@@ -117,7 +112,7 @@ void ScOrcusFactory::finalize()
// String index out-of-bound! Something is up.
continue;
- mrDoc.SetString(it->maPos, maStrings[it->mnIndex], &aParam);
+ maDoc.setStringCell(it->maPos, maStrings[it->mnIndex]);
++nCellCount;
if (nCellCount == 100000)
{
@@ -178,7 +173,7 @@ void ScOrcusFactory::setStatusIndicator(const uno::Reference<task::XStatusIndica
mxStatusIndicator = rIndicator;
}
-ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusFactory& rFactory) :
+ScOrcusSheet::ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& rFactory) :
mrDoc(rDoc), mnTab(nTab), mrFactory(rFactory), mnCellCount(0) {}
void ScOrcusSheet::cellInserted()
@@ -194,7 +189,7 @@ void ScOrcusSheet::cellInserted()
void ScOrcusSheet::set_auto(row_t row, col_t col, const char* p, size_t n)
{
OUString aVal(p, n, RTL_TEXTENCODING_UTF8);
- mrDoc.SetString(col, row, mnTab, aVal);
+ mrDoc.setAutoInput(ScAddress(col, row, mnTab), aVal);
cellInserted();
}
@@ -211,20 +206,20 @@ void ScOrcusSheet::set_string(row_t row, col_t col, size_t sindex)
void ScOrcusSheet::set_value(row_t row, col_t col, double value)
{
- mrDoc.SetValue( col, row, mnTab, value );
+ mrDoc.setNumericCell(ScAddress(col, row, mnTab), value);
cellInserted();
}
void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
{
- mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
+ mrDoc.setNumericCell(ScAddress(col, row, mnTab), value ? 1.0 : 0.0);
cellInserted();
}
void ScOrcusSheet::set_date_time(
row_t row, col_t col, int year, int month, int day, int hour, int minute, double second)
{
- SvNumberFormatter* pFormatter = mrDoc.GetFormatTable();
+ SvNumberFormatter* pFormatter = mrDoc.getDoc().GetFormatTable();
Date aDate(day, month, year);
sal_uIntPtr nSec = floor(second);
@@ -241,7 +236,7 @@ void ScOrcusSheet::set_date_time(
fTime /= DATE_TIME_FACTOR;
- mrDoc.SetValue(col, row, mnTab, nDateDiff + fTime);
+ mrDoc.setNumericCell(ScAddress(col, row, mnTab), nDateDiff + fTime);
cellInserted();
}
@@ -278,13 +273,13 @@ void ScOrcusSheet::set_formula(
{
OUString aFormula(p, n, RTL_TEXTENCODING_UTF8);
formula::FormulaGrammar::Grammar eGrammar = getCalcGrammarFromOrcus( grammar );
- mrDoc.SetFormula(ScAddress(col,row,mnTab), aFormula, eGrammar);
+ mrDoc.setFormulaCell(ScAddress(col,row,mnTab), aFormula, eGrammar);
cellInserted();
}
void ScOrcusSheet::set_formula_result(row_t row, col_t col, const char* p, size_t n)
{
- ScFormulaCell* pCell = mrDoc.GetFormulaCell(ScAddress(col, row, mnTab));
+ ScFormulaCell* pCell = mrDoc.getDoc().GetFormulaCell(ScAddress(col, row, mnTab));
if (!pCell)
{
SAL_WARN("sc", "trying to set formula result for non formula \
@@ -301,17 +296,17 @@ void ScOrcusSheet::set_shared_formula(
{
OUString aFormula( p_formula, n_formula, RTL_TEXTENCODING_UTF8 );
formula::FormulaGrammar::Grammar eGrammar = getCalcGrammarFromOrcus( grammar );
- ScRangeName* pRangeName = mrDoc.GetRangeName();
+ ScRangeName* pRangeName = mrDoc.getDoc().GetRangeName();
OUString aName("shared_");
aName += OUString::valueOf(sal_Int32(pRangeName->size()));
- ScRangeData* pSharedFormula = new ScRangeData( &mrDoc, aName, aFormula, ScAddress(col, row, mnTab), RT_SHARED, eGrammar);
+ ScRangeData* pSharedFormula = new ScRangeData(&mrDoc.getDoc(), aName, aFormula, ScAddress(col, row, mnTab), RT_SHARED, eGrammar);
if(pRangeName->insert(pSharedFormula))
{
maSharedFormulas.insert( std::pair<size_t, ScRangeData*>(sindex, pSharedFormula) );
ScTokenArray aArr;
aArr.AddToken( formula::FormulaIndexToken( ocName, pSharedFormula->GetIndex() ) );
- mrDoc.SetFormula(ScAddress(col,row,mnTab), aArr);
+ mrDoc.setFormulaCell(ScAddress(col,row,mnTab), aArr);
cellInserted();
}
}
@@ -322,17 +317,17 @@ void ScOrcusSheet::set_shared_formula(
{
OUString aFormula( p_formula, n_formula, RTL_TEXTENCODING_UTF8 );
formula::FormulaGrammar::Grammar eGrammar = getCalcGrammarFromOrcus( grammar );
- ScRangeName* pRangeName = mrDoc.GetRangeName();
+ ScRangeName* pRangeName = mrDoc.getDoc().GetRangeName();
OUString aName("shared_");
aName += OUString::valueOf(sal_Int32(pRangeName->size()));
- ScRangeData* pSharedFormula = new ScRangeData( &mrDoc, aName, aFormula, ScAddress(col, row, mnTab), RT_SHARED, eGrammar);
+ ScRangeData* pSharedFormula = new ScRangeData(&mrDoc.getDoc(), aName, aFormula, ScAddress(col, row, mnTab), RT_SHARED, eGrammar);
if(pRangeName->insert(pSharedFormula))
{
maSharedFormulas.insert( std::pair<size_t, ScRangeData*>(sindex, pSharedFormula) );
ScTokenArray aArr;
aArr.AddToken( formula::FormulaIndexToken( ocName, pSharedFormula->GetIndex() ) );
- mrDoc.SetFormula(ScAddress(col,row,mnTab), aArr);
+ mrDoc.setFormulaCell(ScAddress(col,row,mnTab), aArr);
cellInserted();
}
}
@@ -345,7 +340,7 @@ void ScOrcusSheet::set_shared_formula(row_t row, col_t col, size_t sindex)
ScRangeData* pSharedFormula = maSharedFormulas.find(sindex)->second;
ScTokenArray aArr;
aArr.AddToken( formula::FormulaIndexToken( ocName, pSharedFormula->GetIndex() ) );
- mrDoc.SetFormula(ScAddress(col,row,mnTab), aArr);
+ mrDoc.setFormulaCell(ScAddress(col,row,mnTab), aArr);
cellInserted();
}