korganizer Library API Documentation

CalPrintBase Class Reference

Base class for KOrganizer printing classes. More...

#include <calprintbase.h>

List of all members.

Public Slots

virtual void readSettingsWidget ()
virtual void setSettingsWidget ()
virtual void setDateRange (const QDate &from, const QDate &to)

Public Member Functions

 CalPrintBase (KPrinter *pr, Calendar *cal, KConfig *cfg)
virtual QString description ()=0
virtual QString longDescription ()=0
virtual QWidget * configWidget (QWidget *)
virtual void print (QPainter &p, int width, int height)=0
virtual void doPrint ()
virtual KPrinter::Orientation orientation ()
virtual void loadConfig ()=0
virtual void saveConfig ()=0
void doLoadConfig ()
void doSaveConfig ()

Protected Member Functions

int weekdayColumn (int weekday)
void drawHeader (QPainter &p, QString title, const QDate &month1, const QDate &month2, int x, int y, int width, int height)
void drawSmallMonth (QPainter &p, const QDate &qd, int x, int y, int width, int height)
void drawDaysOfWeek (QPainter &p, const QDate &fromDate, const QDate &toDate, int x, int y, int width, int height)
void drawDaysOfWeekBox (QPainter &p, const QDate &qd, int x, int y, int width, int height)
void drawTimeLine (QPainter &p, const QTime &fromTime, const QTime &toTime, int x, int y, int width, int height)
void drawAllDayBox (QPainter &p, Event::List &eventList, const QDate &qd, bool expandable, int x, int y, int width, int &height)
void drawAgendaDayBox (QPainter &p, Event::List &eventList, const QDate &qd, bool expandable, QTime &fromTime, QTime &toTime, int x, int y, int width, int height)
void drawAgendaItem (PrintCellItem *item, QPainter &p, const QDate &, const QDateTime &startPrintDate, const QDateTime &endPrintDate, float minlen, int x, int y, int width)
void drawDayBox (QPainter &p, const QDate &qd, int x, int y, int width, int height, bool fullDate=false)
void drawWeek (QPainter &p, const QDate &qd, int x, int y, int width, int height)
void drawTimeTable (QPainter &p, const QDate &fromDate, const QDate &toDate, QTime &fromTime, QTime &toTime, int x, int y, int width, int height)
void drawMonth (QPainter &p, const QDate &qd, bool weeknumbers, int x, int y, int width, int height)
void drawTodo (int &count, Todo *item, QPainter &p, bool connectSubTodos, bool desc, int pospriority, int possummary, int posDueDt, int level, int x, int &y, int width, int &height, int pageHeight, TodoParentStart *r=0)
int weekDayColumn (int weekday)

Protected Attributes

QDate mFromDate
QDate mToDate
bool mUseColors
KPrinter * mPrinter
Calendar * mCalendar
KConfig * mConfig
QWidget * mConfigWidget

Static Protected Attributes

int mSubHeaderHeight = 20
int mHeaderHeight = 72
int mMargin = 36


Detailed Description

Base class for KOrganizer printing classes.

Each sub class represents one calendar print format.

Definition at line 49 of file calprintbase.h.


Constructor & Destructor Documentation

CalPrintBase::CalPrintBase KPrinter *  pr,
Calendar *  cal,
KConfig *  cfg
 

Constructor.

Parameters:
pr KPrinter object used to print.
cal Calendar to be printed.
cfg KConfig object for reading/writing printing configuration

Definition at line 133 of file calprintbase.cpp.


Member Function Documentation

virtual QString CalPrintBase::description  )  [pure virtual]
 

Returns short description of print format.

Referenced by configWidget(), doLoadConfig(), and doSaveConfig().

virtual QString CalPrintBase::longDescription  )  [pure virtual]
 

Returns long description of print format.

Referenced by configWidget().

QWidget * CalPrintBase::configWidget QWidget *   )  [virtual]
 

Returns widget for configuring the print format.

Definition at line 144 of file calprintbase.cpp.

References description(), and longDescription().

virtual void CalPrintBase::print QPainter &  p,
int  width,
int  height
[pure virtual]
 

Actually do the printing.

Parameters:
p QPainter the print result is painted to
width Width of printable area
height Height of printable area

Referenced by doPrint().

void CalPrintBase::doPrint  )  [virtual]
 

Start printing.

Definition at line 165 of file calprintbase.cpp.

References print().

virtual KPrinter::Orientation CalPrintBase::orientation  )  [inline, virtual]
 

Orientation of printout.

Default is Portrait. If your plugin wants to use some other orientation as default (e.g. depending on some config settings), implement this function in your subclass and return the desired orientation.

Definition at line 96 of file calprintbase.h.

virtual void CalPrintBase::loadConfig  )  [pure virtual]
 

Load print format configuration from config file.

Referenced by doLoadConfig().

virtual void CalPrintBase::saveConfig  )  [pure virtual]
 

Write print format configuration to config file.

Referenced by doSaveConfig().

void CalPrintBase::doLoadConfig  ) 
 

Load complete config.

This also calls loadConfig() of the derived class.

Definition at line 185 of file calprintbase.cpp.

References description(), and loadConfig().

void CalPrintBase::doSaveConfig  ) 
 

Save complete config.

This also calls saveConfig() of the derived class.

Definition at line 200 of file calprintbase.cpp.

References description(), and saveConfig().

virtual void CalPrintBase::readSettingsWidget  )  [inline, virtual, slot]
 

Read settings from configuration widget and apply them to current object.

Definition at line 121 of file calprintbase.h.

virtual void CalPrintBase::setSettingsWidget  )  [inline, virtual, slot]
 

Set configuration widget to reflect settings of current object.

Definition at line 125 of file calprintbase.h.

virtual void CalPrintBase::setDateRange const QDate &  from,
const QDate &  to
[inline, virtual, slot]
 

Set date range which should be printed.

Definition at line 130 of file calprintbase.h.

Referenced by CalPrinter::setDateRange().

void CalPrintBase::drawHeader QPainter &  p,
QString  title,
const QDate &  month1,
const QDate &  month2,
int  x,
int  y,
int  width,
int  height
[protected]
 

Draw the gray header bar of the printout to the QPainter.

It prints the given text and optionally one or two small month views, as specified by the two QDate. The printed text can also contain a line feed. If month2 is invalid, only the month that contains month1 is printed. E.g. the filofax week view draws just the current month, while the month view draws the previous and the next month.

Parameters:
p QPainter of the printout
title The string printed as the title of the page (e.g. the date, date range or todo list title)
month1 Date specifying the month for the left one of the small month views in the title bar. If left empty, only month2 will be printed (or none, it that is invalid as well).
month2 Date specifying the month for the right one of the small month views in the title bar. If left empty, only month1 will be printed (or none, it that is invalid as well).
x x-coordinate of the upper left coordinate of the title bar
y y-coordinate of the upper left coordinate of the title bar
width width of the title bar
height height of the title bar

Definition at line 216 of file calprintbase.cpp.

References drawSmallMonth().

void CalPrintBase::drawSmallMonth QPainter &  p,
const QDate &  qd,
int  x,
int  y,
int  width,
int  height
[protected]
 

Draw a small calendar with the days of a month into the given area.

Used for example in the title bar of the sheet.

Parameters:
p QPainter of the printout
qd Arbitrary Date within the month to be printed.
x x-coordinate of the upper left coordinate of the small calendar
y y-coordinate of the upper left coordinate of the small calendar
width width of the small calendar
height height of the small calendar

Definition at line 253 of file calprintbase.cpp.

Referenced by drawHeader().

void CalPrintBase::drawDaysOfWeek QPainter &  p,
const QDate &  fromDate,
const QDate &  toDate,
int  x,
int  y,
int  width,
int  height
[protected]
 

Draw a horizontal bar with the weekday names of the given date range in the given area of the painter.

This is used for the weekday-bar on top of the timetable view and the month view.

Parameters:
p QPainter of the printout
fromDate First date of the printed dates
toDate Last date of the printed dates

Definition at line 312 of file calprintbase.cpp.

References drawDaysOfWeekBox().

Referenced by drawMonth(), and drawTimeTable().

void CalPrintBase::drawDaysOfWeekBox QPainter &  p,
const QDate &  qd,
int  x,
int  y,
int  width,
int  height
[protected]
 

Draw a single weekday name in a box inside the given area of the painter.

This is called in a loop by drawDaysOfWeek.

Parameters:
p QPainter of the printout
qd Date of the printed day

Definition at line 328 of file calprintbase.cpp.

Referenced by drawDaysOfWeek().

void CalPrintBase::drawTimeLine QPainter &  p,
const QTime &  fromTime,
const QTime &  toTime,
int  x,
int  y,
int  width,
int  height
[protected]
 

Draw a (vertical) time scale from time fromTime to toTime inside the given area of the painter.

Every hour will have a one-pixel line over the whole width, every half-hour the line will only span the left half of the width. This is used in the day and timetable print styles

Parameters:
p QPainter of the printout
fromTime Start time of the time range to display
toTime End time of the time range to display

Definition at line 343 of file calprintbase.cpp.

Referenced by drawTimeTable().

void CalPrintBase::drawAllDayBox QPainter &  p,
Event::List &  eventList,
const QDate &  qd,
bool  expandable,
int  x,
int  y,
int  width,
int &  height
[protected]
 

Draw the all-day box for the agenda print view (the box on top which doesn't have a time on the time scale associated).

If expandable is set, height is the cell height of a single cell, and the returned height will be the total height used for the all-day events. If !expandable, only one cell will be used, and multiple events are concatenated using ", ".

Parameters:
p QPainter of the printout
eventList The list of all-day events that are supposed to be printed inside this box
qd The date of the currently printed day
expandable If true, height is the height of one single cell, the printout will use as many cells as events in the list and return the total height needed for all of them. If false, height specifies the total height allowed for all events, and the events are displayed in one cell, with their summaries concatenated by ", ".

Definition at line 408 of file calprintbase.cpp.

Referenced by drawTimeTable().

void CalPrintBase::drawAgendaDayBox QPainter &  p,
Event::List &  eventList,
const QDate &  qd,
bool  expandable,
QTime &  fromTime,
QTime &  toTime,
int  x,
int  y,
int  width,
int  height
[protected]
 

Draw the agenda box for the day print style (the box showing all events of that day).

Also draws a grid with half-hour spacing of the grid lines.

Parameters:
p QPainter of the printout
eventList The list of the events that are supposed to be printed inside this box
qd The date of the currently printed day
expandable If true, the start and end times are adjusted to include the whole range of all events of that day, not just of the given time range. The height of the box will not be affected by this (but the height of one hour will be scaled down so that the whole range fits into the box. fromTime and toTime receive the actual time range printed by this function).
fromTime Start of the time range to be printed. Might be adjusted to include all events if expandable==true
toTime End of the time range to be printed. Might be adjusted to include all events if expandable==true

Definition at line 478 of file calprintbase.cpp.

Referenced by drawTimeTable().

void CalPrintBase::drawDayBox QPainter &  p,
const QDate &  qd,
int  x,
int  y,
int  width,
int  height,
bool  fullDate = false
[protected]
 

Draw the box containing a list of all events of the given day (with their times, of course).

Used in the Filofax and the month print style.

Parameters:
p QPainter of the printout
qd The date of the currently printed day. All events of the calendar that appear on that day will be printed.
fullDate Whether the title bar of the box should contain the full date string or just a short.

Definition at line 608 of file calprintbase.cpp.

Referenced by drawMonth(), and drawWeek().

void CalPrintBase::drawWeek QPainter &  p,
const QDate &  qd,
int  x,
int  y,
int  width,
int  height
[protected]
 

Draw the week (filofax) table of the week containing the date qd.

The first three days of the week will be shown in the first column (using drawDayBox), the remaining four in the second column, where the last two days of the week (typically Saturday and Sunday) only get half the height of the other day boxes.

Parameters:
p QPainter of the printout
qd Arbitrary date within the week to be printed.

Definition at line 704 of file calprintbase.cpp.

References drawDayBox().

void CalPrintBase::drawTimeTable QPainter &  p,
const QDate &  fromDate,
const QDate &  toDate,
QTime &  fromTime,
QTime &  toTime,
int  x,
int  y,
int  width,
int  height
[protected]
 

Draw the timetable view of the given time range from fromDate to toDate.

On the left side the time scale is printed (using drawTimeLine), then each day gets one column (printed using drawAgendaDayBox), and the events are displayed as boxes (like in korganizer's day/week view). The first cell of each column contains the all-day events (using drawAllDayBox with expandable=false). The given time range cannot be expanded to include all events.

Parameters:
p QPainter of the printout
fromDate First day to be included in the page
toDate Last day to be included in the page
fromTime Start time of the displayed time range
toTime End time of the displayed time range

Definition at line 739 of file calprintbase.cpp.

References drawAgendaDayBox(), drawAllDayBox(), drawDaysOfWeek(), and drawTimeLine().

void CalPrintBase::drawMonth QPainter &  p,
const QDate &  qd,
bool  weeknumbers,
int  x,
int  y,
int  width,
int  height
[protected]
 

Draw the month table of the month containing the date qd.

Each day gets one box (using drawDayBox) that contains a list of all events on that day. They are arranged in a matrix, with the first column being the first day of the week (so it might display some days of the previous and the next month). Above the matrix there is a bar showing the weekdays (drawn using drawDaysOfWeek).

Parameters:
p QPainter of the printout
qd Arbitrary date within the month to be printed.
weeknumbers Whether the week numbers are printed left of each row of the matrix

Definition at line 773 of file calprintbase.cpp.

References drawDayBox(), and drawDaysOfWeek().

void CalPrintBase::drawTodo int &  count,
Todo *  item,
QPainter &  p,
bool  connectSubTodos,
bool  desc,
int  pospriority,
int  possummary,
int  posDueDt,
int  level,
int  x,
int &  y,
int  width,
int &  height,
int  pageHeight,
TodoParentStart *  r = 0
[protected]
 

Draws single todo item and its (intented) subitems, optionally connects them by a tree-like line, and optionally shows due date, summary, description and priority.

Parameters:
count The number of the currently printed todo (count will be incremented for each drawn item)
item The item to be printed. It's subitems are recursively drawn, so drawTodo should only be called on the items of the highest level.
p QPainter of the printout
connectSubTodos Whether subtodos shall be connected with their parent by a line (tree-like).
desc Whether to print the whole description of the item (the summary is always printed).
pospriority x-coordinate where the priority is supposed to be printed. If <0, no priority will be printed.
possummary x-coordinate where the summary of the item is supposed to be printed.
posDueDt x-coordinate where the due date is supposed to the be printed. If <0, no due date will be printed.
level Level of the current item in the todo hierarchy (0 means highest level of printed items, 1 are their subtodos, etc.)
x x-coordinate of the upper left coordinate of the first item
y y-coordinate of the upper left coordinate of the first item
width width of the whole todo list
height Space left on the first page of the todo list
pageHeight Total height allowed for the todo list on a page. The first page uses height, but at each line break the current position is reset to 0 and the height is set to pageHeight.
r Internal (used when printing sub items to give information about its parent)

Definition at line 817 of file calprintbase.cpp.

int CalPrintBase::weekDayColumn int  weekday  )  [protected]
 

Determines the column of the given weekday ( 1=Monday, 7=Sunday ), taking the start of the week setting into account as given in kcontrol.

Parameters:
weekday Index of the weekday


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Mar 6 17:18:33 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003