kword

KWMailMergeDataBase.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00003 
00004    Modified by Joseph wenninger, 2001
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef mailmerge_h
00023 #define mailmerge_h
00024 
00025 #include <kdialogbase.h>
00026 #include <ktrader.h>
00027 
00028 
00029 #include <qmap.h>
00030 #include <qstring.h>
00031 #include <qstringlist.h>
00032 #include <qdom.h>
00033 #include <qtextstream.h>
00034 
00035 #include "KWMailMergeDataSource.h"
00036 #include "KWordMailMergeDatabaseIface.h"
00037 #include <koffice_export.h>
00038 
00039 class QListBox;
00040 class QPushButton;
00041 class QLineEdit;
00042 class QSpinBox;
00043 class KWDocument;
00044 class QVBox;
00045 
00046 //class KWMailMergeDataBase;
00047 
00048 
00049 
00050 
00051 /******************************************************************
00052  *
00053  * Class: KWMailMergeDataBase
00054  *
00055  ******************************************************************/
00056 
00057 class KWORD_EXPORT KWMailMergeDataBase: public QObject,KWordMailMergeDatabaseIface
00058 {
00059 Q_OBJECT
00060 
00061 public:
00062     KWMailMergeDataBase( KWDocument *doc_ );
00063     void showConfigDialog(QWidget *); // Select datasource type  and / or configure datasource
00064 
00065     QString getValue( const QString &name, int record = -1 ) const;  //accesses the plugin
00066     bool isSampleRecord();
00067 
00068     const QMap< QString, QString > &getRecordEntries() const; //accesses the plugin
00069     int getNumRecords() const; //accesses the plugin
00070 
00071     QDomElement save(QDomDocument &doc) const; // save some global config + plugin config
00072     void load( const QDomElement& elem ); // save some global config + plugin config
00073 
00074     KWMailMergeDataSource *loadPlugin(const QString& name);
00075     KWMailMergeDataSource *openPluginFor(int type,int &version);
00076 
00077     virtual void refresh(bool force);
00078     virtual QStringList availablePlugins();
00079     virtual bool loadPlugin(const QString &name,const QString &command);
00080     virtual bool isConfigDialogShown();
00081     
00082     int version();
00083 private:
00084     int m_version;
00085 protected:
00086     friend class KWMailMergeConfigDialog;
00087     KWDocument *doc;
00088     int action;
00089     class KWMailMergeDataSource *plugin;
00090     QMap<QString, QString> emptyMap;
00091     bool askUserForConfirmationAndConfig(KWMailMergeDataSource *tmpPlugin,bool config,QWidget *par,int version);
00092     bool rejectdcopcall;
00093 };
00094 
00095 
00096 class KWMailMergeChoosePluginDialog : public KDialogBase
00097 {
00098   Q_OBJECT
00099 
00100   public:
00101     KWMailMergeChoosePluginDialog( KTrader::OfferList );
00102     ~KWMailMergeChoosePluginDialog();
00103 
00104     int currentPlugin() const;    
00105 
00106   private slots:
00107     void pluginChanged( int pos );
00108 
00109   private:
00110     class QComboBox *chooser;
00111     class QLabel *descriptionLabel;
00112     KTrader::OfferList pluginOffers;
00113 };
00114 
00115 class KWMailMergeConfigDialog : public KDialogBase
00116 {
00117     Q_OBJECT
00118 
00119 public:
00120    KWMailMergeConfigDialog ( QWidget *parent, KWMailMergeDataBase *db );
00121    ~KWMailMergeConfigDialog();
00122 protected:
00123     QPushButton *edit;
00124     QPushButton *create;
00125     QPushButton *open;
00126     QPushButton *preview;
00127     QPushButton *document;
00128     KWMailMergeDataBase *db_;
00129     void enableDisableEdit();
00130     void doNewActions();
00131 
00132 protected slots:
00133     void slotEditClicked();
00134     void slotCreateClicked();
00135     void slotOpenClicked();
00136     void slotPreviewClicked();
00137     void slotDocumentClicked();
00138 };
00139 
00140 /******************************************************************
00141  *
00142  * Class: KWMailMergeVariableInsertDia
00143  *
00144  ******************************************************************/
00145 
00146 class KWMailMergeVariableInsertDia : public KDialogBase
00147 {
00148   Q_OBJECT
00149 
00150   public:
00151     KWMailMergeVariableInsertDia( QWidget *parent, KWMailMergeDataBase *db );
00152     QString getName() const; // ### unused, can we remove this?
00153 
00154   protected slots:
00155     void slotSelectionChanged();
00156 
00157   private:
00158     KWMailMergeDataBase *m_db;
00159 
00160   protected:
00161     QListBox *names;
00162 };
00163 
00164 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys