kspread_editors.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __kspread_editors_h__
00023 #define __kspread_editors_h__
00024
00025 #include <kcompletion.h>
00026 #include <qwidget.h>
00027 #include <kcombobox.h>
00028
00029 class KSpreadCell;
00030 class KSpreadCanvas;
00031 class KSpreadView;
00032
00033 class KSpreadLocationEditWidget;
00034
00035
00036 class QFont;
00037 class QButton;
00038 class KLineEdit;
00039
00040 class KSpreadCellEditor : public QWidget
00041 {
00042 Q_OBJECT
00043 public:
00044 KSpreadCellEditor( KSpreadCell*, KSpreadCanvas* _parent = 0, const char* _name = 0 );
00045 ~KSpreadCellEditor();
00046
00047 KSpreadCell* cell()const { return m_pCell; }
00048
00049 virtual void handleKeyPressEvent( QKeyEvent* _ev ) = 0;
00050 virtual void handleIMEvent( QIMEvent * _ev ) = 0;
00051 virtual void setEditorFont(QFont const & font, bool updateSize) = 0;
00052 virtual QString text() const = 0;
00053 virtual void setText(QString text) = 0;
00054 virtual int cursorPosition() const = 0;
00055 virtual void setCursorPosition(int pos) = 0;
00056
00057 virtual void insertFormulaChar(int c) = 0;
00058 virtual void cut(){};
00059 virtual void paste(){};
00060 virtual void copy(){};
00061 KSpreadCanvas* canvas()const { return m_pCanvas; }
00062
00063 private:
00064 KSpreadCell* m_pCell;
00065 KSpreadCanvas* m_pCanvas;
00066 };
00067
00068 class KSpreadTextEditor : public KSpreadCellEditor
00069 {
00070 Q_OBJECT
00071 public:
00072 KSpreadTextEditor( KSpreadCell*, KSpreadCanvas* _parent = 0, const char* _name = 0 );
00073 ~KSpreadTextEditor();
00074
00075 virtual void handleKeyPressEvent( QKeyEvent* _ev );
00076 virtual void handleIMEvent( QIMEvent * _ev );
00077 virtual void setEditorFont(QFont const & font, bool updateSize);
00078 virtual QString text() const;
00079 virtual void setText(QString text);
00080 virtual int cursorPosition() const;
00081 virtual void setCursorPosition(int pos);
00082
00083 virtual void insertFormulaChar(int c);
00084 virtual void cut();
00085 virtual void paste();
00086 virtual void copy();
00087 bool checkChoose();
00088 void blockCheckChoose( bool b ) { m_blockCheck = b; }
00089 bool sizeUpdate() const { return m_sizeUpdate; }
00090
00091 private slots:
00092 void slotTextChanged( const QString& text );
00093 void slotCompletionModeChanged(KGlobalSettings::Completion _completion);
00094 protected:
00095 void resizeEvent( QResizeEvent* );
00100 bool eventFilter( QObject* o, QEvent* e );
00101
00102 private:
00103
00104 KLineEdit* m_pEdit;
00105 bool m_blockCheck;
00106 bool m_sizeUpdate;
00107 uint m_length;
00108 int m_fontLength;
00109 };
00110
00111
00112 class KSpreadComboboxLocationEditWidget : public KComboBox
00113 {
00114 Q_OBJECT
00115 public:
00116 KSpreadComboboxLocationEditWidget( QWidget *_parent, KSpreadView * _canvas );
00117
00118 public slots:
00119 void slotAddAreaName( const QString & );
00120 void slotRemoveAreaName( const QString & );
00121
00122 private:
00123 KSpreadLocationEditWidget *m_locationWidget;
00124 };
00125
00126
00131 class KSpreadLocationEditWidget : public QLineEdit
00132 {
00133 Q_OBJECT
00134 public:
00135 KSpreadLocationEditWidget( QWidget *_parent, KSpreadView * _canvas );
00136 KSpreadView * view() const { return m_pView;}
00137 protected:
00138 virtual void keyPressEvent( QKeyEvent * _ev );
00139 private:
00140 KSpreadView * m_pView;
00141 signals:
00142 void gotoLocation( int, int );
00143 };
00144
00149 class KSpreadEditWidget : public QLineEdit
00150 {
00151 Q_OBJECT
00152 public:
00153 KSpreadEditWidget( QWidget *parent, KSpreadCanvas *canvas,
00154 QButton *cancelButton, QButton *okButton);
00155
00156 virtual void setText( const QString& t );
00157
00158
00159 void setEditMode( bool mode );
00160
00161 void showEditWidget(bool _show);
00162 public slots:
00163 void slotAbortEdit();
00164 void slotDoneEdit();
00165
00166 protected:
00167 virtual void keyPressEvent ( QKeyEvent* _ev );
00168 virtual void focusOutEvent( QFocusEvent* ev );
00169
00170 private:
00171 QButton* m_pCancelButton;
00172 QButton* m_pOkButton;
00173 KSpreadCanvas* m_pCanvas;
00174 };
00175
00176
00177 #endif
This file is part of the documentation for kspread Library Version 1.4.2.