basetexteditor.h 20.1 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
con's avatar
con committed
2
**
3
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
con's avatar
con committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
con's avatar
con committed
7
**
hjk's avatar
hjk committed
8 9 10 11 12 13 14
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
15
**
16
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17 18 19 20 21 22
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
**
hjk's avatar
hjk committed
24 25
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
con's avatar
con committed
26 27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
hjk's avatar
hjk committed
29

con's avatar
con committed
30 31 32
#ifndef BASETEXTEDITOR_H
#define BASETEXTEDITOR_H

33
#include "basetextdocument.h"
Leandro Melo's avatar
Leandro Melo committed
34
#include "codeassist/assistenums.h"
hjk's avatar
hjk committed
35
#include "texteditor_global.h"
con's avatar
con committed
36

hjk's avatar
hjk committed
37
#include <coreplugin/textdocument.h>
38
#include <coreplugin/editormanager/editormanager.h>
hjk's avatar
hjk committed
39
#include <coreplugin/editormanager/ieditor.h>
40
#include <coreplugin/find/ifindsupport.h>
41

42 43
#include <utils/uncommentselection.h>

44
#include <QPlainTextEdit>
45
#include <functional>
con's avatar
con committed
46 47 48

QT_BEGIN_NAMESPACE
class QToolBar;
Friedemann Kleint's avatar
Friedemann Kleint committed
49
class QPrinter;
hjk's avatar
hjk committed
50 51 52 53 54
class QMenu;
class QPainter;
class QPoint;
class QRect;
class QTextBlock;
con's avatar
con committed
55 56
QT_END_NAMESPACE

57 58
namespace Core { class MimeType; }

con's avatar
con committed
59
namespace TextEditor {
60

61
class TabSettings;
62 63
class RefactorOverlay;
struct RefactorMarker;
Leandro Melo's avatar
Leandro Melo committed
64 65 66
class IAssistMonitorInterface;
class IAssistInterface;
class IAssistProvider;
Jarek Kobus's avatar
Jarek Kobus committed
67
class ICodeStylePreferences;
68
class CompletionAssistProvider;
Christian Stenger's avatar
Christian Stenger committed
69
typedef QList<RefactorMarker> RefactorMarkers;
con's avatar
con committed
70 71

namespace Internal {
hjk's avatar
hjk committed
72
    class BaseTextEditorPrivate;
73
    class BaseTextEditorWidgetPrivate;
74
    class TextEditorOverlay;
con's avatar
con committed
75 76
}

77
class BaseTextEditorWidget;
con's avatar
con committed
78
class FontSettings;
79 80 81
class BehaviorSettings;
class CompletionSettings;
class DisplaySettings;
82
class MarginSettings;
Jarek Kobus's avatar
Jarek Kobus committed
83
class TypingSettings;
84
class StorageSettings;
85
class Indenter;
86
class AutoCompleter;
87
class ExtraEncodingSettings;
con's avatar
con committed
88

hjk's avatar
hjk committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
class TEXTEDITOR_EXPORT BlockRange
{
public:
    BlockRange() : _first(0), _last(-1) {}
    BlockRange(int firstPosition, int lastPosition)
      : _first(firstPosition), _last(lastPosition)
    {}

    inline bool isNull() const { return _last < _first; }

    int first() const { return _first; }
    int last() const { return _last; }

private:
    int _first;
    int _last;
};

107
class TEXTEDITOR_EXPORT BaseTextEditor : public Core::IEditor
108 109 110 111
{
    Q_OBJECT

public:
112 113 114 115 116 117 118
    enum PositionOperation {
        Current = 1,
        EndOfLine = 2,
        StartOfLine = 3,
        Anchor = 4,
        EndOfDoc = 5
    };
119

120 121
    BaseTextEditor(BaseTextEditorWidget *editorWidget);
    ~BaseTextEditor();
122

123
    virtual BaseTextDocument *textDocument();
124

125 126 127 128 129
    enum MarkRequestKind {
        BreakpointRequest,
        BookmarkRequest,
        TaskMarkRequest
    };
130

131
    static BaseTextEditor *currentTextEditor();
132

hjk's avatar
hjk committed
133
    BaseTextEditorWidget *editorWidget() const;
134
    BaseTextDocument *baseTextDocument();
135

136 137 138
    // IEditor
    Core::IDocument *document();
    bool open(QString *errorString, const QString &fileName, const QString &realFileName);
mae's avatar
mae committed
139

140 141
    IEditor *duplicate();

142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
    QByteArray saveState() const;
    bool restoreState(const QByteArray &state);
    QWidget *toolBar();

    enum Side { Left, Right };
    void insertExtraToolBarWidget(Side side, QWidget *widget);

    QString contextHelpId() const; // from IContext

    int currentLine() const;
    int currentColumn() const;
    void gotoLine(int line, int column = 0, bool centerLine = true);

    /*! Returns the amount of visible columns (in characters) in the editor */
    int columnCount() const;

    /*! Returns the amount of visible lines (in characters) in the editor */
    int rowCount() const;

    /*! Returns the position at \a posOp in characters from the beginning of the document */
    virtual int position(PositionOperation posOp = Current, int at = -1) const;

    /*! Converts the \a pos in characters from beginning of document to \a line and \a column */
    virtual void convertPosition(int pos, int *line, int *column) const;

    /*! Returns the cursor rectangle in pixels at \a pos, or current position if \a pos = -1 */
    virtual QRect cursorRect(int pos = -1) const;
169

170 171 172 173 174 175 176 177 178 179 180 181 182
    virtual QString selectedText() const;

    /*! Removes \a length characters to the right of the cursor. */
    virtual void remove(int length);
    /*! Inserts the given string to the right of the cursor. */
    virtual void insert(const QString &string);
    /*! Replaces \a length characters to the right of the cursor with the given string. */
    virtual void replace(int length, const QString &string);
    /*! Sets current cursor position to \a pos. */
    virtual void setCursorPosition(int pos);
    /*! Selects text between current cursor position and \a toPos. */
    virtual void select(int toPos);

183 184 185 186
    /*! Full access to comment definition, */
    Utils::CommentDefinition &commentDefinition() const;
    /*! Convenience style setter. */
    void setCommentStyle(Utils::CommentDefinition::Style style);
187

188 189 190 191 192 193
    CompletionAssistProvider *completionAssistProvider();
    void setCompletionAssistProvider(CompletionAssistProvider *provider); // Not owned.

    // FIXME: Only used to delay initialization from CppEditor.
    // There should be something simpler.
    void setCompletionAssistProvider(const std::function<CompletionAssistProvider *()> &provider);
194

hjk's avatar
hjk committed
195 196
    QObject *fileEncodingLabel() const; // FIXME: Remove

197 198 199
    void setAutoCompleter(AutoCompleter *autoCompleter);
    AutoCompleter *autoCompleter() const;

200 201 202 203 204 205 206
signals:
    void markRequested(TextEditor::BaseTextEditor *editor, int line, TextEditor::BaseTextEditor::MarkRequestKind kind);
    void markContextMenuRequested(TextEditor::BaseTextEditor *editor, int line, QMenu *menu);
    void tooltipOverrideRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int position, bool *handled);
    void tooltipRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int position);
    void markTooltipRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int line);
    void contextHelpIdRequested(TextEditor::BaseTextEditor *editor, int position);
207 208

private slots:
209 210 211 212
    void updateCursorPosition();
    void openGotoLocator();
    void setFileEncodingLabelVisible(bool visible);
    void setFileEncodingLabelText(const QString &text);
213 214

private:
215 216
    friend class Internal::BaseTextEditorWidgetPrivate;
    friend class BaseTextEditorWidget;
hjk's avatar
hjk committed
217
    Internal::BaseTextEditorPrivate *d;
218 219 220
};


221
class TEXTEDITOR_EXPORT BaseTextEditorWidget : public QPlainTextEdit
con's avatar
con committed
222 223
{
    Q_OBJECT
mae's avatar
mae committed
224 225
    Q_PROPERTY(int verticalBlockSelectionFirstColumn READ verticalBlockSelectionFirstColumn)
    Q_PROPERTY(int verticalBlockSelectionLastColumn READ verticalBlockSelectionLastColumn)
hjk's avatar
hjk committed
226

con's avatar
con committed
227
public:
228
    BaseTextEditorWidget(BaseTextDocument *doc, QWidget *parent);
229
    BaseTextEditorWidget(BaseTextEditorWidget *other);
230
    ~BaseTextEditorWidget();
con's avatar
con committed
231

232 233 234
    BaseTextDocument *baseTextDocument() const;

    // IEditor
235
    virtual bool open(QString *errorString, const QString &fileName, const QString &realFileName);
con's avatar
con committed
236 237
    QByteArray saveState() const;
    bool restoreState(const QByteArray &state);
238
    void gotoLine(int line, int column = 0, bool centerLine = true);
239
    int position(BaseTextEditor::PositionOperation posOp = BaseTextEditor::Current,
hjk's avatar
hjk committed
240
         int at = -1) const;
con's avatar
con committed
241 242
    void convertPosition(int pos, int *line, int *column) const;

243
    BaseTextEditor *editor() const;
con's avatar
con committed
244 245 246

    void print(QPrinter *);

247 248
    void appendStandardContextMenuActions(QMenu *menu);

con's avatar
con committed
249 250 251 252 253 254 255 256 257 258 259
    // Works only in conjunction with a syntax highlighter that puts
    // parentheses into text block user data
    void setParenthesesMatchingEnabled(bool b);
    bool isParenthesesMatchingEnabled() const;

    void setHighlightCurrentLine(bool b);
    bool highlightCurrentLine() const;

    void setLineNumbersVisible(bool b);
    bool lineNumbersVisible() const;

260 261
    void setAlwaysOpenLinksInNextSplit(bool b);
    bool alwaysOpenLinksInNextSplit() const;
262

con's avatar
con committed
263 264 265 266 267 268 269 270 271
    void setMarksVisible(bool b);
    bool marksVisible() const;

    void setRequestMarkEnabled(bool b);
    bool requestMarkEnabled() const;

    void setLineSeparatorsAllowed(bool b);
    bool lineSeparatorsAllowed() const;

272
    void updateCodeFoldingVisible();
con's avatar
con committed
273 274
    bool codeFoldingVisible() const;

275 276 277
    void setCodeFoldingSupported(bool b);
    bool codeFoldingSupported() const;

278 279 280
    void setMouseNavigationEnabled(bool b);
    bool mouseNavigationEnabled() const;

281 282 283
    void setMouseHidingEnabled(bool b);
    bool mouseHidingEnabled() const;

284 285 286
    void setScrollWheelZoomingEnabled(bool b);
    bool scrollWheelZoomingEnabled() const;

287 288 289
    void setConstrainTooltips(bool b);
    bool constrainTooltips() const;

290 291 292
    void setCamelCaseNavigationEnabled(bool b);
    bool camelCaseNavigationEnabled() const;

con's avatar
con committed
293 294 295 296 297 298
    void setRevisionsVisible(bool b);
    bool revisionsVisible() const;

    void setVisibleWrapColumn(int column);
    int visibleWrapColumn() const;

299 300 301
    int columnCount() const;
    int rowCount() const;

con's avatar
con committed
302 303
    void setReadOnly(bool b);

David Schulz's avatar
David Schulz committed
304
    void setTextCursor(const QTextCursor &cursor, bool keepBlockSelection);
305 306
    void setTextCursor(const QTextCursor &cursor);

mae's avatar
mae committed
307
    void insertCodeSnippet(const QTextCursor &cursor, const QString &snippet);
308

309
    void setBlockSelection(bool on);
David Schulz's avatar
David Schulz committed
310 311 312 313
    void setBlockSelection(int positionBlock, int positionColumn, int anchhorBlock,
                           int anchorColumn);
    void setBlockSelection(const QTextCursor &cursor);
    QTextCursor blockSelection() const;
314
    bool hasBlockSelection() const;
315

mae's avatar
mae committed
316 317
    int verticalBlockSelectionFirstColumn() const;
    int verticalBlockSelectionLastColumn() const;
318

319 320
    QRegion translatedLineRegion(int lineStart, int lineEnd) const;

321 322
    QPoint toolTipPosition(const QTextCursor &c) const;

Leandro Melo's avatar
Leandro Melo committed
323 324 325 326
    void invokeAssist(AssistKind assistKind, IAssistProvider *provider = 0);

    virtual IAssistInterface *createAssistInterface(AssistKind assistKind,
                                                    AssistReason assistReason) const;
327
    static QMimeData *duplicateMimeData(const QMimeData *source);
Leandro Melo's avatar
Leandro Melo committed
328

329 330
    static QString msgTextTooLarge(quint64 size);

David Schulz's avatar
David Schulz committed
331
    void insertPlainText(const QString &text);
332

333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
    QWidget *extraArea() const;
    virtual int extraAreaWidth(int *markWidthPtr = 0) const;
    virtual void extraAreaPaintEvent(QPaintEvent *);
    virtual void extraAreaLeaveEvent(QEvent *);
    virtual void extraAreaContextMenuEvent(QContextMenuEvent *);
    virtual void extraAreaMouseEvent(QMouseEvent *);
    void updateFoldingHighlight(const QPoint &pos);

    void setLanguageSettingsId(Core::Id settingsId);
    Core::Id languageSettingsId() const;

    void setCodeStyle(ICodeStylePreferences *settings);

    const DisplaySettings &displaySettings() const;
    const MarginSettings &marginSettings() const;

    void ensureCursorVisible();

    enum ExtraSelectionKind {
        CurrentLineSelection,
        ParenthesesMatchingSelection,
        CodeWarningsSelection,
        CodeSemanticsSelection,
        UndefinedSymbolSelection,
        UnusedSymbolSelection,
        FakeVimSelection,
        OtherSelection,
        SnippetPlaceholderSelection,
        ObjCSelection,
        DebuggerExceptionSelection,
        NExtraSelectionKinds
    };
    void setExtraSelections(ExtraSelectionKind kind, const QList<QTextEdit::ExtraSelection> &selections);
    QList<QTextEdit::ExtraSelection> extraSelections(ExtraSelectionKind kind) const;
    QString extraSelectionTooltip(int pos) const;

    RefactorMarkers refactorMarkers() const;
    void setRefactorMarkers(const RefactorMarkers &markers);

    // the blocks list must be sorted
    void setIfdefedOutBlocks(const QList<BlockRange> &blocks);
374
    bool isMissingSyntaxDefinition() const;
David Schulz's avatar
David Schulz committed
375

con's avatar
con committed
376
public slots:
377
    virtual void copy();
mae's avatar
mae committed
378 379
    virtual void paste();
    virtual void cut();
380
    virtual void selectAll();
con's avatar
con committed
381

382 383 384 385 386 387 388 389 390 391 392
    virtual void format();
    virtual void rewrapParagraph();
    virtual void unCommentSelection();
    virtual void setDisplaySettings(const TextEditor::DisplaySettings &);
    virtual void setMarginSettings(const TextEditor::MarginSettings &);
    virtual void setBehaviorSettings(const TextEditor::BehaviorSettings &);
    virtual void setTypingSettings(const TextEditor::TypingSettings &);
    virtual void setStorageSettings(const TextEditor::StorageSettings &);
    virtual void setCompletionSettings(const TextEditor::CompletionSettings &);
    virtual void setExtraEncodingSettings(const TextEditor::ExtraEncodingSettings &);

393
    void circularPaste();
394
    void switchUtf8bom();
395

con's avatar
con committed
396 397
    void zoomIn(int range = 1);
    void zoomOut(int range = 1);
mae's avatar
mae committed
398
    void zoomReset();
con's avatar
con committed
399

400
    void cutLine();
401
    void copyLine();
con's avatar
con committed
402
    void deleteLine();
403 404 405 406
    void deleteEndOfWord();
    void deleteEndOfWordCamelCase();
    void deleteStartOfWord();
    void deleteStartOfWordCamelCase();
mae's avatar
mae committed
407 408 409
    void unfoldAll();
    void fold();
    void unfold();
con's avatar
con committed
410
    void selectEncoding();
411
    void updateTextCodecLabel();
con's avatar
con committed
412

413 414 415 416 417
    void gotoBlockStart();
    void gotoBlockEnd();
    void gotoBlockStartWithSelection();
    void gotoBlockEndWithSelection();

mae's avatar
mae committed
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
    void gotoLineStart();
    void gotoLineStartWithSelection();
    void gotoLineEnd();
    void gotoLineEndWithSelection();
    void gotoNextLine();
    void gotoNextLineWithSelection();
    void gotoPreviousLine();
    void gotoPreviousLineWithSelection();
    void gotoPreviousCharacter();
    void gotoPreviousCharacterWithSelection();
    void gotoNextCharacter();
    void gotoNextCharacterWithSelection();
    void gotoPreviousWord();
    void gotoPreviousWordWithSelection();
    void gotoNextWord();
    void gotoNextWordWithSelection();
mae's avatar
mae committed
434 435 436 437
    void gotoPreviousWordCamelCase();
    void gotoPreviousWordCamelCaseWithSelection();
    void gotoNextWordCamelCase();
    void gotoNextWordCamelCaseWithSelection();
438

439 440
    bool selectBlockUp();
    bool selectBlockDown();
441

442 443 444
    void moveLineUp();
    void moveLineDown();

445 446 447 448 449
    void viewPageUp();
    void viewPageDown();
    void viewLineUp();
    void viewLineDown();

450 451 452
    void copyLineUp();
    void copyLineDown();

453
    void joinLines();
454

455 456 457
    void insertLineAbove();
    void insertLineBelow();

458 459 460
    void uppercaseSelection();
    void lowercaseSelection();

461 462
    void cleanWhitespace();

463 464 465
    void indent();
    void unindent();

David Schulz's avatar
David Schulz committed
466 467 468
    void undo();
    void redo();

469
    void openLinkUnderCursor();
470
    void openLinkUnderCursorInNextSplit();
471

472 473
    /// Abort code assistant if it is running.
    void abortAssist();
474 475 476 477

    void acceptMissingSyntaxDefinitionInfo();

    void configureMimeType(const QString &mimeType);
478
    void configureMimeType(const Core::MimeType &mimeType);
479

con's avatar
con committed
480
signals:
481
    void assistFinished();
482
    void readOnlyChanged();
483 484 485 486 487
    void refactorMarkerClicked(const TextEditor::RefactorMarker &marker);

    void requestFontZoom(int zoom);
    void requestZoomReset();
    void requestBlockUpdate(const QTextBlock &);
con's avatar
con committed
488

489 490
    void configured(Core::IEditor *editor);

con's avatar
con committed
491 492
protected:
    bool event(QEvent *e);
David Schulz's avatar
David Schulz committed
493
    void inputMethodEvent(QInputMethodEvent *e);
con's avatar
con committed
494 495 496
    void keyPressEvent(QKeyEvent *e);
    void wheelEvent(QWheelEvent *e);
    void changeEvent(QEvent *e);
497
    void focusInEvent(QFocusEvent *e);
mae's avatar
mae committed
498
    void focusOutEvent(QFocusEvent *e);
mae's avatar
mae committed
499
    void showEvent(QShowEvent *);
500 501 502 503 504 505 506 507 508 509 510
    bool viewportEvent(QEvent *event);
    void resizeEvent(QResizeEvent *);
    void paintEvent(QPaintEvent *);
    void timerEvent(QTimerEvent *);
    void mouseMoveEvent(QMouseEvent *);
    void mousePressEvent(QMouseEvent *);
    void mouseReleaseEvent(QMouseEvent *);
    void mouseDoubleClickEvent(QMouseEvent *);
    void leaveEvent(QEvent *);
    void keyReleaseEvent(QKeyEvent *);
    void dragEnterEvent(QDragEnterEvent *e);
mae's avatar
mae committed
511

con's avatar
con committed
512 513 514 515
    QMimeData *createMimeDataFromSelection() const;
    bool canInsertFromMimeData(const QMimeData *source) const;
    void insertFromMimeData(const QMimeData *source);

516
    virtual QString plainTextFromSelection(const QTextCursor &cursor) const;
517 518 519 520
    static QString convertToPlainText(const QString &txt);

    virtual QString lineNumber(int blockNumber) const;
    virtual int lineNumberDigits() const;
jkobus's avatar
jkobus committed
521
    virtual bool selectionVisible(int blockNumber) const;
522
    virtual bool replacementVisible(int blockNumber) const;
jkobus's avatar
jkobus committed
523
    virtual QColor replacementPenColor(int blockNumber) const;
524

525
    virtual BaseTextEditor *createEditor();
526
    virtual void triggerPendingUpdates();
527
    virtual void applyFontSettings();
con's avatar
con committed
528

529
    void showDefaultContextMenu(QContextMenuEvent *e, Core::Id menuContextId);
530

531
public:
532 533
    struct Link
    {
David Schulz's avatar
David Schulz committed
534 535 536 537 538 539
        Link(const QString &fileName = QString(), int line = 0, int column = 0)
            : linkTextStart(-1)
            , linkTextEnd(-1)
            , targetFileName(fileName)
            , targetLine(line)
            , targetColumn(column)
540 541
        {}

David Schulz's avatar
David Schulz committed
542 543 544 545 546
        bool hasValidTarget() const
        { return !targetFileName.isEmpty(); }

        bool hasValidLinkText() const
        { return linkTextStart != linkTextEnd; }
547

548
        bool operator==(const Link &other) const
David Schulz's avatar
David Schulz committed
549
        { return linkTextStart == other.linkTextStart && linkTextEnd == other.linkTextEnd; }
550

David Schulz's avatar
David Schulz committed
551 552
        int linkTextStart;
        int linkTextEnd;
553

David Schulz's avatar
David Schulz committed
554 555 556
        QString targetFileName;
        int targetLine;
        int targetColumn;
557 558
    };

559 560
    QString selectedText() const;

561 562
    void setupAsPlainEditor();

563
protected:
564 565 566 567 568 569
    /*!
       Reimplement this function to enable code navigation.

       \a resolveTarget is set to true when the target of the link is relevant
       (it isn't until the link is used).
     */
570 571
    virtual Link findLinkAt(const QTextCursor &, bool resolveTarget = true,
                            bool inNextSplit = false);
572 573 574

    /*!
       Reimplement this function if you want to customize the way a link is
Tobias Hunger's avatar
Tobias Hunger committed
575
       opened. Returns whether the link was opened successfully.
576
     */
577
    virtual bool openLink(const Link &link, bool inNextSplit = false);
578

579 580 581 582
    /*!
      Reimplement this function to change the default replacement text.
      */
    virtual QString foldReplacementText(const QTextBlock &block) const;
583 584 585 586 587 588
    virtual void drawCollapsedBlockPopup(QPainter &painter,
                                         const QTextBlock &block,
                                         QPointF offset,
                                         const QRect &clip);
    int visibleFoldedBlockNumber() const;

589

con's avatar
con committed
590
protected slots:
591 592
    virtual void slotCursorPositionChanged(); // Used in VcsBase
    virtual void slotCodeStyleSettingsChanged(const QVariant &); // Used in CppEditor
con's avatar
con committed
593

594 595
    void configureMimeType();

con's avatar
con committed
596
private slots:
597 598 599 600
    void slotUpdateExtraArea();
    void slotUpdateExtraAreaWidth();
    void slotUpdateRequest(const QRect &r, int dy);
    void slotUpdateBlockNotify(const QTextBlock &);
601
    void updateTabStops();
602
    void applyFontSettingsDelayed();
mae's avatar
mae committed
603

604 605 606 607 608 609 610 611 612
    void editorContentsChange(int position, int charsRemoved, int charsAdded);
    void documentAboutToBeReloaded();
    void documentReloadFinished(bool success);
    void highlightSearchResults(const QString &txt, Core::FindFlags findFlags);
    void setFindScope(const QTextCursor &start, const QTextCursor &end, int, int);
    bool inFindScope(const QTextCursor &cursor);
    bool inFindScope(int selectionStart, int selectionEnd);
    void inSnippetMode(bool *active);

613
    // parentheses matcher
con's avatar
con committed
614
    void _q_matchParentheses();
615
    void _q_highlightBlocks();
con's avatar
con committed
616
    void slotSelectionChanged();
617
    void _q_animateUpdate(int position, QPointF lastPos, QRectF rect);
618
    void doFoo();
619 620 621

private:
    Internal::BaseTextEditorWidgetPrivate *d;
622
    Internal::BaseTextEditorPrivate *dd() const;
623 624 625
    friend class Internal::BaseTextEditorWidgetPrivate;
    friend class Internal::TextEditorOverlay;
    friend class RefactorOverlay;
con's avatar
con committed
626 627 628 629
};

} // namespace TextEditor

630
Q_DECLARE_METATYPE(TextEditor::BaseTextEditorWidget::Link)
631

con's avatar
con committed
632
#endif // BASETEXTEDITOR_H