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) const {
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  ) const;
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  RTransaction& transaction,
95  bool toModelSpaceBlock,
97  ) const;
98 
99  QSharedPointer<RBlock> copyEntityBlock(
100  REntity& entity,
101  RDocument& src,
102  RDocument& dest,
103  bool overwriteBlocks,
104  bool toCurrentBlock,
105  const QString& blockName,
106  RTransaction& transaction
107  ) const;
108 
109  QSharedPointer<RBlock> copyBlock(
110  RBlock::Id blockId,
111  RDocument& src,
112  RDocument& dest,
113  bool overwriteBlocks,
114  bool toCurrentBlock,
115  const QString& blockName,
116  RTransaction& transaction
117  ) const;
118 
119  QSharedPointer<RLayer> copyEntityLayer(
120  REntity& entity,
121  RDocument& src,
122  RDocument& dest,
123  bool overwriteLayers,
124  RTransaction& transaction
125  ) const;
126 
127  QSharedPointer<RLayer> copyLayer(
128  RLayer::Id layerId,
129  RDocument& src, RDocument& dest,
130  bool overwriteLayers,
131  RTransaction& transaction
132  ) const;
133 
134  QSharedPointer<RLinetype> copyEntityLinetype(
135  REntity& entity,
136  RDocument& src,
137  RDocument& dest,
138  bool overwriteLinetypes,
139  RTransaction& transaction
140  ) const;
141 
142  QSharedPointer<RLinetype> copyLinetype(
143  RLinetype::Id linetypeId,
144  RDocument& src, RDocument& dest,
145  bool overwriteLinetypes,
146  RTransaction& transaction
147  ) const;
148 
149 private:
150  mutable QMap<QString, QSharedPointer<RLayer> > copiedLayers;
151  mutable QMap<QString, QSharedPointer<RLinetype> > copiedLinetypes;
152  mutable QMap<QString, QSharedPointer<RBlock> > copiedBlocks;
153  mutable QSet<RBlock::Id> copiedBlockContents;
154 };
155 
157 
158 #endif
This abstract class is an interface for all operation implementations.
Definition: ROperation.h:44
QMap< QString, QSharedPointer< RBlock > > copiedBlocks
Definition: RClipboardOperation.h:152
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
QMap< QString, QSharedPointer< RLayer > > copiedLayers
Definition: RClipboardOperation.h:150
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:151
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:64
#define RDEFAULT_QMAP_QSTRING_QSTRING
Definition: RClipboardOperation.h:35
virtual ~RClipboardOperation()
Definition: RClipboardOperation.h:46
virtual RTransaction apply(RDocument &document, bool preview=false) const
Applies this operation to selection in the given document.
Definition: RClipboardOperation.h:48
QSet< RBlock::Id > copiedBlockContents
Definition: RClipboardOperation.h:153
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