Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / clipcontext.hxx
blob629d6a2b22dc85114d8614a1dbcbdb29f98256a3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #ifndef INCLUDED_SC_INC_CLIPCONTEXT_HXX
11 #define INCLUDED_SC_INC_CLIPCONTEXT_HXX
13 #include "address.hxx"
14 #include "cellvalue.hxx"
15 #include "celltextattr.hxx"
17 #include <memory>
18 #include <vector>
20 class ScDocument;
21 class ScColumn;
22 class ScPatternAttr;
23 class ScPostIt;
24 class ScConditionalFormatList;
26 namespace sc {
28 struct ColumnBlockPosition;
29 class ColumnBlockPositionSet;
31 class ClipContextBase
33 std::unique_ptr<ColumnBlockPositionSet> mpSet;
35 public:
36 ClipContextBase() = delete;
37 ClipContextBase(const ClipContextBase&) = delete;
38 const ClipContextBase& operator=(const ClipContextBase&) = delete;
39 ClipContextBase(ScDocument& rDoc);
40 virtual ~ClipContextBase();
42 ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
45 class CopyFromClipContext : public ClipContextBase
47 SCCOL mnDestCol1;
48 SCCOL mnDestCol2;
49 SCROW mnDestRow1;
50 SCROW mnDestRow2;
51 SCTAB mnTabStart;
52 SCTAB mnTabEnd;
53 ScDocument& mrDestDoc;
54 ScDocument* mpRefUndoDoc;
55 ScDocument* mpClipDoc;
56 InsertDeleteFlags mnInsertFlag;
57 InsertDeleteFlags mnDeleteFlag;
59 std::vector<ScCellValue> maSingleCells;
60 std::vector<sc::CellTextAttr> maSingleCellAttrs;
61 std::vector<const ScPatternAttr*> maSinglePatterns;
62 std::vector<const ScPostIt*> maSingleNotes;
64 ScConditionalFormatList* mpCondFormatList;
65 bool mbAsLink:1;
66 bool mbSkipAttrForEmptyCells:1;
67 bool mbCloneNotes:1;
68 bool mbTableProtected:1;
70 public:
72 struct Range
74 SCCOL mnCol1;
75 SCCOL mnCol2;
76 SCROW mnRow1;
77 SCROW mnRow2;
80 CopyFromClipContext() = delete;
81 CopyFromClipContext(ScDocument& rDoc,
82 ScDocument* pRefUndoDoc, ScDocument* pClipDoc, InsertDeleteFlags nInsertFlag,
83 bool bAsLink, bool bSkipAttrForEmptyCells);
85 virtual ~CopyFromClipContext() override;
87 void setTabRange(SCTAB nStart, SCTAB nEnd);
89 SCTAB getTabStart() const;
90 SCTAB getTabEnd() const;
92 void setDestRange( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
93 Range getDestRange() const;
95 ScDocument* getUndoDoc();
96 ScDocument* getClipDoc();
97 InsertDeleteFlags getInsertFlag() const;
99 void setDeleteFlag( InsertDeleteFlags nFlag );
100 InsertDeleteFlags getDeleteFlag() const;
103 * Set the column size of a "single cell" row, which is used when copying
104 * a single row of cells in a clip doc and pasting it into multiple
105 * rows by replicating it.
107 void setSingleCellColumnSize( size_t nSize );
109 ScCellValue& getSingleCell( size_t nColOffset );
110 sc::CellTextAttr& getSingleCellAttr( size_t nColOffset );
112 void setSingleCell( const ScAddress& rSrcPos, const ScColumn& rSrcCol );
115 const ScPatternAttr* getSingleCellPattern( size_t nColOffset ) const;
116 void setSingleCellPattern( size_t nColOffset, const ScPatternAttr* pAttr );
118 const ScPostIt* getSingleCellNote( size_t nColOffset ) const;
119 void setSingleCellNote( size_t nColOffset, const ScPostIt* pNote );
121 void setCondFormatList( ScConditionalFormatList* pCondFormatList );
122 ScConditionalFormatList* getCondFormatList();
124 void setTableProtected( bool b );
125 bool isTableProtected() const;
127 bool isAsLink() const;
128 bool isSkipAttrForEmptyCells() const;
129 bool isCloneNotes() const;
130 bool isDateCell( const ScColumn& rCol, SCROW nRow ) const;
133 class CopyToClipContext : public ClipContextBase
135 bool mbKeepScenarioFlags:1;
137 public:
138 CopyToClipContext(ScDocument& rDoc, bool bKeepScenarioFlags);
139 virtual ~CopyToClipContext() override;
141 bool isKeepScenarioFlags() const;
144 class CopyToDocContext : public ClipContextBase
146 bool mbStartListening;
148 public:
149 CopyToDocContext(ScDocument& rDoc);
150 virtual ~CopyToDocContext() override;
152 void setStartListening( bool b );
153 bool isStartListening() const;
156 class MixDocContext : public ClipContextBase
158 public:
159 MixDocContext(ScDocument& rDoc);
160 virtual ~MixDocContext() override;
165 #endif
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */