korganizer

calprintdefaultplugins.h
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 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, permission is given to link this program
22  with any edition of TQt, and distribute the resulting executable,
23  without including the source code for TQt in the source distribution.
24 */
25 #ifndef CALPRINTDEFAULTPLUGINS_H
26 #define CALPRINTDEFAULTPLUGINS_H
27 
28 
29 #include <tdelocale.h>
30 #include "calprintpluginbase.h"
31 
32 #ifndef KORG_NOPRINTER
33 namespace KCal {
34 class Calendar;
35 }
36 
37 using namespace KCal;
38 using namespace KOrg;
39 
40 class CalPrintIncidence : public CalPrintPluginBase
41 {
42  public:
43  CalPrintIncidence();
44  virtual ~CalPrintIncidence();
45  virtual TQString description()
46  {
47  return i18n( "Print &incidence" );
48  }
49  virtual TQString info()
50  {
51  return i18n( "Prints an incidence on one page" );
52  }
53  virtual int sortID()
54  {
55  return CalPrinterBase::Incidence;
56  }
57 
58  // Enable the Print Incidence option only if there are selected incidences.
59  virtual bool enabled()
60  {
61  if ( mSelectedIncidences.count() > 0 ) {
62  return true;
63  } else {
64  return false;
65  }
66  }
67  virtual TQWidget *createConfigWidget( TQWidget * );
68  virtual KPrinter::Orientation defaultOrientation()
69  {
70  return KPrinter::Portrait;
71  }
72 
73  public:
74  void print( TQPainter &p, int width, int height );
75  virtual void readSettingsWidget();
76  virtual void setSettingsWidget();
77  virtual void loadConfig();
78  virtual void saveConfig();
79  protected:
80  int printCaptionAndText( TQPainter &p, const TQRect &box, const TQString &caption,
81  const TQString &text, TQFont captionFont, TQFont textFont );
82 
83 
84  protected:
85  bool mShowOptions;
86  bool mShowSubitemsNotes;
87  bool mShowAttendees;
88  bool mShowAttachments;
89 };
90 
91 
92 class CalPrintDay : public CalPrintPluginBase
93 {
94  public:
95  CalPrintDay();
96  virtual ~CalPrintDay();
97  virtual TQString description()
98  {
99  return i18n( "Print da&y" );
100  }
101  virtual TQString info()
102  {
103  return i18n( "Prints all events of a single day on one page" );
104  }
105  virtual int sortID()
106  {
107  return CalPrinterBase::Day;
108  }
109  virtual bool enabled()
110  {
111  return true;
112  }
113  virtual TQWidget *createConfigWidget( TQWidget* );
114 
115  public:
116  void print(TQPainter &p, int width, int height);
117  virtual void readSettingsWidget();
118  virtual void setSettingsWidget();
119  virtual void loadConfig();
120  virtual void saveConfig();
121  virtual void setDateRange( const TQDate& from, const TQDate& to );
122 
123  protected:
124  TQTime mStartTime, mEndTime;
125  bool mIncludeTodos;
126  bool mIncludeAllEvents;
127 };
128 
129 class CalPrintWeek : public CalPrintPluginBase
130 {
131  public:
132  CalPrintWeek();
133  virtual ~CalPrintWeek();
134  virtual TQString description()
135  {
136  return i18n( "Print &week" );
137  }
138  virtual TQString info()
139  {
140  return i18n( "Prints all events of one week on one page" );
141  }
142  virtual int sortID()
143  {
144  return CalPrinterBase::Week;
145  }
146  virtual bool enabled()
147  {
148  return true;
149  }
150  virtual TQWidget *createConfigWidget( TQWidget * );
151 
155  virtual KPrinter::Orientation defaultOrientation();
156 
157  public:
158  void print(TQPainter &p, int width, int height);
159  virtual void readSettingsWidget();
160  virtual void setSettingsWidget();
161  virtual void loadConfig();
162  virtual void saveConfig();
163  virtual void setDateRange( const TQDate& from, const TQDate& to );
164 
165  protected:
166  enum eWeekPrintType { Filofax=0, Timetable, SplitWeek } mWeekPrintType;
167  TQTime mStartTime, mEndTime;
168  bool mIncludeTodos;
169 };
170 
171 class CalPrintMonth : public CalPrintPluginBase
172 {
173  public:
174  CalPrintMonth();
175  virtual ~CalPrintMonth();
176  virtual TQString description()
177  {
178  return i18n( "Print mont&h" );
179  }
180  virtual TQString info()
181  {
182  return i18n( "Prints all events of one month on one page" );
183  }
184  virtual int sortID()
185  {
186  return CalPrinterBase::Month;
187  }
188  virtual bool enabled()
189  {
190  return true;
191  }
192  virtual TQWidget *createConfigWidget( TQWidget * );
193  virtual KPrinter::Orientation defaultOrientation()
194  {
195  return KPrinter::Landscape;
196  }
197 
198 
199  public:
200  void print(TQPainter &p, int width, int height);
201  virtual void readSettingsWidget();
202  virtual void setSettingsWidget();
203  virtual void loadConfig();
204  virtual void saveConfig();
205  virtual void setDateRange( const TQDate& from, const TQDate& to );
206 
207  protected:
208  bool mWeekNumbers;
209  bool mRecurDaily;
210  bool mRecurWeekly;
211  bool mIncludeTodos;
212 };
213 
214 class CalPrintTodos : public CalPrintPluginBase
215 {
216  public:
217  CalPrintTodos();
218  virtual ~CalPrintTodos();
219  virtual TQString description()
220  {
221  return i18n( "Print to-&dos" );
222  }
223  virtual TQString info()
224  {
225  return i18n( "Prints all to-dos in a (tree-like) list" );
226  }
227  virtual int sortID()
228  {
229  return CalPrinterBase::Todolist;
230  }
231  virtual bool enabled()
232  {
233  return true;
234  }
235  virtual TQWidget *createConfigWidget( TQWidget * );
236 
237  public:
238  void print( TQPainter &p, int width, int height );
239  virtual void readSettingsWidget();
240  virtual void setSettingsWidget();
241  virtual void loadConfig();
242  virtual void saveConfig();
243 
244  protected:
245  TQString mPageTitle;
246 
247  enum eTodoPrintType {
248  TodosAll = 0,
249  TodosUnfinished,
250  TodosDueRange
251  } mTodoPrintType;
252 
253  enum eTodoSortField {
254  TodoFieldSummary = 0,
255  TodoFieldStartDate,
256  TodoFieldDueDate,
257  TodoFieldPriority,
258  TodoFieldPercentComplete,
259  TodoFieldUnset
260  } mTodoSortField;
261 
262  enum eTodoSortDirection {
263  TodoDirectionAscending = 0,
264  TodoDirectionDescending,
265  TodoDirectionUnset
266  } mTodoSortDirection;
267 
268  bool mIncludeDescription;
269  bool mIncludePriority;
270  bool mIncludeDueDate;
271  bool mIncludePercentComplete;
272  bool mConnectSubTodos;
273  bool mStrikeOutCompleted;
274  bool mSortField;
275  bool mSortDirection;
276 };
277 
278 
279 #endif
280 
281 #endif
Base class for KOrganizer printing classes.