00001 /*************************************************************************** 00002 qsworkbook.h 00003 ------------------- 00004 begin : 00005 copyright : (C) 2001 by Kamil Dobkowski 00006 email : kamildobk@poczta.onet.pl 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 00019 #ifndef QSWORKBOOK_H 00020 #define QSWORKBOOK_H 00021 00022 #include <qobject.h> 00023 #include <qstring.h> 00024 #include "qscobject.h" 00025 00026 //---------------------------------------------------------------------------------------------------// 00027 00028 template<class CHILD_OBJECT> class QSChildList; 00029 00030 class QSDrv; 00031 class QPainter; 00032 class QWidget; 00040 class QSPage : public QObject 00041 { 00042 Q_OBJECT 00043 public: 00047 QSPage( QObject *parent=NULL ); 00051 virtual ~QSPage(); 00056 void setTitle( const QString& title ); 00060 QString title() const { return m_title; } 00064 QSCObjectCollection *objects() const { return m_objects; } 00069 void paint( QPainter *p, double dpi, bool blocking=false ); 00070 00071 signals: 00075 void sigTitleChanged( const QString& newTitle ); 00080 void sigPageChanged(); 00081 00082 private: 00083 QSCObjectCollection *m_objects; 00084 QString m_title; 00085 00086 private slots: 00087 void slot_collection_changed(); 00088 00089 }; 00090 00091 //---------------------------------------------------------------------------------------------------// 00092 00093 class QPrinter; 00094 00101 class QSWorkbook : public QObject 00102 { 00103 Q_OBJECT 00104 public: 00108 QSWorkbook( QObject *parent ); 00112 virtual ~QSWorkbook(); 00116 //QSConsole *console(); 00120 int pageCount() const; 00124 virtual void clear(); 00128 void print( QPainter *painter, QPrinter *printer, double dpi ); 00132 void pageAdd( QSPage *object ); 00136 void pageInsert( int position, QSPage *page ); 00140 void pageRemove( int index ); 00144 void pageDelete( int index ); 00148 void pageRaise( int index ); 00152 void pageLower( int index ); 00156 void pageToFront( int index ); 00160 void pageToBack( int index ); 00164 void pageReorder( int position, int index ); 00168 int pageFind( QSPage *page ) const; 00172 QSPage *pageFind( QSCObject *object ) const; 00176 QSPage *page( int index ) const; 00183 void setPrinter( QPrinter *printer ); 00187 QPrinter *printer() const { return m_printer; } 00188 00189 signals: 00193 void sigPageAdded( QSPage *o ); 00197 void sigPageRemoved( QSPage *o ); 00201 void sigPageOrder(); 00205 void sigObjectAdded( QSCObject *o ); 00209 void sigObjectRemoved( QSCObject *o ); 00213 void sigObjectOrder(); 00218 void sigPageListChanged(); 00222 void sigPrinterChanged(); 00227 void sigWorkbookChanged(); 00228 00229 private slots: 00230 void slot_object_added(QSCObject*); 00231 void slot_object_removed(QSCObject*); 00232 void slot_object_order(); 00233 void slot_page_changed(); 00234 void slot_page_title_changed( const QString& ); 00235 00236 private: 00237 QPrinter *m_printer; 00238 QSChildList<QSPage> *m_page_list; 00239 }; 00240 00261 #endif 00262