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 
16 #include <memory>
17 #include <vector>
18 
19 class ScDocument;
20 class ScColumn;
21 class ScPatternAttr;
22 class ScPostIt;
24 
25 namespace sc {
26 
27 struct ColumnBlockPosition;
28 class ColumnBlockPositionSet;
29 
31 {
32  std::unique_ptr<ColumnBlockPositionSet> mpSet;
33 
34 public:
35  ClipContextBase() = delete;
36  ClipContextBase(const ClipContextBase&) = delete;
37  const ClipContextBase& operator=(const ClipContextBase&) = delete;
39  virtual ~ClipContextBase();
40 
42  ColumnBlockPositionSet* getBlockPositionSet() { return mpSet.get(); }
43 };
44 
46 {
58 
59  std::vector<ScCellValue> maSingleCells;
60  std::vector<sc::CellTextAttr> maSingleCellAttrs;
61  std::vector<const ScPatternAttr*> maSinglePatterns;
62  std::vector<const ScPostIt*> maSingleNotes;
63 
65  bool mbAsLink:1;
66  bool mbSkipAttrForEmptyCells:1;
67  bool mbCloneNotes:1;
68  bool mbTableProtected:1;
69 
70 public:
71 
72  struct Range
73  {
78  };
79 
80  CopyFromClipContext() = delete;
82  ScDocument* pRefUndoDoc, ScDocument* pClipDoc, InsertDeleteFlags nInsertFlag,
83  bool bAsLink, bool bSkipAttrForEmptyCells);
84 
85  virtual ~CopyFromClipContext() override;
86 
87  void setTabRange(SCTAB nStart, SCTAB nEnd);
88 
89  SCTAB getTabStart() const;
90  SCTAB getTabEnd() const;
91 
92  void setDestRange( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
93  Range getDestRange() const;
94 
95  ScDocument* getUndoDoc();
96  ScDocument* getClipDoc();
97  ScDocument* getDestDoc() { return &mrDestDoc; }
98  InsertDeleteFlags getInsertFlag() const;
99 
100  void setDeleteFlag( InsertDeleteFlags nFlag );
101  InsertDeleteFlags getDeleteFlag() const;
102 
108  void setSingleCellColumnSize( size_t nSize );
109 
110  ScCellValue& getSingleCell( size_t nColOffset );
111  sc::CellTextAttr& getSingleCellAttr( size_t nColOffset );
112 
113  void setSingleCell( const ScAddress& rSrcPos, const ScColumn& rSrcCol );
114 
115 
116  const ScPatternAttr* getSingleCellPattern( size_t nColOffset ) const;
117  void setSingleCellPattern( size_t nColOffset, const ScPatternAttr* pAttr );
118 
119  const ScPostIt* getSingleCellNote( size_t nColOffset ) const;
120  void setSingleCellNote( size_t nColOffset, const ScPostIt* pNote );
121 
122  void setCondFormatList( ScConditionalFormatList* pCondFormatList );
123  ScConditionalFormatList* getCondFormatList();
124 
125  void setTableProtected( bool b );
126  bool isTableProtected() const;
127 
128  bool isAsLink() const;
129  bool isSkipAttrForEmptyCells() const;
130  bool isCloneNotes() const;
131  bool isDateCell( const ScColumn& rCol, SCROW nRow ) const;
132 };
133 
134 class CopyToClipContext final : public ClipContextBase
135 {
137 
138 public:
139  CopyToClipContext(ScDocument& rDoc, bool bKeepScenarioFlags);
140  virtual ~CopyToClipContext() override;
141 
142  bool isKeepScenarioFlags() const;
143 };
144 
145 class CopyToDocContext final : public ClipContextBase
146 {
148 
149 public:
151  virtual ~CopyToDocContext() override;
152 
153  void setStartListening( bool b );
154  bool isStartListening() const;
155 };
156 
157 class MixDocContext final : public ClipContextBase
158 {
159 public:
160  MixDocContext(ScDocument& rDoc);
161  virtual ~MixDocContext() override;
162 };
163 
164 }
165 
166 /* 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:35
virtual ~ClipContextBase()
Definition: clipcontext.cxx:29
MixDocContext(ScDocument &rDoc)
Additional class containing cell annotation data.
Definition: postit.hxx:159
ScDocument * getDestDoc()
Definition: clipcontext.hxx:97
void setStartListening(bool b)
std::vector< const ScPatternAttr * > maSinglePatterns
Definition: clipcontext.hxx:61
sal_Int16 SCCOL
Definition: types.hxx:21
InsertDeleteFlags
Definition: global.hxx:157
const ClipContextBase & operator=(const ClipContextBase &)=delete
CopyToClipContext(ScDocument &rDoc, bool bKeepScenarioFlags)
ScConditionalFormatList * mpCondFormatList
Definition: clipcontext.hxx:64
ScDocument * mpRefUndoDoc
Definition: clipcontext.hxx:54
CopyToDocContext(ScDocument &rDoc)
std::vector< const ScPostIt * > maSingleNotes
Definition: clipcontext.hxx:62
virtual ~CopyToDocContext() override
sal_Int32 SCROW
Definition: types.hxx:17
InsertDeleteFlags mnDeleteFlag
Definition: clipcontext.hxx:57
std::unique_ptr< ColumnBlockPositionSet > mpSet
Definition: clipcontext.hxx:32
virtual ~MixDocContext() override
std::vector< sc::CellTextAttr > maSingleCellAttrs
Definition: clipcontext.hxx:60
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
sal_Int16 SCTAB
Definition: types.hxx:22
ColumnBlockPosition * getBlockPosition(SCTAB nTab, SCCOL nCol)
Definition: clipcontext.cxx:31
ColumnBlockPositionSet * getBlockPositionSet()
Definition: clipcontext.hxx:42
std::vector< ScCellValue > maSingleCells
Definition: clipcontext.hxx:59
InsertDeleteFlags mnInsertFlag
Definition: clipcontext.hxx:56
bool isKeepScenarioFlags() const