1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
12 #include "address.hxx"
13 #include "columnspanset.hxx"
14 #include "mtvelements.hxx"
25 class StartListeningContext
28 std::shared_ptr
<ColumnBlockPositionSet
> mpSet
;
29 std::shared_ptr
<const ColumnSet
> mpColSet
;
32 StartListeningContext(const StartListeningContext
&) = delete;
33 const StartListeningContext
& operator=(const StartListeningContext
&) = delete;
34 StartListeningContext(ScDocument
& rDoc
);
35 StartListeningContext(ScDocument
& rDoc
, 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
; }
40 ColumnBlockPosition
* getBlockPosition(SCTAB nTab
, SCCOL nCol
);
43 class EndListeningContext
47 std::shared_ptr
<ColumnBlockPositionSet
> mpPosSet
;
48 ScTokenArray
* mpOldCode
;
49 ScAddress maPosDelta
; // Add this to get the old position prior to the move.
52 EndListeningContext(const EndListeningContext
&) = delete;
53 const EndListeningContext
& operator=(const EndListeningContext
&) = delete;
54 EndListeningContext(ScDocument
& rDoc
, ScTokenArray
* pOldCode
= nullptr);
55 EndListeningContext(ScDocument
& rDoc
, std::shared_ptr
<ColumnBlockPositionSet
> pSet
,
56 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 final
: public ColumnSpanSet::Action
73 std::unique_ptr
<ColumnBlockPosition
> mpBlockPos
;
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
;
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */