LibreOffice Module sc (master)  1
clipcontext.hxx
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 #ifndef INCLUDED_SC_INC_CLIPCONTEXT_HXX
11 #define INCLUDED_SC_INC_CLIPCONTEXT_HXX
12 
13 #include "address.hxx"
14 #include "cellvalue.hxx"
15 #include "celltextattr.hxx"
16 
17 #include <memory>
18 #include <vector>
19 
20 class ScDocument;
21 class ScColumn;
22 class ScPatternAttr;
23 class ScPostIt;
25 
26 namespace sc {
27 
28 struct ColumnBlockPosition;
29 class ColumnBlockPositionSet;
30 
32 {
33  std::unique_ptr<ColumnBlockPositionSet> mpSet;
34 
35 public:
36  ClipContextBase() = delete;
37  ClipContextBase(const ClipContextBase&) = delete;
38  const ClipContextBase& operator=(const ClipContextBase&) = delete;
40  virtual ~ClipContextBase();
41 
43  ColumnBlockPositionSet* getBlockPositionSet() { return mpSet.get(); }
44 };
45 
47 {
59 
60  std::vector<ScCellValue> maSingleCells;
61  std::vector<sc::CellTextAttr> maSingleCellAttrs;
62  std::vector<const ScPatternAttr*> maSinglePatterns;
63  std::vector<const ScPostIt*> maSingleNotes;
64 
66  bool mbAsLink:1;
68  bool mbCloneNotes:1;
70 
71 public:
72 
73  struct Range
74  {
79  };
80 
81  CopyFromClipContext() = delete;
83  ScDocument* pRefUndoDoc, ScDocument* pClipDoc, InsertDeleteFlags nInsertFlag,
84  bool bAsLink, bool bSkipAttrForEmptyCells);
85 
86  virtual ~CopyFromClipContext() override;
87 
88  void setTabRange(SCTAB nStart, SCTAB nEnd);
89 
90  SCTAB getTabStart() const;
91  SCTAB getTabEnd() const;
92 
93  void setDestRange( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
94  Range getDestRange() const;
95 
100 
101  void setDeleteFlag( InsertDeleteFlags nFlag );
103 
109  void setSingleCellColumnSize( size_t nSize );
110 
111  ScCellValue& getSingleCell( size_t nColOffset );
112  sc::CellTextAttr& getSingleCellAttr( size_t nColOffset );
113 
114  void setSingleCell( const ScAddress& rSrcPos, const ScColumn& rSrcCol );
115 
116 
117  const ScPatternAttr* getSingleCellPattern( size_t nColOffset ) const;
118  void setSingleCellPattern( size_t nColOffset, const ScPatternAttr* pAttr );
119 
120  const ScPostIt* getSingleCellNote( size_t nColOffset ) const;
121  void setSingleCellNote( size_t nColOffset, const ScPostIt* pNote );
122 
123  void setCondFormatList( ScConditionalFormatList* pCondFormatList );
125 
126  void setTableProtected( bool b );
127  bool isTableProtected() const;
128 
129  bool isAsLink() const;
130  bool isSkipAttrForEmptyCells() const;
131  bool isCloneNotes() const;
132  bool isDateCell( const ScColumn& rCol, SCROW nRow ) const;
133 };
134 
135 class CopyToClipContext final : public ClipContextBase
136 {
138 
139 public:
140  CopyToClipContext(ScDocument& rDoc, bool bKeepScenarioFlags);
141  virtual ~CopyToClipContext() override;
142 
143  bool isKeepScenarioFlags() const;
144 };
145 
146 class CopyToDocContext final : public ClipContextBase
147 {
149 
150 public:
152  virtual ~CopyToDocContext() override;
153 
154  void setStartListening( bool b );
155  bool isStartListening() const;
156 };
157 
158 class MixDocContext final : public ClipContextBase
159 {
160 public:
161  MixDocContext(ScDocument& rDoc);
162  virtual ~MixDocContext() override;
163 };
164 
165 }
166 
167 #endif
168 
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void setSingleCell(const ScAddress &rSrcPos, const ScColumn &rSrcCol)
virtual ~CopyToClipContext() override
void setTabRange(SCTAB nStart, SCTAB nEnd)
Definition: clipcontext.cxx:57
bool isStartListening() const
Store position data for column array storage.
InsertDeleteFlags getInsertFlag() const
bool isSkipAttrForEmptyCells() const
bool isTableProtected() const
ClipContextBase()=delete
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:36
virtual ~ClipContextBase()
Definition: clipcontext.cxx:29
MixDocContext(ScDocument &rDoc)
Additional class containing cell annotation data.
Definition: postit.hxx:160
ScConditionalFormatList * getCondFormatList()
void setCondFormatList(ScConditionalFormatList *pCondFormatList)
ScDocument * getDestDoc()
Definition: clipcontext.hxx:98
void setDeleteFlag(InsertDeleteFlags nFlag)
void setStartListening(bool b)
void setSingleCellNote(size_t nColOffset, const ScPostIt *pNote)
std::vector< const ScPatternAttr * > maSinglePatterns
Definition: clipcontext.hxx:62
sal_Int16 SCCOL
Definition: types.hxx:22
InsertDeleteFlags
Definition: global.hxx:158
const ClipContextBase & operator=(const ClipContextBase &)=delete
CopyToClipContext(ScDocument &rDoc, bool bKeepScenarioFlags)
ScConditionalFormatList * mpCondFormatList
Definition: clipcontext.hxx:65
ScDocument * mpRefUndoDoc
Definition: clipcontext.hxx:55
void setDestRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
Definition: clipcontext.cxx:73
const ScPatternAttr * getSingleCellPattern(size_t nColOffset) const
CopyToDocContext(ScDocument &rDoc)
void setSingleCellPattern(size_t nColOffset, const ScPatternAttr *pAttr)
ScCellValue & getSingleCell(size_t nColOffset)
void setTableProtected(bool b)
const ScPostIt * getSingleCellNote(size_t nColOffset) const
std::vector< const ScPostIt * > maSingleNotes
Definition: clipcontext.hxx:63
virtual ~CopyToDocContext() override
sal_Int32 SCROW
Definition: types.hxx:18
sc::CellTextAttr & getSingleCellAttr(size_t nColOffset)
SCTAB getTabEnd() const
Definition: clipcontext.cxx:68
ScDocument * getUndoDoc()
Definition: clipcontext.cxx:91
SCTAB getTabStart() const
Definition: clipcontext.cxx:63
bool isDateCell(const ScColumn &rCol, SCROW nRow) const
ScDocument * getClipDoc()
Definition: clipcontext.cxx:96
InsertDeleteFlags mnDeleteFlag
Definition: clipcontext.hxx:58
InsertDeleteFlags getDeleteFlag() const
std::unique_ptr< ColumnBlockPositionSet > mpSet
Definition: clipcontext.hxx:33
void setSingleCellColumnSize(size_t nSize)
Set the column size of a "single cell" row, which is used when copying a single row of cells in a cli...
Range getDestRange() const
Definition: clipcontext.cxx:81
virtual ~CopyFromClipContext() override
Definition: clipcontext.cxx:53
virtual ~MixDocContext() override
std::vector< sc::CellTextAttr > maSingleCellAttrs
Definition: clipcontext.hxx:61
sal_Int16 SCTAB
Definition: types.hxx:23
ColumnBlockPosition * getBlockPosition(SCTAB nTab, SCCOL nCol)
Definition: clipcontext.cxx:31
ColumnBlockPositionSet * getBlockPositionSet()
Definition: clipcontext.hxx:43
std::vector< ScCellValue > maSingleCells
Definition: clipcontext.hxx:60
InsertDeleteFlags mnInsertFlag
Definition: clipcontext.hxx:57
bool isKeepScenarioFlags() const
bool isCloneNotes() const