LibreOffice Module sc (master)  1
listenercontext.hxx
Go to the documentation of this file.
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 #include "mtvelements.hxx"
16 
17 #include <memory>
18 
19 class ScDocument;
20 class ScTokenArray;
21 
22 namespace sc
23 {
24 class ColumnSet;
25 
27 {
29  std::shared_ptr<ColumnBlockPositionSet> mpSet;
30  std::shared_ptr<const ColumnSet> mpColSet;
31 
32 public:
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; }
40 
42 };
43 
45 {
48  std::shared_ptr<ColumnBlockPositionSet> mpPosSet;
50  ScAddress maPosDelta; // Add this to get the old position prior to the move.
51 
52 public:
54  const EndListeningContext& operator=(const EndListeningContext&) = delete;
55  EndListeningContext(ScDocument& rDoc, ScTokenArray* pOldCode = nullptr);
56  EndListeningContext(ScDocument& rDoc, const std::shared_ptr<ColumnBlockPositionSet>& pSet,
57  ScTokenArray* pOldCode = nullptr);
58 
59  void setPositionDelta(const ScAddress& rDelta);
60 
61  ScDocument& getDoc() { return mrDoc; }
63  ScAddress getOldPosition(const ScAddress& rPos) const;
64 
66 
67  void addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow);
69 };
70 
72 {
74  std::unique_ptr<ColumnBlockPosition> mpBlockPos;
75 
76 public:
78  const PurgeListenerAction& operator=(const PurgeListenerAction&) = delete;
80 
81  virtual void startColumn(SCTAB nTab, SCCOL nCol) override;
82  virtual void execute(const ScAddress& rPos, SCROW nLength, bool bVal) override;
83 };
84 }
85 
86 #endif
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void setPositionDelta(const ScAddress &rDelta)
std::shared_ptr< ColumnBlockPositionSet > mpSet
PurgeListenerAction(const PurgeListenerAction &)=delete
Store position data for column array storage.
void addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow)
const PurgeListenerAction & operator=(const PurgeListenerAction &)=delete
ColumnBlockPosition * getBlockPosition(SCTAB nTab, SCCOL nCol)
const EndListeningContext & operator=(const EndListeningContext &)=delete
virtual void startColumn(SCTAB nTab, SCCOL nCol) override
const std::shared_ptr< const ColumnSet > & getColumnSet() const
ScTokenArray * getOldCode()
ScAddress getOldPosition(const ScAddress &rPos) const
EndListeningContext(const EndListeningContext &)=delete
ColumnBlockPosition * getBlockPosition(SCTAB nTab, SCCOL nCol)
const StartListeningContext & operator=(const StartListeningContext &)=delete
sal_Int16 SCCOL
Definition: types.hxx:22
StartListeningContext(const StartListeningContext &)=delete
std::shared_ptr< ColumnBlockPositionSet > mpPosSet
Structure that stores segments of boolean flags per column, and perform custom action on those segmen...
std::shared_ptr< const ColumnSet > mpColSet
virtual void execute(const ScAddress &rPos, SCROW nLength, bool bVal) override
sal_Int32 SCROW
Definition: types.hxx:18
std::unique_ptr< ColumnBlockPosition > mpBlockPos
void setColumnSet(const std::shared_ptr< const ColumnSet > &pColSet)
sal_Int16 SCTAB
Definition: types.hxx:23