diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp
index a64076ff478b9928cac9cc3f706d04853a604cb1..2d1409c5e9b70eede0698bc8da174ca72db861ca 100644
--- a/src/plugins/cpaster/cpasterplugin.cpp
+++ b/src/plugins/cpaster/cpasterplugin.cpp
@@ -213,7 +213,7 @@ void CodepasterPlugin::postEditor()
         if (ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor)) {
             data = textEditor->selectedText();
             if (data.isEmpty())
-                data = textEditor->contents();
+                data = textEditor->textDocument()->contents();
             mimeType = textEditor->document()->mimeType();
         }
     }
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 1f416b002fd16fc1824fbe08662f9f93d50adcb3..83bd1ef5423e02dd21522be4bf2d2a76f0c74c10 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -1482,10 +1482,10 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor,
     const Snapshot &snapshot = m_modelManager->snapshot();
 
     QTextCursor tc = cursor;
-    QChar ch = characterAt(tc.position());
+    QChar ch = document()->characterAt(tc.position());
     while (ch.isLetterOrNumber() || ch == QLatin1Char('_')) {
         tc.movePosition(QTextCursor::NextCharacter);
-        ch = characterAt(tc.position());
+        ch = document()->characterAt(tc.position());
     }
 
     // Initially try to macth decl/def. For this we need the semantic doc with the AST.
@@ -1493,9 +1493,9 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor,
             && m_lastSemanticInfo.doc->translationUnit()
             && m_lastSemanticInfo.doc->translationUnit()->ast()) {
         int pos = tc.position();
-        while (characterAt(pos).isSpace())
+        while (document()->characterAt(pos).isSpace())
             ++pos;
-        if (characterAt(pos) == QLatin1Char('(')) {
+        if (document()->characterAt(pos) == QLatin1Char('(')) {
             link = attemptFuncDeclDef(cursor, m_lastSemanticInfo.doc, snapshot);
             if (link.hasValidLinkText())
                 return link;
@@ -1626,7 +1626,7 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor,
     QString expression = expressionUnderCursor(tc);
 
     for (int pos = tc.position();; ++pos) {
-        const QChar ch = characterAt(pos);
+        const QChar ch = document()->characterAt(pos);
         if (ch.isSpace())
             continue;
         else {
@@ -2488,9 +2488,9 @@ bool CPPEditorWidget::handleDocumentationComment(QKeyEvent *e)
 bool CPPEditorWidget::isStartOfDoxygenComment(const QTextCursor &cursor) const
 {
     const int pos = cursor.position();
-    QString comment = QString(characterAt(pos - 3))
-            + characterAt(pos - 2)
-            + characterAt(pos - 1);
+    QString comment = QString(document()->characterAt(pos - 3))
+            + document()->characterAt(pos - 2)
+            + document()->characterAt(pos - 1);
 
     if ((comment == QLatin1String("/**"))
             || (comment == QLatin1String("/*!"))
diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp
index 411619de287c63ad0db0eca2adfe9c4059f0fbe8..cae9114ef7e7449fe0e821bbadd0ac11a42c76af 100644
--- a/src/plugins/cpptools/cppcompletionassist.cpp
+++ b/src/plugins/cpptools/cppcompletionassist.cpp
@@ -242,7 +242,7 @@ void CppAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor *e
 
                     // If the function doesn't return anything, automatically place the semicolon,
                     // unless we're doing a scope completion (then it might be function definition).
-                    const QChar characterAtCursor = editor->characterAt(editor->position());
+                    const QChar characterAtCursor = editor->textDocument()->characterAt(editor->position());
                     bool endWithSemicolon = m_typedChar == QLatin1Char(';')
                             || (function->returnType()->isVoidType() && m_completionOperator != T_COLON_COLON);
                     const QChar semicolon = m_typedChar.isNull() ? QLatin1Char(';') : m_typedChar;
@@ -260,7 +260,7 @@ void CppAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor *e
                             m_typedChar = QChar();
                         }
                     } else if (autoParenthesesEnabled) {
-                        const QChar lookAhead = editor->characterAt(editor->position() + 1);
+                        const QChar lookAhead = editor->textDocument()->characterAt(editor->position() + 1);
                         if (MatchingText::shouldInsertMatchingText(lookAhead)) {
                             extraChars += QLatin1Char(')');
                             --cursorOffset;
@@ -299,7 +299,8 @@ void CppAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor *e
     // Determine the length of characters that should just be kept on the editor, but do
     // not consider content that ends as an identifier (which could be undesired).
     const int lineEnd = editor->position(TextEditor::ITextEditor::EndOfLine);
-    const QString inEditor = editor->textAt(editor->position(), lineEnd - editor->position());
+    const QString inEditor = editor->textDocument()->textAt(editor->position(),
+                                                            lineEnd - editor->position());
     int preserveLength = 0;
     if (!inEditor.isEmpty()) {
         preserveLength = toInsert.length() - (editor->position() - basePosition);
@@ -317,7 +318,7 @@ void CppAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor *e
 
     for (int i = 0; i < extraChars.length(); ++i) {
         const QChar a = extraChars.at(i);
-        const QChar b = editor->characterAt(editor->position() + i + preserveLength);
+        const QChar b = editor->textDocument()->characterAt(editor->position() + i + preserveLength);
         if (a == b)
             ++extraLength;
         else
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index 8f5fa3cd440cb05f8f25ac08a18e86d7a8fb3a09..32f1eac904e81b60fff7075c535e42bee0642cc3 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -73,7 +73,7 @@ QString CppEditorSupport::contents()
     if (! _textEditor)
         return QString();
     else if (! _cachedContents.isEmpty())
-        _cachedContents = _textEditor->contents();
+        _cachedContents = _textEditor->textDocument()->contents();
 
     return _cachedContents;
 }
@@ -112,7 +112,7 @@ void CppEditorSupport::updateDocumentNow()
         _updateDocumentTimer->stop();
 
         QStringList sourceFiles(_textEditor->document()->fileName());
-        _cachedContents = _textEditor->contents();
+        _cachedContents = _textEditor->textDocument()->contents();
         _documentParser = _modelManager->updateSourceFiles(sourceFiles);
     }
 }
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index df526ab135c9595cd69c9a80426b1f78a3676526..eb0a1712e927ba61ed601ad40c13f7cf3caad706 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -685,7 +685,7 @@ static bool currentTextEditorPosition(ContextData *data)
     data->fileName = document->fileName();
     if (textEditor->property("DisassemblerView").toBool()) {
         int lineNumber = textEditor->currentLine();
-        QString line = textEditor->contents()
+        QString line = textEditor->textDocument()->contents()
             .section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
         data->address = DisassemblerLine::addressFromDisassemblyLine(line);
     } else {
@@ -1845,7 +1845,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor,
     const QString fileName = editor->document()->fileName();
     if (editor->property("DisassemblerView").toBool()) {
         args.fileName = fileName;
-        QString line = editor->contents()
+        QString line = editor->textDocument()->contents()
             .section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
         BreakpointResponse needle;
         needle.type = BreakpointByAddress;
@@ -1959,7 +1959,7 @@ void DebuggerPluginPrivate::toggleBreakpoint()
     QTC_ASSERT(textEditor, return);
     const int lineNumber = textEditor->currentLine();
     if (textEditor->property("DisassemblerView").toBool()) {
-        QString line = textEditor->contents()
+        QString line = textEditor->textDocument()->contents()
             .section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
         quint64 address = DisassemblerLine::addressFromDisassemblyLine(line);
         toggleBreakpointByAddress(address);
@@ -2016,7 +2016,7 @@ void DebuggerPluginPrivate::requestMark(ITextEditor *editor,
         return;
 
     if (editor->property("DisassemblerView").toBool()) {
-        QString line = editor->contents()
+        QString line = editor->textDocument()->contents()
             .section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
         quint64 address = DisassemblerLine::addressFromDisassemblyLine(line);
         toggleBreakpointByAddress(address);
diff --git a/src/plugins/debugger/sourceutils.cpp b/src/plugins/debugger/sourceutils.cpp
index c495151e415a594640f32ca7f57e8ba400ee0f76..12072d21979064930af82fe1646bf4b5437ee4c8 100644
--- a/src/plugins/debugger/sourceutils.cpp
+++ b/src/plugins/debugger/sourceutils.cpp
@@ -340,7 +340,7 @@ QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos,
         QTextCursor tc(plaintext->document());
         tc.setPosition(pos);
 
-        const QChar ch = editor->characterAt(pos);
+        const QChar ch = editor->textDocument()->characterAt(pos);
         if (ch.isLetterOrNumber() || ch == QLatin1Char('_'))
             tc.movePosition(QTextCursor::EndOfWord);
 
diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp
index 029a4fd8901744cd3896f2f9c7d0421e454e2ca3..3074146e0f8b8bc1e0f1047a715697c9b814fd9e 100644
--- a/src/plugins/designer/qtcreatorintegration.cpp
+++ b/src/plugins/designer/qtcreatorintegration.cpp
@@ -340,7 +340,7 @@ static Document::Ptr addDefinition(const Snapshot &docTable,
                 //! \todo use the InsertionPointLocator to insert at the correct place.
                 // (we'll have to extend that class first to do definition insertions)
 
-                const QString contents = editable->contents();
+                const QString contents = editable->textDocument()->contents();
                 int column;
                 editable->convertPosition(contents.length(), line, &column);
                 editable->gotoLine(*line, column);
diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
index 3d22d826339d5f84431b2d8a4397e82ff28993e8..844e61b380aa48ced6ebc23511cdd4576f38680f 100644
--- a/src/plugins/glsleditor/glsleditor.cpp
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -248,7 +248,7 @@ void GLSLTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
 QString GLSLTextEditorWidget::wordUnderCursor() const
 {
     QTextCursor tc = textCursor();
-    const QChar ch = characterAt(tc.position() - 1);
+    const QChar ch = document()->characterAt(tc.position() - 1);
     // make sure that we're not at the start of the next word.
     if (ch.isLetterOrNumber() || ch == QLatin1Char('_'))
         tc.movePosition(QTextCursor::Left);
diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp
index f50179facfe9b96e91940e3d3f0cda602ea530d9..97168e06355164ef595bc922c1be20c92b517f91 100644
--- a/src/plugins/qmljseditor/qmljscompletionassist.cpp
+++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp
@@ -374,7 +374,7 @@ void QmlJSAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor
     int replacedLength = 0;
     for (int i = 0; i < replaceable.length(); ++i) {
         const QChar a = replaceable.at(i);
-        const QChar b = editor->characterAt(editor->position() + i);
+        const QChar b = editor->textDocument()->characterAt(editor->position() + i);
         if (a == b)
             ++replacedLength;
         else
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index cbd3f6f3948d7f5bb209e88fdc36fa3162f5c82a..ba29abd3d8b9005597b6c3de39d09d7eb21d3444 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -1001,7 +1001,7 @@ void QmlJSTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
 QString QmlJSTextEditorWidget::wordUnderCursor() const
 {
     QTextCursor tc = textCursor();
-    const QChar ch = characterAt(tc.position() - 1);
+    const QChar ch = document()->characterAt(tc.position() - 1);
     // make sure that we're not at the start of the next word.
     if (ch.isLetterOrNumber() || ch == QLatin1Char('_'))
         tc.movePosition(QTextCursor::Left);
diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp
index 408c93e93dfa3bc6f6b54a826fdf80826ad053b2..7e816cf39783cd062519f7ac06b7e21fa3fe6dcd 100644
--- a/src/plugins/qmljseditor/qmljshoverhandler.cpp
+++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp
@@ -214,7 +214,7 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
         i = j = pos;
         QString nameAtt;
         for (;;) {
-            QChar c = qmlEditor->characterAt(j);
+            QChar c = qmlEditor->document()->characterAt(j);
             if (!c.isLetterOrNumber()) break;
             nameAtt.append(c);
             ++j;
@@ -222,7 +222,7 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
         QStringList qName;
         while (i>0) {
             --i;
-            QChar c = qmlEditor->characterAt(i);
+            QChar c = qmlEditor->document()->characterAt(i);
             if (c.isLetterOrNumber()) {
                 nameAtt.prepend(c);
             } else if (c == QLatin1Char('.')) {
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp
index a6ab2ca2694165a1d9bad8f965f236a4e1e9ae86..accbbe2a8587f7db6c7ccefa89bfa0f366942bc4 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp
@@ -312,7 +312,7 @@ void Qt4Manager::addLibrary(const QString &fileName, ProFileEditorWidget *editor
     // add extra \n in case the last line is not empty
     int line, column;
     editable->convertPosition(endOfDoc, &line, &column);
-    if (!editable->textAt(endOfDoc - column, column).simplified().isEmpty())
+    if (!editable->textDocument()->textAt(endOfDoc - column, column).simplified().isEmpty())
         snippet = QLatin1Char('\n') + snippet;
 
     editable->insert(snippet);
diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp
index 9959b9b9b0ed36bf0dfdc8199b72c448b7caa654..7e4d2c34b6c110a387dc01831e83d6986f6731f4 100644
--- a/src/plugins/texteditor/basetextdocument.cpp
+++ b/src/plugins/texteditor/basetextdocument.cpp
@@ -31,6 +31,7 @@
 
 #include "basetextdocumentlayout.h"
 #include "basetexteditor.h"
+#include "convenience.h"
 #include "typingsettings.h"
 #include "storagesettings.h"
 #include "tabsettings.h"
@@ -90,6 +91,21 @@ BaseTextDocument::~BaseTextDocument()
     delete d;
 }
 
+QString BaseTextDocument::contents() const
+{
+    return document()->toPlainText();
+}
+
+QString BaseTextDocument::textAt(int pos, int length) const
+{
+    return Convenience::textAt(QTextCursor(document()), pos, length);
+}
+
+QChar BaseTextDocument::characterAt(int pos) const
+{
+    return document()->characterAt(pos);
+}
+
 QString BaseTextDocument::mimeType() const
 {
     return d->m_mimeType;
diff --git a/src/plugins/texteditor/basetextdocument.h b/src/plugins/texteditor/basetextdocument.h
index 5204da2a6742dc652966f4b04ab557e4135a1ccd..61284e17b1f8aa0c73aad51c729d6550d08dc5f5 100644
--- a/src/plugins/texteditor/basetextdocument.h
+++ b/src/plugins/texteditor/basetextdocument.h
@@ -32,7 +32,7 @@
 
 #include "texteditor_global.h"
 
-#include <coreplugin/textdocument.h>
+#include "itexteditor.h"
 
 QT_BEGIN_NAMESPACE
 class QTextCursor;
@@ -49,7 +49,7 @@ class ExtraEncodingSettings;
 class SyntaxHighlighter;
 class BaseTextDocumentPrivate;
 
-class TEXTEDITOR_EXPORT BaseTextDocument : public Core::TextDocument
+class TEXTEDITOR_EXPORT BaseTextDocument : public ITextEditorDocument
 {
     Q_OBJECT
 
@@ -57,6 +57,11 @@ public:
     BaseTextDocument();
     virtual ~BaseTextDocument();
 
+    // ITextEditorDocument
+    QString contents() const;
+    QString textAt(int pos, int length) const;
+    QChar characterAt(int pos) const;
+
     void setTypingSettings(const TypingSettings &typingSettings);
     void setStorageSettings(const StorageSettings &storageSettings);
     void setTabSettings(const TabSettings &tabSettings);
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index 02697ec709bff83847e42cc004e466adac92b27a..aea6526a31deaff77ae4a9636cd13b1e215785b3 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -707,7 +707,7 @@ void BaseTextEditorWidget::editorContentsChange(int position, int charsRemoved,
     if (doc->isRedoAvailable())
         emit editor()->contentsChangedBecauseOfUndo();
 
-    if (charsAdded != 0 && characterAt(position + charsAdded - 1).isPrint())
+    if (charsAdded != 0 && document()->characterAt(position + charsAdded - 1).isPrint())
         d->m_assistRelevantContentAdded = true;
 }
 
@@ -1241,7 +1241,7 @@ bool BaseTextEditorWidget::camelCaseLeft(QTextCursor &cursor, QTextCursor::MoveM
         return false;
 
     forever {
-        QChar c = characterAt(cursor.position());
+        QChar c = document()->characterAt(cursor.position());
         Input input = Input_other;
         if (c.isUpper())
             input = Input_U;
@@ -1348,7 +1348,7 @@ bool BaseTextEditorWidget::camelCaseRight(QTextCursor &cursor, QTextCursor::Move
     };
 
     forever {
-        QChar c = characterAt(cursor.position());
+        QChar c = document()->characterAt(cursor.position());
         Input input = Input_other;
         if (c.isUpper())
             input = Input_U;
@@ -2101,7 +2101,7 @@ void BaseTextEditorWidget::gotoLine(int line, int column)
             cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, column);
         } else {
             int pos = cursor.position();
-            while (characterAt(pos).category() == QChar::Separator_Space) {
+            while (document()->characterAt(pos).category() == QChar::Separator_Space) {
                 ++pos;
             }
             cursor.setPosition(pos);
@@ -2148,11 +2148,6 @@ void BaseTextEditorWidget::convertPosition(int pos, int *line, int *column) cons
     Convenience::convertPosition(document(), pos, line, column);
 }
 
-QChar BaseTextEditorWidget::characterAt(int pos) const
-{
-    return document()->characterAt(pos);
-}
-
 bool BaseTextEditorWidget::event(QEvent *e)
 {
 #if QT_VERSION >= 0x050000
@@ -4752,14 +4747,14 @@ void BaseTextEditorWidget::handleHomeKey(bool anchor)
 
     const int initpos = cursor.position();
     int pos = cursor.block().position();
-    QChar character = characterAt(pos);
+    QChar character = document()->characterAt(pos);
     const QLatin1Char tab = QLatin1Char('\t');
 
     while (character == tab || character.category() == QChar::Separator_Space) {
         ++pos;
         if (pos == initpos)
             break;
-        character = characterAt(pos);
+        character = document()->characterAt(pos);
     }
 
     // Go to the start of the block when we're already at the start of the text
@@ -4834,7 +4829,7 @@ void BaseTextEditorWidget::handleBackspaceKey()
             }
         }
     } else if (typingSettings.m_smartBackspaceBehavior == TypingSettings::BackspaceUnindents) {
-        const QChar &c = characterAt(pos - 1);
+        const QChar &c = document()->characterAt(pos - 1);
         if (!(c == QLatin1Char(' ') || c == QLatin1Char('\t'))) {
             if (cursorWithinSnippet)
                 cursor.beginEditBlock();
@@ -5241,7 +5236,7 @@ void BaseTextEditorWidget::_q_matchParentheses()
         QPalette pal;
         pal.setBrush(QPalette::Text, d->m_matchFormat.foreground());
         pal.setBrush(QPalette::Base, d->m_matchFormat.background());
-        d->m_animator->setData(font(), pal, characterAt(d->m_animator->position()));
+        d->m_animator->setData(font(), pal, document()->characterAt(d->m_animator->position()));
         connect(d->m_animator, SIGNAL(updateRequest(int,QPointF,QRectF)),
                 this, SLOT(_q_animateUpdate(int,QPointF,QRectF)));
     }
@@ -6334,11 +6329,6 @@ void BaseTextEditor::insertExtraToolBarWidget(BaseTextEditor::Side side,
         m_toolBar->insertWidget(m_toolBar->actions().first(), widget);
 }
 
-int BaseTextEditor::find(const QString &) const
-{
-    return 0;
-}
-
 int BaseTextEditor::currentLine() const
 {
     return e->textCursor().blockNumber() + 1;
@@ -6370,11 +6360,6 @@ QRect BaseTextEditor::cursorRect(int pos) const
     return result;
 }
 
-QString BaseTextEditor::contents() const
-{
-    return e->toPlainText();
-}
-
 QString BaseTextEditor::selectedText() const
 {
     if (e->textCursor().hasSelection())
@@ -6382,11 +6367,6 @@ QString BaseTextEditor::selectedText() const
     return QString();
 }
 
-QString BaseTextEditor::textAt(int pos, int length) const
-{
-    return Convenience::textAt(e->textCursor(), pos, length);
-}
-
 void BaseTextEditor::remove(int length)
 {
     QTextCursor tc = e->textCursor();
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index a469ce47dee52b7a37d6f5d7671d0a27ed6246d0..ea1b8ca9b1f40aa8eaaed733128b30bcb5bb7a12 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -158,8 +158,6 @@ public:
     BaseTextEditor *editor() const;
     ITextMarkable *markableInterface() const;
 
-    QChar characterAt(int pos) const;
-
     void print(QPrinter *);
 
     void setSuggestedFileName(const QString &suggestedFileName);
@@ -621,8 +619,7 @@ public:
     friend class BaseTextEditorWidget;
     BaseTextEditorWidget *editorWidget() const { return e; }
 
-    // EditorInterface
-    //QWidget *widget() { return e; }
+    // IEditor
     Core::IDocument * document() { return e->editorDocument(); }
     bool createNew(const QString &contents) { return e->createNew(contents); }
     bool open(QString *errorString, const QString &fileName, const QString &realFileName) { return e->open(errorString, fileName, realFileName); }
@@ -637,7 +634,6 @@ public:
     void insertExtraToolBarWidget(Side side, QWidget *widget);
 
     // ITextEditor
-    int find(const QString &string) const;
     int currentLine() const;
     int currentColumn() const;
     void gotoLine(int line, int column = 0) { e->gotoLine(line, column); }
@@ -650,10 +646,7 @@ public:
     { e->convertPosition(pos, line, column); }
     QRect cursorRect(int pos = -1) const;
 
-    QString contents() const;
     QString selectedText() const;
-    QString textAt(int pos, int length) const;
-    inline QChar characterAt(int pos) const { return e->characterAt(pos); }
 
     inline ITextMarkable *markableInterface() { return e->markableInterface(); }
 
diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp
index 7d1a0670bca9373e7e8841ff553b99b92cd01dc3..b4c0f9cb42acd0b974236eaf8b5dc0870b24d741 100644
--- a/src/plugins/texteditor/codeassist/codeassistant.cpp
+++ b/src/plugins/texteditor/codeassist/codeassistant.cpp
@@ -195,8 +195,9 @@ void CodeAssistantPrivate::invoke(AssistKind kind, IAssistProvider *provider)
     if (isDisplayingProposal() && m_assistKind == kind && !m_proposal->isFragile()) {
         m_proposalWidget->setReason(ExplicitlyInvoked);
         m_proposalWidget->updateProposal(
-            m_textEditor->textAt(m_proposal->basePosition(),
-                                 m_textEditor->position() - m_proposal->basePosition()));
+                    m_textEditor->textDocument()->textAt(
+                        m_proposal->basePosition(),
+                        m_textEditor->position() - m_proposal->basePosition()));
     } else {
         destroyContext();
         requestProposal(ExplicitlyInvoked, kind, provider);
@@ -334,7 +335,7 @@ void CodeAssistantPrivate::displayProposal(IAssistProposal *newProposal, AssistR
         m_proposalWidget->setIsSynchronized(false);
     else
         m_proposalWidget->setIsSynchronized(true);
-    m_proposalWidget->showProposal(m_textEditor->textAt(
+    m_proposalWidget->showProposal(m_textEditor->textDocument()->textAt(
                                        m_proposal->basePosition(),
                                        m_textEditor->position() - m_proposal->basePosition()));
 }
@@ -393,7 +394,7 @@ CompletionAssistProvider *CodeAssistantPrivate::identifyActivationSequence()
         const int length = provider->activationCharSequenceLength();
         if (length == 0)
             continue;
-        QString sequence = m_textEditor->textAt(m_textEditor->position() - length, length);
+        QString sequence = m_textEditor->textDocument()->textAt(m_textEditor->position() - length, length);
         // In pretty much all cases the sequence will have the appropriate length. Only in the
         // case of typing the very first characters in the document for providers that request a
         // length greater than 1 (currently only C++, which specifies 3), the sequence needs to
@@ -417,7 +418,7 @@ void CodeAssistantPrivate::notifyChange()
             destroyContext();
         } else {
             m_proposalWidget->updateProposal(
-                m_textEditor->textAt(m_proposal->basePosition(),
+                m_textEditor->textDocument()->textAt(m_proposal->basePosition(),
                                      m_textEditor->position() - m_proposal->basePosition()));
             if (m_proposal->isFragile())
                 startAutomaticProposalTimer();
diff --git a/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp b/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp
index e4b0f4d827ff524f2007405c9bddbc550c68c257..0540fb3de68518686ae0e292af468efe9d951a23 100644
--- a/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp
+++ b/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp
@@ -109,10 +109,10 @@ void KeywordsAssistProposalItem::applyContextualContent(TextEditor::BaseTextEdit
     int cursorOffset = 0;
     if (m_keywords.isFunction(toInsert) && settings.m_autoInsertBrackets) {
         if (settings.m_spaceAfterFunctionName) {
-            if (editor->textAt(editor->position(), 2) == QLatin1String(" (")) {
+            if (editor->textDocument()->textAt(editor->position(), 2) == QLatin1String(" (")) {
                 cursorOffset = 2;
-            } else if (editor->characterAt(editor->position()) == QLatin1Char('(')
-                       || editor->characterAt(editor->position()) == QLatin1Char(' ')) {
+            } else if (editor->textDocument()->characterAt(editor->position()) == QLatin1Char('(')
+                       || editor->textDocument()->characterAt(editor->position()) == QLatin1Char(' ')) {
                 replaceLength += 1;
                 toInsert += QLatin1String(" (");
             } else {
@@ -120,7 +120,7 @@ void KeywordsAssistProposalItem::applyContextualContent(TextEditor::BaseTextEdit
                 cursorOffset = -1;
             }
         } else {
-            if (editor->characterAt(editor->position()) == QLatin1Char('(')) {
+            if (editor->textDocument()->characterAt(editor->position()) == QLatin1Char('(')) {
                 cursorOffset = 1;
             } else {
                 toInsert += QLatin1String("()");
diff --git a/src/plugins/texteditor/itexteditor.cpp b/src/plugins/texteditor/itexteditor.cpp
index 563a8b3f1cbf3474723667f812e644168440da79..beb34d75a68a654fc97fd00f02df51024096f969 100644
--- a/src/plugins/texteditor/itexteditor.cpp
+++ b/src/plugins/texteditor/itexteditor.cpp
@@ -35,6 +35,11 @@
 
 using namespace TextEditor;
 
+ITextEditorDocument::ITextEditorDocument(QObject *parent)
+    : Core::TextDocument(parent)
+{
+}
+
 QMap<QString, QString> ITextEditor::openedTextEditorsContents()
 {
     QMap<QString, QString> workingCopy;
@@ -43,7 +48,7 @@ QMap<QString, QString> ITextEditor::openedTextEditorsContents()
         if (!textEditor)
             continue;
         QString fileName = textEditor->document()->fileName();
-        workingCopy[fileName] = textEditor->contents();
+        workingCopy[fileName] = textEditor->textDocument()->contents();
     }
     return workingCopy;
 }
@@ -60,3 +65,9 @@ QMap<QString, QTextCodec *> TextEditor::ITextEditor::openedTextEditorsEncodings(
     }
     return workingCopy;
 }
+
+
+ITextEditorDocument *ITextEditor::textDocument()
+{
+    return qobject_cast<ITextEditorDocument *>(document());
+}
diff --git a/src/plugins/texteditor/itexteditor.h b/src/plugins/texteditor/itexteditor.h
index eb580bdd66de2ba5fbe2b2477dd5e18a196c340a..2e1ae06e38b25ea507be4d9742e279ca810fd5eb 100644
--- a/src/plugins/texteditor/itexteditor.h
+++ b/src/plugins/texteditor/itexteditor.h
@@ -34,6 +34,7 @@
 
 #include "itextmark.h"
 
+#include <coreplugin/textdocument.h>
 #include <coreplugin/editormanager/ieditor.h>
 
 #include <QMap>
@@ -54,6 +55,17 @@ namespace Utils {
 
 namespace TextEditor {
 
+class TEXTEDITOR_EXPORT ITextEditorDocument : public Core::TextDocument
+{
+    Q_OBJECT
+public:
+    explicit ITextEditorDocument(QObject *parent = 0);
+
+    virtual QString contents() const = 0;
+    virtual QString textAt(int pos, int length) const = 0;
+    virtual QChar characterAt(int pos) const = 0;
+};
+
 class TEXTEDITOR_EXPORT ITextEditor : public Core::IEditor
 {
     Q_OBJECT
@@ -68,7 +80,8 @@ public:
 
     ITextEditor() {}
 
-    virtual int find(const QString &string) const = 0;
+    virtual ITextEditorDocument *textDocument();
+
     /*! Returns the position at \a posOp in characters from the beginning of the document */
     virtual int position(PositionOperation posOp = Current, int at = -1) const = 0;
     /*! Converts the \a pos in characters from beginning of document to \a line and \a column */
@@ -80,10 +93,7 @@ public:
     /*! Returns the amount of visible lines (in characters) in the editor */
     virtual int rowCount() const = 0;
 
-    virtual QString contents() const = 0;
     virtual QString selectedText() const = 0;
-    virtual QString textAt(int pos, int length) const = 0;
-    virtual QChar characterAt(int pos) const = 0;
 
     /*! Removes \a length characters to the right of the cursor. */
     virtual void remove(int length) = 0;