27 #ifndef CALPRINTPLUGINBASE_H
28 #define CALPRINTPLUGINBASE_H
34 #include <Akonadi/Calendar/ETMCalendar>
36 #include <KCalCore/Event>
37 #include <KCalCore/Journal>
38 #include <KCalCore/Todo>
46 using namespace KCalCore;
48 #define PORTRAIT_HEADER_HEIGHT 72 // header height, for portrait orientation
49 #define LANDSCAPE_HEADER_HEIGHT 54 // header height, for landscape orientation
50 #define SUBHEADER_HEIGHT 20 // subheader height, for all orientations
51 #define PORTRAIT_FOOTER_HEIGHT 16 // footer height, for portrait orientation
52 #define LANDSCAPE_FOOTER_HEIGHT 14 // footer height, for landscape orientation
53 #define MARGIN_SIZE 36 // margins, for all orientations
54 #define PADDING_SIZE 7 // padding between the various top-level boxes
55 #define BOX_BORDER_WIDTH 2 // width of the border of all top-level boxes
56 #define EVENT_BORDER_WIDTH 0 // with of the border of all incidence boxes
58 #define TIMELINE_WIDTH 50 // width of timeline (day and timetable)
91 virtual void print( QPainter &p,
int width,
int height ) = 0;
95 virtual void doPrint( QPrinter *printer );
100 virtual void loadConfig() = 0;
104 virtual void saveConfig() = 0;
119 bool useColors()
const;
120 void setUseColors(
bool useColors );
122 bool printFooter()
const;
123 void setPrintFooter(
bool printFooter );
126 QColor categoryBgColor(
const Incidence::Ptr &incidence );
128 QString holidayString(
const QDate &dt );
129 Event::Ptr holiday(
const QDate &dt );
136 static int weekdayColumn(
int weekday );
137 void setCategoryColors( QPainter &p,
const Incidence::Ptr &incidence );
139 QPrinter::Orientation orientation()
const;
146 int headerHeight()
const;
147 void setHeaderHeight(
const int height );
149 int subHeaderHeight()
const;
150 void setSubHeaderHeight(
const int height );
156 int footerHeight()
const;
157 void setFooterHeight(
const int height );
160 void setMargin(
const int margin );
163 void setPadding(
const int margin );
165 int borderWidth()
const;
166 void setBorderWidth(
const int border );
168 const KCalendarSystem *calendarSystem()
const;
169 void setCalendarSystem(
const KCalendarSystem *calsys );
181 static void drawBox( QPainter &p,
int linewidth,
const QRect &rect );
189 static void drawShadedBox( QPainter &p,
int linewidth,
const QBrush &brush,
const QRect &rect );
198 void printEventString( QPainter &p,
const QRect &box,
const QString &str,
int flags = -1 );
209 void showEventBox( QPainter &p,
int linewidth,
const QRect &box,
210 const Incidence::Ptr &incidence,
const QString &str,
int flags = -1 );
218 void drawSubHeaderBox( QPainter &p,
const QString &str,
const QRect &box );
228 void drawVerticalBox( QPainter &p,
int linewidth,
const QRect &box,
const QString &str,
252 int drawBoxWithCaption( QPainter &p,
const QRect &box,
const QString &caption,
253 const QString &contents,
bool sameLine,
bool expand,
254 const QFont &captionFont,
const QFont &textFont,
255 bool richContents =
false );
285 int drawHeader( QPainter &p,
const QString &title,
286 const QDate &month1,
const QDate &month2,
287 const QRect &box,
bool expand =
false,
288 QColor backColor = QColor() );
297 int drawFooter( QPainter &p,
const QRect &box );
306 void drawSmallMonth( QPainter &p,
const QDate &qd,
const QRect &box );
317 void drawDaysOfWeek( QPainter &p,
318 const QDate &fromDate,
const QDate &toDate,
327 void drawDaysOfWeekBox( QPainter &p,
const QDate &qd,
const QRect &box );
339 void drawTimeLine( QPainter &p,
340 const QTime &fromTime,
const QTime &toTime,
363 int drawAllDayBox( QPainter &p,
const KCalCore::Event::List &eventList,
364 const QDate &qd,
bool expandable,
366 bool mExcludeConfidential,
bool mExcludePrivate );
393 void drawAgendaDayBox( QPainter &p,
const KCalCore::Event::List &eventList,
394 const QDate &qd,
bool expandable,
395 const QTime &fromTime,
const QTime &toTime,
397 bool includeDescription,
bool excludeTime,
398 bool mExcludeConfidential,
bool mExcludePrivate,
399 const QList<QDate> &workDays );
401 void drawAgendaItem( PrintCellItem *item, QPainter &p,
402 const KDateTime &startPrintDate,
403 const KDateTime &endPrintDate,
404 float minlen,
const QRect &box,
405 bool includeDescription,
bool excludeTime );
426 void drawDayBox( QPainter &p,
const QDate &qd,
427 const QTime &fromTime,
const QTime &toTime,
429 bool fullDate =
false,
bool printRecurDaily =
true,
430 bool printRecurWeekly =
true,
431 bool singleLineLimit =
true,
432 bool showNoteLines =
false,
433 bool includeDescription =
false,
434 bool excludeDescription =
true,
435 bool excludePrivate =
true );
452 void drawWeek( QPainter &p,
const QDate &qd,
453 const QTime &fromTime,
const QTime &toTime,
454 const QRect &box,
bool singleLineLimit,
455 bool showNoteLines,
bool includeDescription,
456 bool excludeConfidential,
bool excludePrivate );
471 void drawDays( QPainter &p,
const QDate &start,
const QDate &end,
472 const QTime &fromTime,
const QTime &toTime,
473 const QRect &box,
bool singleLineLimit,
bool showNoteLines,
474 bool includeDescription,
bool excludeConfidential,
475 bool excludePrivate );
496 void drawTimeTable( QPainter &p,
const QDate &fromDate,
const QDate &toDate,
497 bool expandable,
const QTime &fromTime,
const QTime &toTime,
498 const QRect &box,
bool includeDescription,
499 bool excludeTime,
bool excludeConfidential,
500 bool excludePrivate );
522 void drawMonthTable( QPainter &p,
const QDate &qd,
523 const QTime &fromTime,
const QTime &toTime,
525 bool recurDaily,
bool recurWeekly,
bool singleLineLimit,
526 bool showNoteLines,
bool includeDescription,
527 bool excludeConfidential,
bool excludePrivate,
544 void drawMonth( QPainter &p,
const QDate &dt,
const QRect &box,
545 int maxdays = -1,
int subDailyFlags = TimeBoxes,
546 int holidaysFlags = Text );
551 class TodoParentStart;
589 void drawTodo(
int &count,
const KCalCore::Todo::Ptr &todo, QPainter &p,
590 KCalCore::TodoSortField sortField,
591 KCalCore::SortDirection sortDir,
592 bool connectSubTodos,
bool strikeoutCompleted,
bool desc,
593 int posPriority,
int posSummary,
int posDueDt,
594 int posPercentComplete,
int level,
int x,
int &y,
595 int width,
int pageHeight,
596 const KCalCore::Todo::List &todoList, TodoParentStart *r,
597 bool excludeConfidential,
bool excludePrivate );
609 void drawJournal(
const Journal::Ptr &journal, QPainter &p,
int x,
int &y,
610 int width,
int pageHeight );
620 void drawTextLines( QPainter &p,
const QString &entry,
621 int x,
int &y,
int width,
int pageHeight,
622 bool richTextEntry );
624 void drawSplitHeaderRight( QPainter &p,
const QDate &fd,
const QDate &td,
625 const QDate &cd,
int width,
int height );
633 void drawNoteLines( QPainter &p,
const QRect &box,
int startY );
636 void drawIncidence( QPainter &p,
const QRect &dayBox,
const QString &time,
637 const QString &summary,
const QString &description,
638 int &textY,
bool singleLineLimit,
639 bool includeDescription,
bool richDescription );
640 QString toPlainText(
const QString &htmlText );
641 void drawTodoLines( QPainter &p,
const QString &entry,
642 int x,
int &y,
int width,
int pageHeight,
643 bool richTextEntry, QList<TodoParentStart *> &startPoints,
644 bool connectSubTodos );
const KCalendarSystem * mCalSys
bool mExcludeConfidential
Base class for KOrganizer printing classes.
#define KORGANIZERPRIVATE_EXPORT
Base class for KOrganizer printing classes.