printstyle.h
00001 /* 00002 This file is part of KAddressBook. 00003 Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 00019 As a special exception, permission is given to link this program 00020 with any edition of Qt, and distribute the resulting executable, 00021 without including the source code for Qt in the source distribution. 00022 */ 00023 00024 #ifndef PRINTSTYLE_H 00025 #define PRINTSTYLE_H 00026 00027 #include <qwidget.h> 00028 #include <qstringlist.h> 00029 #include <qpixmap.h> 00030 00031 #include <kabc/field.h> 00032 00033 namespace KABPrinting { 00034 00035 class PrintingWizard; 00036 class PrintProgress; 00037 00060 class PrintStyle : public QObject 00061 { 00062 Q_OBJECT 00063 00064 public: 00065 PrintStyle( PrintingWizard* parent, const char* name = 0 ); 00066 virtual ~PrintStyle(); 00067 00071 virtual void print( KABC::Addressee::List &contacts, PrintProgress* ) = 0; 00072 00078 const QPixmap& preview(); 00079 00083 void hidePages(); 00084 00088 void showPages(); 00089 00093 KABC::Field* preferredSortField(); 00094 00101 bool preferredSortType(); 00102 00103 protected: 00110 bool setPreview( const QString& fileName ); 00111 00115 void setPreview( const QPixmap& image ); 00116 00120 void setPreferredSortOptions( KABC::Field *field, bool ascending = true ); 00121 00125 PrintingWizard *wizard(); 00126 00131 void addPage( QWidget *page, const QString &title ); 00132 00133 private: 00134 PrintingWizard *mWizard; 00135 QPixmap mPreview; 00136 QPtrList<QWidget> mPageList; 00137 QStringList mPageTitles; 00138 00139 KABC::Field *mSortField; 00140 bool mSortType; 00141 }; 00142 00143 00150 class PrintStyleFactory 00151 { 00152 public: 00153 PrintStyleFactory( PrintingWizard* parent, const char* name = 0 ); 00154 virtual ~PrintStyleFactory(); 00155 virtual PrintStyle *create() = 0; 00156 00161 virtual QString description() = 0; 00162 00163 protected: 00164 PrintingWizard* mParent; 00165 const char* mName; 00166 }; 00167 00168 } 00169 00170 #endif