diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-25 00:02:21 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-25 10:00:14 -0500 |
commit | 0dae7466fff1e742543ef7512b7dd22472c75624 (patch) | |
tree | c9f146abd01a7cabd81944fd794c133cdecadca3 /sc/inc | |
parent | 8c041824b67caa53d3f7f96803b7a69ced6614b5 (diff) |
Adjust ref undo to ensure group area listeners are used.
When undoing row deletion (and possibly other similar undo's). And
write test for it.
Change-Id: I04b4fd9932f4236f124dcd25967355c6055dec33
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/cellvalue.hxx | 2 | ||||
-rw-r--r-- | sc/inc/clipcontext.hxx | 5 | ||||
-rw-r--r-- | sc/inc/column.hxx | 17 | ||||
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/inc/formulacell.hxx | 9 | ||||
-rw-r--r-- | sc/inc/grouparealistener.hxx | 6 | ||||
-rw-r--r-- | sc/inc/stringutil.hxx | 3 | ||||
-rw-r--r-- | sc/inc/table.hxx | 5 | ||||
-rw-r--r-- | sc/inc/types.hxx | 7 |
9 files changed, 44 insertions, 12 deletions
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index 9154e30ddacd..3a2d3c8678d1 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -76,7 +76,7 @@ struct SC_DLLPUBLIC ScCellValue */ void release( ScDocument& rDoc, const ScAddress& rPos ); - void release( ScColumn& rColumn, SCROW nRow ); + void release( ScColumn& rColumn, SCROW nRow, sc::StartListeningType eListenType = sc::SingleCellListening ); OUString getString( const ScDocument* pDoc ); diff --git a/sc/inc/clipcontext.hxx b/sc/inc/clipcontext.hxx index 3891274d7283..aa783e4aa203 100644 --- a/sc/inc/clipcontext.hxx +++ b/sc/inc/clipcontext.hxx @@ -144,9 +144,14 @@ public: class CopyToDocContext : public ClipContextBase { + bool mbStartListening; + public: CopyToDocContext(ScDocument& rDoc); virtual ~CopyToDocContext(); + + void setStartListening( bool b ); + bool isStartListening() const; }; class MixDocContext : public ClipContextBase diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 102af126fc78..7f883a63ed76 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -314,8 +314,12 @@ public: * @return pCell if it was successfully inserted, NULL otherwise. pCell * is deleted automatically on failure to insert. */ - ScFormulaCell* SetFormulaCell( SCROW nRow, ScFormulaCell* pCell, bool bSingle = false ); - ScFormulaCell* SetFormulaCell( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell ); + ScFormulaCell* SetFormulaCell( + SCROW nRow, ScFormulaCell* pCell, + sc::StartListeningType eListenType = sc::SingleCellListening ); + ScFormulaCell* SetFormulaCell( + sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell, + sc::StartListeningType eListenType = sc::SingleCellListening ); bool SetFormulaCells( SCROW nRow, std::vector<ScFormulaCell*>& rCells ); @@ -639,10 +643,15 @@ 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, bool bSingle = false ); + const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell, + bool bJoin = true, sc::StartListeningType eListenType = sc::SingleCellListening ); + void AttachNewFormulaCell( - const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin = true, bool bSingle = false ); + const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, + bool bJoin = true, sc::StartListeningType eListenType = sc::SingleCellListening ); + 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/inc/document.hxx b/sc/inc/document.hxx index 554ee3a9afc1..31fde4db04c5 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1916,6 +1916,8 @@ public: void SetHardRecalcState( bool bVal ) { bHardRecalcState = bVal; } void StartAllListeners(); void StartNeededListeners(); + void StartAllListeners( const ScRange& rRange ); + void EndAllListeners( const ScRange& rRange ); const ScFormulaCell* GetFormulaTree() const { return pFormulaTree; } bool HasForcedFormulas() const { return bHasForcedFormulas; } void SetForcedFormulas( bool bVal ) { bHasForcedFormulas = bVal; } diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 50a6f6cb3a64..86b8045ee1d6 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -23,7 +23,6 @@ #include <set> #include <boost/noncopyable.hpp> -#include <boost/ptr_container/ptr_vector.hpp> #include <formula/tokenarray.hxx> #include <osl/conditn.hxx> @@ -58,7 +57,11 @@ class ScTokenArray; struct SC_DLLPUBLIC ScFormulaCellGroup : boost::noncopyable { - typedef boost::ptr_vector<sc::FormulaGroupAreaListener> AreaListenersType; +private: + struct Impl; + Impl* mpImpl; + +public: mutable size_t mnRefCount; @@ -73,8 +76,6 @@ struct SC_DLLPUBLIC ScFormulaCellGroup : boost::noncopyable sal_uInt8 meCalcState; sal_uInt8 meKernelState; - AreaListenersType maAreaListeners; - ScFormulaCellGroup(); ~ScFormulaCellGroup(); diff --git a/sc/inc/grouparealistener.hxx b/sc/inc/grouparealistener.hxx index 5abb0e8ebb92..2c6ea50e2f8c 100644 --- a/sc/inc/grouparealistener.hxx +++ b/sc/inc/grouparealistener.hxx @@ -32,6 +32,7 @@ class FormulaGroupAreaListener : public SvtListener FormulaGroupAreaListener(); // disabled public: + FormulaGroupAreaListener( const ScRange& rRange, ScFormulaCell** ppTopCell, SCROW nGroupLen, bool bStartFixed, bool bEndFixed ); @@ -52,10 +53,11 @@ public: */ void collectFormulaCells( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<ScFormulaCell*>& rCells ) const; -#if DEBUG_AREA_BROADCASTER ScAddress getTopCellPos() const; + const ScRange& getRange() const; SCROW getGroupLength() const; -#endif + bool isStartFixed() const; + bool isEndFixed() const; private: void notifyCellChange( const SfxHint& rHint, const ScAddress& rPos ); diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx index 0d536db87836..ef7bd50f3db6 100644 --- a/sc/inc/stringutil.hxx +++ b/sc/inc/stringutil.hxx @@ -23,6 +23,7 @@ #include <rtl/ustring.hxx> #include "scdllapi.h" #include <i18nlangtag/lang.h> +#include <types.hxx> class SvNumberFormatter; @@ -79,6 +80,8 @@ struct SC_DLLPUBLIC ScSetStringParam */ bool mbHandleApostrophe; + sc::StartListeningType meStartListening; + ScSetStringParam(); /** diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 0d0a5c43a9c0..df3372ecef3f 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -437,10 +437,13 @@ public: sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, ScTable* pTable ); - void StartListeningFromClip( + void StartListeningFormulaCells( sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + void EndListeningFormulaCells( + sc::EndListeningContext& rEndCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + void SetDirtyFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans ); diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx index e483b1eff98e..d92c9b5b9430 100644 --- a/sc/inc/types.hxx +++ b/sc/inc/types.hxx @@ -108,6 +108,13 @@ enum AreaOverlapType OneColumnInsideArea }; +enum StartListeningType +{ + ConvertToGroupListening, + SingleCellListening, + NoListening +}; + } #endif |