25 #ifndef CALENDARSUPPORT_PRINTING_CALPRINTPLUGINBASE_H
26 #define CALENDARSUPPORT_PRINTING_CALPRINTPLUGINBASE_H
31 #include <Akonadi/Calendar/ETMCalendar>
32 #include <KCalendarSystem>
34 #include <KCalCore/Event>
35 #include <KCalCore/Journal>
36 #include <KCalCore/Todo>
44 #define PORTRAIT_HEADER_HEIGHT 72 // header height, for portrait orientation
45 #define LANDSCAPE_HEADER_HEIGHT 54 // header height, for landscape orientation
46 #define SUBHEADER_HEIGHT 20 // subheader height, for all orientations
47 #define PORTRAIT_FOOTER_HEIGHT 16 // footer height, for portrait orientation
48 #define LANDSCAPE_FOOTER_HEIGHT 14 // footer height, for landscape orientation
49 #define MARGIN_SIZE 36 // margins, for all orientations
50 #define PADDING_SIZE 7 // padding between the various top-level boxes
51 #define BOX_BORDER_WIDTH 2 // width of the border of all top-level boxes
52 #define EVENT_BORDER_WIDTH 0 // with of the border of all incidence boxes
54 #define TIMELINE_WIDTH 50 // width of timeline (day and timetable)
56 namespace CalendarSupport {
89 virtual void print(
QPainter &p,
int width,
int height ) = 0;
93 virtual void doPrint(
QPrinter *printer );
98 virtual void loadConfig() = 0;
102 virtual void saveConfig() = 0;
115 bool useColors()
const;
116 void setUseColors(
bool useColors );
118 bool printFooter()
const;
119 void setPrintFooter(
bool printFooter );
126 static int weekdayColumn(
int weekday );
128 QPrinter::Orientation orientation()
const;
135 int headerHeight()
const;
136 void setHeaderHeight(
const int height );
138 int subHeaderHeight()
const;
139 void setSubHeaderHeight(
const int height );
145 int footerHeight()
const;
146 void setFooterHeight(
const int height );
149 void setMargin(
const int margin );
152 void setPadding(
const int margin );
154 int borderWidth()
const;
155 void setBorderWidth(
const int border );
157 const KCalendarSystem *calendarSystem();
158 void setCalendarSystem(
const KCalendarSystem *calsys );
170 static void drawBox(
QPainter &p,
int linewidth,
const QRect &rect );
178 static void drawShadedBox(
QPainter &p,
int linewidth,
const QBrush &brush,
const QRect &rect );
198 void showEventBox(
QPainter &p,
int linewidth,
const QRect &box,
199 const KCalCore::Incidence::Ptr &
incidence,
const QString &str,
int flags = -1 );
242 const QString &contents,
bool sameLine,
bool expand,
243 const QFont &captionFont,
const QFont &textFont,
244 bool richContents =
false );
276 const QRect &box,
bool expand =
false,
352 int drawAllDayBox(
QPainter &p,
const KCalCore::Event::List &eventList,
353 const QDate &qd,
bool expandable,
355 bool excludeConfidential,
bool excludePrivate );
382 void drawAgendaDayBox(
QPainter &p,
const KCalCore::Event::List &eventList,
383 const QDate &qd,
bool expandable,
386 bool includeDescription,
bool excludeTime,
387 bool excludeConfidential,
bool excludePrivate,
390 void drawAgendaItem( PrintCellItem *item,
QPainter &p,
391 const KDateTime &startPrintDate,
392 const KDateTime &endPrintDate,
393 float minlen,
const QRect &box,
394 bool includeDescription,
bool excludeTime );
418 bool fullDate =
false,
bool printRecurDaily =
true,
419 bool printRecurWeekly =
true,
420 bool singleLineLimit =
true,
421 bool showNoteLines =
false,
422 bool includeDescription =
false,
423 bool excludeDescription =
true,
424 bool excludePrivate =
true );
443 const QRect &box,
bool singleLineLimit,
444 bool showNoteLines,
bool includeDescription,
445 bool excludeConfidential,
bool excludePrivate );
462 const QRect &box,
bool singleLineLimit,
bool showNoteLines,
463 bool includeDescription,
bool excludeConfidential,
464 bool excludePrivate );
486 bool expandable,
const QTime &fromTime,
const QTime &toTime,
487 const QRect &box,
bool includeDescription,
488 bool excludeTime,
bool excludeConfidential,
489 bool excludePrivate );
514 bool recurDaily,
bool recurWeekly,
bool singleLineLimit,
515 bool showNoteLines,
bool includeDescription,
516 bool excludeConfidential,
bool excludePrivate,
536 int maxdays = -1,
int subDailyFlags = TimeBoxes,
537 int holidaysFlags = Text,
538 bool excludeConfidential =
false,
bool excludePrivate =
false );
543 class TodoParentStart;
581 void drawTodo(
int &count,
const KCalCore::Todo::Ptr &
todo,
QPainter &p,
582 KCalCore::TodoSortField sortField,
583 KCalCore::SortDirection sortDir,
584 bool connectSubTodos,
bool strikeoutCompleted,
bool desc,
585 int posPriority,
int posSummary,
int posDueDt,
586 int posPercentComplete,
int level,
int x,
int &y,
587 int width,
int pageHeight,
588 const KCalCore::Todo::List &todoList, TodoParentStart *r,
589 bool excludeConfidential,
bool excludePrivate );
601 void drawJournal(
const KCalCore::Journal::Ptr &
journal,
QPainter &p,
int x,
int &y,
602 int width,
int pageHeight );
613 int x,
int &y,
int width,
int pageHeight,
614 bool richTextEntry );
617 const QDate &cd,
int width,
int height );
625 void drawNoteLines(
QPainter &p,
const QRect &box,
int startY );
628 QTime dayStart()
const;
629 QColor categoryBgColor(
const KCalCore::Incidence::Ptr &
incidence )
const;
633 int &textY,
bool singleLineLimit,
634 bool includeDescription,
bool richDescription );
637 int x,
int &y,
int width,
int pageHeight,
639 bool connectSubTodos );
659 void setColorsByIncidenceCategory(
QPainter &p,
660 const KCalCore::Incidence::Ptr &
incidence )
const;
665 KCalCore::Event::Ptr holidayEvent(
const QDate &date )
const;
CALENDARSUPPORT_EXPORT KCalCore::Incidence::Ptr incidence(const Akonadi::Item &item)
returns the incidence from an akonadi item, or a null pointer if the item has no such payload ...
CALENDARSUPPORT_EXPORT KCalCore::Todo::Ptr todo(const Akonadi::Item &item)
returns the todo from an akonadi item, or a null pointer if the item has no such payload ...
const KCalendarSystem * mCalSys
CALENDARSUPPORT_EXPORT QStringList categories(const KCalCore::Incidence::List &incidences)
Base class for Calendar printing classes.
Base class for Calendar printing classes.
CALENDARSUPPORT_EXPORT QList< QDate > workDays(const QDate &start, const QDate &end)
Returns a list containing work days between start and .
#define CALENDARSUPPORT_EXPORT
CALENDARSUPPORT_EXPORT KCalCore::Journal::Ptr journal(const Akonadi::Item &item)
returns the journal from an akonadi item, or a null pointer if the item has no such payload ...