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 #pragma once
11 
12 #include "address.hxx"
13 #include "cellvalue.hxx"
14 #include "celltextattr.hxx"
15 #include "Sparkline.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  std::vector<std::shared_ptr<sc::Sparkline>> maSingleSparkline;
65 
67  bool mbAsLink:1;
68  bool mbSkipEmptyCells:1;
69  bool mbTableProtected: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 
96  ScDocument* getUndoDoc();
97  ScDocument* getClipDoc();
98  ScDocument* getDestDoc() { return &mrDestDoc; }
99  InsertDeleteFlags getInsertFlag() const;
100 
101  void setDeleteFlag( InsertDeleteFlags nFlag );
102  InsertDeleteFlags getDeleteFlag() const;
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  std::shared_ptr<sc::Sparkline> const& getSingleSparkline(size_t nColOffset) const;
124  void setSingleSparkline(size_t nColOffset, std::shared_ptr<sc::Sparkline> const& pSparkline);
125 
126  void setCondFormatList( ScConditionalFormatList* pCondFormatList );
127  ScConditionalFormatList* getCondFormatList();
128 
129  void setTableProtected( bool b );
130  bool isTableProtected() const;
131 
132  bool isAsLink() const;
133 
140  bool isSkipEmptyCells() const;
141  bool isCloneNotes() const;
142  bool isCloneSparklines() const;
143  bool isDateCell( const ScColumn& rCol, SCROW nRow ) const;
144 };
145 
146 class CopyToClipContext final : public ClipContextBase
147 {
149 
150 public:
151  CopyToClipContext(ScDocument& rDoc, bool bKeepScenarioFlags);
152  virtual ~CopyToClipContext() override;
153 
154  bool isKeepScenarioFlags() const;
155 };
156 
157 class CopyToDocContext final : public ClipContextBase
158 {
160 
161 public:
163  virtual ~CopyToDocContext() override;
164 
165  void setStartListening( bool b );
166  bool isStartListening() const;
167 };
168 
169 class MixDocContext final : public ClipContextBase
170 {
171 public:
172  MixDocContext(ScDocument& rDoc);
173  virtual ~MixDocContext() override;
174 };
175 
176 }
177 
178 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~CopyToClipContext() override
bool isStartListening() const
Store position data for column array storage.
ClipContextBase()=delete
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:31
virtual ~ClipContextBase()
Definition: clipcontext.cxx:30
MixDocContext(ScDocument &rDoc)
Additional class containing cell annotation data.
Definition: postit.hxx:160
ScDocument * getDestDoc()
Definition: clipcontext.hxx:98
void setStartListening(bool b)
std::vector< std::shared_ptr< sc::Sparkline > > maSingleSparkline
Definition: clipcontext.hxx:64
std::vector< const ScPatternAttr * > maSinglePatterns
Definition: clipcontext.hxx:62
sal_Int16 SCCOL
Definition: types.hxx:21
InsertDeleteFlags
Definition: global.hxx:147
const ClipContextBase & operator=(const ClipContextBase &)=delete
CopyToClipContext(ScDocument &rDoc, bool bKeepScenarioFlags)
CAUTION! The following defines must be in the same namespace as the respective type.
ScConditionalFormatList * mpCondFormatList
Definition: clipcontext.hxx:66
ScDocument * mpRefUndoDoc
Definition: clipcontext.hxx:55
CopyToDocContext(ScDocument &rDoc)
std::vector< const ScPostIt * > maSingleNotes
Definition: clipcontext.hxx:63
virtual ~CopyToDocContext() override
sal_Int32 SCROW
Definition: types.hxx:17
InsertDeleteFlags mnDeleteFlag
Definition: clipcontext.hxx:58
std::unique_ptr< ColumnBlockPositionSet > mpSet
Definition: clipcontext.hxx:33
virtual ~MixDocContext() override
std::vector< sc::CellTextAttr > maSingleCellAttrs
Definition: clipcontext.hxx:61
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
sal_Int16 SCTAB
Definition: types.hxx:22
ColumnBlockPosition * getBlockPosition(SCTAB nTab, SCCOL nCol)
Definition: clipcontext.cxx:32
ColumnBlockPositionSet * getBlockPositionSet()
Definition: clipcontext.hxx:43
std::vector< ScCellValue > maSingleCells
Definition: clipcontext.hxx:60
InsertDeleteFlags mnInsertFlag
Definition: clipcontext.hxx:57
bool isKeepScenarioFlags() const