calprintdefaultplugins.h
00001 /* 00002 This file is part of KOrganizer. 00003 00004 Copyright (c) 1998 Preston Brown <pbrown@kde.org> 00005 Copyright (c) 2003 Reinhold Kainhofer <reinhold@kainhofer.com> 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 00021 As a special exception, permission is given to link this program 00022 with any edition of TQt, and distribute the resulting executable, 00023 without including the source code for TQt in the source distribution. 00024 */ 00025 #ifndef CALPRINTDEFAULTPLUGINS_H 00026 #define CALPRINTDEFAULTPLUGINS_H 00027 00028 00029 #include <tdelocale.h> 00030 #include "calprintpluginbase.h" 00031 00032 #ifndef KORG_NOPRINTER 00033 namespace KCal { 00034 class Calendar; 00035 } 00036 00037 using namespace KCal; 00038 using namespace KOrg; 00039 00040 class CalPrintIncidence : public CalPrintPluginBase 00041 { 00042 public: 00043 CalPrintIncidence(); 00044 virtual ~CalPrintIncidence(); 00045 virtual TQString description() 00046 { 00047 return i18n( "Print &incidence" ); 00048 } 00049 virtual TQString info() 00050 { 00051 return i18n( "Prints an incidence on one page" ); 00052 } 00053 virtual int sortID() 00054 { 00055 return CalPrinterBase::Incidence; 00056 } 00057 00058 // Enable the Print Incidence option only if there are selected incidences. 00059 virtual bool enabled() 00060 { 00061 if ( mSelectedIncidences.count() > 0 ) { 00062 return true; 00063 } else { 00064 return false; 00065 } 00066 } 00067 virtual TQWidget *createConfigWidget( TQWidget * ); 00068 virtual KPrinter::Orientation defaultOrientation() 00069 { 00070 return KPrinter::Portrait; 00071 } 00072 00073 public: 00074 void print( TQPainter &p, int width, int height ); 00075 virtual void readSettingsWidget(); 00076 virtual void setSettingsWidget(); 00077 virtual void loadConfig(); 00078 virtual void saveConfig(); 00079 protected: 00080 int printCaptionAndText( TQPainter &p, const TQRect &box, const TQString &caption, 00081 const TQString &text, TQFont captionFont, TQFont textFont ); 00082 00083 00084 protected: 00085 bool mShowOptions; 00086 bool mShowSubitemsNotes; 00087 bool mShowAttendees; 00088 bool mShowAttachments; 00089 }; 00090 00091 00092 class CalPrintDay : public CalPrintPluginBase 00093 { 00094 public: 00095 CalPrintDay(); 00096 virtual ~CalPrintDay(); 00097 virtual TQString description() 00098 { 00099 return i18n( "Print da&y" ); 00100 } 00101 virtual TQString info() 00102 { 00103 return i18n( "Prints all events of a single day on one page" ); 00104 } 00105 virtual int sortID() 00106 { 00107 return CalPrinterBase::Day; 00108 } 00109 virtual bool enabled() 00110 { 00111 return true; 00112 } 00113 virtual TQWidget *createConfigWidget( TQWidget* ); 00114 00115 public: 00116 void print(TQPainter &p, int width, int height); 00117 virtual void readSettingsWidget(); 00118 virtual void setSettingsWidget(); 00119 virtual void loadConfig(); 00120 virtual void saveConfig(); 00121 virtual void setDateRange( const TQDate& from, const TQDate& to ); 00122 00123 protected: 00124 TQTime mStartTime, mEndTime; 00125 bool mIncludeTodos; 00126 bool mIncludeAllEvents; 00127 }; 00128 00129 class CalPrintWeek : public CalPrintPluginBase 00130 { 00131 public: 00132 CalPrintWeek(); 00133 virtual ~CalPrintWeek(); 00134 virtual TQString description() 00135 { 00136 return i18n( "Print &week" ); 00137 } 00138 virtual TQString info() 00139 { 00140 return i18n( "Prints all events of one week on one page" ); 00141 } 00142 virtual int sortID() 00143 { 00144 return CalPrinterBase::Week; 00145 } 00146 virtual bool enabled() 00147 { 00148 return true; 00149 } 00150 virtual TQWidget *createConfigWidget( TQWidget * ); 00151 00155 virtual KPrinter::Orientation defaultOrientation(); 00156 00157 public: 00158 void print(TQPainter &p, int width, int height); 00159 virtual void readSettingsWidget(); 00160 virtual void setSettingsWidget(); 00161 virtual void loadConfig(); 00162 virtual void saveConfig(); 00163 virtual void setDateRange( const TQDate& from, const TQDate& to ); 00164 00165 protected: 00166 enum eWeekPrintType { Filofax=0, Timetable, SplitWeek } mWeekPrintType; 00167 TQTime mStartTime, mEndTime; 00168 bool mIncludeTodos; 00169 }; 00170 00171 class CalPrintMonth : public CalPrintPluginBase 00172 { 00173 public: 00174 CalPrintMonth(); 00175 virtual ~CalPrintMonth(); 00176 virtual TQString description() 00177 { 00178 return i18n( "Print mont&h" ); 00179 } 00180 virtual TQString info() 00181 { 00182 return i18n( "Prints all events of one month on one page" ); 00183 } 00184 virtual int sortID() 00185 { 00186 return CalPrinterBase::Month; 00187 } 00188 virtual bool enabled() 00189 { 00190 return true; 00191 } 00192 virtual TQWidget *createConfigWidget( TQWidget * ); 00193 virtual KPrinter::Orientation defaultOrientation() 00194 { 00195 return KPrinter::Landscape; 00196 } 00197 00198 00199 public: 00200 void print(TQPainter &p, int width, int height); 00201 virtual void readSettingsWidget(); 00202 virtual void setSettingsWidget(); 00203 virtual void loadConfig(); 00204 virtual void saveConfig(); 00205 virtual void setDateRange( const TQDate& from, const TQDate& to ); 00206 00207 protected: 00208 bool mWeekNumbers; 00209 bool mRecurDaily; 00210 bool mRecurWeekly; 00211 bool mIncludeTodos; 00212 }; 00213 00214 class CalPrintTodos : public CalPrintPluginBase 00215 { 00216 public: 00217 CalPrintTodos(); 00218 virtual ~CalPrintTodos(); 00219 virtual TQString description() 00220 { 00221 return i18n( "Print to-&dos" ); 00222 } 00223 virtual TQString info() 00224 { 00225 return i18n( "Prints all to-dos in a (tree-like) list" ); 00226 } 00227 virtual int sortID() 00228 { 00229 return CalPrinterBase::Todolist; 00230 } 00231 virtual bool enabled() 00232 { 00233 return true; 00234 } 00235 virtual TQWidget *createConfigWidget( TQWidget * ); 00236 00237 public: 00238 void print( TQPainter &p, int width, int height ); 00239 virtual void readSettingsWidget(); 00240 virtual void setSettingsWidget(); 00241 virtual void loadConfig(); 00242 virtual void saveConfig(); 00243 00244 protected: 00245 TQString mPageTitle; 00246 00247 enum eTodoPrintType { 00248 TodosAll = 0, 00249 TodosUnfinished, 00250 TodosDueRange 00251 } mTodoPrintType; 00252 00253 enum eTodoSortField { 00254 TodoFieldSummary = 0, 00255 TodoFieldStartDate, 00256 TodoFieldDueDate, 00257 TodoFieldPriority, 00258 TodoFieldPercentComplete, 00259 TodoFieldUnset 00260 } mTodoSortField; 00261 00262 enum eTodoSortDirection { 00263 TodoDirectionAscending = 0, 00264 TodoDirectionDescending, 00265 TodoDirectionUnset 00266 } mTodoSortDirection; 00267 00268 bool mIncludeDescription; 00269 bool mIncludePriority; 00270 bool mIncludeDueDate; 00271 bool mIncludePercentComplete; 00272 bool mConnectSubTodos; 00273 bool mStrikeOutCompleted; 00274 bool mSortField; 00275 bool mSortDirection; 00276 }; 00277 00278 00279 #endif 00280 00281 #endif