Changeset View
Changeset View
Standalone View
Standalone View
src/common/KReportRenderObjects.h
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
45 | // | 45 | // | ||
46 | // ORODocument | 46 | // ORODocument | ||
47 | // This object is a single document containing one or more OROPage elements | 47 | // This object is a single document containing one or more OROPage elements | ||
48 | // | 48 | // | ||
49 | class KREPORT_EXPORT ORODocument : public QObject | 49 | class KREPORT_EXPORT ORODocument : public QObject | ||
50 | { | 50 | { | ||
51 | Q_OBJECT | 51 | Q_OBJECT | ||
52 | 52 | | |||
53 | friend class OROPage; | | |||
54 | friend class OROSection; | | |||
55 | | ||||
56 | public: | 53 | public: | ||
57 | explicit ORODocument(const QString & = QString()); | 54 | explicit ORODocument(const QString &title = QString()); | ||
staniek: +title param. | |||||
58 | ~ORODocument(); | 55 | ~ORODocument(); | ||
59 | 56 | | |||
60 | QString title() const { | 57 | QString title() const; | ||
staniek: +index | |||||
staniek: + const OROPage* page(int index) const; overload | |||||
staniek: +const overload | |||||
staniek: +param name here and everywhere :) | |||||
staniek: +title param. | |||||
staniek: TODO | |||||
61 | return m_title; | 58 | void setTitle(const QString &title); | ||
62 | }; | | |||
63 | void setTitle(const QString &); | | |||
64 | 59 | | |||
65 | int pages() const { | | |||
66 | return m_pages.count(); | | |||
67 | }; | | |||
68 | OROPage* page(int); | | |||
69 | void addPage(OROPage*); | | |||
70 | 60 | | |||
staniek: While we're looking here. Add docs informing that ownership is transferred. | |||||
71 | int sections() const { | 61 | /** | ||
72 | return m_sections.count(); | 62 | * @brief Return the total number of pages in the document | ||
staniek: Add docs informing that the page object will be removed and deleted. | |||||
73 | }; | 63 | * | ||
74 | OROSection* section(int); | 64 | */ | ||
75 | void addSection(OROSection*); | 65 | int pageCount() const; | ||
76 | 66 | | |||
77 | void setPageLayout(const QPageLayout &); | 67 | /** | ||
staniek: Add docs informing that ownership is transferred. | |||||
78 | QPageLayout pageLayout() const { | 68 | * @brief Return a pointer to a given page | ||
staniek: Setion -> Section | |||||
staniek: TODO | |||||
staniek: Add docs informing that the section object will be removed and deleted.
| |||||
79 | return m_pageLayout; | 69 | * | ||
80 | }; | 70 | * @param index page number to find | ||
71 | * @return OROPage* | ||||
72 | */ | ||||
73 | OROPage* page(int index); | ||||
74 | const OROPage* page(int index) const; | ||||
81 | 75 | | |||
82 | void notifyChange(int pageNo); | 76 | /** | ||
77 | * @brief Adds the supplied page to this document | ||||
78 | * | ||||
79 | * Ownership of the page is tranferred the document | ||||
80 | * | ||||
81 | * @param page an OROPage* to be added | ||||
82 | */ | ||||
83 | void addPage(OROPage* page); | ||||
83 | 84 | | |||
84 | protected: | 85 | /** | ||
85 | QString m_title; | 86 | * @brief Returns the index of the supplied page in the document | ||
86 | QList<OROPage*> m_pages; | 87 | * | ||
87 | QList<OROSection*> m_sections; | 88 | * @param page OROPage* to find | ||
88 | QPageLayout m_pageLayout; | 89 | * @return int page index | ||
90 | */ | ||||
91 | int pageIndex(const OROPage* page) const; | ||||
92 | | ||||
93 | /** | ||||
94 | * @brief Removes the given page from the document | ||||
95 | * | ||||
96 | * The page is also deleted | ||||
97 | * | ||||
98 | * @param page OROPage* to delete | ||||
99 | */ | ||||
100 | void removePage(OROPage* page); | ||||
101 | | ||||
102 | /** | ||||
103 | * @brief Takes the page from the document but does not delete it | ||||
104 | * | ||||
105 | * @param page OROPage* to take from the document | ||||
106 | */ | ||||
107 | void takePage(OROPage *page); | ||||
108 | | ||||
109 | /** | ||||
110 | * @brief Return the total number of sections in the document | ||||
111 | * | ||||
112 | */ | ||||
113 | int sectionCount() const; | ||||
114 | | ||||
115 | /** | ||||
116 | * @brief Return a pointer to a given section | ||||
117 | * | ||||
118 | * @param index section number to find | ||||
119 | * @return OROSection* | ||||
120 | */ | ||||
121 | OROSection* section(int index); | ||||
122 | const OROSection* section(int index) const; | ||||
123 | | ||||
124 | /** | ||||
125 | * @brief Adds the supplied sectin to the document | ||||
126 | * | ||||
127 | * Ownership of the section is transferred to the document | ||||
128 | * | ||||
129 | * @param section OROSection* to add to the document | ||||
130 | */ | ||||
131 | void addSection(OROSection* section); | ||||
132 | | ||||
133 | /** | ||||
134 | * @brief Removes the supplied section from the document | ||||
135 | * | ||||
136 | * The section will also be deleted | ||||
137 | * | ||||
138 | * @param section OROSection* to remove and delete | ||||
139 | */ | ||||
140 | void removeSection(OROSection *section); | ||||
141 | | ||||
142 | /** | ||||
143 | * @brief Takes the section from the document but does not delete it | ||||
144 | * | ||||
145 | * @param page OROSection* to take from the document | ||||
146 | */ | ||||
147 | void takeSection(OROSection *section); | ||||
148 | | ||||
149 | void setPageLayout(const QPageLayout &layout); | ||||
150 | QPageLayout pageLayout() const; | ||||
151 | | ||||
152 | void notifyChange(int pageNo); | ||||
89 | 153 | | |||
90 | Q_SIGNALS: | 154 | Q_SIGNALS: | ||
91 | void updated(int pageNo); | 155 | void updated(int pageNo); | ||
156 | | ||||
157 | private: | ||||
158 | class Private; | ||||
159 | Private * const d; | ||||
92 | }; | 160 | }; | ||
93 | 161 | | |||
94 | // | 162 | // | ||
95 | // OROPage | 163 | // OROPage | ||
96 | // This object is a single page in a document and may contain zero or more | 164 | // This object is a single page in a document and may contain zero or more | ||
97 | // OROPrimitive objects all of which represent some form of mark to made on | 165 | // OROPrimitive objects all of which represent some form of mark to made on | ||
98 | // a page. | 166 | // a page. | ||
99 | // | 167 | // | ||
100 | class KREPORT_EXPORT OROPage | 168 | class KREPORT_EXPORT OROPage | ||
101 | { | 169 | { | ||
102 | friend class ORODocument; | | |||
103 | friend class OROPrimitive; | | |||
104 | | ||||
105 | public: | 170 | public: | ||
106 | explicit OROPage(ORODocument * = 0); | 171 | explicit OROPage(ORODocument * doc = 0); | ||
107 | ~OROPage(); | 172 | ~OROPage(); | ||
108 | 173 | | |||
109 | ORODocument* document() const { | 174 | ORODocument* document(); | ||
staniek: remove const, add const overload | |||||
110 | return m_document; | 175 | const ORODocument* document() const; | ||
111 | }; | 176 | void setDocument(ORODocument *doc); | ||
112 | int page() const; // returns this pages current page number | | |||
113 | 177 | | |||
114 | int primitives() const { | 178 | int pageNumber() const; // returns this pages current page number | ||
115 | return m_primitives.count(); | | |||
116 | }; | | |||
117 | OROPrimitive* primitive(int); | | |||
118 | void addPrimitive(OROPrimitive*, bool atBeginning = false, bool notify = false); | | |||
119 | 179 | | |||
120 | protected: | 180 | int primitiveCount() const; | ||
121 | ORODocument * m_document; | 181 | | ||
122 | QList<OROPrimitive*> m_primitives; | 182 | OROPrimitive* primitive(int index); | ||
183 | const OROPrimitive* primitive(int index) const; | ||||
184 | | ||||
185 | void insertPrimitive(OROPrimitive* primitive, int index = -1); | ||||
186 | void removePrimitive(OROPrimitive *primitive); | ||||
187 | void takePrimitive(OROPrimitive *primitive); | ||||
staniek: -> pageNumber
| |||||
188 | | ||||
189 | private: | ||||
replace with void insertPrimitive(OROPrimitive*, int index = -1)
staniek: replace with void insertPrimitive(OROPrimitive*, int index = -1)
- removes atBeginning… | |||||
190 | class Private; | ||||
staniek: remove const, add const overload | |||||
191 | Private * const d; | ||||
123 | }; | 192 | }; | ||
124 | // | 193 | // | ||
125 | // OROSection | 194 | // OROSection | ||
126 | // This object is a single row in a document and may contain zero or more | 195 | // This object is a single row in a document and may contain zero or more | ||
127 | // OROPrimitives | 196 | // OROPrimitives | ||
128 | // | 197 | // | ||
129 | class KREPORT_EXPORT OROSection | 198 | class KREPORT_EXPORT OROSection | ||
130 | { | 199 | { | ||
131 | friend class ORODocument; | | |||
132 | friend class OROPrimitive; | | |||
133 | | ||||
134 | public: | 200 | public: | ||
135 | enum Sort { | 201 | explicit OROSection(ORODocument* doc = 0); | ||
staniek: mostly unused, what to do with it? | |||||
I noticed it is mostly unused, only SortX. I imagine there could be use cases for sorting in other directions (probably not Z though). remove Z and keep Y ? piggz: I noticed it is mostly unused, only SortX. I imagine there could be use cases for sorting in… | |||||
staniek: How about keeping X and Y by using Qt::Orientation and removing Sort? | |||||
136 | SortX = 1, | | |||
137 | SortY, | | |||
138 | SortZ | | |||
139 | }; | | |||
140 | | ||||
141 | explicit OROSection(ORODocument * = 0); | | |||
142 | ~OROSection(); | 202 | ~OROSection(); | ||
143 | 203 | | |||
144 | void setHeight(int); | 204 | void setHeight(int); | ||
145 | int height(); | 205 | int height() const; | ||
staniek: +const | |||||
146 | | ||||
147 | void setBackgroundColor(const QColor&L); | | |||
148 | QColor backgroundColor(); | | |||
149 | | ||||
150 | ORODocument* document() const { | | |||
151 | return m_document; | | |||
152 | }; | | |||
153 | 206 | | |||
154 | void setType(KReportSectionData::Section t) { | 207 | void setBackgroundColor(const QColor& color); | ||
staniek: fix par. name | |||||
155 | m_type = t; | 208 | QColor backgroundColor() const; | ||
staniek: +const | |||||
156 | } | | |||
157 | KReportSectionData::Section type() { | | |||
158 | return m_type; | | |||
159 | } | | |||
160 | 209 | | |||
161 | int primitives() const { | 210 | ORODocument* document(); | ||
162 | return m_primitives.count(); | 211 | const ORODocument* document() const; | ||
163 | }; | 212 | void setDocument(ORODocument *doc); | ||
164 | OROPrimitive* primitive(int); | 213 | | ||
165 | void addPrimitive(OROPrimitive*); | 214 | void setType(KReportSectionData::Section t); | ||
166 | 215 | KReportSectionData::Section type() const; | |||
staniek: +const | |||||
167 | void sortPrimatives(Sort); | 216 | | ||
168 | protected: | 217 | int primitiveCount() const; | ||
staniek: +const overload | |||||
staniek: +param name | |||||
169 | ORODocument * m_document; | 218 | OROPrimitive* primitive(int index); | ||
170 | QList<OROPrimitive*> m_primitives; | 219 | const OROPrimitive* primitive(int index) const; | ||
171 | long m_row; | 220 | void addPrimitive(OROPrimitive* primitive); | ||
172 | int m_height; | 221 | void sortPrimitives(Qt::Orientation orientation); | ||
staniek: +param name | |||||
staniek: The param is only checked against SortX | |||||
staniek: typo "primatives" | |||||
173 | KReportSectionData::Section m_type; | | |||
174 | QColor m_backgroundColor; | | |||
175 | 222 | | |||
176 | private: | 223 | private: | ||
177 | static bool xLessThan(OROPrimitive* s1, OROPrimitive* s2); | 224 | class Private; | ||
225 | Private * const d; | ||||
staniek: private so move to .cpp only? | |||||
staniek: I mean xLessThan | |||||
178 | }; | 226 | }; | ||
179 | 227 | | |||
180 | 228 | | |||
181 | // | 229 | // | ||
182 | // OROPrimitive | 230 | // OROPrimitive | ||
183 | // This object represents the basic primitive with a position and type. | 231 | // This object represents the basic primitive with a position and type. | ||
184 | // Other primitives are subclasses with a defined type and any additional | 232 | // Other primitives are subclasses with a defined type and any additional | ||
185 | // information they require to define that primitive. | 233 | // information they require to define that primitive. | ||
186 | // | 234 | // | ||
187 | class KREPORT_EXPORT OROPrimitive | 235 | class KREPORT_EXPORT OROPrimitive | ||
188 | { | 236 | { | ||
189 | friend class OROPage; | | |||
190 | | ||||
191 | public: | 237 | public: | ||
192 | virtual ~OROPrimitive(); | 238 | virtual ~OROPrimitive(); | ||
193 | 239 | | |||
194 | // Returns the type of the primitive which should be | 240 | OROPage* page(); | ||
195 | // set by the subclass | 241 | const OROPage* page() const; | ||
196 | int type() const { | 242 | void setPage(OROPage *page); | ||
staniek: remove const,
add const overload | |||||
197 | return m_type; | | |||
198 | }; | | |||
199 | OROPage * page() const { | | |||
200 | return m_page; | | |||
201 | }; | | |||
202 | 243 | | |||
203 | QPointF position() const { | 244 | QPointF position() const; | ||
staniek: +arg name | |||||
204 | return m_position; | 245 | void setPosition(const QPointF &pos); | ||
205 | }; | 246 | | ||
206 | void setPosition(const QPointF &); | 247 | QSizeF size() const; | ||
207 | QSizeF size() const { return m_size; } | | |||
208 | void setSize(const QSizeF &s); | 248 | void setSize(const QSizeF &s); | ||
209 | 249 | | |||
210 | virtual OROPrimitive* clone() = 0; | 250 | virtual OROPrimitive* clone() const = 0; | ||
211 | 251 | | |||
212 | protected: | 252 | protected: | ||
213 | OROPrimitive(int); | 253 | OROPrimitive(); | ||
staniek: +arg name | |||||
214 | 254 | | |||
215 | OROPage * m_page; | 255 | private: | ||
216 | int m_type; | 256 | class Private; | ||
217 | QPointF m_position; | 257 | Private * const d; | ||
218 | QSizeF m_size; | | |||
219 | }; | 258 | }; | ||
220 | 259 | | |||
221 | // | 260 | // | ||
222 | // OROTextBox | 261 | // OROTextBox | ||
223 | // This is a text box primitive it defines a box region and text that will | 262 | // This is a text box primitive it defines a box region and text that will | ||
224 | // be rendered inside that region. It also contains information for font | 263 | // be rendered inside that region. It also contains information for font | ||
225 | // and positioning of the text. | 264 | // and positioning of the text. | ||
226 | // | 265 | // | ||
227 | class KREPORT_EXPORT OROTextBox : public OROPrimitive | 266 | class KREPORT_EXPORT OROTextBox : public OROPrimitive | ||
228 | { | 267 | { | ||
229 | public: | 268 | public: | ||
230 | OROTextBox(); | 269 | OROTextBox(); | ||
231 | virtual ~OROTextBox(); | 270 | virtual ~OROTextBox(); | ||
232 | 271 | | |||
233 | QString text() const { | 272 | QString text() const; | ||
234 | return m_text; | 273 | void setText(const QString &text); | ||
staniek: +arg name here and everywhere | |||||
staniek: Not done... | |||||
staniek: TODO | |||||
235 | }; | | |||
236 | void setText(const QString &); | | |||
237 | 274 | | |||
238 | KRTextStyleData textStyle() const { | 275 | KRTextStyleData textStyle() const; | ||
239 | return m_textStyle; | | |||
240 | } | | |||
241 | void setTextStyle(const KRTextStyleData&); | 276 | void setTextStyle(const KRTextStyleData&); | ||
242 | 277 | | |||
243 | KReportLineStyle lineStyle() const { | 278 | KReportLineStyle lineStyle() const; | ||
244 | return m_lineStyle; | | |||
245 | } | | |||
246 | void setLineStyle(const KReportLineStyle&); | 279 | void setLineStyle(const KReportLineStyle&); | ||
247 | 280 | | |||
248 | void setFont(const QFont &); | 281 | void setFont(const QFont &font); | ||
249 | 282 | | |||
250 | int flags() const { | 283 | int flags() const; | ||
251 | return m_flags; | 284 | void setFlags(int flags); | ||
Hmm, in most cases dynamic_cast<> is ok for checking types. This construction feels like written for pre-C++ without dynamic cast and polymorphism... If we even need type IDs it would be possible to have a single enum with them. staniek: Hmm, in most cases dynamic_cast<> is ok for checking types.
I propose to remove this line and… | |||||
252 | }; | | |||
253 | void setFlags(int); | | |||
254 | | ||||
255 | static const int TextBox; | | |||
256 | 285 | | |||
257 | virtual OROPrimitive* clone(); | 286 | virtual OROPrimitive* clone() const; | ||
258 | 287 | | |||
259 | bool requiresPostProcessing(){return m_requiresPostProcessing;} | 288 | bool requiresPostProcessing() const; | ||
260 | void setRequiresPostProcessing(bool pp = true){m_requiresPostProcessing = pp;} | 289 | void setRequiresPostProcessing(bool pp); | ||
261 | 290 | | |||
262 | bool wordWrap() const {return m_wordWrap;} | 291 | bool wordWrap() const; | ||
263 | void setWordWrap(bool ww){m_wordWrap = ww;} | 292 | void setWordWrap(bool ww); | ||
staniek: remove = true | |||||
264 | 293 | | |||
265 | bool canGrow() const {return m_canGrow;} | 294 | bool canGrow() const; | ||
266 | void setCanGrow(bool cg){m_canGrow = cg;} | 295 | void setCanGrow(bool grow); | ||
267 | 296 | | |||
268 | protected: | 297 | private: | ||
269 | QString m_text; | 298 | class Private; | ||
270 | KRTextStyleData m_textStyle; | 299 | Private * const d; | ||
271 | KReportLineStyle m_lineStyle; | | |||
272 | Qt::Alignment m_alignment; | | |||
273 | int m_flags; // Qt::AlignmentFlag and Qt::TextFlag OR'd | | |||
274 | bool m_wordWrap; | | |||
275 | bool m_canGrow; | | |||
276 | bool m_requiresPostProcessing; | | |||
277 | }; | 300 | }; | ||
278 | 301 | | |||
279 | // | 302 | // | ||
280 | // OROLine | 303 | // OROLine | ||
281 | // This primitive defines a line with a width/weight. | 304 | // This primitive defines a line with a width/weight. | ||
282 | // | 305 | // | ||
283 | class KREPORT_EXPORT OROLine : public OROPrimitive | 306 | class KREPORT_EXPORT OROLine : public OROPrimitive | ||
284 | { | 307 | { | ||
285 | public: | 308 | public: | ||
286 | OROLine(); | 309 | OROLine(); | ||
287 | virtual ~OROLine(); | 310 | virtual ~OROLine(); | ||
288 | 311 | | |||
289 | QPointF startPoint() const { | 312 | QPointF startPoint() const { | ||
290 | return position(); | 313 | return position(); | ||
291 | }; | 314 | }; | ||
292 | void setStartPoint(const QPointF &); | 315 | void setStartPoint(const QPointF &start); | ||
staniek: let's add arg name | |||||
293 | 316 | | |||
294 | QPointF endPoint() const { | 317 | QPointF endPoint() const; | ||
295 | return m_endPoint; | 318 | void setEndPoint(const QPointF &end); | ||
staniek: let's add arg name | |||||
296 | }; | | |||
297 | void setEndPoint(const QPointF &); | | |||
298 | 319 | | |||
299 | KReportLineStyle lineStyle() const { | 320 | KReportLineStyle lineStyle() const; | ||
300 | return m_lineStyle; | 321 | void setLineStyle(const KReportLineStyle& style); | ||
staniek: let's add arg name | |||||
301 | }; | | |||
302 | void setLineStyle(const KReportLineStyle&); | | |||
303 | 322 | | |||
304 | static const int Line; | 323 | virtual OROPrimitive* clone() const; | ||
staniek: remove? | |||||
305 | virtual OROPrimitive* clone(); | 324 | | ||
306 | protected: | 325 | private: | ||
307 | QPointF m_endPoint; | 326 | class Private; | ||
308 | KReportLineStyle m_lineStyle; | 327 | Private * const d; | ||
309 | }; | 328 | }; | ||
310 | 329 | | |||
311 | // | 330 | // | ||
312 | // OROImage | 331 | // OROImage | ||
313 | // This primitive defines an image | 332 | // This primitive defines an image | ||
314 | // | 333 | // | ||
315 | class KREPORT_EXPORT OROImage: public OROPrimitive | 334 | class KREPORT_EXPORT OROImage: public OROPrimitive | ||
316 | { | 335 | { | ||
317 | public: | 336 | public: | ||
318 | OROImage(); | 337 | OROImage(); | ||
319 | virtual ~OROImage(); | 338 | virtual ~OROImage(); | ||
320 | 339 | | |||
321 | QImage image() const { | 340 | QImage image() const; | ||
322 | return m_image; | 341 | void setImage(const QImage &img); | ||
staniek: let's add arg name | |||||
323 | }; | | |||
324 | void setImage(const QImage &); | | |||
325 | 342 | | |||
326 | bool scaled() const { | 343 | bool isScaled() const; | ||
staniek: int -> Qt::TransformationMode | |||||
staniek: -> isScaled | |||||
staniek: let's add arg name | |||||
327 | return m_scaled; | 344 | void setScaled(bool scaled); | ||
staniek: int -> Qt::TransformationMode | |||||
328 | }; | | |||
329 | void setScaled(bool); | | |||
330 | 345 | | |||
331 | int transformationMode() const { | 346 | Qt::TransformationMode transformationMode() const; | ||
staniek: int -> Qt::AspectRatioMode ? | |||||
332 | return m_transformFlags; | 347 | void setTransformationMode(Qt::TransformationMode transformation); | ||
staniek: int -> Qt::AspectRatioMode ? | |||||
333 | }; | | |||
334 | void setTransformationMode(int); | | |||
335 | 348 | | |||
336 | int aspectRatioMode() const { | 349 | Qt::AspectRatioMode aspectRatioMode() const; | ||
337 | return m_aspectFlags; | 350 | void setAspectRatioMode(Qt::AspectRatioMode aspect); | ||
338 | }; | | |||
339 | void setAspectRatioMode(int); | | |||
340 | 351 | | |||
341 | static const int Image; | 352 | virtual OROPrimitive* clone() const; | ||
342 | virtual OROPrimitive* clone(); | | |||
343 | 353 | | |||
344 | protected: | 354 | private: | ||
345 | QImage m_image; | 355 | class Private; | ||
346 | bool m_scaled; | 356 | Private * const d; | ||
347 | int m_transformFlags; | | |||
348 | int m_aspectFlags; | | |||
349 | }; | 357 | }; | ||
350 | 358 | | |||
359 | // | ||||
360 | // OROPicture | ||||
361 | // This primitive defines a picture | ||||
362 | // | ||||
351 | class KREPORT_EXPORT OROPicture: public OROPrimitive | 363 | class KREPORT_EXPORT OROPicture: public OROPrimitive | ||
352 | { | 364 | { | ||
353 | public: | 365 | public: | ||
354 | OROPicture(); | 366 | OROPicture(); | ||
355 | virtual ~OROPicture(); | 367 | virtual ~OROPicture(); | ||
356 | 368 | | |||
357 | void setPicture(const QPicture& p) { | 369 | void setPicture(const QPicture& pic); | ||
358 | m_picture = p; | 370 | QPicture* picture(); | ||
359 | } | | |||
360 | QPicture* picture() { | | |||
361 | return &m_picture; | | |||
362 | }; | | |||
363 | 371 | | |||
364 | static const int Picture; | 372 | virtual OROPrimitive* clone() const; | ||
staniek: remove? | |||||
365 | virtual OROPrimitive* clone(); | 373 | | ||
366 | protected: | 374 | private: | ||
367 | QPicture m_picture; | 375 | class Private; | ||
376 | Private * const d; | ||||
368 | 377 | | |||
369 | }; | 378 | }; | ||
370 | // | 379 | // | ||
371 | // ORORect | 380 | // ORORect | ||
372 | // This primitive defines a drawn rectangle | 381 | // This primitive defines a drawn rectangle | ||
373 | // | 382 | // | ||
374 | class KREPORT_EXPORT ORORect: public OROPrimitive | 383 | class KREPORT_EXPORT ORORect: public OROPrimitive | ||
375 | { | 384 | { | ||
376 | public: | 385 | public: | ||
377 | ORORect(); | 386 | ORORect(); | ||
378 | virtual ~ORORect(); | 387 | virtual ~ORORect(); | ||
379 | 388 | | |||
380 | QRectF rect() const { | 389 | QRectF rect() const; | ||
381 | return QRectF(m_position, m_size); | 390 | void setRect(const QRectF &rectangle); | ||
382 | }; | | |||
383 | void setRect(const QRectF &); | | |||
384 | 391 | | |||
385 | QPen pen() const { | 392 | QPen pen() const; | ||
386 | return m_pen; | 393 | void setPen(const QPen &pen); | ||
387 | }; | | |||
388 | void setPen(const QPen &); | | |||
389 | 394 | | |||
390 | QBrush brush() const { | 395 | QBrush brush() const; | ||
391 | return m_brush; | 396 | void setBrush(const QBrush &brush); | ||
staniek: let's add arg name | |||||
392 | }; | | |||
393 | void setBrush(const QBrush &); | | |||
394 | 397 | | |||
395 | static const int Rect; | 398 | virtual OROPrimitive* clone() const; | ||
staniek: remove? | |||||
396 | virtual OROPrimitive* clone(); | 399 | | ||
397 | protected: | 400 | private: | ||
398 | QPen m_pen; | 401 | class Private; | ||
399 | QBrush m_brush; | 402 | Private * const d; | ||
400 | }; | 403 | }; | ||
401 | 404 | | |||
402 | // | 405 | // | ||
403 | // ORORect | 406 | // ORORect | ||
404 | // This primitive defines a drawn rectangle | 407 | // This primitive defines a drawn rectangle | ||
405 | // | 408 | // | ||
406 | class KREPORT_EXPORT OROEllipse: public OROPrimitive | 409 | class KREPORT_EXPORT OROEllipse: public OROPrimitive | ||
407 | { | 410 | { | ||
408 | public: | 411 | public: | ||
409 | OROEllipse(); | 412 | OROEllipse(); | ||
410 | virtual ~OROEllipse(); | 413 | virtual ~OROEllipse(); | ||
411 | 414 | | |||
412 | QRectF rect() const { | 415 | QRectF rect() const; | ||
413 | return QRectF(m_position, m_size); | 416 | void setRect(const QRectF &rectangle); | ||
staniek: let's add arg name | |||||
414 | }; | 417 | | ||
415 | void setRect(const QRectF &); | 418 | QPen pen() const; | ||
staniek: let's add arg name | |||||
419 | void setPen(const QPen &pen); | ||||
staniek: let's add arg name | |||||
420 | | ||||
421 | QBrush brush() const; | ||||
staniek: remove? | |||||
422 | void setBrush(const QBrush &brush); | ||||
416 | 423 | | |||
417 | QPen pen() const { | 424 | virtual OROPrimitive* clone() const; | ||
418 | return m_pen; | 425 | | ||
426 | private: | ||||
427 | class Private; | ||||
428 | Private * const d; | ||||
419 | }; | 429 | }; | ||
420 | void setPen(const QPen &); | | |||
421 | 430 | | |||
422 | QBrush brush() const { | 431 | class KREPORT_EXPORT OROCheckBox : public OROPrimitive | ||
staniek: OROCheckBox? | |||||
423 | return m_brush; | 432 | { | ||
433 | public: | ||||
434 | enum Type { | ||||
staniek: Remove? | |||||
staniek: TODO: enum types? | |||||
435 | Cross = 1, | ||||
436 | Tick, | ||||
437 | Dot | ||||
424 | }; | 438 | }; | ||
425 | void setBrush(const QBrush &); | | |||
426 | 439 | | |||
427 | static const int Ellipse; | 440 | OROCheckBox(); | ||
428 | virtual OROPrimitive* clone(); | 441 | virtual ~OROCheckBox(); | ||
442 | virtual OROPrimitive* clone() const; | ||||
429 | 443 | | |||
430 | protected: | 444 | void setCheckType(Type type); | ||
431 | QSizeF m_size; | 445 | Type checkType() const; | ||
432 | QPen m_pen; | | |||
433 | QBrush m_brush; | | |||
434 | }; | | |||
435 | | ||||
436 | class KREPORT_EXPORT OROCheck : public OROPrimitive | | |||
437 | { | | |||
438 | public: | | |||
439 | OROCheck(); | | |||
440 | virtual ~OROCheck(); | | |||
441 | virtual OROPrimitive* clone(); | | |||
442 | static const int Check; | | |||
443 | | ||||
444 | void setCheckType(const QString& t) { | | |||
445 | if (t == QLatin1String("Cross") || t == QLatin1String("Tick") || t == QLatin1String("Dot")) { | | |||
446 | m_checkType = t; | | |||
447 | } else { | | |||
448 | m_checkType = QLatin1String("Cross"); | | |||
449 | } | | |||
450 | } | | |||
451 | | ||||
452 | QString checkType() const { | | |||
453 | return m_checkType; | | |||
454 | }; | | |||
455 | | ||||
456 | void setValue(bool v) { | | |||
457 | m_value = v; | | |||
458 | } | | |||
459 | bool value() const { | | |||
460 | return m_value; | | |||
461 | } | | |||
462 | | ||||
463 | void setLineStyle(const KReportLineStyle& ls) { | | |||
464 | m_lineStyle = ls; | | |||
465 | } | | |||
466 | | ||||
467 | KReportLineStyle lineStyle() const { | | |||
468 | return m_lineStyle; | | |||
469 | } | | |||
470 | void setForegroundColor(const QColor& fg) { | | |||
471 | m_fgColor = fg; | | |||
472 | } | | |||
473 | QColor foregroundColor() const { | | |||
474 | return m_fgColor; | | |||
475 | } | | |||
476 | 446 | | |||
477 | protected: | 447 | void setValue(bool val); | ||
478 | QSizeF m_size; | 448 | bool value() const; | ||
479 | QString m_checkType; | | |||
480 | bool m_value; | | |||
481 | KReportLineStyle m_lineStyle; | | |||
482 | QColor m_fgColor; | | |||
483 | 449 | | |||
450 | void setLineStyle(const KReportLineStyle& ls); | ||||
451 | KReportLineStyle lineStyle() const; | ||||
452 | | ||||
453 | void setForegroundColor(const QColor& fg); | ||||
454 | QColor foregroundColor() const; | ||||
455 | | ||||
456 | private: | ||||
457 | class Private; | ||||
458 | Private * const d; | ||||
484 | 459 | | |||
485 | }; | 460 | }; | ||
486 | 461 | | |||
487 | #endif // __RENDEROBJECTS_H__ | 462 | #endif // __RENDEROBJECTS_H__ |
+title param.