/usr/include/openrpt/OpenRPT/renderer/renderobjects.h is in libopenrpt-dev 3.3.4-6.
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 | /*
* OpenRPT report writer and rendering engine
* Copyright (C) 2001-2012 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 __RENDEROBJECTS_H__
#define __RENDEROBJECTS_H__
#include <QString>
#include <QList>
#include <QPointF>
#include <QSizeF>
#include <QFont>
#include <QImage>
#include <QPen>
#include <QBrush>
#include "../../common/reportpageoptions.h"
#include "reportprinter.h"
class ORObject;
class ORODocument;
class OROPage;
class OROPrimitive;
class OROTextBox;
class OROLine;
class OROImage;
class OROBarcode;
//
// ORODocument
// This object is a single document containing one or more OROPage elements
//
class ORODocument
{
friend class OROPage;
public:
ORODocument(const QString & title = QString(), ReportPrinter::type printerType = ReportPrinter::Standard);
virtual ~ORODocument();
QString title() const { return _title; };
void setTitle(const QString & pTitle);
ReportPrinter::type printerType() const { return _type; };
int pages() const { return _pages.count(); };
OROPage* page(int);
void addPage(OROPage*);
void setPageOptions(const ReportPageOptions &);
ReportPageOptions pageOptions() const { return _pageOptions; };
void setPrinterParams(QList<QPair<QString,QString> > params) { _printerParams = params; }
QList<QPair<QString,QString> > getPrinterParams() const { return _printerParams; }
private:
QString _title;
ReportPrinter::type _type;
QList<OROPage*> _pages;
ReportPageOptions _pageOptions;
QList<QPair<QString,QString> > _printerParams;
};
//
// OROPage
// This object is a single page in a document and may contain zero or more
// OROPrimitive objects all of which represent some form of mark to made on
// a page.
//
class OROPage
{
friend class ORODocument;
friend class OROPrimitive;
public:
OROPage(ORODocument * = 0);
virtual ~OROPage();
ORODocument* document() const { return _document; };
int page() const; // returns this pages current page number
int primitives() const { return _primitives.count(); };
OROPrimitive* primitive(int);
void addPrimitive(OROPrimitive*);
void setWatermarkText(const QString &);
void setWatermarkFont(const QFont &);
void setWatermarkOpacity(unsigned char); // 0..255 : default 25
QString watermarkText() const { return _wmText; };
QFont watermarkFont() const { return _wmFont; };
unsigned char watermarkOpacity() const { return _wmOpacity; };
void setBackgroundImage(const QImage &);
void setBackgroundPosition(const QPointF &);
void setBackgroundSize(const QSizeF &);
void setBackgroundScale(bool);
void setBackgroundScaleMode(Qt::AspectRatioMode);
void setBackgroundAlign(int);
void setBackgroundOpacity(unsigned char);
QImage backgroundImage() const { return _bgImage; };
QPointF backgroundPosition() const { return _bgPos; };
QSizeF backgroundSize() const { return _bgSize; };
bool backgroundScale() const { return _bgScale; };
Qt::AspectRatioMode backgroundScaleMode() const { return _bgScaleMode; };
int backgroundAlign() const { return _bgAlign; };
unsigned char backgroundOpacity() const { return _bgOpacity; };
protected:
ORODocument * _document;
QList<OROPrimitive*> _primitives;
QString _wmText;
QFont _wmFont;
unsigned char _wmOpacity;
QImage _bgImage;
QPointF _bgPos;
QSizeF _bgSize;
bool _bgScale;
Qt::AspectRatioMode _bgScaleMode;
int _bgAlign;
unsigned char _bgOpacity;
};
//
// OROPrimitive
// This object represents the basic primitive with a position and type.
// Other primitives are subclasses with a defined type and any additional
// information they require to define that primitive.
//
class OROPrimitive
{
friend class OROPage;
public:
virtual ~OROPrimitive();
// Returns the type of the primitive which should be
// set by the subclass
int type() const { return _type; };
OROPage * page() const { return _page; };
QPointF position() const { return _position; };
void setPosition(const QPointF &);
QPen pen() const {return _pen;}
void setPen(QPen p) {_pen = p;}
QPen border() const {return _border;}
void setBorder(QPen p) {_border = p;}
QBrush brush() const {return _brush;}
void setBrush(QBrush b) {_brush = b;}
qreal rotation() const { return _rotation; }
void setRotation(qreal angle) { _rotation = angle;}
QPointF rotationAxis() const { return _rotationAxis;}
void setRotationAxis(const QPointF p);
void drawRect(QRectF rc, QPainter* painter, int printResolution);
protected:
OROPrimitive(ORObject *o, int);
private:
OROPage * _page;
int _type;
QPointF _position;
QPen _pen;
QPen _border;
QBrush _brush;
qreal _rotation;
QPointF _rotationAxis;
};
//
// OROTextBox
// This is a text box primitive it defines a box region and text that will
// be rendered inside that region. It also contains information for font
// and positioning of the text.
//
class OROTextBox : public OROPrimitive
{
public:
OROTextBox(ORObject *o);
virtual ~OROTextBox();
QSizeF size() const { return _size; };
void setSize(const QSizeF &);
QString text() const { return _text; };
void setText(const QString &);
QString textForcedToWrap(QPainter *p);
QFont font() const { return _font; };
void setFont(const QFont &);
int flags() const { return _flags; };
void setFlags(int);
static const int TextBox;
protected:
QSizeF _size;
QString _text;
QFont _font;
int _flags; // Qt::AlignmentFlag and Qt::TextFlag OR'd
};
//
// OROBarcode
// This is a barcode primitive
//
class OROBarcode : public OROPrimitive
{
public:
OROBarcode(ORObject *o);
virtual ~OROBarcode();
QSizeF size() const { return _size; };
void setSize(const QSizeF &);
QString data() const { return _data; };
void setData(const QString &);
QString format() const { return _format; };
void setFormat(const QString &);
qreal narrowBarWidth() const { return _narrowBarWidth; };
void setNarrowBarWidth(double);
int align() const { return _align; };
void setAlign(int);
static const int Barcode;
protected:
QSizeF _size;
QString _data;
QString _format;
qreal _narrowBarWidth;
int _align;
};
//
// OROLine
// This primitive defines a line with a width/weight.
//
class OROLine : public OROPrimitive
{
public:
OROLine(ORObject *o);
virtual ~OROLine();
QPointF startPoint() const { return position(); };
void setStartPoint(const QPointF &);
QPointF endPoint() const { return _endPoint; };
void setEndPoint(const QPointF &);
static const int Line;
protected:
QPointF _endPoint;
};
//
// OROImage
// This primitive defines an image
//
class OROImage: public OROPrimitive
{
public:
OROImage(ORObject *o);
virtual ~OROImage();
QImage image() const { return _image; };
void setImage(const QImage &);
QSizeF size() const { return _size; };
void setSize(const QSizeF &);
bool scaled() const { return _scaled; };
void setScaled(bool);
int transformationMode() const { return _transformFlags; };
void setTransformationMode(int);
int aspectRatioMode() const { return _aspectFlags; };
void setAspectRatioMode(int);
static const int Image;
protected:
QImage _image;
QSizeF _size;
bool _scaled;
int _transformFlags;
int _aspectFlags;
};
//
// ORORect
// This primitive defines a drawn rectangle
//
class ORORect: public OROPrimitive
{
public:
ORORect(ORObject *o);
virtual ~ORORect();
QSizeF size() const { return _size; }
void setSize(const QSizeF &);
QRectF rect() const { return QRectF(position(), _size); };
void setRect(const QRectF &);
static const int Rect;
protected:
QSizeF _size;
};
#endif // __RENDEROBJECTS_H__
|