diff options
author | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2011-02-11 16:11:43 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-12-04 07:17:07 +0000 |
commit | 32034b60ae416b06926371b5cdf06486e319c68a (patch) | |
tree | 24df2bef62178c2dbe290a027fbab14c45199e04 | |
parent | 191bf98991e1934bfef115a1cec463ac250b0191 (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
Conflicts:
sc/source/ui/unoobj/cellsuno.cxx
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 78 |
1 files changed, 51 insertions, 27 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index f74dfdcfdf0e..fa5f6ca31a66 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1204,36 +1204,60 @@ static sal_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 ) + switch( rElement.getValueTypeClass() ) { - // 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 ) - { - // accept integer types because Basic passes a floating point + 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.isEmpty() ) - pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) ); - } - else - bError = sal_True; // invalid type + 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.isEmpty() ) + 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 + } ++nDocCol; } } |