~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kspread/ui/Editors.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
class FormulaEditorHighlighter : public QSyntaxHighlighter
69
69
{
70
70
public:
71
 
  /**
72
 
   * Constructs a FormulaHighlighter to color-code cell references in a QTextEdit.
73
 
   *
74
 
   * @param textEdit The QTextEdit widget which the highlighter should operate on
75
 
   * @param selection The Selection object
76
 
   */
77
 
  FormulaEditorHighlighter(QTextEdit* textEdit, Selection* selection);
78
 
  virtual ~FormulaEditorHighlighter();
79
 
 
80
 
 
81
 
  /**
82
 
   * Called automatically by KTextEditor to highlight text when modified.
83
 
   */
84
 
  virtual void highlightBlock(const QString& text);
85
 
  /**
86
 
   *
87
 
   */
88
 
  const Tokens& formulaTokens() const;
89
 
  /**
90
 
   *
91
 
   */
92
 
  uint rangeCount() const;
93
 
  /**
94
 
   * Returns true if any of the ranges or cells in the Formula.have changed since the
95
 
   * last call to @ref FormulaEditorHighlighter::rangeChanged()
96
 
   */
97
 
  bool rangeChanged() const;
98
 
 
99
 
  /**
100
 
   * Sets the highlighter's range changed flag to false.
101
 
   */
102
 
  void resetRangeChanged();
 
71
    /**
 
72
     * Constructs a FormulaHighlighter to color-code cell references in a QTextEdit.
 
73
     *
 
74
     * @param textEdit The QTextEdit widget which the highlighter should operate on
 
75
     * @param selection The Selection object
 
76
     */
 
77
    FormulaEditorHighlighter(QTextEdit* textEdit, Selection* selection);
 
78
    virtual ~FormulaEditorHighlighter();
 
79
 
 
80
 
 
81
    /**
 
82
     * Called automatically by KTextEditor to highlight text when modified.
 
83
     */
 
84
    virtual void highlightBlock(const QString& text);
 
85
    /**
 
86
     *
 
87
     */
 
88
    const Tokens& formulaTokens() const;
 
89
    /**
 
90
     *
 
91
     */
 
92
    uint rangeCount() const;
 
93
    /**
 
94
     * Returns true if any of the ranges or cells in the Formula.have changed since the
 
95
     * last call to @ref FormulaEditorHighlighter::rangeChanged()
 
96
     */
 
97
    bool rangeChanged() const;
 
98
 
 
99
    /**
 
100
     * Sets the highlighter's range changed flag to false.
 
101
     */
 
102
    void resetRangeChanged();
103
103
 
104
104
 
105
105
 
106
106
protected:
107
 
  /**
108
 
  * Returns the position of the brace matching the one found at position pos
109
 
  */
110
 
  int findMatchingBrace(int pos);
111
 
  /**
112
 
  * Examines the brace (Token::LeftPar or Token::RightPar) operator token at the given index in the token vector
113
 
  * ( as returned by formulaTokens() ) and if the cursor is next to it, the token plus any matching brace will be highlighted
114
 
  */
115
 
  void handleBrace(uint index);
 
107
    /**
 
108
    * Returns the position of the brace matching the one found at position pos
 
109
    */
 
110
    int findMatchingBrace(int pos);
 
111
    /**
 
112
    * Examines the brace (Token::LeftPar or Token::RightPar) operator token at the given index in the token vector
 
113
    * ( as returned by formulaTokens() ) and if the cursor is next to it, the token plus any matching brace will be highlighted
 
114
    */
 
115
    void handleBrace(uint index);
116
116
 
117
117
private:
118
 
    Q_DISABLE_COPY( FormulaEditorHighlighter )
 
118
    Q_DISABLE_COPY(FormulaEditorHighlighter)
119
119
 
120
 
  class Private;
121
 
  Private * const d;
 
120
    class Private;
 
121
    Private * const d;
122
122
};
123
123
 
124
124
 
138
138
 
139
139
public:
140
140
 
141
 
    FunctionCompletion( CellEditor* editor );
 
141
    FunctionCompletion(CellEditor* editor);
142
142
    ~FunctionCompletion();
143
143
 
144
144
    /**
145
145
    * Handles various keyboard and mouse actions which may occur on the autocompletion popup list
146
146
    */
147
 
    bool eventFilter( QObject *o, QEvent *e );
 
147
    bool eventFilter(QObject *o, QEvent *e);
148
148
 
149
149
    /**
150
150
    * Populates the autocompletion list box with the specified choices and shows it so that the user can view and select a function name.
151
151
    * @param choices A list of possible function names which match the characters that the user has already entered.
152
152
    */
153
 
    void showCompletion( const QStringList &choices );
 
153
    void showCompletion(const QStringList &choices);
154
154
 
155
155
public slots:
156
156
    /**
159
159
    void doneCompletion();
160
160
 
161
161
private slots:
162
 
    void itemSelected( QListWidgetItem* item = 0 );
 
162
    void itemSelected(QListWidgetItem* item = 0);
163
163
 
164
164
signals:
165
165
    /**
166
166
    * Emitted, if the user selects a function name from the list.
167
167
    */
168
 
    void selectedCompletion( const QString& item );
 
168
    void selectedCompletion(const QString& item);
169
169
 
170
170
private:
171
171
    class Private;
172
172
    Private * const d;
173
 
    FunctionCompletion( const FunctionCompletion& );
174
 
    FunctionCompletion& operator=( const FunctionCompletion& );
 
173
    FunctionCompletion(const FunctionCompletion&);
 
174
    FunctionCompletion& operator=(const FunctionCompletion&);
175
175
};
176
176
 
177
177
 
197
197
    const Cell& cell() const;
198
198
    Selection* selection() const;
199
199
 
200
 
    void handleKeyPressEvent( QKeyEvent* _ev );
201
 
    void handleInputMethodEvent( QInputMethodEvent  * _ev );
 
200
    void handleKeyPressEvent(QKeyEvent* _ev);
 
201
    void handleInputMethodEvent(QInputMethodEvent  * _ev);
202
202
    void setEditorFont(QFont const & font, bool updateSize, const KoViewConverter *viewConverter);
203
203
 
204
204
    int cursorPosition() const;
238
238
    void  slotSelectionDestroyed();
239
239
 
240
240
protected:
241
 
    void resizeEvent( QResizeEvent* );
 
241
    void resizeEvent(QResizeEvent*);
242
242
    /**
243
243
     * Steals some key events from the KLineEdit and sends
244
244
     * it to the KSpread::Canvas ( its parent ) instead.
245
245
     */
246
 
    bool eventFilter( QObject* o, QEvent* e );
 
246
    bool eventFilter(QObject* o, QEvent* e);
247
247
 
248
248
protected slots:
249
249
    void checkFunctionAutoComplete();
250
250
    void triggerFunctionAutoComplete();
251
 
    void functionAutoComplete( const QString& item );
 
251
    void functionAutoComplete(const QString& item);
252
252
 
253
253
private:
254
 
    Q_DISABLE_COPY( CellEditor )
 
254
    Q_DISABLE_COPY(CellEditor)
255
255
 
256
256
    class Private;
257
257
    Private * const d;
270
270
    void setSelection(Selection* selection);
271
271
 
272
272
public slots:
273
 
    void slotAddAreaName( const QString & );
274
 
    void slotRemoveAreaName( const QString & );
 
273
    void slotAddAreaName(const QString &);
 
274
    void slotRemoveAreaName(const QString &);
275
275
private:
276
276
    LocationEditWidget *m_locationWidget;
277
277
};
288
288
public:
289
289
    LocationEditWidget(QWidget *parent, Selection* selection);
290
290
 
291
 
    void addCompletionItem( const QString &_item );
292
 
    void removeCompletionItem( const QString &_item );
 
291
    void addCompletionItem(const QString &_item);
 
292
    void removeCompletionItem(const QString &_item);
293
293
 
294
294
private slots:
295
295
    void slotActivateItem();
296
296
 
297
297
protected:
298
 
    virtual void keyPressEvent( QKeyEvent * _ev );
 
298
    virtual void keyPressEvent(QKeyEvent * _ev);
299
299
private:
300
300
    Selection* m_selection;
301
301
    KCompletion completionList;
316
316
    void setCellTool(CellToolBase* cellTool);
317
317
 
318
318
Q_SIGNALS:
319
 
    void textChanged (const QString &text);
 
319
    void textChanged(const QString &text);
320
320
 
321
321
public Q_SLOTS:
322
322
    void applyChanges();
328
328
    void focusInEvent(QFocusEvent *event);
329
329
    void focusOutEvent(QFocusEvent *event);
330
330
 
331
 
    void adjustHeight ();
 
331
    void adjustHeight();
332
332
private slots:
333
 
    void slotTextChanged ();
 
333
    void slotTextChanged();
334
334
 
335
335
private:
336
336
    Q_DISABLE_COPY(ExternalEditor)
340
340
};
341
341
 
342
342
#if 0 // KSPREAD_DISCARD_FORMULA_BAR
343
 
  /**
344
 
 * The widget that appears above the sheet and allows to
345
 
 * edit the cells content.
346
 
 */
 
343
/**
 
344
* The widget that appears above the sheet and allows to
 
345
* edit the cells content.
 
346
*/
347
347
class EditWidget : public KLineEdit
348
348
{
349
349
    Q_OBJECT
350
350
public:
351
 
    EditWidget( QWidget *parent, Canvas *canvas,
352
 
                QAbstractButton *cancelButton, QAbstractButton *okButton);
 
351
    EditWidget(QWidget *parent, Canvas *canvas,
 
352
               QAbstractButton *cancelButton, QAbstractButton *okButton);
353
353
 
354
 
    virtual void setText( const QString& t );
 
354
    virtual void setText(const QString& t);
355
355
 
356
356
    // Go into edit mode (enable the buttons)
357
 
    void setEditMode( bool mode );
 
357
    void setEditMode(bool mode);
358
358
 
359
359
    void showEditWidget(bool _show);
360
360
 
363
363
    void slotDoneEdit();
364
364
 
365
365
protected:
366
 
    virtual void keyPressEvent ( QKeyEvent* _ev );
367
 
    virtual void focusOutEvent( QFocusEvent* ev );
 
366
    virtual void keyPressEvent(QKeyEvent* _ev);
 
367
    virtual void focusOutEvent(QFocusEvent* ev);
368
368
 
369
369
private:
370
370
    QAbstractButton* m_pCancelButton;
381
381
 */
382
382
class KSPREAD_EXPORT RegionSelector : public QWidget
383
383
{
384
 
  Q_OBJECT
 
384
    Q_OBJECT
385
385
 
386
386
public:
387
 
  enum SelectionMode { SingleCell = 0, MultipleCells = 1 }; // TODO Stefan: merge with Selection::Mode
388
 
  enum DisplayMode { Widget, Dialog };
389
 
 
390
 
  RegionSelector(QWidget* parent = 0);
391
 
  ~RegionSelector();
392
 
 
393
 
  void setSelectionMode( SelectionMode mode );
394
 
  void setSelection(Selection* selection);
395
 
  void setDialog( QDialog* dialog );
396
 
  void setLabel( const QString& text );
397
 
 
398
 
  KTextEdit* textEdit() const;
 
387
    enum SelectionMode { SingleCell = 0, MultipleCells = 1 }; // TODO Stefan: merge with Selection::Mode
 
388
    enum DisplayMode { Widget, Dialog };
 
389
 
 
390
    RegionSelector(QWidget* parent = 0);
 
391
    ~RegionSelector();
 
392
 
 
393
    void setSelectionMode(SelectionMode mode);
 
394
    void setSelection(Selection* selection);
 
395
    void setDialog(QDialog* dialog);
 
396
    void setLabel(const QString& text);
 
397
 
 
398
    KTextEdit* textEdit() const;
399
399
 
400
400
protected:
401
 
  bool eventFilter( QObject* obj, QEvent* event );
 
401
    bool eventFilter(QObject* obj, QEvent* event);
402
402
 
403
403
protected Q_SLOTS:
404
 
  void switchDisplayMode( bool state );
405
 
  void choiceChanged();
 
404
    void switchDisplayMode(bool state);
 
405
    void choiceChanged();
406
406
 
407
407
private:
408
 
    Q_DISABLE_COPY( RegionSelector )
 
408
    Q_DISABLE_COPY(RegionSelector)
409
409
 
410
 
  class Private;
411
 
  Private * const d;
 
410
    class Private;
 
411
    Private * const d;
412
412
};
413
413
 
414
414
} // namespace KSpread