lib

KoCustomVariablesDia.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KOVARIABLEDLGS_H
21#define KOVARIABLEDLGS_H
22
23#include "KoVariable.h"
24
25#include <kdialogbase.h>
26#include <tqptrlist.h>
27#include <tqstring.h>
28#include <tdelistview.h>
29#include <koffice_export.h>
30class TQComboBox;
31class TQVBox;
32class TQResizeEvent;
33class KLineEdit;
34class TQCloseEvent;
35
36/******************************************************************
37 *
38 * Class: KoVariableNameDia
39 *
40 ******************************************************************/
41
42class KoVariableNameDia : public KDialogBase
43{
44 TQ_OBJECT
45
46
47public:
48 // For KWMailMergeVariableInsertDia
49 KoVariableNameDia( TQWidget *parent );
50 // For kwview
51 KoVariableNameDia( TQWidget *parent, const TQPtrList<KoVariable> &vars );
52 TQString getName() const;
53
54protected slots:
55 void textChanged ( const TQString &_text );
56protected:
57 void init();
58
59 TQComboBox *names;
60 TQVBox *back;
61};
62
68class KoCustomVariablesListItem : public TQListViewItem
69{
70public:
71 KoCustomVariablesListItem( TQListView *parent );
72
73 void setVariable( KoCustomVariable *v );
74 KoCustomVariable *getVariable() const;
75
76 virtual void setup();
77 virtual int width ( const TQFontMetrics & fm, const TQListView * lv, int c ) const;
78 void update();
79
80 // Gets the value from the lineedit and sets it into the variable
81 void applyValue();
82
83protected:
85 KLineEdit *editWidget;
86};
87
93class KoCustomVariablesList : public TDEListView
94{
95 TQ_OBJECT
96
97
98public:
99 KoCustomVariablesList( TQWidget *parent );
100
101 void setValues();
102 void updateItems();
103
104protected slots:
105 void columnSizeChange( int c, int os, int ns );
106 void sectionClicked( int c );
107
108private:
109 class Private;
110 Private* d; // currently unused
111};
112
117class KOTEXT_EXPORT KoCustomVariablesDia : public KDialogBase
118{
119 TQ_OBJECT
120
121
122public:
123 KoCustomVariablesDia( TQWidget *parent, const TQPtrList<KoVariable> &variables );
124protected slots:
125 void slotOk();
126
127protected:
128 TQVBox *back;
130
131};
132
138class KOTEXT_EXPORT KoCustomVarDialog : public KDialogBase
139{
140 TQ_OBJECT
141
142
143public:
147 KoCustomVarDialog( TQWidget *parent );
151 KoCustomVarDialog( TQWidget *parent, KoCustomVariable *var );
152
153 virtual TQString name();
154 virtual TQString value();
155
156protected slots:
157 void slotAddOk();
158 void slotEditOk();
159 void slotTextChanged(const TQString&);
160
161protected:
162 TQVBox *back;
163 KLineEdit *m_name;
164 KLineEdit *m_value;
165
166private:
167 void init();
168 KoCustomVariable *m_var;
169};
170
171#endif
KDialogBase(TQWidget *parent=0, const char *name=0, bool modal=true, const TQString &caption=TQString::null, int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
virtual void slotOk()
KoCustomVarDialog(TQWidget *parent)
Add new variable.
A custom variable is a variable whose value is entered by the user.
Definition KoVariable.h:552
Class: KoCustomVariablesList The listview.
TDEListView(TQWidget *parent=0, const char *name=0)