summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-04-16 00:25:38 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-16 00:27:56 -0400
commitd1f25fc074568d2e57ab3f5031052c702e72c55f (patch)
treec782f557a6f895ac92f9296d7490bb9e4fb0f9c0 /sc
parent768f089d9d81a8c27940591e2755ea58b30ec96c (diff)
Populate the text width and script type arrays on import.
They must be in sync with their cell array counterpart at all times. Change-Id: I050c08057f06d29f710187129a510dadbfad0e4d
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/documentimport.hxx2
-rw-r--r--sc/source/core/data/documentimport.cxx32
-rw-r--r--sc/source/filter/orcus/interface.cxx2
3 files changed, 36 insertions, 0 deletions
diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
index eca8021e1728..eeafbba44c47 100644
--- a/sc/inc/documentimport.hxx
+++ b/sc/inc/documentimport.hxx
@@ -58,6 +58,8 @@ public:
void setFormulaCell(const ScAddress& rPos, const OUString& rFormula, formula::FormulaGrammar::Grammar eGrammar);
void setFormulaCell(const ScAddress& rPos, const ScTokenArray& rArray);
+ void finalize();
+
private:
void insertCell(const ScAddress& rPos, ScBaseCell* pCell);
};
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 3a3218c1759e..e0df2a2a1303 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -14,6 +14,7 @@
#include "cell.hxx"
#include "formulacell.hxx"
#include "docoptio.hxx"
+#include "globalnames.hxx"
ScDocumentImport::ScDocumentImport(ScDocument& rDoc) : mrDoc(rDoc) {}
ScDocumentImport::ScDocumentImport(const ScDocumentImport& r) : mrDoc(r.mrDoc) {}
@@ -89,6 +90,37 @@ void ScDocumentImport::setFormulaCell(const ScAddress& rPos, const ScTokenArray&
insertCell(rPos, new ScFormulaCell(&mrDoc, rPos, &rArray));
}
+void ScDocumentImport::finalize()
+{
+ // Populate the text width and script type arrays in all columns.
+ ScDocument::TableContainer::iterator itTab = mrDoc.maTabs.begin(), itTabEnd = mrDoc.maTabs.end();
+ for (; itTab != itTabEnd; ++itTab)
+ {
+ if (!*itTab)
+ continue;
+
+ ScTable& rTab = **itTab;
+ ScColumn* pCol = &rTab.aCol[0];
+ ScColumn* pColEnd = pCol + static_cast<size_t>(MAXCOLCOUNT);
+ for (; pCol != pColEnd; ++pCol)
+ {
+ ScColumn& rCol = *pCol;
+ if (rCol.maItems.empty())
+ // Column has no cells. Skip it.
+ continue;
+
+ ScColumn::TextWidthType::iterator itWidthPos = rCol.maTextWidths.begin();
+ ScColumn::ScriptType::iterator itScriptPos = rCol.maScriptTypes.begin();
+ std::vector<ColEntry>::iterator itCell = rCol.maItems.begin(), itCellEnd = rCol.maItems.end();
+ for (; itCell != itCellEnd; ++itCell)
+ {
+ itWidthPos = rCol.maTextWidths.set<unsigned short>(itWidthPos, itCell->nRow, TEXTWIDTH_DIRTY);
+ itScriptPos = rCol.maScriptTypes.set<unsigned short>(itScriptPos, itCell->nRow, SC_SCRIPTTYPE_UNKNOWN);
+ }
+ }
+ }
+}
+
void ScDocumentImport::insertCell(const ScAddress& rPos, ScBaseCell* pCell)
{
if (!mrDoc.TableExists(rPos.Tab()))
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 2929e140a555..55b170a03ea7 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -123,6 +123,8 @@ void ScOrcusFactory::finalize()
if (mxStatusIndicator.is())
mxStatusIndicator->end();
+
+ maDoc.finalize();
}
size_t ScOrcusFactory::appendString(const OUString& rStr)