Line data Source code
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 :
16 : #include <vector>
17 : #include <boost/unordered_map.hpp>
18 : #include <boost/noncopyable.hpp>
19 : #include <boost/scoped_ptr.hpp>
20 :
21 : class ScDocument;
22 : class ScColumn;
23 : class ScPatternAttr;
24 : class ScPostIt;
25 : class ScConditionalFormatList;
26 :
27 : namespace sc {
28 :
29 : struct ColumnBlockPosition;
30 : class ColumnBlockPositionSet;
31 :
32 : class ClipContextBase : boost::noncopyable
33 : {
34 : boost::scoped_ptr<ColumnBlockPositionSet> mpSet;
35 :
36 : ClipContextBase(); // disabled
37 :
38 : public:
39 : ClipContextBase(ScDocument& rDoc);
40 : virtual ~ClipContextBase();
41 :
42 : ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
43 : };
44 :
45 : class CopyFromClipContext : public ClipContextBase
46 : {
47 : SCCOL mnDestCol1;
48 : SCCOL mnDestCol2;
49 : SCROW mnDestRow1;
50 : SCROW mnDestRow2;
51 : SCTAB mnTabStart;
52 : SCTAB mnTabEnd;
53 : ScDocument* mpRefUndoDoc;
54 : ScDocument* mpClipDoc;
55 : InsertDeleteFlags mnInsertFlag;
56 : InsertDeleteFlags mnDeleteFlag;
57 : ScCellValue maSingleCell;
58 : ScConditionalFormatList* mpCondFormatList;
59 : const ScPatternAttr* mpSinglePattern;
60 : const ScPostIt* mpSingleNote;
61 : bool mbAsLink:1;
62 : bool mbSkipAttrForEmptyCells:1;
63 : bool mbCloneNotes:1;
64 : bool mbTableProtected:1;
65 :
66 : CopyFromClipContext(); // disabled
67 :
68 : public:
69 :
70 : struct Range
71 : {
72 : SCCOL mnCol1;
73 : SCCOL mnCol2;
74 : SCROW mnRow1;
75 : SCROW mnRow2;
76 : };
77 :
78 : CopyFromClipContext(ScDocument& rDoc,
79 : ScDocument* pRefUndoDoc, ScDocument* pClipDoc, InsertDeleteFlags nInsertFlag,
80 : bool bAsLink, bool bSkipAttrForEmptyCells);
81 :
82 : virtual ~CopyFromClipContext();
83 :
84 : void setTabRange(SCTAB nStart, SCTAB nEnd);
85 :
86 262 : SCTAB getTabStart() const { return mnTabStart;}
87 156 : SCTAB getTabEnd() const { return mnTabEnd;}
88 :
89 : void setDestRange( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
90 : Range getDestRange() const;
91 :
92 104 : ScDocument* getUndoDoc() { return mpRefUndoDoc;}
93 898 : ScDocument* getClipDoc() { return mpClipDoc;}
94 1740 : InsertDeleteFlags getInsertFlag() const { return mnInsertFlag;}
95 :
96 : void setDeleteFlag( InsertDeleteFlags nFlag );
97 6 : InsertDeleteFlags getDeleteFlag() const { return mnDeleteFlag;}
98 :
99 12 : ScCellValue& getSingleCell() { return maSingleCell;}
100 :
101 : void setCondFormatList( ScConditionalFormatList* pCondFormatList );
102 10 : ScConditionalFormatList* getCondFormatList() { return mpCondFormatList;}
103 :
104 6 : const ScPatternAttr* getSingleCellPattern() const { return mpSinglePattern;}
105 : void setSingleCellPattern( const ScPatternAttr* pAttr );
106 :
107 6 : const ScPostIt* getSingleCellNote() const { return mpSingleNote;}
108 : void setSingleCellNote( const ScPostIt* pNote );
109 :
110 : void setTableProtected( bool b );
111 10 : bool isTableProtected() const { return mbTableProtected;}
112 :
113 698 : bool isAsLink() const { return mbAsLink;}
114 274 : bool isSkipAttrForEmptyCells() const { return mbSkipAttrForEmptyCells;}
115 446 : bool isCloneNotes() const { return mbCloneNotes;}
116 : bool isDateCell( const ScColumn& rCol, SCROW nRow ) const;
117 : };
118 :
119 : class CopyToClipContext : public ClipContextBase
120 : {
121 : bool mbKeepScenarioFlags:1;
122 : bool mbCloneNotes:1;
123 :
124 : CopyToClipContext(); // disabled
125 :
126 : public:
127 : CopyToClipContext(ScDocument& rDoc, bool bKeepScenarioFlags, bool bCloneNotes);
128 : virtual ~CopyToClipContext();
129 :
130 150 : bool isKeepScenarioFlags() const { return mbKeepScenarioFlags;}
131 150 : bool isCloneNotes() const { return mbCloneNotes;}
132 : };
133 :
134 : class CopyToDocContext : public ClipContextBase
135 : {
136 : public:
137 : CopyToDocContext(ScDocument& rDoc);
138 : virtual ~CopyToDocContext();
139 : };
140 :
141 : class MixDocContext : public ClipContextBase
142 : {
143 : public:
144 : MixDocContext(ScDocument& rDoc);
145 : virtual ~MixDocContext();
146 : };
147 :
148 : }
149 :
150 : #endif
151 :
152 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|