1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #ifndef INCLUDED_SC_INC_LISTENERCONTEXT_HXX
11 #define INCLUDED_SC_INC_LISTENERCONTEXT_HXX
13 #include "address.hxx"
14 #include "columnspanset.hxx"
16 #include <boost/noncopyable.hpp>
17 #include <boost/scoped_ptr.hpp>
18 #include <boost/shared_ptr.hpp>
25 struct ColumnBlockPosition
;
26 class ColumnBlockPositionSet
;
28 class StartListeningContext
: boost::noncopyable
31 boost::shared_ptr
<ColumnBlockPositionSet
> mpSet
;
33 StartListeningContext(ScDocument
& rDoc
);
34 StartListeningContext(ScDocument
& rDoc
, const boost::shared_ptr
<ColumnBlockPositionSet
>& pSet
);
37 ColumnBlockPosition
* getBlockPosition(SCTAB nTab
, SCCOL nCol
);
40 class EndListeningContext
: boost::noncopyable
44 boost::shared_ptr
<ColumnBlockPositionSet
> mpPosSet
;
45 ScTokenArray
* mpOldCode
;
46 ScAddress maPosDelta
; // Add this to get the old position prior to the move.
49 EndListeningContext(ScDocument
& rDoc
, ScTokenArray
* pOldCode
= NULL
);
50 EndListeningContext(ScDocument
& rDoc
, const boost::shared_ptr
<ColumnBlockPositionSet
>& pSet
, ScTokenArray
* pOldCode
= NULL
);
52 void setPositionDelta( const ScAddress
& rDelta
);
55 ScTokenArray
* getOldCode();
56 ScAddress
getOldPosition( const ScAddress
& rPos
) const;
58 ColumnBlockPosition
* getBlockPosition(SCTAB nTab
, SCCOL nCol
);
60 void addEmptyBroadcasterPosition(SCTAB nTab
, SCCOL nCol
, SCROW nRow
);
61 void purgeEmptyBroadcasters();
64 class PurgeListenerAction
: public ColumnSpanSet::Action
, boost::noncopyable
67 boost::scoped_ptr
<ColumnBlockPosition
> mpBlockPos
;
70 PurgeListenerAction( ScDocument
& rDoc
);
72 virtual void startColumn( SCTAB nTab
, SCCOL nCol
) SAL_OVERRIDE
;
73 virtual void execute( const ScAddress
& rPos
, SCROW nLength
, bool bVal
) SAL_OVERRIDE
;
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */