korganizer

CalPrintHelper Class Reference

List of all members.

Detailed Description

Definition at line 51 of file calprinthelper.h.


Public Member Functions

 CalPrintHelper (KPrinter *pr, Calendar *cal, KConfig *cfg, KOrg::CoreHelper *corehelper)
virtual ~CalPrintHelper ()
bool useColors () const
void setUseColors (bool useColors)
Eventholiday (const QDate &dt)
void setCategoryColors (QPainter &p, Incidence *incidence)
void setCalendarSystem (const KCalendarSystem *calsys)
const KCalendarSystem * calendarSystem () const
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, bool printRecurDaily=true, bool printRecurWeekly=true)
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, bool recurDaily, bool recurWeekly, int x, int y, int width, int height)
void drawTodo (int &count, Todo *todo, QPainter &p, TodoSortField sortField, SortDirection sortDir, bool connectSubTodos, bool strikeoutCompleted, bool desc, int posPriority, int posSummary, int posDueDt, int posPercentComplete, int level, int x, int &y, int width, int pageHeight, const Todo::List &todoList, TodoParentStart *r=0)
void drawJournal (Journal *journal, QPainter &p, int x, int &y, int width, int pageHeight)
void drawJournalField (QPainter &p, QString field, QString text, int x, int &y, int width, int pageHeight)
void drawSplitHeaderRight (QPainter &p, const QDate &fd, const QDate &td, const QDate &cd, int width, int height)

Static Public Member Functions

static int weekdayColumn (int weekday)

Public Attributes

bool mUseColors
int mHeaderHeight
int mSubHeaderHeight
int mMargin

Protected Member Functions

void drawIncidence (QPainter &p, QRect &dayBox, const QString &time, const QString &summary, int &textY)

Protected Attributes

KPrinter * mPrinter
CalendarmCalendar
KConfig * mConfig
const KCalendarSystem * mCalSys
KOrg::CoreHelpermCoreHelper

Constructor & Destructor Documentation

CalPrintHelper::CalPrintHelper ( KPrinter *  pr,
Calendar cal,
KConfig *  cfg,
KOrg::CoreHelper corehelper 
)

Constructor.

Parameters:
pr KPrinter object used to print.
cal Calendar to be printed.
cfg KConfig object for reading/writing printing configuration.
corehelper KOrganizer core helper, useful for all helper classes.

Definition at line 102 of file calprinthelper.cpp.


Member Function Documentation

void CalPrintHelper::drawAgendaDayBox ( QPainter &  p,
Event::List eventList,
const QDate &  qd,
bool  expandable,
QTime &  fromTime,
QTime &  toTime,
int  x,
int  y,
int  width,
int  height 
)

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
x x-coordinate of the upper left coordinate of the agenda day box.
y y-coordinate of the upper left coordinate of the agenda day box.
width Width of the agenda day box.
height Height of the agenda day box.

Definition at line 412 of file calprinthelper.cpp.

void CalPrintHelper::drawAllDayBox ( QPainter &  p,
Event::List eventList,
const QDate &  qd,
bool  expandable,
int  x,
int  y,
int  width,
int &  height 
)

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 ", ".
x x-coordinate of the upper left coordinate of the all day box.
y y-coordinate of the upper left coordinate of the all day box.
width Width of the all day box.
height Height of the all day box.

Definition at line 347 of file calprinthelper.cpp.

void CalPrintHelper::drawDayBox ( QPainter &  p,
const QDate &  qd,
int  x,
int  y,
int  width,
int  height,
bool  fullDate = false,
bool  printRecurDaily = true,
bool  printRecurWeekly = true 
)

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.
x x-coordinate of the upper left coordinate of the day box.
y y-coordinate of the upper left coordinate of the day box.
width Width of the day box.
height Height of the day box.
fullDate Whether the title bar of the box should contain the full date string or just a short.
printRecurDaily Whether daily recurring incidences should be printed.
printRecurWeekly Whether weekly recurring incidences should be printed.

Definition at line 550 of file calprinthelper.cpp.

void CalPrintHelper::drawDaysOfWeek ( QPainter &  p,
const QDate &  fromDate,
const QDate &  toDate,
int  x,
int  y,
int  width,
int  height 
)

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
x x-coordinate of the upper left coordinate of the first day
y y-coordinate of the upper left coordinate of the first day
width Width of all the days of the week
height Height of all the days of the week

Definition at line 231 of file calprinthelper.cpp.

void CalPrintHelper::drawDaysOfWeekBox ( QPainter &  p,
const QDate &  qd,
int  x,
int  y,
int  width,
int  height 
)

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
x x-coordinate of the upper left coordinate of the weekbox
y y-coordinate of the upper left coordinate of the weekbox
width Width of the weekbox
height Height of the weekbox

Definition at line 247 of file calprinthelper.cpp.

void CalPrintHelper::drawHeader ( QPainter &  p,
QString  title,
const QDate &  month1,
const QDate &  month2,
int  x,
int  y,
int  width,
int  height 
)

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 132 of file calprinthelper.cpp.

void CalPrintHelper::drawJournal ( Journal journal,
QPainter &  p,
int  x,
int &  y,
int  width,
int  pageHeight 
)

Draws single journal item.

Parameters:
journal The item to be printed.
p QPainter of the printout
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 list
pageHeight Total height allowed for the list on a page. If an item would be below that line, a new page is started.

Definition at line 1043 of file calprinthelper.cpp.

void CalPrintHelper::drawMonth ( QPainter &  p,
const QDate &  qd,
bool  weeknumbers,
bool  recurDaily,
bool  recurWeekly,
int  x,
int  y,
int  width,
int  height 
)

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.
recurDaily Whether daily recurring incidences should be printed.
recurWeekly Whether weekly recurring incidences should be printed.
weeknumbers Whether the week numbers are printed left of each row of the matrix
x x-coordinate of the upper left coordinate of the month.
y y-coordinate of the upper left coordinate of the month.
width Width of the month.
height Height of the month.

Definition at line 731 of file calprinthelper.cpp.

void CalPrintHelper::drawSmallMonth ( QPainter &  p,
const QDate &  qd,
int  x,
int  y,
int  width,
int  height 
)

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 167 of file calprinthelper.cpp.

void CalPrintHelper::drawTimeLine ( QPainter &  p,
const QTime &  fromTime,
const QTime &  toTime,
int  x,
int  y,
int  width,
int  height 
)

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
x x-coordinate of the upper left coordinate of the timeline
y y-coordinate of the upper left coordinate of the timeline
width Width of the timeline
height Height of the timeline

Definition at line 263 of file calprinthelper.cpp.

void CalPrintHelper::drawTimeTable ( QPainter &  p,
const QDate &  fromDate,
const QDate &  toDate,
QTime &  fromTime,
QTime &  toTime,
int  x,
int  y,
int  width,
int  height 
)

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
x x-coordinate of the upper left coordinate of the time table.
y y-coordinate of the upper left coordinate of the time table.
width Width of the time table.
height Height of the time table.

Definition at line 695 of file calprinthelper.cpp.

void CalPrintHelper::drawTodo ( int &  count,
Todo todo,
QPainter &  p,
TodoSortField  sortField,
SortDirection  sortDir,
bool  connectSubTodos,
bool  strikeoutCompleted,
bool  desc,
int  posPriority,
int  posSummary,
int  posDueDt,
int  posPercentComplete,
int  level,
int  x,
int &  y,
int  width,
int  pageHeight,
const Todo::List todoList,
TodoParentStart *  r = 0 
)

Draws single to-do and its (intented) sub-to-dos, 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 to-do (count will be incremented for each to-do drawn)
todo The to-do to be printed. It's sub-to-dos are recursively drawn, so drawTodo should only be called on the to-dos of the highest level.
p QPainter of the printout
sortField Specifies on which attribute of the todo you want to sort.
sortDir Specifies if you want to sort ascending or descending.
connectSubTodos Whether sub-to-dos shall be connected with their parent by a line (tree-like).
strikeoutCompleted Whether completed to-dos should be printed with strike-out summaries.
desc Whether to print the whole description of the to-do (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 to-do 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.
posPercentComplete x-coordinate where the percentage complete is supposed to be printed. If <0, percentage complete will not be printed.
level Level of the current to-do in the to-do hierarchy (0 means highest level of printed to-dos, 1 are their sub-to-dos, etc.)
x x-coordinate of the upper left coordinate of the first to-do.
y y-coordinate of the upper left coordinate of the first to-do.
width width of the whole to-do list.
pageHeight Total height allowed for the to-do list on a page. If an to-do would be below that line, a new page is started.
todoList Contains a list of sub-todos for the specified todo .
r Internal (used when printing sub-to-dos to give information about its parent)

Definition at line 792 of file calprinthelper.cpp.

void CalPrintHelper::drawWeek ( QPainter &  p,
const QDate &  qd,
int  x,
int  y,
int  width,
int  height 
)

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.
x x-coordinate of the upper left coordinate of the week.
y y-coordinate of the upper left coordinate of the week.
width Width of the week.
height Height of the week.

Definition at line 660 of file calprinthelper.cpp.

int CalPrintHelper::weekdayColumn ( int  weekday  )  [static]

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

Definition at line 1017 of file calprinthelper.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys