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 #pragma once
11 
12 #include "address.hxx"
13 #include "columnspanset.hxx"
14 #include "mtvelements.hxx"
15 
16 #include <memory>
17 
18 class ScDocument;
19 class ScTokenArray;
20 
21 namespace sc
22 {
23 class ColumnSet;
24 
26 {
28  std::shared_ptr<ColumnBlockPositionSet> mpSet;
29  std::shared_ptr<const ColumnSet> mpColSet;
30 
31 public:
35  StartListeningContext(ScDocument& rDoc, const std::shared_ptr<ColumnBlockPositionSet>& pSet);
36  void setColumnSet(const std::shared_ptr<const ColumnSet>& pColSet);
37  const std::shared_ptr<const ColumnSet>& getColumnSet() const;
38  ScDocument& getDoc() { return mrDoc; }
39 
41 };
42 
44 {
47  std::shared_ptr<ColumnBlockPositionSet> mpPosSet;
49  ScAddress maPosDelta; // Add this to get the old position prior to the move.
50 
51 public:
53  const EndListeningContext& operator=(const EndListeningContext&) = delete;
54  EndListeningContext(ScDocument& rDoc, ScTokenArray* pOldCode = nullptr);
55  EndListeningContext(ScDocument& rDoc, const std::shared_ptr<ColumnBlockPositionSet>& pSet,
56  ScTokenArray* pOldCode = nullptr);
57 
58  void setPositionDelta(const ScAddress& rDelta);
59 
60  ScDocument& getDoc() { return mrDoc; }
62  ScAddress getOldPosition(const ScAddress& rPos) const;
63 
65 
66  void addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow);
68 };
69 
71 {
73  std::unique_ptr<ColumnBlockPosition> mpBlockPos;
74 
75 public:
77  const PurgeListenerAction& operator=(const PurgeListenerAction&) = delete;
79 
80  virtual void startColumn(SCTAB nTab, SCCOL nCol) override;
81  virtual void execute(const ScAddress& rPos, SCROW nLength, bool bVal) override;
82 };
83 }
84 
85 /* 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:21
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:17
std::unique_ptr< ColumnBlockPosition > mpBlockPos
void setColumnSet(const std::shared_ptr< const ColumnSet > &pColSet)
sal_Int16 SCTAB
Definition: types.hxx:22