QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RClipboardOperation.h
Go to the documentation of this file.
1
20#ifndef RCLIPBOARDOPERATION_H
21#define RCLIPBOARDOPERATION_H
22
23#include "operations_global.h"
24
25#include <QMap>
26
27#include "ROperation.h"
28
29class RDocument;
30class RBlock;
33class REntity;
34class RLayer;
35class RLinetype;
36class RVector;
37
38#ifndef RQMapQStringQString
40#endif
41
49public:
52
53 virtual RTransaction apply(RDocument& document, bool preview = false) {
54 // MSVC:
55 //Q_UNUSED(document)
56 Q_UNUSED(preview)
57 return RTransaction();
58 }
59
60 void copy(RDocument& src, RDocument& dest,
61 const RVector& offset,
62 double scale,
63 double rotation,
64 const RVector& center,
65 bool flipHorizontal,
66 bool flipVertical,
67 bool toCurrentLayer,
68 bool toCurrentBlock,
69 bool overwriteLayers,
70 bool overwriteBlocks,
71 const QString& blockName,
72 const QString& layerName,
73 RTransaction& transaction,
74 bool selectionOnly, bool clear,
75 bool toModelSpaceBlock,
76 bool preview) {
77
78 copy(src, dest,
79 offset,
80 scale,
81 rotation,
82 center,
83 flipHorizontal,
84 flipVertical,
85 toCurrentLayer,
86 toCurrentBlock,
87 overwriteLayers,
88 overwriteBlocks,
89 blockName,
90 layerName,
91 transaction,
92 selectionOnly, clear,
93 toModelSpaceBlock,
94 preview,
98 }
99
103 void copy(RDocument& src, RDocument& dest,
104 const RVector& offset,
105 double scale,
106 double rotation,
107 const RVector& center,
108 bool flipHorizontal,
109 bool flipVertical,
110 bool toCurrentLayer,
111 bool toCurrentBlock,
112 bool overwriteLayers,
113 bool overwriteBlocks,
114 const QString& blockName,
115 const QString& layerName,
116 RTransaction& transaction,
117 bool selectionOnly, bool clear,
118 bool toModelSpaceBlock,
119 bool preview,
120 const RQMapQStringQString& attributes,
121 const RQMapQStringQString& properties,
122 const RQMapQStringQString& blockProperties
123 );
124
126 REntity& entity,
127 RDocument& src, RDocument& dest,
128 const RVector& offset,
129 double scale,
130 double unitScale,
131 double rotation,
132 const RVector& center,
133 bool flipHorizontal,
134 bool flipVertical,
135 bool toCurrentLayer,
136 bool toCurrentBlock,
137 bool overwriteLayers,
138 bool overwriteBlocks,
139 const QString& blockName,
140 const QString& layerName,
141 RTransaction& transaction,
142 bool toModelSpaceBlock) {
143
144 copyEntity(
145 entity,
146 src, dest,
147 offset,
148 scale,
149 unitScale,
150 rotation,
151 center,
152 flipHorizontal,
153 flipVertical,
154 toCurrentLayer,
155 toCurrentBlock,
156 overwriteLayers,
157 overwriteBlocks,
158 blockName,
159 layerName,
160 transaction,
161 toModelSpaceBlock,
163 );
164 }
165
169 void copyEntity(
170 REntity& entity,
171 RDocument& src, RDocument& dest,
172 const RVector& offset,
173 double scale,
174 double unitScale,
175 double rotation,
176 const RVector& center,
177 bool flipHorizontal,
178 bool flipVertical,
179 bool toCurrentLayer,
180 bool toCurrentBlock,
181 bool overwriteLayers,
182 bool overwriteBlocks,
183 const QString& blockName,
184 const QString& layerName,
185 RTransaction& transaction,
186 bool toModelSpaceBlock,
187 const RQMapQStringQString& attributes
188 );
189
190 QSharedPointer<RBlock> copyEntityBlock(
191 REntity& entity,
192 RDocument& src,
193 RDocument& dest,
194 bool overwriteBlocks,
195 bool toCurrentBlock,
196 const QString& blockName,
197 RTransaction& transaction
198 );
199
200 QSharedPointer<RBlock> copyBlock(
201 RObject::Id blockId,
202 RDocument& src,
203 RDocument& dest,
204 bool overwriteBlocks,
205 bool toCurrentBlock,
206 const QString& blockName,
207 RTransaction& transaction
208 );
209
210 QSharedPointer<RLayer> copyEntityLayer(
211 REntity& entity,
212 RDocument& src,
213 RDocument& dest,
214 bool overwriteLayers,
215 RTransaction& transaction
216 );
217
218 QSharedPointer<RLayer> copyLayer(
219 RObject::Id layerId,
220 RDocument& src, RDocument& dest,
221 bool overwriteLayers,
222 RTransaction& transaction
223 );
224
225 QSharedPointer<RLinetype> copyEntityLinetype(
226 REntity& entity,
227 RDocument& src,
228 RDocument& dest,
229 bool overwriteLinetypes,
230 RTransaction& transaction
231 );
232
233 QSharedPointer<RLinetype> copyLinetype(
234 RObject::Id linetypeId,
235 RDocument& src, RDocument& dest,
236 bool overwriteLinetypes,
237 RTransaction& transaction
238 );
239
240 void setCopyEmptyBlocks(bool on) {
241 copyEmptyBlocks = on;
242 }
243
244 void setCopyAllLayers(bool on) {
245 copyAllLayers = on;
246 }
247
248 void setKeepSelection(bool on) {
249 keepSelection = on;
250 }
251
252 void setBlockOwnership(bool on) {
253 blockOwnership = on;
254 }
255
257 customEntityType = t;
258 }
259
260 virtual RBlockReferenceEntity* createBlockReferenceEntity(RDocument& doc, RS::EntityType customEntityType, const RBlockReferenceData& data);
261
262private:
266 QSet<RObject::Id> copiedBlockContents;
272};
273
275
276#endif
QMap< QString, QString > RQMapQStringQString
Definition RClipboardOperation.h:39
Q_DECLARE_METATYPE(RMath *)
QMap< QString, QString > RQMapQStringQString
Definition RObject.h:35
Definition RDebug.h:38
Represents a block definition in a drawing.
Definition RBlock.h:42
Defines the geometry and appearance of a block reference entity.
Definition RBlockReferenceData.h:43
Block reference entity.
Definition RBlockReferenceEntity.h:38
Base class for clipboard related operations (copy, cut, paste).
Definition RClipboardOperation.h:48
bool blockOwnership
Definition RClipboardOperation.h:270
QSet< RObject::Id > copiedBlockContents
Definition RClipboardOperation.h:266
virtual ~RClipboardOperation()
Definition RClipboardOperation.h:51
QMap< QString, QSharedPointer< RLinetype > > copiedLinetypes
Definition RClipboardOperation.h:264
QMap< QString, QSharedPointer< RLayer > > copiedLayers
Definition RClipboardOperation.h:263
void setKeepSelection(bool on)
Definition RClipboardOperation.h:248
void setBlockOwnership(bool on)
Definition RClipboardOperation.h:252
void setCopyAllLayers(bool on)
Definition RClipboardOperation.h:244
bool copyAllLayers
Definition RClipboardOperation.h:268
RS::EntityType customEntityType
Definition RClipboardOperation.h:271
void setCopyEmptyBlocks(bool on)
Definition RClipboardOperation.h:240
bool keepSelection
Definition RClipboardOperation.h:269
void setCustomEntityType(RS::EntityType t)
Definition RClipboardOperation.h:256
bool copyEmptyBlocks
Definition RClipboardOperation.h:267
virtual RTransaction apply(RDocument &document, bool preview=false)
Applies this operation to selection in the given document.
Definition RClipboardOperation.h:53
QMap< QString, QSharedPointer< RBlock > > copiedBlocks
Definition RClipboardOperation.h:265
void copyEntity(REntity &entity, RDocument &src, RDocument &dest, const RVector &offset, double scale, double unitScale, double rotation, const RVector &center, bool flipHorizontal, bool flipVertical, bool toCurrentLayer, bool toCurrentBlock, bool overwriteLayers, bool overwriteBlocks, const QString &blockName, const QString &layerName, RTransaction &transaction, bool toModelSpaceBlock)
Definition RClipboardOperation.h:125
void copy(RDocument &src, RDocument &dest, const RVector &offset, double scale, double rotation, const RVector &center, bool flipHorizontal, bool flipVertical, bool toCurrentLayer, bool toCurrentBlock, bool overwriteLayers, bool overwriteBlocks, const QString &blockName, const QString &layerName, RTransaction &transaction, bool selectionOnly, bool clear, bool toModelSpaceBlock, bool preview)
Definition RClipboardOperation.h:60
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition RDocument.h:78
Base class for all entity classes.
Definition REntity.h:63
Represents a layer in a drawing.
Definition RLayer.h:45
Represents a linetype in a drawing.
Definition RLinetype.h:45
int Id
Definition RObject.h:69
This abstract class is an interface for all operation implementations.
Definition ROperation.h:45
EntityType
Entity types used for property handling / filtering.
Definition RS.h:227
Transaction implementation.
Definition RTransaction.h:73
Represents a 3d vector (x/y/z).
Definition RVector.h:47
void scale(void e, void factor, void focusPoint)
Scales the given entity or shape by the given factor with the given focus point.
Definition simple_modify.js:15
#define QCADOPERATIONS_EXPORT
Definition operations_global.h:10