QCAD
Open Source 2D CAD
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 "RDocument.h"
28 #include "REntity.h"
29 #include "RExporter.h"
30 #include "ROperation.h"
31 #include "RVector.h"
32 
33 typedef QMap<QString, QString> RQMapQStringQString;
34 
35 #define RDEFAULT_QMAP_QSTRING_QSTRING RQMapQStringQString()
36 
44 public:
46  virtual ~RClipboardOperation() {}
47 
48  virtual RTransaction apply(RDocument& document, bool preview = false) {
49  Q_UNUSED(document)
50  Q_UNUSED(preview)
51  return RTransaction();
52  }
53 
57  void copy(RDocument& src, RDocument& dest,
58  const RVector& offset,
59  double scale,
60  double rotation,
61  bool flipHorizontal,
62  bool flipVertical,
63  bool toCurrentLayer,
64  bool toCurrentBlock,
65  bool overwriteLayers,
66  bool overwriteBlocks,
67  const QString& blockName,
68  const QString& layerName,
69  RTransaction& transaction,
70  bool selectionOnly, bool clear,
71  bool toModelSpaceBlock,
72  bool preview,
75  );
76 
80  void copyEntity(
81  REntity& entity,
82  RDocument& src, RDocument& dest,
83  const RVector& offset,
84  double scale,
85  double unitScale,
86  double rotation,
87  bool flipHorizontal,
88  bool flipVertical,
89  bool toCurrentLayer,
90  bool toCurrentBlock,
91  bool overwriteLayers,
92  bool overwriteBlocks,
93  const QString& blockName,
94  const QString& layerName,
95  RTransaction& transaction,
96  bool toModelSpaceBlock,
98  );
99 
100  QSharedPointer<RBlock> copyEntityBlock(
101  REntity& entity,
102  RDocument& src,
103  RDocument& dest,
104  bool overwriteBlocks,
105  bool toCurrentBlock,
106  const QString& blockName,
107  RTransaction& transaction
108  );
109 
110  QSharedPointer<RBlock> copyBlock(
111  RBlock::Id blockId,
112  RDocument& src,
113  RDocument& dest,
114  bool overwriteBlocks,
115  bool toCurrentBlock,
116  const QString& blockName,
117  RTransaction& transaction
118  );
119 
120  QSharedPointer<RLayer> copyEntityLayer(
121  REntity& entity,
122  RDocument& src,
123  RDocument& dest,
124  bool overwriteLayers,
125  RTransaction& transaction
126  );
127 
128  QSharedPointer<RLayer> copyLayer(
129  RLayer::Id layerId,
130  RDocument& src, RDocument& dest,
131  bool overwriteLayers,
132  RTransaction& transaction
133  );
134 
135  QSharedPointer<RLinetype> copyEntityLinetype(
136  REntity& entity,
137  RDocument& src,
138  RDocument& dest,
139  bool overwriteLinetypes,
140  RTransaction& transaction
141  );
142 
143  QSharedPointer<RLinetype> copyLinetype(
144  RLinetype::Id linetypeId,
145  RDocument& src, RDocument& dest,
146  bool overwriteLinetypes,
147  RTransaction& transaction
148  );
149 
150 private:
151  QMap<QString, QSharedPointer<RLayer> > copiedLayers;
152  QMap<QString, QSharedPointer<RLinetype> > copiedLinetypes;
153  QMap<QString, QSharedPointer<RBlock> > copiedBlocks;
154  QSet<RBlock::Id> copiedBlockContents;
155 };
156 
158 
159 #endif
This abstract class is an interface for all operation implementations.
Definition: ROperation.h:44
QMap< QString, QSharedPointer< RBlock > > copiedBlocks
Definition: RClipboardOperation.h:153
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
QMap< QString, QSharedPointer< RLayer > > copiedLayers
Definition: RClipboardOperation.h:151
int Id
Definition: RObject.h:57
Transaction implementation.
Definition: RTransaction.h:74
#define QCADOPERATIONS_EXPORT
Definition: operations_global.h:10
QMap< QString, QSharedPointer< RLinetype > > copiedLinetypes
Definition: RClipboardOperation.h:152
virtual RTransaction apply(RDocument &document, bool preview=false)
Applies this operation to selection in the given document.
Definition: RClipboardOperation.h:48
Base class for all entity classes.
Definition: REntity.h:64
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
Q_DECLARE_METATYPE(RMath *)
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:71
#define RDEFAULT_QMAP_QSTRING_QSTRING
Definition: RClipboardOperation.h:35
virtual ~RClipboardOperation()
Definition: RClipboardOperation.h:46
QSet< RBlock::Id > copiedBlockContents
Definition: RClipboardOperation.h:154
QMap< QString, QString > RQMapQStringQString
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RClipboardOperation.h:33
Base class for clipboard related operations (copy, cut, paste).
Definition: RClipboardOperation.h:43