diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-14 23:15:32 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-15 00:15:06 -0400 |
commit | 88955714d345d8584e86ae34bf5f5d1f3f4af9f7 (patch) | |
tree | 0ff18e33c5cf692327f5187331b47fecce53b2a0 /sc/inc | |
parent | 980898058f1411d234c009caaae58b29eb3420c8 (diff) |
fdo#71491: Adjust reference during undo of drag-n-drop of cell range.
Also with this commit, the signature of SvtListener::Notify() changes,
by dropping the first argument which nobody uses. This change was necessary
in order to call it directly without needing to pass any broadcaster instance.
Change-Id: I6a1e97f0fb1e070d1d8f7db614690b04c9e8024e
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/brdcst.hxx | 6 | ||||
-rw-r--r-- | sc/inc/cellsuno.hxx | 2 | ||||
-rw-r--r-- | sc/inc/chartlis.hxx | 2 | ||||
-rw-r--r-- | sc/inc/column.hxx | 3 | ||||
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/inc/formulacell.hxx | 2 | ||||
-rw-r--r-- | sc/inc/lookupcache.hxx | 2 | ||||
-rw-r--r-- | sc/inc/mtvcellfunc.hxx | 10 | ||||
-rw-r--r-- | sc/inc/refhint.hxx | 62 | ||||
-rw-r--r-- | sc/inc/simplehintids.hxx | 22 | ||||
-rw-r--r-- | sc/inc/table.hxx | 10 | ||||
-rw-r--r-- | sc/inc/tokenarray.hxx | 10 |
12 files changed, 124 insertions, 9 deletions
diff --git a/sc/inc/brdcst.hxx b/sc/inc/brdcst.hxx index beef7749b440..b328becc244a 100644 --- a/sc/inc/brdcst.hxx +++ b/sc/inc/brdcst.hxx @@ -21,16 +21,12 @@ #include "global.hxx" #include "address.hxx" +#include <simplehintids.hxx> #include <tools/rtti.hxx> #include <svl/hint.hxx> -#include <svl/smplhint.hxx> class SvtBroadcaster; -#define SC_HINT_DATACHANGED SFX_HINT_DATACHANGED -#define SC_HINT_TABLEOPDIRTY SFX_HINT_USER00 -#define SC_HINT_CALCALL SFX_HINT_USER01 - class ScHint : public SfxSimpleHint { ScAddress aAddress; diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx index 9ab5b27d71f0..09e112e6497d 100644 --- a/sc/inc/cellsuno.hxx +++ b/sc/inc/cellsuno.hxx @@ -115,7 +115,7 @@ class ScLinkListener : public SvtListener public: ScLinkListener(const Link& rL) : aLink(rL) {} virtual ~ScLinkListener(); - virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); + virtual void Notify( const SfxHint& rHint ); }; typedef ::com::sun::star::uno::Reference< diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx index ea80fa76679e..d04a1ab9b857 100644 --- a/sc/inc/chartlis.hxx +++ b/sc/inc/chartlis.hxx @@ -92,7 +92,7 @@ public: bool IsUno() const { return (pUnoData != NULL); } - virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); + virtual void Notify( const SfxHint& rHint ); void StartListeningTo(); void EndListeningTo(); void ChangeListening( const ScRangeListRef& rRangeListRef, diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index de2821451499..c9e97572de65 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -61,6 +61,7 @@ struct RowSpan; class RowHeightContext; class CompileFormulaContext; struct SetFormulaDirtyContext; +class RefMovedHint; } @@ -462,6 +463,8 @@ public: void StartNeededListeners(); // only for cells where NeedsListening()==true void SetDirtyIfPostponed(); void BroadcastRecalcOnRefMove(); + void BroadcastRefMoved( const sc::RefMovedHint& rHint ); + void TransferListeners( ScColumn& rDestCol, SCROW nRow1, SCROW nRow2, SCROW nRowDelta ); void CompileDBFormula( sc::CompileFormulaContext& rCxt ); void CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 2d39f5ac175f..05afc1c87a5d 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -77,6 +77,7 @@ class DocumentLinkManager; class CellValues; class RowHeightContext; struct SetFormulaDirtyContext; +class RefMovedHint; } @@ -1829,6 +1830,7 @@ public: void Broadcast( const ScHint& rHint ); void BroadcastCells( const ScRange& rRange, sal_uLong nHint ); + void BroadcastRefMoved( const sc::RefMovedHint& rHint ); /// only area, no cell broadcast void AreaBroadcast( const ScHint& rHint ); diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 9b47046c36e7..81dd1fdfdf2e 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -314,7 +314,7 @@ public: void SetPreviousTrack( ScFormulaCell* pF ); void SetNextTrack( ScFormulaCell* pF ); - virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint); + virtual void Notify( const SfxHint& rHint ); void SetCompile( bool bVal ); ScDocument* GetDocument() const; void SetMatColsRows( SCCOL nCols, SCROW nRows, bool bDirtyFlag=true ); diff --git a/sc/inc/lookupcache.hxx b/sc/inc/lookupcache.hxx index 0b6c53baec4f..2f73930e2e64 100644 --- a/sc/inc/lookupcache.hxx +++ b/sc/inc/lookupcache.hxx @@ -120,7 +120,7 @@ public: ScLookupCache( ScDocument * pDoc, const ScRange & rRange ); virtual ~ScLookupCache(); /// Remove from document structure and delete (!) cache on modify hint. - virtual void Notify( SvtBroadcaster & rBC, const SfxHint & rHint ); + virtual void Notify( const SfxHint& rHint ); /// @returns document address in o_rAddress if Result==FOUND Result lookup( ScAddress & o_rResultAddress, diff --git a/sc/inc/mtvcellfunc.hxx b/sc/inc/mtvcellfunc.hxx index d5e79218a350..092dcf7a54c1 100644 --- a/sc/inc/mtvcellfunc.hxx +++ b/sc/inc/mtvcellfunc.hxx @@ -187,6 +187,16 @@ ProcessNote( CellNoteStoreType, cellnote_block, _FuncElem, FuncElseNoOp<size_t> >(it, rStore, nRow1, nRow2, rFuncElem, aElse); } +template<typename _FuncElem> +typename BroadcasterStoreType::iterator +ProcessBroadcaster( + const BroadcasterStoreType::iterator& it, BroadcasterStoreType& rStore, SCROW nRow1, SCROW nRow2, _FuncElem& rFuncElem) +{ + FuncElseNoOp<size_t> aElse; + return ProcessElements1< + BroadcasterStoreType, broadcaster_block, _FuncElem, FuncElseNoOp<size_t> >(it, rStore, nRow1, nRow2, rFuncElem, aElse); +} + } #endif diff --git a/sc/inc/refhint.hxx b/sc/inc/refhint.hxx new file mode 100644 index 000000000000..ec56735faaf3 --- /dev/null +++ b/sc/inc/refhint.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef SC_REFHINT_HXX +#define SC_REFHINT_HXX + +#include <address.hxx> +#include <simplehintids.hxx> + +namespace sc { + +class RefHint : public SfxSimpleHint +{ +public: + enum Type { Moved }; + +private: + Type meType; + + RefHint(); // disabled + +protected: + RefHint( Type eType ); + +public: + virtual ~RefHint() = 0; + + Type getType() const; +}; + +class RefMovedHint : public RefHint +{ + ScRange maRange; + ScAddress maMoveDelta; + +public: + + RefMovedHint( const ScRange& rRange, const ScAddress& rMove ); + virtual ~RefMovedHint(); + + /** + * Get the source range from which the references have moved. + */ + const ScRange& getRange() const; + + /** + * Get the movement vector. + */ + const ScAddress& getDelta() const; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/simplehintids.hxx b/sc/inc/simplehintids.hxx new file mode 100644 index 000000000000..ecf2f9357c2d --- /dev/null +++ b/sc/inc/simplehintids.hxx @@ -0,0 +1,22 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef SC_SIMPLEHINTIDS_HXX +#define SC_SIMPLEHINTIDS_HXX + +#include <svl/smplhint.hxx> + +#define SC_HINT_DATACHANGED SFX_HINT_DATACHANGED +#define SC_HINT_TABLEOPDIRTY SFX_HINT_USER00 +#define SC_HINT_CALCALL SFX_HINT_USER01 +#define SC_HINT_REFERENCE SFX_HINT_USER02 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 8cf0fb1d6815..ce58c206558c 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -72,6 +72,7 @@ class CellValues; class RowHeightContext; class CompileFormulaContext; struct SetFormulaDirtyContext; +class RefMovedHint; } @@ -896,6 +897,15 @@ public: */ void BroadcastRecalcOnRefMove(); + /** + * Broadcast all listeners of specified range that the range have moved. + */ + void BroadcastRefMoved( const sc::RefMovedHint& rHint ); + + void TransferListeners( + ScTable& rDestTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + SCCOL nColDelta, SCROW nRowDelta ); + void TransferCellValuesTo( SCCOL nCol, SCROW nRow, size_t nLen, sc::CellValues& rDest ); void CopyCellValuesFrom( SCCOL nCol, SCROW nRow, const sc::CellValues& rSrc ); diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx index 312e63a5584a..eb68997b8cad 100644 --- a/sc/inc/tokenarray.hxx +++ b/sc/inc/tokenarray.hxx @@ -144,6 +144,16 @@ public: const sc::RefUpdateContext& rCxt, const ScAddress& rOldPos, const ScAddress& rNewPos ); /** + * Move reference positions that are within specified moved range. + * + * @param rPos position of this formula cell + * @param rMovedRange range that has been moved. + * @param rDelta movement vector. + */ + void MoveReference( + const ScAddress& rPos, const ScRange& rMovedRange, const ScAddress& rDelta ); + + /** * Adjust all references in named expression. In named expression, we only * update absolute positions, and leave relative positions intact. * |