summaryrefslogtreecommitdiff
path: root/sc/inc/refhint.hxx
blob: cfdcaa6ec40e83f468c209f6a41f3e9ebd091f19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef INCLUDED_SC_INC_REFHINT_HXX
#define INCLUDED_SC_INC_REFHINT_HXX

#include "address.hxx"
#include <svl/hint.hxx>

namespace sc {

struct RefUpdateContext;
class ColRowReorderMapType;

class RefHint : public SfxHint
{
public:
    enum Type {
        Moved,
        ColumnReordered,
        RowReordered,
        StartListening,
        StopListening
    };

private:
    Type meType;

protected:
    RefHint( Type eType );

public:
    RefHint() = delete;
    virtual ~RefHint() override = 0;

    RefHint(RefHint const &) = default;
    RefHint(RefHint &&) = default;
    RefHint & operator =(RefHint const &) = default;
    RefHint & operator =(RefHint &&) = default;

    Type getType() const;
};

class RefMovedHint : public RefHint
{
    ScRange maRange;
    ScAddress maMoveDelta;
    const sc::RefUpdateContext& mrCxt;

public:

    RefMovedHint( const ScRange& rRange, const ScAddress& rMove, const sc::RefUpdateContext& rCxt );
    virtual ~RefMovedHint() override;

    /**
     * Get the source range from which the references have moved.
     */
    const ScRange& getRange() const;

    /**
     * Get the movement vector.
     */
    const ScAddress& getDelta() const;

    const sc::RefUpdateContext& getContext() const;
};

class RefColReorderHint : public RefHint
{
    const sc::ColRowReorderMapType& mrColMap;
    SCTAB mnTab;
    SCROW mnRow1;
    SCROW mnRow2;

public:
    RefColReorderHint( const sc::ColRowReorderMapType& rColMap, SCTAB nTab, SCROW nRow1, SCROW nRow2 );
    virtual ~RefColReorderHint() override;

    RefColReorderHint(RefColReorderHint const &) = default;
    RefColReorderHint(RefColReorderHint &&) = default;
    RefColReorderHint & operator =(RefColReorderHint const &) = delete; // due to mrColMap
    RefColReorderHint & operator =(RefColReorderHint &&) = delete; // due to mrColMap

    const sc::ColRowReorderMapType& getColMap() const;

    SCTAB getTab() const;
    SCROW getStartRow() const;
    SCROW getEndRow() const;
};

class RefRowReorderHint : public RefHint
{
    const sc::ColRowReorderMapType& mrRowMap;
    SCTAB mnTab;
    SCCOL mnCol1;
    SCCOL mnCol2;

public:
    RefRowReorderHint( const sc::ColRowReorderMapType& rRowMap, SCTAB nTab, SCCOL nCol1, SCCOL nCol2 );
    virtual ~RefRowReorderHint() override;

    RefRowReorderHint(RefRowReorderHint const &) = default;
    RefRowReorderHint(RefRowReorderHint &&) = default;
    RefRowReorderHint & operator =(RefRowReorderHint const &) = delete; // due to mrRowMap
    RefRowReorderHint & operator =(RefRowReorderHint &&) = delete; // due to mrRowMap

    const sc::ColRowReorderMapType& getRowMap() const;

    SCTAB getTab() const;
    SCCOL getStartColumn() const;
    SCCOL getEndColumn() const;
};

class RefStartListeningHint : public RefHint
{
public:
    RefStartListeningHint();
    virtual ~RefStartListeningHint() override;
};

class RefStopListeningHint : public RefHint
{
public:
    RefStopListeningHint();
    virtual ~RefStopListeningHint() override;
};

}

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */