korganizer

calprinthelper.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 1998 Preston Brown <pbrown@kde.org>
00005     Copyright (c) 2003 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
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:
00062     CalPrintHelper( KPrinter *pr, Calendar *cal, KConfig *cfg, KOrg::CoreHelper *corehelper );
00063     virtual ~CalPrintHelper();
00064 
00065     bool useColors() const { return mUseColors; }
00066     void setUseColors( bool useColors ) { mUseColors = useColors; }
00067 
00068   public:
00069     Event *holiday( const QDate &dt );
00075     static int weekdayColumn( int weekday );
00076     void setCategoryColors( QPainter &p, Incidence *incidence );
00077 
00078     void setCalendarSystem( const KCalendarSystem *calsys ) { mCalSys = calsys; }
00079     const KCalendarSystem *calendarSystem() const { return mCalSys; }
00080 
00081     bool mUseColors;
00082 
00083   public:
00087     class TodoParentStart;
00088 
00089   public:
00115     void drawHeader( QPainter &p, QString title,
00116                      const QDate &month1, const QDate &month2,
00117                      int x, int y, int width, int height );
00128     void drawSmallMonth( QPainter &p, const QDate &qd,
00129                          int x, int y, int width, int height );
00130 
00143     void drawDaysOfWeek( QPainter &p,
00144                          const QDate &fromDate, const QDate &toDate,
00145                          int x, int y, int width, int height );
00156     void drawDaysOfWeekBox( QPainter &p, const QDate &qd,
00157                             int x, int y, int width, int height );
00171     void drawTimeLine( QPainter &p,
00172                        const QTime &fromTime, const QTime &toTime,
00173                        int x, int y, int width, int height );
00194     void drawAllDayBox( QPainter &p, Event::List &eventList,
00195                         const QDate &qd, bool expandable,
00196                         int x, int y, int width, int &height );
00219     void drawAgendaDayBox( QPainter &p, Event::List &eventList,
00220                            const QDate &qd, bool expandable,
00221                            QTime &fromTime, QTime &toTime,
00222                            int x, int y, int width, int height);
00223 
00224     void drawAgendaItem( PrintCellItem *item, QPainter &p, const QDate &,
00225                          const QDateTime &startPrintDate,
00226                          const QDateTime &endPrintDate,
00227                          float minlen, int x, int y, int width );
00243     void drawDayBox( QPainter &p, const QDate &qd,
00244                      int x, int y, int width, int height,
00245                      bool fullDate = false, bool printRecurDaily = true,
00246                      bool printRecurWeekly = true );
00259     void drawWeek( QPainter &p, const QDate &qd,
00260                    int x, int y, int width, int height );
00279     void drawTimeTable( QPainter &p, const QDate &fromDate, const QDate &toDate,
00280                         QTime &fromTime, QTime &toTime,
00281                         int x, int y, int width, int height );
00282 
00299     void drawMonth( QPainter &p, const QDate &qd, bool weeknumbers,
00300                     bool recurDaily, bool recurWeekly,
00301                     int x, int y, int width, int height );
00302 
00325     void drawTodo( int &count, Todo *todo, QPainter &p,
00326                    TodoSortField sortField, SortDirection sortDir,
00327                    bool connectSubTodos, bool strikeoutCompleted, bool desc,
00328                    int posPriority, int posSummary, int posDueDt,
00329                    int posPercentComplete, int level, int x, int &y,
00330                    int width, int pageHeight,
00331                    const Todo::List &todoList, TodoParentStart *r = 0 );
00332 
00343     void drawJournal( Journal * journal, QPainter &p, int x, int &y,
00344                       int width, int pageHeight );
00345     void drawJournalField( QPainter &p, QString field, QString text,
00346                            int x, int &y, int width, int pageHeight );
00347 
00348     void drawSplitHeaderRight( QPainter &p, const QDate &fd, const QDate &td,
00349                                const QDate &cd, int width, int height );
00350 
00351 
00352   protected:
00353     KPrinter *mPrinter;
00354     Calendar *mCalendar;
00355     KConfig *mConfig;
00356     const KCalendarSystem *mCalSys;
00357     KOrg::CoreHelper *mCoreHelper;
00358 
00359     void drawIncidence( QPainter &p, QRect &dayBox, const QString &time,
00360                         const QString &summary, int &textY );
00361 
00362   public:
00363     // FIXME: move these to the appropriate subclasses or set them globally.
00364     int mHeaderHeight;
00365     int mSubHeaderHeight;
00366     int mMargin;
00367 };
00368 
00369 #endif
00370 
00371 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys