• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

korganizer

  • sources
  • kde-4.12
  • kdepim
  • korganizer
  • printing
calprintpluginbase.h
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 1998 Preston Brown <pbrown@kde.org>
5  Copyright (C) 2003 Reinhold Kainhofer <reinhold@kainhofer.com>
6  Copyright (C) 2008 Ron Goodheart <rong.dev@gmail.com>
7  Copyright (c) 2012 Allen Winter <winter@kde.org>
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License along
20  with this program; if not, write to the Free Software Foundation, Inc.,
21  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 
23  As a special exception, permission is given to link this program
24  with any edition of Qt, and distribute the resulting executable,
25  without including the source code for Qt in the source distribution.
26 */
27 #ifndef CALPRINTPLUGINBASE_H
28 #define CALPRINTPLUGINBASE_H
29 
30 #include "korganizer/korganizer_export.h"
31 #include "korganizer/printplugin.h"
32 #include "korganizer/corehelper.h"
33 
34 #include <Akonadi/Calendar/ETMCalendar>
35 
36 #include <KCalCore/Event>
37 #include <KCalCore/Journal>
38 #include <KCalCore/Todo>
39 #include <KDateTime>
40 
41 #include <QPainter>
42 
43 class PrintCellItem;
44 class QWidget;
45 
46 using namespace KCalCore;
47 
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
57 
58 #define TIMELINE_WIDTH 50 // width of timeline (day and timetable)
59 
64 class KORGANIZERPRIVATE_EXPORT CalPrintPluginBase : public KOrg::PrintPlugin
65 {
66  public:
67  enum DisplayFlags {
68  Text=0x0001,
69  TimeBoxes=0x0002
70  };
71 
72  public:
76  CalPrintPluginBase();
77  virtual ~CalPrintPluginBase();
78 
82  virtual QWidget *createConfigWidget( QWidget * );
83 
91  virtual void print( QPainter &p, int width, int height ) = 0;
95  virtual void doPrint( QPrinter *printer );
96 
100  virtual void loadConfig() = 0;
104  virtual void saveConfig() = 0;
105 
109  void doLoadConfig();
113  void doSaveConfig();
114 
116  public:
117  void setKOrgCoreHelper( KOrg::CoreHelper *helper );
118 
119  bool useColors() const;
120  void setUseColors( bool useColors );
121 
122  bool printFooter() const;
123  void setPrintFooter( bool printFooter );
124 
126  QColor categoryBgColor( const Incidence::Ptr &incidence );
127  QTime dayStart();
128  QString holidayString( const QDate &dt );
129  Event::Ptr holiday( const QDate &dt );
130 
136  static int weekdayColumn( int weekday );
137  void setCategoryColors( QPainter &p, const Incidence::Ptr &incidence );
138 
139  QPrinter::Orientation orientation() const;
140 
146  int headerHeight() const;
147  void setHeaderHeight( const int height );
148 
149  int subHeaderHeight() const;
150  void setSubHeaderHeight( const int height );
156  int footerHeight() const;
157  void setFooterHeight( const int height );
158 
159  int margin() const;
160  void setMargin( const int margin );
161 
162  int padding() const;
163  void setPadding( const int margin );
164 
165  int borderWidth() const;
166  void setBorderWidth( const int border );
167 
168  const KCalendarSystem *calendarSystem() const;
169  void setCalendarSystem( const KCalendarSystem *calsys );
170 
171  /*****************************************************************
172  ** PRINTING HELPER FUNCTIONS **
173  *****************************************************************/
174  public:
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 );
190 
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 );
211 
218  void drawSubHeaderBox( QPainter &p, const QString &str, const QRect &box );
219 
228  void drawVerticalBox( QPainter &p, int linewidth, const QRect &box, const QString &str,
229  int flags=-1 );
230 
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 );
256 
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() );
289 
297  int drawFooter( QPainter &p, const QRect &box );
298 
306  void drawSmallMonth( QPainter &p, const QDate &qd, const QRect &box );
307 
317  void drawDaysOfWeek( QPainter &p,
318  const QDate &fromDate, const QDate &toDate,
319  const QRect &box );
327  void drawDaysOfWeekBox( QPainter &p, const QDate &qd, const QRect &box );
328 
339  void drawTimeLine( QPainter &p,
340  const QTime &fromTime, const QTime &toTime,
341  const QRect &box );
342 
363  int drawAllDayBox( QPainter &p, const KCalCore::Event::List &eventList,
364  const QDate &qd, bool expandable,
365  const QRect &box,
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,
396  const QRect &box,
397  bool includeDescription, bool excludeTime,
398  bool mExcludeConfidential, bool mExcludePrivate,
399  const QList<QDate> &workDays );
400 
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 );
406 
426  void drawDayBox( QPainter &p, const QDate &qd,
427  const QTime &fromTime, const QTime &toTime,
428  const QRect &box,
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 );
501 
522  void drawMonthTable( QPainter &p, const QDate &qd,
523  const QTime &fromTime, const QTime &toTime,
524  bool weeknumbers,
525  bool recurDaily, bool recurWeekly, bool singleLineLimit,
526  bool showNoteLines, bool includeDescription,
527  bool excludeConfidential, bool excludePrivate,
528  const QRect &box );
544  void drawMonth( QPainter &p, const QDate &dt, const QRect &box,
545  int maxdays = -1, int subDailyFlags = TimeBoxes,
546  int holidaysFlags = Text );
547 
551  class TodoParentStart;
552 
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 );
598 
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 );
623 
624  void drawSplitHeaderRight( QPainter &p, const QDate &fd, const QDate &td,
625  const QDate &cd, int width, int height );
626 
633  void drawNoteLines( QPainter &p, const QRect &box, int startY );
634 
635  protected:
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 );
645 
646  protected:
647  bool mUseColors;
648  bool mPrintFooter;
649  bool mShowNoteLines;
650  bool mExcludeConfidential;
651  bool mExcludePrivate;
652  int mHeaderHeight;
653  int mSubHeaderHeight;
654  int mFooterHeight;
655  int mMargin;
656  int mPadding;
657  int mBorder;
658  const KCalendarSystem *mCalSys;
659 
660  public:
661 };
662 
663 #endif
CalPrintPluginBase::mFooterHeight
int mFooterHeight
Definition: calprintpluginbase.h:654
CalPrintPluginBase::DisplayFlags
DisplayFlags
Definition: calprintpluginbase.h:67
CalPrintPluginBase::mPrintFooter
bool mPrintFooter
Definition: calprintpluginbase.h:648
printplugin.h
QWidget
CalPrintPluginBase::mBorder
int mBorder
Definition: calprintpluginbase.h:657
CalPrintPluginBase::mCalSys
const KCalendarSystem * mCalSys
Definition: calprintpluginbase.h:658
corehelper.h
CalPrintPluginBase::mExcludeConfidential
bool mExcludeConfidential
Definition: calprintpluginbase.h:650
KOrg::PrintPlugin
Base class for KOrganizer printing classes.
Definition: printplugin.h:62
CalPrintPluginBase::mShowNoteLines
bool mShowNoteLines
Definition: calprintpluginbase.h:649
CalPrintPluginBase::mMargin
int mMargin
Definition: calprintpluginbase.h:655
KORGANIZERPRIVATE_EXPORT
#define KORGANIZERPRIVATE_EXPORT
Definition: korganizer_export.h:35
CalPrintPluginBase::mExcludePrivate
bool mExcludePrivate
Definition: calprintpluginbase.h:651
korganizer_export.h
CalPrintPluginBase::mSubHeaderHeight
int mSubHeaderHeight
Definition: calprintpluginbase.h:653
CalPrintPluginBase
Base class for KOrganizer printing classes.
Definition: calprintpluginbase.h:64
KOrg::CoreHelper
Definition: corehelper.h:30
CalPrintPluginBase::mUseColors
bool mUseColors
Definition: calprintpluginbase.h:647
CalPrintPluginBase::mHeaderHeight
int mHeaderHeight
Definition: calprintpluginbase.h:652
CalPrintPluginBase::mPadding
int mPadding
Definition: calprintpluginbase.h:656
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

korganizer

Skip menu "korganizer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal