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,
74  ) const;
75 
79  void copyEntity(
80  REntity& entity,
81  RDocument& src, RDocument& dest,
82  const RVector& offset,
83  double scale,
84  double unitScale,
85  double rotation,
86  bool flipHorizontal,
87  bool flipVertical,
88  bool toCurrentLayer,
89  bool toCurrentBlock,
90  bool overwriteLayers,
91  bool overwriteBlocks,
92  const QString& blockName,
93  RTransaction& transaction,
94  bool toModelSpaceBlock,
96  ) const;
97 
98  QSharedPointer<RBlock> copyEntityBlock(
99  REntity& entity,
100  RDocument& src,
101  RDocument& dest,
102  bool overwriteBlocks,
103  bool toCurrentBlock,
104  const QString& blockName,
105  RTransaction& transaction
106  ) const;
107 
108  QSharedPointer<RBlock> copyBlock(
109  RBlock::Id blockId,
110  RDocument& src,
111  RDocument& dest,
112  bool overwriteBlocks,
113  bool toCurrentBlock,
114  const QString& blockName,
115  RTransaction& transaction
116  ) const;
117 
118  QSharedPointer<RLayer> copyEntityLayer(
119  REntity& entity,
120  RDocument& src,
121  RDocument& dest,
122  bool overwriteLayers,
123  RTransaction& transaction
124  ) const;
125 
126  QSharedPointer<RLayer> copyLayer(
127  RLayer::Id layerId,
128  RDocument& src, RDocument& dest,
129  bool overwriteLayers,
130  RTransaction& transaction
131  ) const;
132 
133  QSharedPointer<RLinetype> copyEntityLinetype(
134  REntity& entity,
135  RDocument& src,
136  RDocument& dest,
137  bool overwriteLinetypes,
138  RTransaction& transaction
139  ) const;
140 
141  QSharedPointer<RLinetype> copyLinetype(
142  RLinetype::Id linetypeId,
143  RDocument& src, RDocument& dest,
144  bool overwriteLinetypes,
145  RTransaction& transaction
146  ) const;
147 
148 private:
149  mutable QMap<QString, QSharedPointer<RLayer> > copiedLayers;
150  mutable QMap<QString, QSharedPointer<RLinetype> > copiedLinetypes;
151  mutable QMap<QString, QSharedPointer<RBlock> > copiedBlocks;
152  mutable QSet<RBlock::Id> copiedBlockContents;
153 };
154 
156 
157 #endif
This abstract class is an interface for all operation implementations.
Definition: ROperation.h:44
QMap< QString, QSharedPointer< RBlock > > copiedBlocks
Definition: RClipboardOperation.h:151
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
QMap< QString, QSharedPointer< RLayer > > copiedLayers
Definition: RClipboardOperation.h:149
int Id
Definition: RObject.h:53
Transaction implementation.
Definition: RTransaction.h:70
#define QCADOPERATIONS_EXPORT
Definition: operations_global.h:10
QMap< QString, QSharedPointer< RLinetype > > copiedLinetypes
Definition: RClipboardOperation.h:150
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 p1, void p2)
Scales the given entity or shape by the given factor with the given focus point.
Definition: simple_modify.js:54
#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:152
QMap< QString, QString > RQMapQStringQString
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RClipboardOperation.h:33
Base class for clipboard related operations (copy, cut, paste).
Definition: RClipboardOperation.h:43