korganizer Library API Documentation

calprintbase.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 1998 Preston Brown
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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 // #define KORG_NOPRINTER
00028 
00029 #ifndef KORG_NOPRINTER
00030 
00031 #include <qwidget.h>
00032 #include <qdatetime.h>
00033 #include <kprinter.h>
00034 #include <libkcal/event.h>
00035 
00036 class PrintCellItem;
00037 
00038 namespace KCal {
00039 class Calendar;
00040 class Todo;
00041 }
00042 
00043 using namespace KCal;
00044 
00049 class CalPrintBase : public QObject
00050 {
00051     Q_OBJECT
00052   public:
00060     CalPrintBase( KPrinter *pr, Calendar *cal, KConfig *cfg );
00061     virtual ~CalPrintBase();
00062 
00066     virtual QString description() = 0;
00070     virtual QString longDescription() = 0;
00071 
00075     virtual QWidget *configWidget( QWidget * );
00076 
00084     virtual void print( QPainter &p, int width, int height ) = 0;
00088     virtual void doPrint();
00089 
00096     virtual KPrinter::Orientation orientation() { return KPrinter::Portrait; }
00097 
00101     virtual void loadConfig() = 0;
00105     virtual void saveConfig() = 0;
00106 
00110     void doLoadConfig();
00114     void doSaveConfig();
00115           
00116 
00117   public slots:
00121     virtual void readSettingsWidget() {}
00125     virtual void setSettingsWidget() {}
00126 
00130     virtual void setDateRange( const QDate &from, const QDate &to )
00131     {
00132       mFromDate = from;
00133       mToDate = to;
00134     }
00135 
00136   protected:
00137     int weekdayColumn( int weekday );
00138 
00139     QDate mFromDate;
00140     QDate mToDate;
00141     bool mUseColors;
00142 
00143   public:
00147     class TodoParentStart;
00148 
00149   protected:
00175     void drawHeader( QPainter &p, QString title,
00176                      const QDate &month1, const QDate &month2,
00177                      int x, int y, int width, int height );
00188     void drawSmallMonth( QPainter &p, const QDate &qd,
00189                          int x, int y, int width, int height );
00190 
00199     void drawDaysOfWeek( QPainter &p,
00200                          const QDate &fromDate, const QDate &toDate,
00201                          int x, int y, int width, int height );
00208     void drawDaysOfWeekBox( QPainter &p, const QDate &qd,
00209                             int x, int y, int width, int height );
00219     void drawTimeLine( QPainter &p,
00220                        const QTime &fromTime, const QTime &toTime,
00221                        int x, int y, int width, int height );
00238     void drawAllDayBox( QPainter &p, Event::List &eventList,
00239                         const QDate &qd, bool expandable,
00240                         int x, int y, int width, int &height );
00259     void drawAgendaDayBox( QPainter &p, Event::List &eventList,
00260                            const QDate &qd, bool expandable,
00261                            QTime &fromTime, QTime &toTime,
00262                            int x, int y, int width, int height);
00263 
00264     void drawAgendaItem( PrintCellItem *item, QPainter &p, const QDate &,
00265                          const QDateTime &startPrintDate,
00266                          const QDateTime &endPrintDate,
00267                          float minlen, int x, int y, int width );
00277     void drawDayBox( QPainter &p, const QDate &qd,
00278                      int x, int y, int width, int height,
00279                      bool fullDate = false );
00288     void drawWeek( QPainter &p, const QDate &qd,
00289                    int x, int y, int width, int height );
00304     void drawTimeTable( QPainter &p, const QDate &fromDate, const QDate &toDate,
00305                         QTime &fromTime, QTime &toTime,
00306                         int x, int y, int width, int height );
00307 
00318     void drawMonth( QPainter &p, const QDate &qd, bool weeknumbers,
00319                     int x, int y, int width, int height );
00320 
00345     void drawTodo( int &count, Todo * item, QPainter &p, bool connectSubTodos,
00346                    bool desc, int pospriority, int possummary, int posDueDt,
00347                    int level, int x, int &y, int width, int &height,
00348                    int pageHeight, TodoParentStart *r = 0 );
00349 
00355     int weekDayColumn( int weekday );
00356 
00357     KPrinter *mPrinter;
00358     Calendar *mCalendar;
00359     KConfig *mConfig;
00360     QWidget *mConfigWidget;
00361 
00362   protected:
00363     // TODO_RK: move these to the appropriate subclasses or set them globally.
00364     static int mSubHeaderHeight;
00365     static int mHeaderHeight;
00366     static int mMargin;
00367 };
00368 
00369 #endif
00370 
00371 #endif
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:26 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003