46 #ifndef PIMPRINT_CALPRINTBASE_H
47 #define PIMPRINT_CALPRINTBASE_H
52 #include <KCalCore/Calendar>
53 #include <KCalCore/Event>
54 #include <KCalCore/Incidence>
59 class KCalendarSystem;
76 Q_PROPERTY(
bool useColor
77 READ useColor WRITE setUseColor)
79 Q_PROPERTY(
bool useLandscape
80 READ useLandscape WRITE setUseLandscape)
82 Q_PROPERTY(
int pageWidth
83 READ pageWidth WRITE setPageWidth)
85 Q_PROPERTY(
int pageHeight
86 READ pageHeight WRITE setPageHeight)
88 Q_PROPERTY(
int headerHeight
89 READ headerHeight WRITE setHeaderHeight)
91 Q_PROPERTY(
int subheaderHeight
92 READ subHeaderHeight WRITE setSubHeaderHeight)
94 Q_PROPERTY(
int footerHeight
95 READ footerHeight WRITE setFooterHeight)
97 Q_PROPERTY(
int padding
98 READ padding WRITE setPadding)
100 Q_PROPERTY(
int margins READ margins)
102 Q_PROPERTY(
int boxBorderWidth READ boxBorderWidth)
104 Q_PROPERTY(
int itemBoxBorderWidth READ itemBoxBorderWidth)
106 Q_PROPERTY(
int timeLineWidth READ timeLineWidth)
119 virtual
void print(
QPainter &p) = 0;
141 void setUseColor(
const bool useColor);
147 bool useColor()
const;
154 void setUseLandscape(
const bool landscape);
160 bool useLandscape()
const;
167 void setPageHeight(
const int height)
const;
173 int pageHeight()
const;
180 void setPageWidth(
const int width)
const;
186 int pageWidth()
const;
193 void setHeaderHeight(
const int height);
201 int headerHeight()
const;
208 void setSubHeaderHeight(
const int height);
216 int subHeaderHeight()
const;
223 void setFooterHeight(
const int height);
231 int footerHeight()
const;
237 void setPadding(
const int padding);
258 int boxBorderWidth()
const;
264 int itemBoxBorderWidth()
const;
270 int timeLineWidth()
const;
273 InfoAll = 0x00000001,
274 InfoDescription = 0x00000002,
275 InfoLocation = 0x00000004,
276 InfoAttendees = 0x00000008,
277 InfoCategories = 0x00000010,
278 InfoPriority = 0x00000020,
279 InfoDueDate = 0x00000040,
280 InfoPercentDone = 0x00000080,
281 InfoTimeRange = 0x00000100
283 Q_DECLARE_FLAGS(InfoOptions, InfoOption)
286 TypeAll = 0x00000001,
287 TypeEvent = 0x00000002,
288 TypeTodo = 0x00000004,
289 TypeJournal = 0x00000008,
290 TypeConfidential = 0x00000010,
291 TypePrivate = 0x00000020
293 Q_DECLARE_FLAGS(TypeOptions, TypeOption)
296 RangeTimeExpand = 0x00000001,
297 RangeRecurAny = 0x00000002,
298 RangeRecurDaily = 0x00000004,
299 RangeRecurWeekly = 0x00000008
301 Q_DECLARE_FLAGS(RangeOptions, RangeOption)
304 ExtraSingleLine = 0x00000001,
305 ExtraNoteLines = 0x00000002,
306 ExtraWeekNumbers = 0x00000004,
307 ExtraStrikeDoneTodos = 0x00000008,
308 ExtraConnectSubTodos = 0x00000010,
309 ExtraFooter = 0x00000020
311 Q_DECLARE_FLAGS(ExtraOptions, ExtraOption)
318 void setThePrinter(
QPrinter *printer);
331 void setPrintCalendar(const KCalCore::Calendar::Ptr &calendar);
337 KCalCore::Calendar::Ptr printCalendar() const;
344 void setCalendarSystem(KCalendarSystem *calSystem);
350 KCalendarSystem *calendarSystem() const;
357 void setPrintStyle(const Style style);
363 Style printStyle() const;
370 void setInfoOptions(InfoOptions flags);
376 InfoOptions infoOptions() const;
383 void setTypeOptions(TypeOptions flags);
389 TypeOptions typeOptions() const;
396 void setRangeOptions(RangeOptions flags);
402 RangeOptions rangeOptions() const;
409 void setExtraOptions(ExtraOptions flags);
415 ExtraOptions extraOptions() const;
447 const QDate &rightMonth = QDate(),
448 const
bool expand = false,
477 void drawBox(
QPainter &p, const
int linewidth, const
QRect &box) const;
488 void drawShadedBox(
QPainter &p, const
int linewidth,
505 int flags = -1) const;
522 const KCalCore::Incidence::Ptr &incidence,
524 int flags = -1) const;
535 const
QString &str,
int flags = -1) const;
554 bool fullDate = false) const;
579 const KCalCore::Event::List &eventList,
580 const
QTime &startTime,
581 const
QTime &endTime,
582 const
QList<QDate> &workDays) const;
586 const KDateTime &startPrintDate,
587 const KDateTime &endPrintDate,
588 float minlen, const
QRect &box) const;
603 const
QTime &startTime,
604 const
QTime &endTime,
605 const
QRect &box) const;
626 const QDate &startDate, const QDate &endDate,
628 bool expandAll = false) const;
642 const QDate &fromDate, const QDate &toDate) const;
649 int weekdayColumn(
int weekday) const;
689 void drawSmallMonth(
QPainter &p, const QDate &date, const
QRect &box) const;
698 void drawNoteLines(
QPainter &p, const
QRect &box, const
int startY) const;
702 int &textY,
bool richDescription) const;
706 QColor categoryBgColor(const KCalCore::Incidence::Ptr &incidence) const;
711 void setColorsByIncidenceCategory(
QPainter &p,
712 const KCalCore::Incidence::Ptr &incidence) const;
714 QString holidayString(const QDate &date) const;
716 KCalCore::Event::Ptr holidayEvent(const QDate &date) const;
731 void drawDaysOfWeekBox(
QPainter &p, const
QRect &box, const QDate &date) const;
755 const KCalCore::Event::List &eventList,
756 bool expandAll = false) const;
766 Q_DECLARE_OPERATORS_FOR_FLAGS(
CalPrintBase::InfoOptions)
767 Q_DECLARE_OPERATORS_FOR_FLAGS(
CalPrintBase::TypeOptions)
768 Q_DECLARE_OPERATORS_FOR_FLAGS(
CalPrintBase::RangeOptions)
769 Q_DECLARE_OPERATORS_FOR_FLAGS(
CalPrintBase::ExtraOptions)
783 Actually
do the printing.
785 @param p
QPainter the print result is painted
to
786 @param width Width of printable area
787 @param height Height of printable area
789 virtual void print(
QPainter &p,
int width,
int height) = 0;
793 virtual void doPrint(
QPrinter *printer);
796 bool printFooter()
const;
797 void setPrintFooter(
bool printFooter);
803 void setMargin(
const int margin);
833 const QString &contents,
bool sameLine,
bool expand,
834 const QFont &captionFont,
const QFont &textFont,
835 bool richContents =
false);
#define PIMPRINT_CALENDAR_EXPORT