summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorDaniel Rentz [dr] <daniel.rentz@oracle.com>2011-02-11 16:11:43 +0100
committerDaniel Rentz [dr] <daniel.rentz@oracle.com>2011-02-11 16:11:43 +0100
commit3965dbb11d44ee09ff7f43ea1a931f30b7b8439a (patch)
treeb59e9efcbc7fa76f47172d585716e02f20678259 /sc/source/ui
parent1a96f96d48647907520617ac9c5d14f4b51b409d (diff)
dr78: #164376# oox import performance: step 2 - move every access to XCell interface into SheetDataBuffer class, delay creation of array formulas and table operations, let XCellRangeData::setDataArray() accept formula token sequences in addition to plain values
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx75
1 files changed, 50 insertions, 25 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index ceb76f7671a0..cb3ab775ccb4 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1110,35 +1110,60 @@ BOOL lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
for (long nCol=0; nCol<nCols; nCol++)
{
const uno::Any& rElement = pColArr[nCol];
- uno::TypeClass eElemClass = rElement.getValueTypeClass();
- if ( eElemClass == uno::TypeClass_VOID )
- {
- // void = "no value"
- pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE );
- }
- else if ( eElemClass == uno::TypeClass_BYTE ||
- eElemClass == uno::TypeClass_SHORT ||
- eElemClass == uno::TypeClass_UNSIGNED_SHORT ||
- eElemClass == uno::TypeClass_LONG ||
- eElemClass == uno::TypeClass_UNSIGNED_LONG ||
- eElemClass == uno::TypeClass_FLOAT ||
- eElemClass == uno::TypeClass_DOUBLE )
+ switch( rElement.getValueTypeClass() )
{
+ case uno::TypeClass_VOID:
+ {
+ // void = "no value"
+ pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE );
+ }
+ break;
+
// #87871# accept integer types because Basic passes a floating point
// variable as byte, short or long if it's an integer number.
- double fVal(0.0);
- rElement >>= fVal;
- pDoc->SetValue( nDocCol, nDocRow, nTab, fVal );
- }
- else if ( eElemClass == uno::TypeClass_STRING )
- {
- rtl::OUString aUStr;
- rElement >>= aUStr;
- if ( aUStr.getLength() )
- pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) );
+ case uno::TypeClass_BYTE:
+ case uno::TypeClass_SHORT:
+ case uno::TypeClass_UNSIGNED_SHORT:
+ case uno::TypeClass_LONG:
+ case uno::TypeClass_UNSIGNED_LONG:
+ case uno::TypeClass_FLOAT:
+ case uno::TypeClass_DOUBLE:
+ {
+ double fVal(0.0);
+ rElement >>= fVal;
+ pDoc->SetValue( nDocCol, nDocRow, nTab, fVal );
+ }
+ break;
+
+ case uno::TypeClass_STRING:
+ {
+ rtl::OUString aUStr;
+ rElement >>= aUStr;
+ if ( aUStr.getLength() )
+ pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) );
+ }
+ break;
+
+ // accept Sequence<FormulaToken> for formula cells
+ case uno::TypeClass_SEQUENCE:
+ {
+ uno::Sequence< sheet::FormulaToken > aTokens;
+ if ( rElement >>= aTokens )
+ {
+ ScTokenArray aTokenArray;
+ ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, aTokens );
+ ScAddress aPos( nDocCol, nDocRow, nTab );
+ ScBaseCell* pNewCell = new ScFormulaCell( pDoc, aPos, &aTokenArray );
+ pDoc->PutCell( aPos, pNewCell );
+ }
+ else
+ bError = true;
+ }
+ break;
+
+ default:
+ bError = true; // invalid type
}
- else
- bError = TRUE; // invalid type
++nDocCol;
}