~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to korganizer/printing/calprintpluginbase.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
*/
26
26
#ifndef CALPRINTPLUGINBASE_H
27
27
#define CALPRINTPLUGINBASE_H
28
 
// #define KORG_NOPRINTER
29
 
 
30
 
#ifndef KORG_NOPRINTER
31
28
 
32
29
#include "korganizer/korganizer_export.h"
33
30
#include "korganizer/printplugin.h"
34
31
#include "korganizer/corehelper.h"
35
32
 
36
 
#include <kcal/calendar.h>
37
 
#include <kcal/event.h>
38
 
#include <kcal/todo.h>
39
 
 
40
 
#include <kdatetime.h>
41
 
 
42
 
#include <QtCore/QDateTime>
 
33
#include <calendarsupport/calendar.h>
 
34
 
 
35
#include <KCalCore/Event>
 
36
#include <KCalCore/Journal>
 
37
#include <KCalCore/Todo>
 
38
#include <KDateTime>
 
39
 
43
40
#include <QtGui/QPainter>
44
 
#include <QtGui/QPrinter>
45
41
 
46
42
class PrintCellItem;
47
43
class QWidget;
48
44
 
49
 
using namespace KCal;
 
45
using namespace KCalCore;
50
46
 
51
47
#define PORTRAIT_HEADER_HEIGHT 72   // header height, for portrait orientation
52
48
#define LANDSCAPE_HEADER_HEIGHT 54  // header height, for landscape orientation
53
49
#define SUBHEADER_HEIGHT 20         // subheader height, for all orientations
 
50
#define PORTRAIT_FOOTER_HEIGHT 16   // footer height, for portrait orientation
 
51
#define LANDSCAPE_FOOTER_HEIGHT 14  // footer height, for landscape orientation
54
52
#define MARGIN_SIZE 36              // margins, for all orientations
55
53
#define PADDING_SIZE 7              // padding between the various top-level boxes
56
54
#define BOX_BORDER_WIDTH 2          // width of the border of all top-level boxes
62
60
  Base class for KOrganizer printing classes. Each sub class represents one
63
61
  calendar print format.
64
62
*/
65
 
class KORG_STDPRINTING_EXPORT CalPrintPluginBase : public KOrg::PrintPlugin
 
63
class KORGANIZERPRIVATE_EXPORT CalPrintPluginBase : public KOrg::PrintPlugin
66
64
{
67
65
  public:
68
66
    enum DisplayFlags {
120
118
    void setUseColors( bool useColors );
121
119
 
122
120
    /** Helper functions to hide the KOrg::CoreHelper */
123
 
    QColor categoryBgColor( Incidence *incidence );
 
121
    QColor categoryBgColor( const Incidence::Ptr &incidence );
124
122
    QTime dayStart();
125
 
    bool isWorkingDay( const QDate &dt );
126
123
    QString holidayString( const QDate &dt );
127
 
    Event *holiday( const QDate &dt );
 
124
    Event::Ptr holiday( const QDate &dt );
128
125
 
129
126
    /**
130
127
      Determines the column of the given weekday ( 1=Monday, 7=Sunday ), taking the
132
129
      @param weekday Index of the weekday
133
130
    */
134
131
    static int weekdayColumn( int weekday );
135
 
    void setCategoryColors( QPainter &p, Incidence *incidence );
 
132
    void setCategoryColors( QPainter &p, const Incidence::Ptr &incidence );
136
133
 
137
134
    QPrinter::Orientation orientation() const;
138
135
 
146
143
 
147
144
    int subHeaderHeight() const;
148
145
    void setSubHeaderHeight( const int height );
 
146
    /** Returns the height of the page footer. If the height was explicitly
 
147
        set using setFooterHeight, that value is returned, otherwise a
 
148
        default value based on the printer orientation.
 
149
        @return height of the page footer of the printout
 
150
    */
 
151
    int footerHeight() const;
 
152
    void setFooterHeight( const int height );
 
153
 
149
154
    int margin() const;
150
155
    void setMargin( const int margin );
151
156
 
188
193
    void printEventString( QPainter &p, const QRect &box, const QString &str, int flags = -1 );
189
194
    /**
190
195
      Print the box for the given event with the given string.
191
 
      @param p QPainer of the printout
 
196
      @param p QPainter of the printout
 
197
      @param linewidth is the width of the line used to draw the box, ignored if less than 1.
192
198
      @param box Coordinates of the event's box
193
199
      @param incidence The incidence (if available), from which the category
194
200
                       color will be deduced, if applicable.
195
201
      @param str The string to print inside the box
 
202
      @param flags is a bitwise OR of Qt::AlignmentFlags and Qt::TextFlags values.
196
203
    */
197
 
    void showEventBox( QPainter &p, const QRect &box, Incidence *incidence,
198
 
                       const QString &str, int flags = -1 );
 
204
    void showEventBox( QPainter &p, int linewidth, const QRect &box,
 
205
                       const Incidence::Ptr &incidence, const QString &str, int flags = -1 );
199
206
 
200
207
    /**
201
208
      Draw a subheader box with a shaded background and the given string
208
215
    /**
209
216
      Draw an event box with vertical text.
210
217
      @param p QPainter of the printout
 
218
      @param linewidth is the width of the line used to draw the box, ignored if less than 1.
211
219
      @param box Coordinates of the box
212
220
      @param str ext to be printed inside the box
 
221
      @param flags is a bitwise OR of Qt::AlignmentFlags and Qt::TextFlags values.
213
222
    */
214
 
    void drawVerticalBox( QPainter &p, const QRect &box, const QString &str );
 
223
    void drawVerticalBox( QPainter &p, int linewidth, const QRect &box, const QString &str,
 
224
                          int flags=-1 );
215
225
 
216
226
    /**
217
227
      Draw a component box with a heading (printed in bold).
271
281
                     const QDate &month1, const QDate &month2,
272
282
                     const QRect &box, bool expand = false,
273
283
                     QColor backColor = QColor() );
 
284
 
 
285
    /**
 
286
      Draw a page footer containing the printing date and possibly
 
287
      other things, like a page number.
 
288
      @param p QPainter of the printout
 
289
      @param box coordinates of the footer
 
290
      @return The bottom of the printed box.
 
291
    */
 
292
    int drawFooter( QPainter &p, const QRect &box );
 
293
 
274
294
    /**
275
295
      Draw a small calendar with the days of a month into the given area.
276
296
      Used for example in the title bar of the sheet.
335
355
      @param excludePrivate Whether to exclude Incidence marked private.
336
356
      @return The height used for the all-day box.
337
357
    */
338
 
    int drawAllDayBox( QPainter &p, Event::List &eventList,
 
358
    int drawAllDayBox( QPainter &p, const Akonadi::Item::List &eventList,
339
359
                        const QDate &qd, bool expandable,
340
360
                        const QRect &box,
341
361
                        bool mExcludeConfidential, bool mExcludePrivate );
361
381
      @param excludeTime Whether the time is printed in the detail area.
362
382
      @param excludeConfidential Whether to exclude Incidence marked confidential.
363
383
      @param excludePrivate Whether to exclude Incidence marked private.
 
384
      @param workDays List of workDays
364
385
    */
365
 
    void drawAgendaDayBox( QPainter &p, Event::List &eventList,
 
386
    void drawAgendaDayBox( QPainter &p, const Akonadi::Item::List &eventList,
366
387
                           const QDate &qd, bool expandable,
367
388
                           QTime &fromTime, QTime &toTime,
368
389
                           const QRect &box,
369
390
                           bool includeDescription, bool excludeTime,
370
 
                           bool mExcludeConfidential, bool mExcludePrivate );
 
391
                           bool mExcludeConfidential, bool mExcludePrivate,
 
392
                           const QList<QDate> &workDays );
371
393
 
372
394
    void drawAgendaItem( PrintCellItem *item, QPainter &p,
373
395
                         const KDateTime &startPrintDate,
543
565
      @param r Internal (used when printing sub-to-dos to give information
544
566
      about its parent)
545
567
    */
546
 
    void drawTodo( int &count, Todo *todo, QPainter &p,
547
 
                   TodoSortField sortField, SortDirection sortDir,
 
568
    void drawTodo( int &count, const Akonadi::Item &todo, QPainter &p,
 
569
                   CalendarSupport::TodoSortField sortField,
 
570
                   CalendarSupport::SortDirection sortDir,
548
571
                   bool connectSubTodos, bool strikeoutCompleted, bool desc,
549
572
                   int posPriority, int posSummary, int posDueDt,
550
573
                   int posPercentComplete, int level, int x, int &y,
551
574
                   int width, int pageHeight,
552
 
                   const Todo::List &todoList, TodoParentStart *r,
 
575
                   const Akonadi::Item::List &todoList, TodoParentStart *r,
553
576
                   bool excludeConfidential, bool excludePrivate );
554
577
 
555
578
    /**
562
585
      @param pageHeight Total height allowed for the list on a page. If an item
563
586
                   would be below that line, a new page is started.
564
587
    */
565
 
    void drawJournal( Journal * journal, QPainter &p, int x, int &y,
 
588
    void drawJournal( const Journal::Ptr &journal, QPainter &p, int x, int &y,
566
589
                      int width, int pageHeight );
567
590
    /**
568
591
      Draws text lines splitting on page boundaries.
587
610
      @param startY starting y-coordinate for the first line
588
611
    */
589
612
    void drawNoteLines( QPainter &p, const QRect &box, int startY );
590
 
    /**
591
 
      Draw footer information, date printed, etc.
592
 
      @param p QPainter of the printout
593
 
      @param box coordinates of the box, footer is placed underneath
594
 
    */
595
 
    void drawFooter( QPainter &p, const QRect &box );
596
613
 
597
614
  protected:
598
615
    void drawIncidence( QPainter &p, const QRect &dayBox, const QString &time,
612
629
    bool mExcludePrivate;
613
630
    int mHeaderHeight;
614
631
    int mSubHeaderHeight;
 
632
    int mFooterHeight;
615
633
    int mMargin;
616
634
    int mPadding;
617
635
    int mBorder;
621
639
};
622
640
 
623
641
#endif
624
 
 
625
 
#endif