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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
/* -*- 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_CLIPCONTEXT_HXX
#define INCLUDED_SC_INC_CLIPCONTEXT_HXX
#include "address.hxx"
#include "cellvalue.hxx"
#include "celltextattr.hxx"
#include <memory>
#include <vector>
class ScDocument;
class ScColumn;
class ScPatternAttr;
class ScPostIt;
class ScConditionalFormatList;
namespace sc {
struct ColumnBlockPosition;
class ColumnBlockPositionSet;
class ClipContextBase
{
std::unique_ptr<ColumnBlockPositionSet> mpSet;
public:
ClipContextBase() = delete;
ClipContextBase(const ClipContextBase&) = delete;
const ClipContextBase& operator=(const ClipContextBase&) = delete;
ClipContextBase(ScDocument& rDoc);
virtual ~ClipContextBase();
ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
ColumnBlockPositionSet* getBlockPositionSet() { return mpSet.get(); }
};
class CopyFromClipContext final : public ClipContextBase
{
SCCOL mnDestCol1;
SCCOL mnDestCol2;
SCROW mnDestRow1;
SCROW mnDestRow2;
SCTAB mnTabStart;
SCTAB mnTabEnd;
ScDocument& mrDestDoc;
ScDocument* const mpRefUndoDoc;
ScDocument* mpClipDoc;
InsertDeleteFlags const mnInsertFlag;
InsertDeleteFlags mnDeleteFlag;
std::vector<ScCellValue> maSingleCells;
std::vector<sc::CellTextAttr> maSingleCellAttrs;
std::vector<const ScPatternAttr*> maSinglePatterns;
std::vector<const ScPostIt*> maSingleNotes;
ScConditionalFormatList* mpCondFormatList;
bool const mbAsLink:1;
bool const mbSkipAttrForEmptyCells:1;
bool const mbCloneNotes:1;
bool mbTableProtected:1;
public:
struct Range
{
SCCOL mnCol1;
SCCOL mnCol2;
SCROW mnRow1;
SCROW mnRow2;
};
CopyFromClipContext() = delete;
CopyFromClipContext(ScDocument& rDoc,
ScDocument* pRefUndoDoc, ScDocument* pClipDoc, InsertDeleteFlags nInsertFlag,
bool bAsLink, bool bSkipAttrForEmptyCells);
virtual ~CopyFromClipContext() override;
void setTabRange(SCTAB nStart, SCTAB nEnd);
SCTAB getTabStart() const;
SCTAB getTabEnd() const;
void setDestRange( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
Range getDestRange() const;
ScDocument* getUndoDoc();
ScDocument* getClipDoc();
ScDocument* getDestDoc() { return &mrDestDoc; }
InsertDeleteFlags getInsertFlag() const;
void setDeleteFlag( InsertDeleteFlags nFlag );
InsertDeleteFlags getDeleteFlag() const;
/**
* Set the column size of a "single cell" row, which is used when copying
* a single row of cells in a clip doc and pasting it into multiple
* rows by replicating it.
*/
void setSingleCellColumnSize( size_t nSize );
ScCellValue& getSingleCell( size_t nColOffset );
sc::CellTextAttr& getSingleCellAttr( size_t nColOffset );
void setSingleCell( const ScAddress& rSrcPos, const ScColumn& rSrcCol );
const ScPatternAttr* getSingleCellPattern( size_t nColOffset ) const;
void setSingleCellPattern( size_t nColOffset, const ScPatternAttr* pAttr );
const ScPostIt* getSingleCellNote( size_t nColOffset ) const;
void setSingleCellNote( size_t nColOffset, const ScPostIt* pNote );
void setCondFormatList( ScConditionalFormatList* pCondFormatList );
ScConditionalFormatList* getCondFormatList();
void setTableProtected( bool b );
bool isTableProtected() const;
bool isAsLink() const;
bool isSkipAttrForEmptyCells() const;
bool isCloneNotes() const;
bool isDateCell( const ScColumn& rCol, SCROW nRow ) const;
};
class CopyToClipContext final : public ClipContextBase
{
bool const mbKeepScenarioFlags:1;
public:
CopyToClipContext(ScDocument& rDoc, bool bKeepScenarioFlags);
virtual ~CopyToClipContext() override;
bool isKeepScenarioFlags() const;
};
class CopyToDocContext final : public ClipContextBase
{
bool mbStartListening;
public:
CopyToDocContext(ScDocument& rDoc);
virtual ~CopyToDocContext() override;
void setStartListening( bool b );
bool isStartListening() const;
};
class MixDocContext final : public ClipContextBase
{
public:
MixDocContext(ScDocument& rDoc);
virtual ~MixDocContext() override;
};
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|