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

« back to all changes in this revision

Viewing changes to kspread/ui/CellEditor.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
 
 
3
   Copyright 1999-2006 The KSpread Team <koffice-devel@kde.org>
 
4
 
 
5
   This library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Library General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2 of the License, or (at your option) any later version.
 
9
 
 
10
   This library is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Library General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Library General Public License
 
16
   along with this library; see the file COPYING.LIB.  If not, write to
 
17
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
   Boston, MA 02110-1301, USA.
 
19
*/
 
20
 
 
21
 
 
22
#ifndef KSPREAD_CELL_EDITOR
 
23
#define KSPREAD_CELL_EDITOR
 
24
 
 
25
#include <KGlobalSettings>
 
26
#include <KTextEdit>
 
27
 
 
28
#include "kspread_export.h"
 
29
#include "CellEditorBase.h"
 
30
class KoViewConverter;
 
31
 
 
32
namespace KSpread
 
33
{
 
34
class CellToolBase;
 
35
class Selection;
 
36
 
 
37
/**
 
38
 * class CellEditor
 
39
 */
 
40
class CellEditor : public KTextEdit, public CellEditorBase
 
41
{
 
42
    Q_OBJECT
 
43
public:
 
44
    /**
 
45
    * Creates a new CellEditor.
 
46
    * \param cellTool the cell tool
 
47
    * \param parent the parent widget
 
48
    */
 
49
    explicit CellEditor(CellToolBase *cellTool, QWidget *parent = 0);
 
50
    ~CellEditor();
 
51
 
 
52
    Selection* selection() const;
 
53
 
 
54
    void setEditorFont(QFont const & font, bool updateSize, const KoViewConverter *viewConverter);
 
55
 
 
56
    int cursorPosition() const;
 
57
    void setCursorPosition(int pos);
 
58
 
 
59
    QPoint globalCursorPosition() const;
 
60
 
 
61
    /**
 
62
     * Replaces the current formula token(/reference) with the name of the
 
63
     * selection's active sub-region name.
 
64
     * This is called after selection changes to sync the formula expression.
 
65
     */
 
66
    void selectionChanged();
 
67
 
 
68
    /**
 
69
     * Activates the sub-region belonging to the \p index 'th range.
 
70
     */
 
71
    void setActiveSubRegion(int index);
 
72
 
 
73
    // CellEditorBase interface
 
74
    virtual QWidget* widget() { return this; }
 
75
    virtual void cut() { KTextEdit::cut(); }
 
76
    virtual void copy() { KTextEdit::copy(); }
 
77
    virtual void paste() { KTextEdit::paste(); }
 
78
    virtual QString toPlainText() const { return KTextEdit::toPlainText(); }
 
79
Q_SIGNALS:
 
80
    void textChanged(const QString &text);
 
81
 
 
82
public slots:
 
83
    void setText(const QString& text, int cursorPos = -1);
 
84
 
 
85
    /**
 
86
     * Permutes the fixation of the reference, at which the editor's cursor
 
87
     * is placed. It is only active, if a formula is edited.
 
88
     */
 
89
    void permuteFixation();
 
90
 
 
91
private slots:
 
92
    void  slotTextChanged();
 
93
    void  slotCompletionModeChanged(KGlobalSettings::Completion _completion);
 
94
    void  slotCursorPositionChanged();
 
95
 
 
96
protected: // reimplementations
 
97
    virtual void keyPressEvent(QKeyEvent *event);
 
98
    virtual void focusInEvent(QFocusEvent *event);
 
99
    virtual void focusOutEvent(QFocusEvent *event);
 
100
 
 
101
protected slots:
 
102
    void checkFunctionAutoComplete();
 
103
    void triggerFunctionAutoComplete();
 
104
    void functionAutoComplete(const QString& item);
 
105
 
 
106
private:
 
107
    Q_DISABLE_COPY(CellEditor)
 
108
 
 
109
    class Private;
 
110
    Private * const d;
 
111
};
 
112
 
 
113
} // namespace KSpread
 
114
 
 
115
#endif // KSPREAD_CELL_EDITOR