calprinter.h
00001 /* 00002 This file is part of KOrganizer. 00003 00004 Copyright (c) 1998 Preston Brown <pbrown@kde.org> 00005 Copyright (C) 2003-2004 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 _CALPRINTER_H 00026 #define _CALPRINTER_H 00027 00028 #ifndef KORG_NOPRINTER 00029 00030 #include <tqptrlist.h> 00031 #include <kdialogbase.h> 00032 #include <korganizer/baseview.h> 00033 #include <korganizer/printplugin.h> 00034 #include <tdepimmacros.h> 00035 00036 namespace KOrg { 00037 class CoreHelper; 00038 } 00039 using namespace KCal; 00040 00041 class TQVButtonGroup; 00042 class TQWidgetStack; 00043 class CalPrintDialog; 00044 class TDEConfig; 00045 class TQComboBox; 00046 class TQLabel; 00047 00053 class KDE_EXPORT CalPrinter : public TQObject, public KOrg::CalPrinterBase 00054 { 00055 Q_OBJECT 00056 00057 00058 public: 00059 enum ePrintOrientation { 00060 eOrientPlugin=0, 00061 eOrientPrinter, 00062 eOrientPortrait, 00063 eOrientLandscape 00064 }; 00065 public: 00071 CalPrinter( TQWidget *par, Calendar *cal, KOrg::CoreHelper *helper ); 00072 virtual ~CalPrinter(); 00073 00074 void init( Calendar *calendar ); 00075 00082 void setDateRange( const TQDate &start, const TQDate &end ); 00083 00084 public slots: 00085 void updateConfig(); 00086 00087 private slots: 00088 void doPrint( KOrg::PrintPlugin *selectedStyle, CalPrinter::ePrintOrientation dlgorientation, bool preview = false ); 00089 00090 public: 00091 void print( int type, const TQDate &fd, const TQDate &td, 00092 Incidence::List selectedIncidences = Incidence::List(), bool preview = false ); 00093 00094 Calendar *calendar() const; 00095 TDEConfig *config() const; 00096 00097 protected: 00098 KOrg::PrintPlugin::List mPrintPlugins; 00099 00100 private: 00101 Calendar *mCalendar; 00102 TQWidget *mParent; 00103 TDEConfig *mConfig; 00104 KOrg::CoreHelper *mCoreHelper; 00105 }; 00106 00107 class CalPrintDialog : public KDialogBase 00108 { 00109 Q_OBJECT 00110 00111 public: 00112 CalPrintDialog( KOrg::PrintPlugin::List plugins, 00113 TQWidget *parent = 0, const char *name = 0 ); 00114 virtual ~CalPrintDialog(); 00115 KOrg::PrintPlugin *selectedPlugin(); 00116 void setOrientation( CalPrinter::ePrintOrientation orientation ); 00117 CalPrinter::ePrintOrientation orientation() { return mOrientation; } 00118 00119 public slots: 00120 void setPrintType( int ); 00121 void setPreview( bool ); 00122 00123 protected slots: 00124 void slotOk(); 00125 00126 private: 00127 TQVButtonGroup *mTypeGroup; 00128 TQWidgetStack *mConfigArea; 00129 TQMap<int, KOrg::PrintPlugin*> mPluginIDs; 00130 TQString mPreviewText; 00131 TQComboBox *mOrientationSelection; 00132 00133 CalPrinter::ePrintOrientation mOrientation; 00134 }; 00135 00136 #endif 00137 00138 #endif