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
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user