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 INCLUDED_SC_INC_LISTENERCONTEXT_HXX
11 : #define INCLUDED_SC_INC_LISTENERCONTEXT_HXX
12 :
13 : #include "address.hxx"
14 : #include "columnspanset.hxx"
15 :
16 : #include <boost/noncopyable.hpp>
17 : #include <boost/scoped_ptr.hpp>
18 : #include <boost/shared_ptr.hpp>
19 :
20 : class ScDocument;
21 : class ScTokenArray;
22 :
23 : namespace sc {
24 :
25 : struct ColumnBlockPosition;
26 : class ColumnBlockPositionSet;
27 :
28 2997 : class StartListeningContext : boost::noncopyable
29 : {
30 : ScDocument& mrDoc;
31 : boost::shared_ptr<ColumnBlockPositionSet> mpSet;
32 : public:
33 : StartListeningContext(ScDocument& rDoc);
34 : StartListeningContext(ScDocument& rDoc, const boost::shared_ptr<ColumnBlockPositionSet>& pSet);
35 7058 : ScDocument& getDoc() { return mrDoc;}
36 :
37 : ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
38 : };
39 :
40 1615 : class EndListeningContext : boost::noncopyable
41 : {
42 : ScDocument& mrDoc;
43 : ColumnSpanSet maSet;
44 : boost::shared_ptr<ColumnBlockPositionSet> mpPosSet;
45 : ScTokenArray* mpOldCode;
46 : ScAddress maPosDelta; // Add this to get the old position prior to the move.
47 :
48 : public:
49 : EndListeningContext(ScDocument& rDoc, ScTokenArray* pOldCode = NULL);
50 : EndListeningContext(ScDocument& rDoc, const boost::shared_ptr<ColumnBlockPositionSet>& pSet, ScTokenArray* pOldCode = NULL);
51 :
52 : void setPositionDelta( const ScAddress& rDelta );
53 :
54 2148 : ScDocument& getDoc() { return mrDoc;}
55 521 : ScTokenArray* getOldCode() { return mpOldCode;}
56 : ScAddress getOldPosition( const ScAddress& rPos ) const;
57 :
58 : ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
59 :
60 : void addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow);
61 : void purgeEmptyBroadcasters();
62 : };
63 :
64 420 : class PurgeListenerAction : public ColumnSpanSet::Action, boost::noncopyable
65 : {
66 : ScDocument& mrDoc;
67 : boost::scoped_ptr<ColumnBlockPosition> mpBlockPos;
68 :
69 : public:
70 : PurgeListenerAction( ScDocument& rDoc );
71 :
72 : virtual void startColumn( SCTAB nTab, SCCOL nCol ) SAL_OVERRIDE;
73 : virtual void execute( const ScAddress& rPos, SCROW nLength, bool bVal ) SAL_OVERRIDE;
74 : };
75 :
76 : }
77 :
78 : #endif
79 :
80 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|