00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef CALPRINTBASE_H
00026 #define CALPRINTBASE_H
00027
00028 #ifndef KORG_NOPRINTER
00029
00030 #include <qdatetime.h>
00031 #include <kprinter.h>
00032 #include <libkcal/calendar.h>
00033 #include <libkcal/event.h>
00034 #include <libkcal/todo.h>
00035 #include <kdepimmacros.h>
00036
00037 class PrintCellItem;
00038
00039 namespace KCal {
00040 class Calendar;
00041 class Todo;
00042 class Event;
00043 }
00044 namespace KOrg {
00045 class CoreHelper;
00046 }
00047 class QWidget;
00048
00049 using namespace KCal;
00050
00051 class KDE_EXPORT CalPrintHelper
00052 {
00053 public:
00061 CalPrintHelper( KPrinter *pr, Calendar *cal, KConfig *cfg, KOrg::CoreHelper *corehelper );
00062 virtual ~CalPrintHelper();
00063
00064 bool useColors() const { return mUseColors; }
00065 void setUseColors( bool useColors ) { mUseColors = useColors; }
00066
00067 public:
00068 Event *holiday( const QDate &dt );
00074 static int weekdayColumn( int weekday );
00075 void setCategoryColors( QPainter &p, Incidence *incidence );
00076
00077 void setCalendarSystem( const KCalendarSystem *calsys ) { mCalSys = calsys; }
00078 const KCalendarSystem *calendarSystem() const { return mCalSys; }
00079
00080 bool mUseColors;
00081
00082 public:
00086 class TodoParentStart;
00087
00088 public:
00114 void drawHeader( QPainter &p, QString title,
00115 const QDate &month1, const QDate &month2,
00116 int x, int y, int width, int height );
00127 void drawSmallMonth( QPainter &p, const QDate &qd,
00128 int x, int y, int width, int height );
00129
00138 void drawDaysOfWeek( QPainter &p,
00139 const QDate &fromDate, const QDate &toDate,
00140 int x, int y, int width, int height );
00147 void drawDaysOfWeekBox( QPainter &p, const QDate &qd,
00148 int x, int y, int width, int height );
00158 void drawTimeLine( QPainter &p,
00159 const QTime &fromTime, const QTime &toTime,
00160 int x, int y, int width, int height );
00177 void drawAllDayBox( QPainter &p, Event::List &eventList,
00178 const QDate &qd, bool expandable,
00179 int x, int y, int width, int &height );
00198 void drawAgendaDayBox( QPainter &p, Event::List &eventList,
00199 const QDate &qd, bool expandable,
00200 QTime &fromTime, QTime &toTime,
00201 int x, int y, int width, int height);
00202
00203 void drawAgendaItem( PrintCellItem *item, QPainter &p, const QDate &,
00204 const QDateTime &startPrintDate,
00205 const QDateTime &endPrintDate,
00206 float minlen, int x, int y, int width );
00218 void drawDayBox( QPainter &p, const QDate &qd,
00219 int x, int y, int width, int height,
00220 bool fullDate = false, bool printRecurWeekly = true,
00221 bool printRecurWeekly = true );
00230 void drawWeek( QPainter &p, const QDate &qd,
00231 int x, int y, int width, int height );
00246 void drawTimeTable( QPainter &p, const QDate &fromDate, const QDate &toDate,
00247 QTime &fromTime, QTime &toTime,
00248 int x, int y, int width, int height );
00249
00262 void drawMonth( QPainter &p, const QDate &qd, bool weeknumbers,
00263 bool recurDaily, bool recurWeekly,
00264 int x, int y, int width, int height );
00265
00285 void drawTodo( int &count, Todo *todo, QPainter &p,
00286 TodoSortField sortField, SortDirection sortDir,
00287 bool connectSubTodos, bool strikeoutCompleted, bool desc,
00288 int posPriority, int posSummary, int posDueDt,
00289 int posPercentComplete, int level, int x, int &y,
00290 int width, int pageHeight,
00291 const Todo::List &todoList, TodoParentStart *r = 0 );
00292
00303 void drawJournal( Journal * journal, QPainter &p, int x, int &y,
00304 int width, int pageHeight );
00305 void drawJournalField( QPainter &p, QString field, QString text,
00306 int x, int &y, int width, int pageHeight );
00307
00308 void drawSplitHeaderRight( QPainter &p, const QDate &fd, const QDate &td,
00309 const QDate &cd, int width, int height );
00310
00311
00312 protected:
00313 KPrinter *mPrinter;
00314 Calendar *mCalendar;
00315 KConfig *mConfig;
00316 const KCalendarSystem *mCalSys;
00317 KOrg::CoreHelper *mCoreHelper;
00318
00319 void drawIncidence( QPainter &p, QRect &dayBox, const QString &time,
00320 const QString &summary, int &textY );
00321
00322 public:
00323
00324 int mHeaderHeight;
00325 int mSubHeaderHeight;
00326 int mMargin;
00327 };
00328
00329 #endif
00330
00331 #endif