LibreOffice Module sc (master) 1
listenercontext.cxx
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#include <listenercontext.hxx>
11#include <document.hxx>
12#include <mtvelements.hxx>
13#include <utility>
14
15namespace sc {
16
18 mrDoc(rDoc), mpSet(std::make_shared<ColumnBlockPositionSet>(rDoc)) {}
19
21 ScDocument& rDoc, std::shared_ptr<ColumnBlockPositionSet> pSet) :
22 mrDoc(rDoc), mpSet(std::move(pSet)) {}
23
24void StartListeningContext::setColumnSet( const std::shared_ptr<const ColumnSet>& rpColSet )
25{
26 mpColSet = rpColSet;
27}
28
29const std::shared_ptr<const ColumnSet>& StartListeningContext::getColumnSet() const
30{
31 return mpColSet;
32}
33
35{
36 return mpSet->getBlockPosition(nTab, nCol);
37}
38
40 mrDoc(rDoc), mpPosSet(std::make_shared<ColumnBlockPositionSet>(rDoc)),
41 mpOldCode(pOldCode), maPosDelta(0,0,0) {}
42
44 ScDocument& rDoc, std::shared_ptr<ColumnBlockPositionSet> pSet, ScTokenArray* pOldCode) :
45 mrDoc(rDoc), mpPosSet(std::move(pSet)),
46 mpOldCode(pOldCode), maPosDelta(0,0,0) {}
47
49{
50 maPosDelta = rDelta;
51}
52
54{
55 ScAddress aOldPos = rPos;
56 aOldPos.IncCol(maPosDelta.Col());
57 aOldPos.IncRow(maPosDelta.Row());
58 aOldPos.IncTab(maPosDelta.Tab());
59 return aOldPos;
60}
61
63{
64 return mpPosSet->getBlockPosition(nTab, nCol);
65}
66
68{
69 maSet.set(mrDoc, nTab, nCol, nRow, true);
70}
71
73{
75 maSet.executeAction(mrDoc, aAction);
76}
77
79 mrDoc(rDoc), mpBlockPos(new ColumnBlockPosition) {}
80
82{
84}
85
86void PurgeListenerAction::execute( const ScAddress& rPos, SCROW nLength, bool bVal )
87{
88 if (bVal)
89 {
91 }
92};
93
94}
95
96/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void IncTab(SCTAB nDelta=1)
Definition: address.hxx:320
SCTAB Tab() const
Definition: address.hxx:283
void IncCol(SCCOL nDelta=1)
Definition: address.hxx:316
SCROW Row() const
Definition: address.hxx:274
void IncRow(SCROW nDelta=1)
Definition: address.hxx:312
SCCOL Col() const
Definition: address.hxx:279
void DeleteBroadcasters(sc::ColumnBlockPosition &rBlockPos, const ScAddress &rTopPos, SCROW nLength)
Definition: document.cxx:2512
SC_DLLPUBLIC bool InitColumnBlockPosition(sc::ColumnBlockPosition &rBlockPos, SCTAB nTab, SCCOL nCol)
Definition: document.cxx:2663
void executeAction(ScDocument &rDoc, Action &ac) const
void set(const ScDocument &rDoc, SCTAB nTab, SCCOL nCol, SCROW nRow, bool bVal)
void setPositionDelta(const ScAddress &rDelta)
void addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow)
ScAddress getOldPosition(const ScAddress &rPos) const
std::shared_ptr< ColumnBlockPositionSet > mpPosSet
EndListeningContext(const EndListeningContext &)=delete
ColumnBlockPosition * getBlockPosition(SCTAB nTab, SCCOL nCol)
virtual void startColumn(SCTAB nTab, SCCOL nCol) override
std::unique_ptr< ColumnBlockPosition > mpBlockPos
virtual void execute(const ScAddress &rPos, SCROW nLength, bool bVal) override
PurgeListenerAction(const PurgeListenerAction &)=delete
std::shared_ptr< ColumnBlockPositionSet > mpSet
void setColumnSet(const std::shared_ptr< const ColumnSet > &pColSet)
ColumnBlockPosition * getBlockPosition(SCTAB nTab, SCCOL nCol)
StartListeningContext(const StartListeningContext &)=delete
std::shared_ptr< const ColumnSet > mpColSet
const std::shared_ptr< const ColumnSet > & getColumnSet() const
std::shared_ptr< T > make_shared(Args &&... args)
CAUTION! The following defines must be in the same namespace as the respective type.
Store position data for column array storage.
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
sal_Int32 nLength