This file is indexed.

/usr/include/openrpt/common/parsexmlutils.h is in libopenrpt-dev 3.3.7-1.

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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
/*
 * 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.
 */

/*
 *     This is a collection of various functions used to parse the
 * different xml structures used in the Report definitions.  Most
 * of these are structures that are common to several or the complex
 * structures.
 */

#ifndef __PARSEXMLUTILS_H__
#define __PARSEXMLUTILS_H__

// forward declarations
class QDomElement;
class QDomNode;

#include "querysource.h"
#include "reportpageoptions.h"

#include <QString>
#include <QRect>
#include <QFont>
#include <QColor>
#include <QMap>
#include <QList>
#include <QPair>
#include <QPen>
#include <QBrush>
#include <QSqlDatabase>

//
// Data Structures
//
class ORDataData
{
  public:
    ORDataData()
    {
      query = QString::null;
      column = QString::null;
    }
    ORDataData(const QString & q, const QString & c)
    {
      query = q;
      column = c;
    }
    ORDataData(const ORDataData & d)
    {
      query = d.query;
      column = d.column;
    }

    ORDataData & operator=(const ORDataData & d)
    {
      query = d.query;
      column = d.column;
      return *this;
    }

    bool operator==(const ORDataData & d) const
    {
      return ((query == d.query) && (column == d.column));
    }

    bool operator< (const ORDataData & d) const
    {
      if((query < d.query) || (query == d.query && column < d.column))
        return true;
      return false;
    }

    QString query;
    QString column;
};
class ORKeyData
{
  public:
    QString query;
    QString column;
};

class ORColorDefData
{
  public:
    QString name;
    int red, green, blue;
};
class ORTitleData
{
  public:
    QString string;
    QFont font;
    bool font_defined;
};
class ORStyleData
{
  public:
    bool bar;
    bool line;
    bool point;
};
class ORDataAxisData
{
  public:
    ORTitleData title;
    QString column;
    QFont font;
    bool font_defined;
};
class ORValueAxisData
{
  public:
    ORTitleData title;
    double min;
    double max;
    bool autominmax;
    QFont font;
    bool font_defined;
};

class ORCrossTabQueryData
{
public:
  QString m_query;
  QString m_hAlign;
  QString m_vAlign;
};

class ORCrossTabTablePropertiesData
{
public:
  bool   m_wrapPolicyColumnsFirst;

  bool   m_showColumnHeaderOnEachPart;
  bool   m_showRowHeaderOnEachPart;

  double m_cellLeftMargin;
  double m_cellRightMargin;
  double m_cellTopMargin;
  double m_cellBottomMargin;
};

class ORSeriesData
{
  public:
    QString name;
    QString color; 
    QString column;
    ORStyleData style;
};


class ORLineData;
class ORRectData;
class ORLabelData;
class ORFieldData;
class ORTextData;
class ORBarcodeData;
class ORImageData;
class ORGraphData;
class ORCrossTabData;

class ORObject
{
  public:
    ORObject();
    virtual ~ORObject();

    virtual bool isLine();
    virtual ORLineData * toLine();
    virtual bool isRect();
    virtual ORRectData * toRect();
    virtual bool isLabel();
    virtual ORLabelData * toLabel();
    virtual bool isField();
    virtual ORFieldData * toField();
    virtual bool isText();
    virtual ORTextData * toText();
    virtual bool isBarcode();
    virtual ORBarcodeData * toBarcode();
    virtual bool isImage();
    virtual ORImageData * toImage();
    virtual bool isGraph();
    virtual ORGraphData * toGraph();
    virtual bool isCrossTab();
    virtual ORCrossTabData * toCrossTab();

    QPen pen() const {return _pen;}
    void setPen(QPen p) {_pen = p;}

    QBrush brush() const {return _brush;}
    void setBrush(QBrush b) {_brush = b;}

	qreal rotation() const { return _rotation; }
	void setRotation(qreal angle) { _rotation = angle;}

    QPen border() const {return _border;}
    void setBorder(QPen p) {_border = p;}

    bool isStatic();

private:
    QPen    _pen;
    QBrush  _brush;
	qreal   _rotation;
    QPen    _border;
};

class ORLineData : public ORObject
{
  public:
    int xStart, yStart;
    int xEnd,   yEnd;

    virtual bool isLine();
    virtual ORLineData * toLine();
};

class ORRectData : public ORObject
{
public:
    int x, y;
    int width,  height;

    virtual bool isRect();
    virtual ORRectData * toRect();
};

class ORLabelData : public ORObject
{
  public:
    QRect rect;
    QFont font;
    int align;
    QString string;

    virtual bool isLabel();
    virtual ORLabelData * toLabel();
};

class ORFieldData : public ORObject
{
  public:
    QRect rect;
    QFont font;
    int align;
    ORDataData data;

    bool trackTotal;
    bool sub_total;
    bool builtinFormat;
    QString format;

    int lines;
    int columns;
    qreal xSpacing;
    qreal ySpacing;
    bool triggerPageBreak;
    bool leftToRight;

    virtual bool isField();
    virtual ORFieldData * toField();
};

class ORTextData : public ORObject
{
  public:
    QRect rect;
    QFont font;
    int align;
    ORDataData data;
    int bottompad;

    virtual bool isText();
    virtual ORTextData * toText();
};

class ORBarcodeData : public ORObject
{
  public:
    QRect rect;
    QString format;
    int maxlength;
    ORDataData data;
    int align; // 0 = left, 1 = center, 2 = right
    double narrowBarWidth;

    virtual bool isBarcode();
    virtual ORBarcodeData * toBarcode();

    static double defaultNarrowBarWidth() { return 0.01; }
};

class ORImageData : public ORObject
{
  public:
    QRect rect;

    QString mode;

    QString format;      // } 
    QString inline_data; // } INLINE
                         //     OR
    ORDataData data;     // } FROM DB

    virtual bool isImage();
    virtual ORImageData * toImage();
};

class ORGraphData : public ORObject
{
  // TODO need a destructor that can delete the series entries
  public:
	  ~ORGraphData() {qDeleteAll(series);}

    ORDataData data;

    QFont font;
    QRect rect;

    ORTitleData title;
    ORDataAxisData dataaxis;
    ORValueAxisData valueaxis;

    QList<ORSeriesData*> series;

    virtual bool isGraph();
    virtual ORGraphData * toGraph();
};


class ORCrossTabData : public ORObject
{
  public:
    ORDataData data;

    QFont font;
    QRect rect;

    // Table properties
    ORCrossTabTablePropertiesData m_tableProperties;

    //Data
    ORCrossTabQueryData m_column;
    ORCrossTabQueryData m_row;
    ORCrossTabQueryData m_value;

    virtual bool isCrossTab();
    virtual ORCrossTabData * toCrossTab();
};


//
// ORWatermarkData
//
class ORWatermarkData
{
  public:
    ORWatermarkData();

    int opacity;
    bool useDefaultFont;
    QFont font;
    bool staticText;
    QString text;
    ORDataData data;

    bool valid;
};

//
// ORBackgroundData
//
class ORBackgroundData
{
  public:
    ORBackgroundData();

    bool enabled;
    bool staticImage;
    QString image;
    ORDataData data;
    int opacity;
    QString mode;
    int align;
    QRect rect;
};

//
// ORSectionData is used to store the information about a specific
// section. A section has a name and optionally extra data. `name'
// rpthead, rptfoot, pghead, pgfoot, grphead, grpfoot or detail.
// In the case of pghead and pgfoot extra would contain the page
// designation (firstpage, odd, even or lastpage).
//
class ORSectionData
{
  public:
	  ~ORSectionData() {qDeleteAll(objects);}

    QString name;
    QString extra; // extra info about the section
    qreal height;

    QList<ORObject*> objects;
    QList<ORDataData> trackTotal;
};

class ORDetailGroupSectionData
{
  public:
    ORDetailGroupSectionData();
    ~ORDetailGroupSectionData();

    enum PageBreak {
      BreakNone = 0,
      BreakAfterGroupFoot = 1
    };

    QString name;
    QString column;
    int pagebreak;

    QMap<ORDataData,double> _subtotCheckPoints;

    ORSectionData * head;
    ORSectionData * foot;
};

class ORDetailSectionData
{
  public:
    ORDetailSectionData();
	~ORDetailSectionData();

    enum PageBreak {
      BreakNone = 0,
      BreakAtEnd = 1
    };

    QString name;
    int pagebreak;

    ORKeyData key;

    ORSectionData * detail;

    QList<ORDetailGroupSectionData*> groupList;
    QList<ORDataData> trackTotal;
};

class ORParameter
{
  public:
    ORParameter() : active(false) {};
    ORParameter(const QString & n) : name(n), active(false) {}
    ORParameter(const ORParameter & d)
    {
      name = d.name;
      type = d.type;
      defaultValue = d.defaultValue;
      description = d.description;
      listtype = d.listtype;
      query = d.query;
      values = d.values;
      active = d.active;
    }

    ORParameter & operator=(const ORParameter & d)
    {
      name = d.name;
      type = d.type;
      defaultValue = d.defaultValue;
      description = d.description;
      listtype = d.listtype;
      query = d.query;
      values = d.values;
      active = d.active;
      return *this;
    }

    QString name;
    QString type;
    QString defaultValue;
    QString description;
    QString listtype;
    QString query;
    QList<QPair<QString,QString> > values;
    bool active;
};

class ORReportData
{
  public:
    ORReportData();
        ~ORReportData();

    QString title;
    QString name;
    QString description;

    QMap<QString,ORParameter> definedParams;

    ORWatermarkData wmData;
    ORBackgroundData bgData;

    ReportPageOptions page;
    QuerySourceList queries;

    ORSectionData * pghead_first;
    ORSectionData * pghead_odd;
    ORSectionData * pghead_even;
    ORSectionData * pghead_last;
    ORSectionData * pghead_any;

    ORSectionData * rpthead;
    ORSectionData * rptfoot;

    ORSectionData * pgfoot_first;
    ORSectionData * pgfoot_odd;
    ORSectionData * pgfoot_even;
    ORSectionData * pgfoot_last;
    ORSectionData * pgfoot_any;

    QList<ORDetailSectionData*> sections;
    QMap<QString, QColor> color_map;
    QList<ORDataData> trackTotal;
};


bool parseReportRect(const QDomElement & elemSource, QRect &, ORObject &);
bool parseReportRect(const QDomElement &, QRect &);
bool parseReportFont(const QDomElement &, QFont &);

QColor parseColor(const QDomNode &n);

bool parseReportData(const QDomElement &, ORDataData &);
bool parseReportKey(const QDomElement &, ORKeyData &);

bool parseReportLine(const QDomElement &, ORLineData &);
bool parseReportLabel(const QDomElement &, ORLabelData &);
bool parseReportField(const QDomElement &, ORFieldData &);
bool parseReportText(const QDomElement &, ORTextData &);

bool parseReportBarcode(const QDomElement &, ORBarcodeData &);
bool parseReportImage(const QDomElement &, ORImageData &);

bool parseReportWatermark(const QDomElement &, ORWatermarkData &);
bool parseReportBackground(const QDomElement &, ORBackgroundData &);

bool parseReportColorDefData(const QDomElement &, ORColorDefData &);

bool parseReportGraphData(const QDomElement &, ORGraphData &);

bool parseReportCrossTabData(const QDomElement &, ORCrossTabData &);

bool parseReportTitleData(const QDomElement &, ORTitleData &);
bool parseReportStyleData(const QDomElement &, ORStyleData &);
bool parseReportDataAxisData(const QDomElement &, ORDataAxisData &);
bool parseReportValueAxisData(const QDomElement &, ORValueAxisData &);
bool parseReportSeriesData(const QDomElement &, ORSeriesData &);

bool parseReportSection(const QDomElement &, ORSectionData &);
bool parseReportDetailSection(const QDomElement &, ORDetailSectionData &);
bool parseReport(const QDomElement &, ORReportData &, QSqlDatabase db);

bool parseReportParameter(const QDomElement &, ORReportData &);

#endif