File: TjPrintReport.h

package info (click to toggle)
taskjuggler 2.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,252 kB
  • ctags: 3,649
  • sloc: cpp: 37,290; sh: 12,764; xml: 5,938; perl: 5,207; makefile: 282; python: 258; lisp: 67
file content (142 lines) | stat: -rw-r--r-- 3,392 bytes parent folder | download | duplicates (2)
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
/*
 * The TaskJuggler Project Management Software
 *
 * Copyright (c) 2001, 2002, 2003, 2004, 2005 by Chris Schlaeger <cs@kde.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * $Id$
 */

#ifndef _TjPrintReport_h_
#define _TjPrintReport_h_

#include <set>
#include <vector>

#include <qpainter.h>
#include <qfont.h>

#include <kprinter.h>

#include "TjReportRow.h"
#include "TjReportColumn.h"
#include "ltstr.h"

class QPaintDevice;
class Report;
class QtReportElement;
class ReportElement;
class TjGanttChart;
class TjObjPosTable;
class Task;
class Resource;

class TjPrintReport
{
public:
    TjPrintReport(const Report* rd, KPrinter* pr);
    virtual ~TjPrintReport();

    virtual void initialize() = 0;
    virtual bool generate() = 0;

    bool beginPrinting();
    void printReportPage(int x, int y);
    void endPrinting();

    int getNumberOfColumns() const { return columns.size(); }

    void getNumberOfPages(int& xPages, int& yPages);

protected:
    void generateTableHeader();
    void generateTaskListRow(TjReportRow* row, const Task* task,
                             const Resource* resource = 0);
    void generateResourceListRow(TjReportRow* row, Resource* resource,
                                 const Task* task = 0);

    void generateCustomAttribute(const CoreAttributes* ca, const QString name,
                                 QString& cellText) const;

    void layoutPages();
    void expandColumns(int xPage, int remainder, TjReportColumn* lastColumn);

    void printReportCell(TjReportRow* row, int col);

    const Report* reportDef;
    const QtReportElement* reportElement;

    int mmToXPixels(double mm);
    int mmToYPixels(double mm);
    int pointsToYPixels(double pts);

    int scenario;

    int maxDepthTaskList;
    int maxDepthResourceList;

    std::vector<TjReportRow*> rows;
    std::vector<TjReportColumn*> columns;

    TjObjPosTable* objPosTable;
    KPrinter* printer;
    QPainter p;

    QFont standardFont;
    QFont tableHeaderFont;
    QFont headlineFont;
    QFont signatureFont;

    bool showGantt;
    TjGanttChart* ganttChart;
    QObject* ganttChartObj;

    // The top and left (non-printable) margin of the page in pixels.
    int topMargin;
    int leftMargin;

    // The printable size of the page in pixels
    int pageWidth;
    int pageHeight;

    // The leftmost pixes of the headline
    int headlineX;
    // The Y coordinate of the headline baseline
    int headlineBase;
    // The height of the headline in pixels
    int headlineHeight;

    // The top pixel of the table header
    int headerY;

    // The height of the table header in pixels
    int headerHeight;

    // Rightmost pixel of the table
    int tableRight;
    // Lowermost pixel of the table
    int tableBottom;

    // The margin around cell content in pixels
    int cellMargin;

    // The step size for indentation of table cell content in pixels
    int indentSteps;

    // The top pixel of the footer
    int footerY;
    // The height of the footer in pixels
    int footerHeight;

    // The top pixel of the bottom line.
    int bottomlineY;
    // The height of the bottom line in pixels
    int bottomlineHeight;

    std::set<const char*, ltstr> specialColumns;
} ;

#endif