Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : */
9 :
10 : #ifndef SC_LISTENERCONTEXT_HXX
11 : #define SC_LISTENERCONTEXT_HXX
12 :
13 : #include "address.hxx"
14 : #include "columnspanset.hxx"
15 :
16 : #include <boost/noncopyable.hpp>
17 : #include <boost/scoped_ptr.hpp>
18 :
19 : class ScDocument;
20 : class ScTokenArray;
21 :
22 : namespace sc {
23 :
24 : struct ColumnBlockPosition;
25 : class ColumnBlockPositionSet;
26 :
27 0 : class StartListeningContext : boost::noncopyable
28 : {
29 : ScDocument& mrDoc;
30 : boost::scoped_ptr<ColumnBlockPositionSet> mpSet;
31 : public:
32 : StartListeningContext(ScDocument& rDoc);
33 : ScDocument& getDoc();
34 :
35 : ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
36 : };
37 :
38 0 : class EndListeningContext : boost::noncopyable
39 : {
40 : ScDocument& mrDoc;
41 : ColumnSpanSet maSet;
42 : boost::scoped_ptr<ColumnBlockPositionSet> mpPosSet;
43 : ScTokenArray* mpOldCode;
44 : ScAddress maPosDelta; // Add this to get the old position prior to the move.
45 :
46 : public:
47 : EndListeningContext(ScDocument& rDoc, ScTokenArray* pOldCode = NULL);
48 :
49 : void setPositionDelta( const ScAddress& rDelta );
50 :
51 : ScDocument& getDoc();
52 : ScTokenArray* getOldCode();
53 : ScAddress getOldPosition( const ScAddress& rPos ) const;
54 :
55 : ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
56 :
57 : void addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow);
58 : void purgeEmptyBroadcasters();
59 : };
60 :
61 0 : class PurgeListenerAction : public ColumnSpanSet::Action, boost::noncopyable
62 : {
63 : ScDocument& mrDoc;
64 : boost::scoped_ptr<ColumnBlockPosition> mpBlockPos;
65 :
66 : public:
67 : PurgeListenerAction( ScDocument& rDoc );
68 :
69 : virtual void startColumn( SCTAB nTab, SCCOL nCol ) SAL_OVERRIDE;
70 : virtual void execute( const ScAddress& rPos, SCROW nLength, bool bVal ) SAL_OVERRIDE;
71 : };
72 :
73 : }
74 :
75 : #endif
76 :
77 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|