diff options
author | Noel Power <noel.power@suse.com> | 2013-05-17 18:27:05 +0100 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-05-17 18:31:51 +0100 |
commit | 81b0155096fc369feae3fe33fc8cf09c2ed3de01 (patch) | |
tree | 88de93d4d7420cb0754b68a6779f38f1262ae723 | |
parent | 67ba9fdb2c298cbc62e64b9768355a8bf8c5b098 (diff) |
fix missing xlsx import formula dependecy startlisten on formula array cells
Formula arrays in xlsx documents don't change ( when depenant cells change ) this is
because of some performace hacks that prevent wide-scale startlisten calls
( e.g. inhibited because filter calls SetInsertingFromOtherDoc(true) ) Instead
of enabling that stuff again some we do some manual dependecy setting
Change-Id: I994d0ec505339201f6f78229963de45f10437212
-rw-r--r-- | sc/source/filter/oox/formulabuffer.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index eba84aba4f13..0c4432959511 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -155,16 +155,41 @@ void FormulaBuffer::applyCellFormulaValues( const std::vector< ValueAddressPair } } } +// bound to need this somewhere else, if so probably need to move it to +// worksheethelper or somewhere else more suitable +void StartCellListening( sal_Int16 nSheet, sal_Int32 nRow, sal_Int32 nCol, ScDocument& rDoc ) +{ + ScAddress aCellPos; + CellAddress aAddress; + aAddress.Sheet = nSheet; + aAddress.Row = nRow; + aAddress.Column = nCol; + ScUnoConversion::FillScAddress( aCellPos, aAddress ); + ScFormulaCell* pFCell = rDoc.GetFormulaCell( aCellPos ); + if ( pFCell ) + pFCell->StartListeningTo( &rDoc ); +} void FormulaBuffer::applyArrayFormulas( const std::vector< TokenRangeAddressItem >& rVector ) { + ScDocument& rDoc = getScDocument(); for ( std::vector< TokenRangeAddressItem >::const_iterator it = rVector.begin(), it_end = rVector.end(); it != it_end; ++it ) { Reference< XArrayFormulaTokens > xTokens( getRange( it->maCellRangeAddress ), UNO_QUERY ); OSL_ENSURE( xTokens.is(), "SheetDataBuffer::finalizeArrayFormula - missing formula token interface" ); ApiTokenSequence aTokens = getFormulaParser().importFormula( it->maTokenAndAddress.maCellAddress, it->maTokenAndAddress.maTokenStr ); if( xTokens.is() ) + { xTokens->setArrayTokens( aTokens ); + // set dependencies, add listeners on the cells in array + for ( sal_Int32 nCol = it->maCellRangeAddress.StartColumn; nCol <= it->maCellRangeAddress.EndColumn; ++nCol ) + { + for ( sal_Int32 nRow = it->maCellRangeAddress.StartRow; nRow <= it->maCellRangeAddress.EndRow; ++nRow ) + { + StartCellListening( it->maCellRangeAddress.Sheet, nRow, nCol, rDoc ); + } + } + } } } |