diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-19 22:05:32 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-19 22:07:35 -0500 |
commit | 797db638870f5c6192e72c0b4669b471788e16ea (patch) | |
tree | 75e395b7fefc972b0147cafcb17fdbc23525de55 /sc | |
parent | d273a60bfdbf9bb7623bed38667ec0647753157c (diff) |
Use group area listener when entering a new single formula cell.
Change-Id: I01dc4537919b69a312e92ede2ae00fbe7d781bd7
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/column.hxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/column3.cxx | 22 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 2 |
3 files changed, 22 insertions, 10 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 72a55e96455a..19bb2aa3267b 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -307,7 +307,7 @@ public: * @return pCell if it was successfully inserted, NULL otherwise. pCell * is deleted automatically on failure to insert. */ - ScFormulaCell* SetFormulaCell( SCROW nRow, ScFormulaCell* pCell ); + ScFormulaCell* SetFormulaCell( SCROW nRow, ScFormulaCell* pCell, bool bSingle = false ); ScFormulaCell* SetFormulaCell( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell ); bool SetFormulaCells( SCROW nRow, std::vector<ScFormulaCell*>& rCells ); @@ -630,8 +630,10 @@ private: sc::CellStoreType::iterator GetPositionToInsert( SCROW nRow ); sc::CellStoreType::iterator GetPositionToInsert( const sc::CellStoreType::iterator& it, SCROW nRow ); - void AttachNewFormulaCell( const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell, bool bJoin = true ); - void AttachNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin = true ); + void AttachNewFormulaCell( + const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell, bool bJoin = true, bool bSingle = false ); + void AttachNewFormulaCell( + const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin = true, bool bSingle = false ); void AttachNewFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength ); void BroadcastNewCell( SCROW nRow ); bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc::CellStoreType::iterator& itr ); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 150d6097fb7e..8b6fa92f7f92 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -375,13 +375,13 @@ sc::CellStoreType::iterator ScColumn::GetPositionToInsert( const sc::CellStoreTy } void ScColumn::AttachNewFormulaCell( - const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell, bool bJoin ) + const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell, bool bJoin, bool bSingle ) { - AttachNewFormulaCell(maCells.position(itPos, nRow), rCell, bJoin); + AttachNewFormulaCell(maCells.position(itPos, nRow), rCell, bJoin, bSingle); } void ScColumn::AttachNewFormulaCell( - const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin ) + const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin, bool bSingle ) { if (bJoin) // See if this new formula cell can join an existing shared formula group. @@ -394,7 +394,17 @@ void ScColumn::AttachNewFormulaCell( // After Import we call CalcAfterLoad and in there Listening. if (!pDocument->IsClipOrUndo() && !pDocument->IsInsertingFromOtherDoc()) { - rCell.StartListeningTo(pDocument); + if (bSingle) + { + boost::shared_ptr<sc::ColumnBlockPositionSet> pPosSet(new sc::ColumnBlockPositionSet(*pDocument)); + sc::StartListeningContext aStartCxt(*pDocument, pPosSet); + sc::EndListeningContext aEndCxt(*pDocument, pPosSet); + SCROW nRow = aPos.first->position + aPos.second; + StartListeningFormulaCells(aStartCxt, aEndCxt, nRow, nRow); + } + else + rCell.StartListeningTo(pDocument); + if (!pDocument->IsCalcingAfterLoad()) rCell.SetDirty(); } @@ -1822,7 +1832,7 @@ void ScColumn::SetFormula( SCROW nRow, const OUString& rFormula, formula::Formul AttachNewFormulaCell(it, nRow, *pCell); } -ScFormulaCell* ScColumn::SetFormulaCell( SCROW nRow, ScFormulaCell* pCell ) +ScFormulaCell* ScColumn::SetFormulaCell( SCROW nRow, ScFormulaCell* pCell, bool bSingle ) { sc::CellStoreType::iterator it = GetPositionToInsert(nRow); sal_uInt32 nCellFormat = GetNumberFormat(nRow); @@ -1833,7 +1843,7 @@ ScFormulaCell* ScColumn::SetFormulaCell( SCROW nRow, ScFormulaCell* pCell ) CellStorageModified(); - AttachNewFormulaCell(it, nRow, *pCell); + AttachNewFormulaCell(it, nRow, *pCell, true, bSingle); return pCell; } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 0856454c85fb..ef81e6d35fd5 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1409,7 +1409,7 @@ ScFormulaCell* ScTable::SetFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* p return NULL; } - return aCol[nCol].SetFormulaCell(nRow, pCell); + return aCol[nCol].SetFormulaCell(nRow, pCell, true); } bool ScTable::SetFormulaCells( SCCOL nCol, SCROW nRow, std::vector<ScFormulaCell*>& rCells ) |