Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / listenercontext.hxx
blobad413490b65d83f1b4fd948c9a0ae5edf5707222
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #ifndef INCLUDED_SC_INC_LISTENERCONTEXT_HXX
11 #define INCLUDED_SC_INC_LISTENERCONTEXT_HXX
13 #include "address.hxx"
14 #include "columnspanset.hxx"
16 #include <memory>
18 class ScDocument;
19 class ScTokenArray;
21 namespace sc {
23 struct ColumnBlockPosition;
24 class ColumnBlockPositionSet;
25 class ColumnSet;
27 class StartListeningContext
29 ScDocument& mrDoc;
30 std::shared_ptr<ColumnBlockPositionSet> mpSet;
31 std::shared_ptr<const ColumnSet> mpColSet;
32 public:
33 StartListeningContext(const StartListeningContext&) = delete;
34 const StartListeningContext& operator=(const StartListeningContext&) = delete;
35 StartListeningContext(ScDocument& rDoc);
36 StartListeningContext(ScDocument& rDoc, const std::shared_ptr<ColumnBlockPositionSet>& pSet);
37 void setColumnSet( const std::shared_ptr<const ColumnSet>& pColSet );
38 const std::shared_ptr<const ColumnSet>& getColumnSet() const;
39 ScDocument& getDoc() { return mrDoc;}
41 ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
44 class EndListeningContext
46 ScDocument& mrDoc;
47 ColumnSpanSet maSet;
48 std::shared_ptr<ColumnBlockPositionSet> mpPosSet;
49 ScTokenArray* mpOldCode;
50 ScAddress maPosDelta; // Add this to get the old position prior to the move.
52 public:
53 EndListeningContext(const EndListeningContext&) = delete;
54 const EndListeningContext& operator=(const EndListeningContext&) = delete;
55 EndListeningContext(ScDocument& rDoc, ScTokenArray* pOldCode = nullptr);
56 EndListeningContext(ScDocument& rDoc, const std::shared_ptr<ColumnBlockPositionSet>& pSet, ScTokenArray* pOldCode = nullptr);
58 void setPositionDelta( const ScAddress& rDelta );
60 ScDocument& getDoc() { return mrDoc;}
61 ScTokenArray* getOldCode() { return mpOldCode;}
62 ScAddress getOldPosition( const ScAddress& rPos ) const;
64 ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
66 void addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow);
67 void purgeEmptyBroadcasters();
70 class PurgeListenerAction : public ColumnSpanSet::Action
72 ScDocument& mrDoc;
73 std::unique_ptr<ColumnBlockPosition> mpBlockPos;
75 public:
76 PurgeListenerAction(const PurgeListenerAction&) = delete;
77 const PurgeListenerAction& operator=(const PurgeListenerAction&) = delete;
78 PurgeListenerAction( ScDocument& rDoc );
80 virtual void startColumn( SCTAB nTab, SCCOL nCol ) override;
81 virtual void execute( const ScAddress& rPos, SCROW nLength, bool bVal ) override;
86 #endif
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */