68
68
class FormulaEditorHighlighter : public QSyntaxHighlighter
72
* Constructs a FormulaHighlighter to color-code cell references in a QTextEdit.
74
* @param textEdit The QTextEdit widget which the highlighter should operate on
75
* @param selection The Selection object
77
FormulaEditorHighlighter(QTextEdit* textEdit, Selection* selection);
78
virtual ~FormulaEditorHighlighter();
82
* Called automatically by KTextEditor to highlight text when modified.
84
virtual void highlightBlock(const QString& text);
88
const Tokens& formulaTokens() const;
92
uint rangeCount() const;
94
* Returns true if any of the ranges or cells in the Formula.have changed since the
95
* last call to @ref FormulaEditorHighlighter::rangeChanged()
97
bool rangeChanged() const;
100
* Sets the highlighter's range changed flag to false.
102
void resetRangeChanged();
72
* Constructs a FormulaHighlighter to color-code cell references in a QTextEdit.
74
* @param textEdit The QTextEdit widget which the highlighter should operate on
75
* @param selection The Selection object
77
FormulaEditorHighlighter(QTextEdit* textEdit, Selection* selection);
78
virtual ~FormulaEditorHighlighter();
82
* Called automatically by KTextEditor to highlight text when modified.
84
virtual void highlightBlock(const QString& text);
88
const Tokens& formulaTokens() const;
92
uint rangeCount() const;
94
* Returns true if any of the ranges or cells in the Formula.have changed since the
95
* last call to @ref FormulaEditorHighlighter::rangeChanged()
97
bool rangeChanged() const;
100
* Sets the highlighter's range changed flag to false.
102
void resetRangeChanged();
108
* Returns the position of the brace matching the one found at position pos
110
int findMatchingBrace(int pos);
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
115
void handleBrace(uint index);
108
* Returns the position of the brace matching the one found at position pos
110
int findMatchingBrace(int pos);
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
115
void handleBrace(uint index);
118
Q_DISABLE_COPY( FormulaEditorHighlighter )
118
Q_DISABLE_COPY(FormulaEditorHighlighter)
141
FunctionCompletion( CellEditor* editor );
141
FunctionCompletion(CellEditor* editor);
142
142
~FunctionCompletion();
145
145
* Handles various keyboard and mouse actions which may occur on the autocompletion popup list
147
bool eventFilter( QObject *o, QEvent *e );
147
bool eventFilter(QObject *o, QEvent *e);
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.
153
void showCompletion( const QStringList &choices );
153
void showCompletion(const QStringList &choices);
159
159
void doneCompletion();
162
void itemSelected( QListWidgetItem* item = 0 );
162
void itemSelected(QListWidgetItem* item = 0);
166
166
* Emitted, if the user selects a function name from the list.
168
void selectedCompletion( const QString& item );
168
void selectedCompletion(const QString& item);
172
172
Private * const d;
173
FunctionCompletion( const FunctionCompletion& );
174
FunctionCompletion& operator=( const FunctionCompletion& );
173
FunctionCompletion(const FunctionCompletion&);
174
FunctionCompletion& operator=(const FunctionCompletion&);
197
197
const Cell& cell() const;
198
198
Selection* selection() const;
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);
204
204
int cursorPosition() const;
238
238
void slotSelectionDestroyed();
241
void resizeEvent( QResizeEvent* );
241
void resizeEvent(QResizeEvent*);
243
243
* Steals some key events from the KLineEdit and sends
244
244
* it to the KSpread::Canvas ( its parent ) instead.
246
bool eventFilter( QObject* o, QEvent* e );
246
bool eventFilter(QObject* o, QEvent* e);
249
249
void checkFunctionAutoComplete();
250
250
void triggerFunctionAutoComplete();
251
void functionAutoComplete( const QString& item );
251
void functionAutoComplete(const QString& item);
254
Q_DISABLE_COPY( CellEditor )
254
Q_DISABLE_COPY(CellEditor)
257
257
Private * const d;
270
270
void setSelection(Selection* selection);
273
void slotAddAreaName( const QString & );
274
void slotRemoveAreaName( const QString & );
273
void slotAddAreaName(const QString &);
274
void slotRemoveAreaName(const QString &);
276
276
LocationEditWidget *m_locationWidget;
289
289
LocationEditWidget(QWidget *parent, Selection* selection);
291
void addCompletionItem( const QString &_item );
292
void removeCompletionItem( const QString &_item );
291
void addCompletionItem(const QString &_item);
292
void removeCompletionItem(const QString &_item);
295
295
void slotActivateItem();
298
virtual void keyPressEvent( QKeyEvent * _ev );
298
virtual void keyPressEvent(QKeyEvent * _ev);
300
300
Selection* m_selection;
301
301
KCompletion completionList;
342
342
#if 0 // KSPREAD_DISCARD_FORMULA_BAR
344
* The widget that appears above the sheet and allows to
345
* edit the cells content.
344
* The widget that appears above the sheet and allows to
345
* edit the cells content.
347
347
class EditWidget : public KLineEdit
351
EditWidget( QWidget *parent, Canvas *canvas,
352
QAbstractButton *cancelButton, QAbstractButton *okButton);
351
EditWidget(QWidget *parent, Canvas *canvas,
352
QAbstractButton *cancelButton, QAbstractButton *okButton);
354
virtual void setText( const QString& t );
354
virtual void setText(const QString& t);
356
356
// Go into edit mode (enable the buttons)
357
void setEditMode( bool mode );
357
void setEditMode(bool mode);
359
359
void showEditWidget(bool _show);
382
382
class KSPREAD_EXPORT RegionSelector : public QWidget
387
enum SelectionMode { SingleCell = 0, MultipleCells = 1 }; // TODO Stefan: merge with Selection::Mode
388
enum DisplayMode { Widget, Dialog };
390
RegionSelector(QWidget* parent = 0);
393
void setSelectionMode( SelectionMode mode );
394
void setSelection(Selection* selection);
395
void setDialog( QDialog* dialog );
396
void setLabel( const QString& text );
398
KTextEdit* textEdit() const;
387
enum SelectionMode { SingleCell = 0, MultipleCells = 1 }; // TODO Stefan: merge with Selection::Mode
388
enum DisplayMode { Widget, Dialog };
390
RegionSelector(QWidget* parent = 0);
393
void setSelectionMode(SelectionMode mode);
394
void setSelection(Selection* selection);
395
void setDialog(QDialog* dialog);
396
void setLabel(const QString& text);
398
KTextEdit* textEdit() const;
401
bool eventFilter( QObject* obj, QEvent* event );
401
bool eventFilter(QObject* obj, QEvent* event);
403
403
protected Q_SLOTS:
404
void switchDisplayMode( bool state );
405
void choiceChanged();
404
void switchDisplayMode(bool state);
405
void choiceChanged();
408
Q_DISABLE_COPY( RegionSelector )
408
Q_DISABLE_COPY(RegionSelector)
414
414
} // namespace KSpread