/usr/include/openrpt/OpenRPT/wrtembed/graphicsitems.h is in libopenrpt-dev 3.3.12-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | /*
* OpenRPT report writer and rendering engine
* Copyright (C) 2001-2014 by OpenMFG, LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Please contact info@openmfg.com with any questions on this license.
*/
#ifndef __GRAPHICSITEMS_H__
#define __GRAPHICSITEMS_H__
#include <QtGui>
#include <QGraphicsRectItem>
#include <QDomDocument>
#include <parsexmlutils.h>
class ORResizeHandle : public QGraphicsRectItem
{
public:
enum { Type = UserType + 99 };
enum Role {
TopLeft = 0,
Top,
TopRight,
Right,
BottomRight,
Bottom,
BottomLeft,
Left,
StartLine,
EndLine
};
ORResizeHandle(enum Role role, QGraphicsItem * parent);
void reposition();
int type() const { return Type; }
protected:
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
private:
Role _role;
bool _moved;
};
class ORGraphicsRectItem : public QGraphicsRectItem
{
public:
enum { Type = UserType + 100 };
ORGraphicsRectItem(QGraphicsItem * parent = 0);
ORGraphicsRectItem(const QDomNode &, QGraphicsItem * parent = 0);
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
virtual void buildXML(QDomDocument & doc, QDomElement & parent);
int type() const { return Type; }
static void buildXML(QGraphicsItem * item, QDomDocument & doc, QDomElement & parent);
static void buildXMLFont(QDomDocument &, QDomElement &, QFont);
static QFont getDefaultEntityFont();
static void setDefaultEntityFont(const QFont &);
virtual void properties(QWidget * parent = 0);
void borderProperties(QWidget * parent = 0);
qreal rotation() const { return _rotation; }
void setRotation(qreal angle);
QPen border() const { return _border; }
void setBorder(QPen p) { _border = p; }
protected:
void contextMenuEvent(QGraphicsSceneContextMenuEvent * event);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event);
void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void buildXMLCommon(QDomDocument & doc, QDomElement & entity);
void parseRect(const QDomNode & entity);
private:
ORResizeHandle *_rhTopLeft;
ORResizeHandle *_rhTop;
ORResizeHandle *_rhTopRight;
ORResizeHandle *_rhRight;
ORResizeHandle *_rhBottomRight;
ORResizeHandle *_rhBottom;
ORResizeHandle *_rhBottomLeft;
ORResizeHandle *_rhLeft;
qreal _rotation;
QPen _border;
bool _moved;
static bool _readDefaultFont;
static QFont _defaultFont;
};
class ORGraphicsLineItem : public QGraphicsLineItem
{
public:
enum { Type = UserType + 104 };
ORGraphicsLineItem(QGraphicsItem * parent = 0);
ORGraphicsLineItem(const QDomNode &, QGraphicsItem * parent = 0);
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
void buildXML(QDomDocument & doc, QDomElement & parent);
int type() const { return Type; }
virtual void properties(QWidget * parent = 0);
virtual QRectF boundingRect() const;
virtual QPainterPath shape() const;
protected:
void contextMenuEvent(QGraphicsSceneContextMenuEvent * event);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event);
void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
private:
ORResizeHandle * _rhStartPoint;
ORResizeHandle * _rhEndPoint;
bool _moved;
};
class ORGraphicsLabelItem : public ORGraphicsRectItem
{
public:
enum { Type = UserType + 101 };
ORGraphicsLabelItem(QGraphicsItem * parent = 0);
ORGraphicsLabelItem(const QDomNode &, QGraphicsItem * parent = 0);
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
void buildXML(QDomDocument & doc, QDomElement & parent);
int type() const { return Type; }
// Label specific methods
void setText(const QString& text);
void setFont(const QFont& font);
void setTextFlags(int flags);
QString text() const { return _txt; }
QFont font() const { return _font; }
int textFlags() const { return _flags; }
virtual void properties(QWidget * parent = 0);
protected:
// label specific data
QString _txt;
int _flags;
QFont _font;
};
class ORGraphicsFieldItem : public ORGraphicsRectItem
{
public:
enum { Type = UserType + 102 };
ORGraphicsFieldItem(QGraphicsItem * parent = 0);
ORGraphicsFieldItem(const QDomNode &, QGraphicsItem * parent = 0);
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
QRectF boundingRect () const;
void buildXML(QDomDocument & doc, QDomElement & parent);
int type() const { return Type; }
// Field specific methods
void setQuery(const QString&);
void setColumn(const QString&);
void setFont(const QFont&);
void setTextFlags(int);
void setTrackTotal(bool);
void setFormat(const QString &, bool=false);
void setUseSubTotal(bool);
void setArray(int lines, int columns, double xSpacing, double ySpacing, bool pageBreak, bool leftToRight);
QString query() const { return _qry; }
QString column() const { return _clmn; }
QFont font() const { return _font; }
bool trackTotal() const { return _trackTotal; }
bool trackBuiltinFormat() const { return _trackBuiltinFormat; }
bool useSubTotal() const { return _useSubTotal; }
QString format() const { return _format; }
int textFlags() const { return _flags; }
int lines() const { return _lines; }
int columns() const { return _columns; }
qreal xSpacing() const { return _xSpacing; }
qreal ySpacing() const { return _ySpacing; }
qreal triggerPageBreak() const { return _triggerPageBreak; }
qreal leftToRight() const { return _leftToRight; }
virtual void properties(QWidget * parent = 0);
protected:
// Field specific data
QString _qry;
QString _clmn;
int _flags;
QFont _font;
bool _trackTotal;
bool _trackBuiltinFormat;
bool _useSubTotal;
QString _format;
int _lines;
int _columns;
qreal _xSpacing;
qreal _ySpacing;
bool _triggerPageBreak;
bool _leftToRight;
};
class ORGraphicsTextItem : public ORGraphicsRectItem
{
public:
enum { Type = UserType + 103 };
ORGraphicsTextItem(QGraphicsItem * parent = 0);
ORGraphicsTextItem(const QDomNode &, QGraphicsItem * parent = 0);
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
void buildXML(QDomDocument & doc, QDomElement & parent);
int type() const { return Type; }
// Text specific methods
void setBottomPadding(double bp);
void setQuery(const QString&);
void setColumn(const QString&);
void setFont(const QFont&);
void setTextFlags(int);
double bottomPadding() const { return _bpad; }
QString query() const { return _qry; }
QString column() const { return _clmn; }
QFont font() const { return _font; }
int textFlags() const { return _flags; }
virtual void properties(QWidget * parent = 0);
protected:
// Text specific data
double _bpad;
QString _qry;
QString _clmn;
int _flags;
QFont _font;
};
class ORGraphicsBarcodeItem : public ORGraphicsRectItem
{
public:
enum { Type = UserType + 105 };
ORGraphicsBarcodeItem(QGraphicsItem * parent = 0);
ORGraphicsBarcodeItem(const QDomNode &, QGraphicsItem * parent = 0);
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
void buildXML(QDomDocument & doc, QDomElement & parent);
int type() const { return Type; }
// Barcode specific Methods
void setFormat(const QString&);
void setQuery(const QString&);
void setColumn(const QString&);
void setMaxLength(int i);
void setAlignment(int i);
void setNarrowBarWidth(double bw);
QString format() const { return _frmt; }
QString query() const { return _qry; }
QString column() const { return _clmn; }
int maxLength() const { return _maxlength; }
int alignment() const { return _align; }
double narrowBarWidth() const { return _narrowBarWidth; }
virtual void properties(QWidget * parent = 0);
protected:
// Barcode specific data
QString _qry;
QString _clmn;
QString _frmt;
int _maxlength;
int _align;
double _narrowBarWidth;
private:
// all these values are in inches and
// are for internal use only
double _min_width_data;
double _min_width_total;
double _min_height;
};
class ORGraphicsImageItem : public ORGraphicsRectItem
{
public:
enum { Type = UserType + 106 };
ORGraphicsImageItem(QGraphicsItem * parent = 0);
ORGraphicsImageItem(const QDomNode &, QGraphicsItem * parent = 0);
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
void buildXML(QDomDocument & doc, QDomElement & parent);
int type() const { return Type; }
// Image specific methods
void setInline(bool);
void setInlineImageData(QString);
void setQuery(const QString&);
void setColumn(const QString&);
void setMode(QString);
bool isInline() const { return _img_inline; }
QString inlineImageData() const { return img_data; }
QString query() const { return _qry; }
QString column() const { return _clmn; }
QString mode() const { return _mode; }
virtual void properties(QWidget * parent = 0);
protected:
// Image specific data
bool _img_inline;
QString _qry;
QString _clmn;
QString _mode;
QImage img;
QString img_data;
QString _frmt;
};
class ORGraphicsGraphItem : public ORGraphicsRectItem
{
public:
enum { Type = UserType + 107 };
ORGraphicsGraphItem(QGraphicsItem * parent = 0);
ORGraphicsGraphItem(const QDomNode &, QGraphicsItem * parent = 0);
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
void buildXML(QDomDocument & doc, QDomElement & parent);
int type() const { return Type; }
// Graph specific methods
void setData(const ORGraphData &);
void copyData(ORGraphData &);
void setQuery(const QString &);
QString query() const;
virtual void properties(QWidget * parent = 0);
protected:
// Graph specific data
ORGraphData _graphData;
};
class ORGraphicsCrossTabItem : public ORGraphicsRectItem
{
public:
enum { Type = UserType + 108 };
ORGraphicsCrossTabItem(QGraphicsItem * parent = 0);
ORGraphicsCrossTabItem(const QDomNode &, QGraphicsItem * parent = 0);
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
void buildXML(QDomDocument & doc, QDomElement & parent);
int type() const { return Type; }
// CrossTab specific methods
void setQuery(const QString&);
void setColumn(const QString&, const QString&);
void setFont(const QFont&);
void setHAlign(const QString&, const QString&);
void setVAlign(const QString&, const QString&);
void setTableWrapping(const bool& policyColumnsFirst);
void setCellMargins(const double& left, const double& right,
const double& top, const double& bottom);
void setDisplayHeaderColumn(const bool& display);
void setDisplayHeaderRow(const bool& display);
QString query() const { return m_query; }
QString column(const QString & type) const { return m_queryColumn.value(type); }
QFont font() const { return m_font; }
QString HAlign(const QString& type) const { return m_hAlign.value(type); }
QString VAlign(const QString& type) const { return m_vAlign.value(type); }
bool tableWrapping() const { return m_tableWrapPolicyColumnsFirst; }
void cellMargins(double& left, double& right,
double& top, double& bottom) const
{ left = m_leftMargin; right = m_rightMargin;
top = m_topMargin; bottom = m_bottomMargin; }
bool displayHeaderColumn() const { return m_columnHeaderOnEachPart; }
bool displayHeaderRow() const { return m_rowHeaderOnEachPart; }
virtual void properties(QWidget * parent = 0);
protected:
// CrossTab specific data
QString m_query;
QMultiMap<QString,QString> m_queryColumn;
QMap<QString,QString> m_hAlign;
QMap<QString,QString> m_vAlign;
QFont m_font;
bool m_tableWrapPolicyColumnsFirst;
bool m_rowHeaderOnEachPart;
bool m_columnHeaderOnEachPart;
double m_leftMargin;
double m_rightMargin;
double m_topMargin;
double m_bottomMargin;
void setTableRect();
QRectF tableRect();
};
#endif
|