QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RTextEntity.h
Go to the documentation of this file.
1 #ifndef RTEXTENTITY_H
2 #define RTEXTENTITY_H
3 
4 #include "REntity.h"
5 #include "RTextData.h"
6 
7 class RDocument;
8 class RExporter;
9 
17 class RTextEntity: public REntity {
18 
19  Q_DECLARE_TR_FUNCTIONS(RTextEntity)
20 
21 public:
31 
45 
46 public:
49  virtual ~RTextEntity();
50 
51  static void init();
52 
53  virtual RTextEntity* clone() const {
54  return new RTextEntity(*this);
55  }
56 
57  virtual RS::EntityType getType() const {
58  return RS::EntityText;
59  }
60 
61  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value);
62  QPair<QVariant, RPropertyAttributes> getProperty(
63  RPropertyTypeId propertyTypeId,
64  bool humanReadable = false, bool noAttributes = false);
65 
66  virtual void exportEntity(RExporter& e, bool preview=false) const;
67 
68  QList<RPainterPath> getPainterPaths(bool draft = false) const {
69  return data.getPainterPaths(draft);
70  }
71 
72  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX) const {
73  return data.getShapes(queryBox);
74  }
75 
76  virtual QList<QSharedPointer<RShape> > getExploded() const {
77  return data.getExploded();
78  }
79 
80  virtual RTextData& getTextData() {
81  return data;
82  }
83 
84  virtual RTextData& getData() {
85  return data;
86  }
87 
88  void setData(RTextData& d) {
89  data = d;
90  }
91 
92  virtual const RTextData& getData() const {
93  return data;
94  }
95 
96  RVector getPosition() const {
97  return data.getPosition();
98  }
99 
101  return data.getAlignmentPoint();
102  }
103 
104  double getTextHeight() const {
105  return data.getTextHeight();
106  }
107 
108  double getTextWidth() const {
109  return data.getTextWidth();
110  }
111 
112  double getWidth() const {
113  return data.getWidth();
114  }
115  double getHeight() const {
116  return data.getHeight();
117  }
118 
120  return data.getVAlign();
121  }
122 
124  return data.getHAlign();
125  }
126 
127  QString getFontName() const {
128  return data.getFontName();
129  }
130 
131  void setFontName(const QString& fontName) {
132  data.setFontName(fontName);
133  }
134 
135  QString getEscapedText() const {
136  return data.getEscapedText();
137  }
138 
139  //QString getHtmlText() const {
140  // return data.getHtmlText();
141  //}
142 
143  QString getPlainText() const {
144  return data.getPlainText();
145  }
146 
147  void setText(const QString& text) {
148  data.setText(text);
149  }
150 
151  bool isSimple() const {
152  return data.isSimple();
153  }
154 
155 protected:
156  virtual void print(QDebug dbg) const;
157 
158 protected:
160 };
161 
163 Q_DECLARE_METATYPE(QSharedPointer<RTextEntity>)
164 Q_DECLARE_METATYPE(QSharedPointer<RTextEntity>*)
165 
166 #endif