kword

kwmailmerge_kspread.h
1/*
2 This file is part of the KDE project
3 Copyright (C) 2004 Tobias Koenig <tokoe@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef _KWMAILMERGE_KSPREAD_H_
22#define _KWMAILMERGE_KSPREAD_H_
23
24#include <tqdom.h>
25#include <tqmap.h>
26
27#include <kspread_doc.h>
28#include <kspread_sheet.h>
29
30#include "KWMailMergeDataSource.h"
31
32class KWMailMergeKSpread: public KWMailMergeDataSource
33{
34 TQ_OBJECT
35
36
37 public:
38 KWMailMergeKSpread( TDEInstance *inst, TQObject *parent );
39 ~KWMailMergeKSpread();
40
44 virtual void save( TQDomDocument&, TQDomElement& );
45
49 virtual void load( TQDomElement& );
50
58 virtual class TQString getValue( const class TQString &name, int record = -1 ) const;
59
63 virtual int getNumRecords() const;
64
70 virtual void refresh( bool force );
71
75 virtual bool showConfigDialog( TQWidget*, int action);
76
77
78 void setURL( const KURL &url ) { _url = url; }
79 KURL url() const { return _url; }
80
81 void setSpreadSheetNumber( int number ) { _spreadSheetNumber = number; }
82 int spreadSheetNumber() const { return _spreadSheetNumber; }
83
84 protected:
85 friend class KWMailMergeKSpreadConfig;
86
87 private slots:
88 void initSpreadSheets();
89
90 private:
91 void initDocument();
92
93 int rows() const;
94 int columns() const;
95
96 TQString cellText( const KSpread::Cell* ) const;
97
98 KSpread::Doc *_document;
99 KSpread::Sheet* _sheet;
100 KURL _url;
101 int _spreadSheetNumber;
102
103 TQMap<TQString, int> _columnMap;
104};
105
106#endif
107