kword

kwmailmerge_kspread.h

00001 /*
00002    This file is part of the KDE project
00003    Copyright (C) 2004 Tobias Koenig <tokoe@kde.org>
00004  
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009  
00010    This library 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 GNU
00013    Library General Public License for more details.
00014  
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef _KWMAILMERGE_KSPREAD_H_
00022 #define _KWMAILMERGE_KSPREAD_H_
00023 
00024 #include <qdom.h>
00025 #include <qmap.h>
00026 
00027 #include <kspread_doc.h>
00028 #include <kspread_sheet.h>
00029 
00030 #include "KWMailMergeDataSource.h"
00031 
00032 class KWMailMergeKSpread: public KWMailMergeDataSource
00033 {
00034   Q_OBJECT
00035 
00036   public:
00037     KWMailMergeKSpread( KInstance *inst, QObject *parent );
00038     ~KWMailMergeKSpread();
00039 
00043     virtual void save( QDomDocument&, QDomElement& );
00044 
00048     virtual void load( QDomElement& );
00049 
00057     virtual class QString getValue( const class QString &name, int record = -1 ) const;
00058 
00062     virtual int getNumRecords() const;
00063 
00069     virtual void refresh( bool force );
00070 
00074     virtual bool showConfigDialog( QWidget*, int action);
00075 
00076 
00077     void setURL( const KURL &url ) { _url = url; }
00078     KURL url() const { return _url; }
00079 
00080     void setSpreadSheetNumber( int number ) { _spreadSheetNumber = number; }
00081     int spreadSheetNumber() const { return _spreadSheetNumber; }
00082 
00083   protected:
00084     friend class KWMailMergeKSpreadConfig;
00085 
00086   private slots:
00087     void initSpreadSheets();
00088 
00089   private:
00090     void initDocument();
00091 
00092     int rows() const;
00093     int columns() const;
00094 
00095     QString cellText( const KSpread::Cell* ) const;
00096 
00097     KSpread::Doc *_document;
00098     KSpread::Sheet* _sheet;
00099     KURL _url;
00100     int _spreadSheetNumber;
00101 
00102     QMap<QString, int> _columnMap;
00103 };
00104 
00105 #endif
00106 
KDE Home | KDE Accessibility Home | Description of Access Keys