OSDN Git Service

Automatically align underspecified tasks boundaries on project boundaries when possible.
[tjqt4port/tj2qt4.git] / taskjuggler / ReportElementBase.h
1 /*
2  * ReportElement.h - TaskJuggler
3  *
4  * Copyright (c) 2001, 2002, 2003, 2004 by Chris Schlaeger <cs@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * $Id: ReportElement.h 1335 2006-09-24 13:49:05Z cs $
11  */
12
13 #ifndef _ReportElementBase_h_
14 #define _ReportElementBase_h_
15
16 #include "Report.h"
17 #include "MacroTable.h"
18
19 class TableLineInfo;
20
21 /**
22  * @short A class that forms the base for elements of a report.
23  * @author Chris Schlaeger <cs@kde.org>
24  */
25 class ReportElementBase {
26 public:
27     ReportElementBase(Report* r, const QString& df = "", int dl = 0);
28     virtual ~ReportElementBase() { }
29
30     QString scaledDuration(double t, const RealFormat& realFormat,
31                            bool showUnit = false, bool longUnit = false) const;
32     QString scaledLoad(double t, const RealFormat& realFormat,
33                        bool showUnit = false, bool longUnit = false) const;
34
35     bool setLoadUnit(const QString& u);
36
37     const RealFormat& getNumberFormat() const { return numberFormat; }
38
39     void setMacros(TableLineInfo* tli);
40
41     void setPropertyMacros(TableLineInfo* tli,
42                            const QDictIterator<CustomAttributeDefinition>& d);
43
44     const QString expandReportVariable(const QString& t) const;
45
46 protected:
47     QString scaledValue(double t, const RealFormat& realFormat,
48                         bool showUnit, bool longUnit,
49                         const QValueList<double>& factors) const;
50
51     Report* report;
52
53     LoadUnit loadUnit;
54
55     RealFormat numberFormat;
56     RealFormat currencyFormat;
57
58     MacroTable mt;
59
60     /* We store the location of the report definition in case we need it
61      * for error reporting. */
62     QString defFileName;
63     int defFileLine;
64
65
66 };
67
68 #endif
69