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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 00019 As a special exception, permission is given to link this program 00020 with any edition of TQt, and distribute the resulting executable, 00021 without including the source code for TQt in the source distribution. 00022 */ 00023 00024 #ifndef PRINTSTYLE_H 00025 #define PRINTSTYLE_H 00026 00027 #include <tqwidget.h> 00028 #include <tqstringlist.h> 00029 #include <tqpixmap.h> 00030 00031 #include <kabc/field.h> 00032 00033 namespace KABPrinting { 00034 00035 class PrintingWizard; 00036 class PrintProgress; 00037 00060 class PrintStyle : public TQObject 00061 { 00062 Q_OBJECT 00063 TQ_OBJECT 00064 00065 public: 00066 PrintStyle( PrintingWizard* parent, const char* name = 0 ); 00067 virtual ~PrintStyle(); 00068 00072 virtual void print( const KABC::Addressee::List &contacts, PrintProgress* ) = 0; 00073 00079 const TQPixmap& preview(); 00080 00084 void hidePages(); 00085 00089 void showPages(); 00090 00094 KABC::Field* preferredSortField(); 00095 00102 bool preferredSortType(); 00103 00104 protected: 00111 bool setPreview( const TQString& fileName ); 00112 00116 void setPreview( const TQPixmap& image ); 00117 00121 void setPreferredSortOptions( KABC::Field *field, bool ascending = true ); 00122 00126 PrintingWizard *wizard(); 00127 00132 void addPage( TQWidget *page, const TQString &title ); 00133 00134 private: 00135 PrintingWizard *mWizard; 00136 TQPixmap mPreview; 00137 TQPtrList<TQWidget> mPageList; 00138 TQStringList mPageTitles; 00139 00140 KABC::Field *mSortField; 00141 bool mSortType; 00142 }; 00143 00144 00151 class PrintStyleFactory 00152 { 00153 public: 00154 PrintStyleFactory( PrintingWizard* parent, const char* name = 0 ); 00155 virtual ~PrintStyleFactory(); 00156 00157 virtual PrintStyle *create() const = 0; 00158 00163 virtual TQString description() const = 0; 00164 00165 protected: 00166 PrintingWizard* mParent; 00167 const char* mName; 00168 }; 00169 00170 } 00171 00172 #endif