Commit d7c2b0b6 authored by hjk's avatar hjk Committed by Tobias Hunger

TextEditor: Consolidate document access functions.

There was document(), textDocument() and baseTextDocument().
Two should be enough...

Change-Id: Id9e41c8d857c5cb3269a9fce5ab594d34448c982
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent a9b70458
......@@ -81,7 +81,7 @@ AndroidManifestEditorWidget *AndroidManifestEditor::widget() const
Core::IDocument *AndroidManifestEditor::document()
{
return textEditor()->baseTextDocument();
return textEditor()->textDocument();
}
TextEditor::BaseTextEditorWidget *AndroidManifestEditor::textEditor() const
......
......@@ -472,7 +472,7 @@ bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
void AndroidManifestEditorWidget::updateTargetComboBox()
{
const QString docPath(m_textEditorWidget->baseTextDocument()->filePath());
const QString docPath(m_textEditorWidget->textDocument()->filePath());
ProjectExplorer::Project *project = androidProject(docPath);
QStringList items;
if (project) {
......@@ -573,7 +573,7 @@ void AndroidManifestEditorWidget::preSave()
syncToEditor();
if (m_setAppName && m_appNameInStringsXml) {
QString baseDir = QFileInfo(m_textEditorWidget->baseTextDocument()->filePath()).absolutePath();
QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
QFile f(fileName);
if (f.open(QIODevice::ReadOnly)) {
......@@ -597,7 +597,7 @@ void AndroidManifestEditorWidget::preSave()
m_setAppName = false;
}
QString baseDir = QFileInfo(m_textEditorWidget->baseTextDocument()->filePath()).absolutePath();
QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
if (!m_lIconPath.isEmpty()) {
copyIcon(LowDPI, baseDir, m_lIconPath);
m_lIconPath.clear();
......@@ -691,7 +691,7 @@ void AndroidManifestEditorWidget::updateInfoBar()
void AndroidManifestEditorWidget::updateSdkVersions()
{
const QString docPath(m_textEditorWidget->baseTextDocument()->filePath());
const QString docPath(m_textEditorWidget->textDocument()->filePath());
QPair<int, int> apiLevels = AndroidManager::apiLevelRange();
for (int i = apiLevels.first; i < apiLevels.second + 1; ++i)
m_androidMinSdkVersion->addItem(tr("API %1: %2")
......@@ -708,7 +708,7 @@ void AndroidManifestEditorWidget::updateSdkVersions()
void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int line, int column)
{
Core::InfoBar *infoBar = m_textEditorWidget->baseTextDocument()->infoBar();
Core::InfoBar *infoBar = m_textEditorWidget->textDocument()->infoBar();
QString text;
if (line < 0)
text = tr("Could not parse file: \"%1\".").arg(errorMessage);
......@@ -726,7 +726,7 @@ void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int
void AndroidManifestEditorWidget::hideInfoBar()
{
Core::InfoBar *infoBar = m_textEditorWidget->baseTextDocument()->infoBar();
Core::InfoBar *infoBar = m_textEditorWidget->textDocument()->infoBar();
infoBar->removeInfo(infoBarId);
m_timerParseCheck.stop();
}
......@@ -765,7 +765,7 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
setApiLevel(m_androidMinSdkVersion, usesSdkElement, QLatin1String("android:minSdkVersion"));
setApiLevel(m_androidTargetSdkVersion, usesSdkElement, QLatin1String("android:targetSdkVersion"));
QString baseDir = QFileInfo(m_textEditorWidget->baseTextDocument()->filePath()).absolutePath();
QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
QDomElement applicationElement = manifest.firstChildElement(QLatin1String("application"));
......@@ -1426,6 +1426,6 @@ AndroidManifestTextEditorWidget::AndroidManifestTextEditorWidget(AndroidManifest
m_parent(parent)
{
setupAsPlainEditor();
baseTextDocument()->setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
textDocument()->setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
}
......@@ -1531,7 +1531,7 @@ IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const QString
return 0;
e->setForceReadOnly(true);
s.replace(QLatin1Char(' '), QLatin1Char('_'));
e->baseTextDocument()->setSuggestedFileName(s);
e->textDocument()->setSuggestedFileName(s);
if (!source.isEmpty())
e->setSource(source);
if (codec)
......
......@@ -224,7 +224,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
// TODO: Resolve variables
QDir dir(QFileInfo(baseTextDocument()->filePath()).absolutePath());
QDir dir(QFileInfo(textDocument()->filePath()).absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
......
......@@ -294,7 +294,7 @@ bool CppDocumentationCommentHelper::handleKeyPressEvent(QKeyEvent *e) const
cursor.setPosition(pos);
cursor.insertText(comment);
cursor.setPosition(pos - 3, QTextCursor::KeepAnchor);
m_editorWidget->baseTextDocument()->autoIndent(cursor);
m_editorWidget->textDocument()->autoIndent(cursor);
cursor.endEditBlock();
e->accept();
return true;
......
......@@ -163,7 +163,7 @@ public:
CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q)
: q(q)
, m_modelManager(CppModelManagerInterface::instance())
, m_cppEditorDocument(qobject_cast<CPPEditorDocument *>(q->baseTextDocument()))
, m_cppEditorDocument(qobject_cast<CPPEditorDocument *>(q->textDocument()))
, m_cppEditorOutline(new CppEditorOutline(q))
, m_cppDocumentationCommentHelper(q)
, m_localRenaming(q)
......@@ -179,7 +179,7 @@ CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q)
CppEditorWidget::CppEditorWidget(QWidget *parent)
: TextEditor::BaseTextEditorWidget(new CPPEditorDocument(), parent)
{
baseTextDocument()->setIndenter(new CppTools::CppQtStyleIndenter);
textDocument()->setIndenter(new CppTools::CppQtStyleIndenter);
ctor();
}
......@@ -215,7 +215,7 @@ void CppEditorWidget::ctor()
connect(d->m_declDefLinkFinder, SIGNAL(foundLink(QSharedPointer<FunctionDeclDefLink>)),
this, SLOT(onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefLink>)));
connect(baseTextDocument(), SIGNAL(filePathChanged(QString,QString)),
connect(textDocument(), SIGNAL(filePathChanged(QString,QString)),
this, SLOT(onFilePathChanged()));
connect(&d->m_localRenaming, SIGNAL(finished()),
......@@ -566,7 +566,7 @@ void CppEditorWidget::highlightSymbolUsages(int from, int to)
else if (!d->m_highlightWatcher || d->m_highlightWatcher->isCanceled())
return; // aborted
TextEditor::SyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter();
TextEditor::SyntaxHighlighter *highlighter = textDocument()->syntaxHighlighter();
QTC_ASSERT(highlighter, return);
TextEditor::SemanticHighlighter::incrementalApplyExtraAdditionalFormats(
......@@ -579,7 +579,7 @@ void CppEditorWidget::finishHighlightSymbolUsages()
if (!d->m_highlightWatcher->isCanceled()
&& editorRevision() == d->m_highlightRevision
&& !d->m_lastSemanticInfo.doc.isNull()) {
TextEditor::SyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter();
TextEditor::SyntaxHighlighter *highlighter = textDocument()->syntaxHighlighter();
QTC_CHECK(highlighter);
if (highlighter)
TextEditor::SemanticHighlighter::clearExtraAdditionalFormatsUntilEnd(highlighter,
......@@ -796,13 +796,13 @@ bool CPPEditor::open(QString *errorString, const QString &fileName, const QStrin
{
if (!TextEditor::BaseTextEditor::open(errorString, fileName, realFileName))
return false;
baseTextDocument()->setMimeType(Core::MimeDatabase::findByFile(QFileInfo(fileName)).type());
textDocument()->setMimeType(Core::MimeDatabase::findByFile(QFileInfo(fileName)).type());
return true;
}
void CppEditorWidget::applyFontSettings()
{
const TextEditor::FontSettings &fs = baseTextDocument()->fontSettings();
const TextEditor::FontSettings &fs = textDocument()->fontSettings();
d->m_semanticHighlightFormatMap[CppHighlightingSupport::TypeUse] =
fs.toTextCharFormat(TextEditor::C_TYPE);
......@@ -913,7 +913,7 @@ void CppEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
// We can use the semanticInfo's snapshot (and avoid locking), but not its
// document, since it doesn't contain expanded macros.
LookupContext context(semanticInfo.snapshot.document(baseTextDocument()->filePath()),
LookupContext context(semanticInfo.snapshot.document(textDocument()->filePath()),
semanticInfo.snapshot);
SemanticInfo::LocalUseIterator it(semanticInfo.localUses);
......@@ -1042,7 +1042,7 @@ void CppEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefL
d->m_declDefLink = link;
Core::IDocument *targetDocument
= Core::DocumentModel::documentForFilePath( d->m_declDefLink->targetFile->fileName());
if (baseTextDocument() != targetDocument) {
if (textDocument() != targetDocument) {
if (auto textDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
connect(textDocument, SIGNAL(contentsChanged()),
this, SLOT(abortDeclDefLink()));
......@@ -1054,7 +1054,7 @@ void CppEditorWidget::onFilePathChanged()
{
QTC_ASSERT(d->m_modelManager, return);
QByteArray additionalDirectives;
const QString &filePath = baseTextDocument()->filePath();
const QString &filePath = textDocument()->filePath();
if (!filePath.isEmpty()) {
const QString &projectFile = ProjectExplorer::SessionManager::value(
QLatin1String(Constants::CPP_PREPROCESSOR_PROJECT_PREFIX) + filePath).toString();
......@@ -1091,7 +1091,7 @@ void CppEditorWidget::abortDeclDefLink()
Core::IDocument *targetDocument
= Core::DocumentModel::documentForFilePath(d->m_declDefLink->targetFile->fileName());
if (baseTextDocument() != targetDocument) {
if (textDocument() != targetDocument) {
if (auto textDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
disconnect(textDocument, SIGNAL(contentsChanged()),
this, SLOT(abortDeclDefLink()));
......@@ -1113,7 +1113,7 @@ void CppEditorWidget::onLocalRenamingProcessKeyPressNormally(QKeyEvent *e)
QTextCharFormat CppEditorWidget::textCharFormat(TextEditor::TextStyle category)
{
return baseTextDocument()->fontSettings().toTextCharFormat(category);
return textDocument()->fontSettings().toTextCharFormat(category);
}
void CppEditorWidget::showPreProcessorWidget()
......@@ -1127,7 +1127,7 @@ void CppEditorWidget::showPreProcessorWidget()
if (projectParts.isEmpty())
projectParts << d->m_modelManager->fallbackProjectPart();
CppPreProcessorDialog preProcessorDialog(this, baseTextDocument()->filePath(), projectParts);
CppPreProcessorDialog preProcessorDialog(this, textDocument()->filePath(), projectParts);
if (preProcessorDialog.exec() == QDialog::Accepted) {
QSharedPointer<SnapshotUpdater> updater
= d->m_modelManager->cppEditorSupport(editor())->snapshotUpdater();
......
......@@ -191,7 +191,7 @@ void CppEditorOutline::updateNow()
return;
const CPlusPlus::Snapshot snapshot = cmmi->snapshot();
const QString filePath = m_editorWidget->baseTextDocument()->filePath();
const QString filePath = m_editorWidget->textDocument()->filePath();
CPlusPlus::Document::Ptr document = snapshot.document(filePath);
if (!document)
return;
......
......@@ -87,7 +87,7 @@ void CppElementEvaluator::execute()
return;
const Snapshot &snapshot = m_modelManager->snapshot();
Document::Ptr doc = snapshot.document(m_editor->baseTextDocument()->filePath());
Document::Ptr doc = snapshot.document(m_editor->textDocument()->filePath());
if (!doc)
return;
......
......@@ -550,7 +550,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
}
// Now we prefer the doc from the snapshot with macros expanded.
Document::Ptr doc = snapshot.document(m_widget->baseTextDocument()->filePath());
Document::Ptr doc = snapshot.document(m_widget->textDocument()->filePath());
if (!doc) {
doc = documentFromSemanticInfo;
if (!doc)
......@@ -645,7 +645,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
if (Symbol *d = r.declaration()) {
if (d->isDeclaration() || d->isFunction()) {
const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength());
if (m_widget->baseTextDocument()->filePath() == fileName) {
if (m_widget->textDocument()->filePath() == fileName) {
if (unsigned(lineNumber) == d->line()
&& unsigned(positionInBlock) >= d->column()) { // TODO: check the end
result = r; // take the symbol under cursor.
......
......@@ -143,12 +143,12 @@ void CppIncludeHierarchyWidget::perform()
return;
m_model->clear();
m_model->buildHierarchy(m_editor, widget->baseTextDocument()->filePath());
m_model->buildHierarchy(m_editor, widget->textDocument()->filePath());
if (m_model->isEmpty())
return;
m_inspectedFile->setup(widget->baseTextDocument()->displayName(),
widget->baseTextDocument()->filePath());
m_inspectedFile->setup(widget->textDocument()->displayName(),
widget->textDocument()->filePath());
//expand "Includes"
m_treeView->expand(m_model->index(0, 0));
......
......@@ -296,7 +296,7 @@ void CppLocalRenaming::updateEditorWidgetWithSelections()
QTextCharFormat CppLocalRenaming::textCharFormat(TextEditor::TextStyle category) const
{
return m_editorWidget->baseTextDocument()->fontSettings().toTextCharFormat(category);
return m_editorWidget->textDocument()->fontSettings().toTextCharFormat(category);
}
void CppLocalRenaming::finishRenameChange()
......
......@@ -87,7 +87,7 @@ const IAssistProvider *CppQuickFixAssistProcessor::provider() const
CppQuickFixAssistInterface::CppQuickFixAssistInterface(CppEditorWidget *editor,
TextEditor::AssistReason reason)
: DefaultAssistInterface(editor->document(), editor->position(),
editor->baseTextDocument()->filePath(), reason)
editor->textDocument()->filePath(), reason)
, m_editor(editor)
, m_semanticInfo(editor->semanticInfo())
, m_snapshot(CppTools::CppModelManagerInterface::instance()->snapshot())
......
......@@ -63,6 +63,6 @@ QString CppSnippetProvider::displayName() const
void CppSnippetProvider::decorateEditor(TextEditor::SnippetEditorWidget *editor) const
{
editor->setSyntaxHighlighter(new CppHighlighter);
editor->baseTextDocument()->setIndenter(new CppTools::CppQtStyleIndenter);
editor->textDocument()->setIndenter(new CppTools::CppQtStyleIndenter);
editor->editor()->setAutoCompleter(new CppAutoCompleter);
}
......@@ -447,7 +447,7 @@ void InvokeCompletionTokenAction::run(CppEditorWidget *editorWidget)
// editorWidget->setFocus();
QApplication::processEvents();
TestActionsTestCase::undoChangesInDocument(editorWidget->baseTextDocument());
TestActionsTestCase::undoChangesInDocument(editorWidget->textDocument());
}
class RunAllQuickFixesTokenAction : public TestActionsTestCase::AbstractAction
......
......@@ -465,7 +465,7 @@ void CppCodeStylePreferencesWidget::updatePreview()
const TextEditor::TabSettings ts = cppCodeStylePreferences->currentTabSettings();
QtStyleCodeFormatter formatter(ts, ccss);
foreach (TextEditor::SnippetEditorWidget *preview, m_previews) {
preview->baseTextDocument()->setTabSettings(ts);
preview->textDocument()->setTabSettings(ts);
preview->setCodeStyle(cppCodeStylePreferences);
QTextDocument *doc = preview->document();
......@@ -475,7 +475,7 @@ void CppCodeStylePreferencesWidget::updatePreview()
QTextCursor tc = preview->textCursor();
tc.beginEditBlock();
while (block.isValid()) {
preview->baseTextDocument()->indenter()->indentBlock(doc, block, QChar::Null, ts);
preview->textDocument()->indenter()->indentBlock(doc, block, QChar::Null, ts);
block = block.next();
}
......@@ -492,7 +492,7 @@ void CppCodeStylePreferencesWidget::decorateEditors(const TextEditor::FontSettin
});
foreach (TextEditor::SnippetEditorWidget *editor, m_previews) {
editor->baseTextDocument()->setFontSettings(fontSettings);
editor->textDocument()->setFontSettings(fontSettings);
if (provider)
provider->decorateEditor(editor);
}
......
......@@ -103,7 +103,7 @@ public:
QStringList completions;
CppCompletionAssistInterface *ai
= new CppCompletionAssistInterface(m_editorWidget->document(), m_position,
m_editorWidget->baseTextDocument()->filePath(),
m_editorWidget->textDocument()->filePath(),
ExplicitlyInvoked, m_snapshot,
ProjectPart::HeaderPaths());
CppCompletionAssistProcessor processor;
......
......@@ -121,7 +121,7 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor
, m_initialized(false)
, m_lastHighlightRevision(0)
, m_lastHighlightOnCompleteSemanticInfo(true)
, m_highlightingSupport(modelManager->highlightingSupport(textEditor->baseTextDocument()))
, m_highlightingSupport(modelManager->highlightingSupport(textEditor->textDocument()))
, m_completionAssistProvider(
modelManager->completionAssistProvider(textEditor->document()->mimeType()))
{
......
......@@ -1185,7 +1185,7 @@ IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &outp
if (!e)
return 0;
s.replace(QLatin1Char(' '), QLatin1Char('_'));
e->baseTextDocument()->setSuggestedFileName(s);
e->textDocument()->setSuggestedFileName(s);
e->setForceReadOnly(true);
if (!source.isEmpty())
e->setSource(source);
......
......@@ -714,7 +714,7 @@ void QmlLiveTextPreview::showSyncWarning(
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
Core::InfoBar *infoBar = editor->baseTextDocument()->infoBar();
Core::InfoBar *infoBar = editor->textDocument()->infoBar();
Core::InfoBarEntry info(Core::Id(INFO_OUT_OF_SYNC), errorMessage);
BaseToolsClient *toolsClient = m_inspectorAdapter->toolsClient();
if (toolsClient && toolsClient->supportReload())
......@@ -735,7 +735,7 @@ void QmlLiveTextPreview::removeOutofSyncInfo()
{
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
Core::InfoBar *infoBar = editor->baseTextDocument()->infoBar();
Core::InfoBar *infoBar = editor->textDocument()->infoBar();
infoBar->removeInfo(Core::Id(INFO_OUT_OF_SYNC));
}
}
......
......@@ -136,7 +136,7 @@ void SourceAgent::updateLocationMarker()
QTC_ASSERT(d->editor, return);
if (d->locationMark)
d->editor->baseTextDocument()->removeMark(d->locationMark);
d->editor->textDocument()->removeMark(d->locationMark);
delete d->locationMark;
d->locationMark = 0;
if (d->engine->stackHandler()->currentFrame().file == d->path) {
......@@ -144,7 +144,7 @@ void SourceAgent::updateLocationMarker()
d->locationMark = new TextEditor::TextMark(QString(), lineNumber);
d->locationMark->setIcon(debuggerCore()->locationMarkIcon());
d->locationMark->setPriority(TextEditor::TextMark::HighPriority);
d->editor->baseTextDocument()->addMark(d->locationMark);
d->editor->textDocument()->addMark(d->locationMark);
QPlainTextEdit *plainTextEdit = d->editor->editorWidget();
QTC_ASSERT(plainTextEdit, return);
QTextCursor tc = plainTextEdit->textCursor();
......
......@@ -44,7 +44,7 @@ DesignerXmlEditorWidget::DesignerXmlEditorWidget(QDesignerFormWindowInterface *f
{
setupAsPlainEditor();
setReadOnly(true);
configureMimeType(baseTextDocument()->mimeType());
configureMimeType(textDocument()->mimeType());
}
TextEditor::BaseTextEditor *DesignerXmlEditorWidget::createEditor()
......@@ -61,7 +61,7 @@ FormWindowEditor *DesignerXmlEditorWidget::designerEditor() const
Internal::FormWindowFile *DesignerXmlEditorWidget::formWindowFile() const
{
return qobject_cast<FormWindowFile *>(baseTextDocument());
return qobject_cast<FormWindowFile *>(textDocument());
}
} // namespace Internal
......
......@@ -309,7 +309,7 @@ static void addDeclaration(const Snapshot &snapshot,
tc.beginEditBlock();
tc.insertText(loc.prefix() + declaration + loc.suffix());
tc.setPosition(pos, QTextCursor::KeepAnchor);
widget->baseTextDocument()->autoIndent(tc);
widget->textDocument()->autoIndent(tc);
tc.endEditBlock();
}
}
......
......@@ -264,14 +264,14 @@ void DiffEditor::ctor()
SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
connect(TextEditorSettings::instance(),
SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
m_descriptionWidget->baseTextDocument(),
m_descriptionWidget->textDocument(),
SLOT(setFontSettings(TextEditor::FontSettings)));
m_descriptionWidget->setDisplaySettings(
TextEditorSettings::displaySettings());
m_descriptionWidget->setCodeStyle(
TextEditorSettings::codeStyle());
m_descriptionWidget->baseTextDocument()->setFontSettings(
m_descriptionWidget->textDocument()->setFontSettings(
TextEditorSettings::fontSettings());
m_controller = m_document->controller();
......
......@@ -348,7 +348,7 @@ void SideDiffEditorWidget::setDisplaySettings(const DisplaySettings &ds)
void SideDiffEditorWidget::applyFontSettings()
{
SelectableTextEditorWidget::applyFontSettings();
const TextEditor::FontSettings &fs = baseTextDocument()->fontSettings();
const TextEditor::FontSettings &fs = textDocument()->fontSettings();
m_fileLineForeground = fs.formatFor(C_DIFF_FILE_LINE).foreground();
m_chunkLineForeground = fs.formatFor(C_DIFF_CONTEXT_LINE).foreground();
m_textForeground = fs.toTextCharFormat(C_TEXT).foreground().color();
......@@ -1161,8 +1161,8 @@ void SideBySideDiffEditorWidget::showDiff()
void SideBySideDiffEditorWidget::setFontSettings(
const TextEditor::FontSettings &fontSettings)
{
m_leftEditor->baseTextDocument()->setFontSettings(fontSettings);
m_rightEditor->baseTextDocument()->setFontSettings(fontSettings);
m_leftEditor->textDocument()->setFontSettings(fontSettings);
m_rightEditor->textDocument()->setFontSettings(fontSettings);
m_spanLineFormat = fontSettings.toTextCharFormat(C_LINE_NUMBER);
m_fileLineFormat = fontSettings.toTextCharFormat(C_DIFF_FILE_LINE);
......
......@@ -172,7 +172,7 @@ void UnifiedDiffEditorWidget::setDisplaySettings(const DisplaySettings &ds)
void UnifiedDiffEditorWidget::setFontSettings(const FontSettings &fontSettings)
{
baseTextDocument()->setFontSettings(fontSettings);
textDocument()->setFontSettings(fontSettings);
m_fileLineFormat = fontSettings.toTextCharFormat(C_DIFF_FILE_LINE);
m_chunkLineFormat = fontSettings.toTextCharFormat(C_DIFF_CONTEXT_LINE);
......
......@@ -322,7 +322,7 @@ void EmacsKeysPlugin::insertLineAndIndent()
cursor.beginEditBlock();
cursor.insertBlock();
if (m_currentBaseTextEditorWidget != 0)
m_currentBaseTextEditorWidget->baseTextDocument()->autoIndent(cursor);
m_currentBaseTextEditorWidget->textDocument()->autoIndent(cursor);
cursor.endEditBlock();
m_currentEditorWidget->setTextCursor(cursor);
m_currentState->endOwnAction(KeysActionOther);
......
......@@ -1921,7 +1921,7 @@ void FakeVimPluginPrivate::checkForElectricCharacter(bool *result, QChar c)
if (!handler)
return;
if (BaseTextEditorWidget *bt = qobject_cast<BaseTextEditorWidget *>(handler->widget()))
*result = bt->baseTextDocument()->indenter()->isElectricCharacter(c);
*result = bt->textDocument()->indenter()->isElectricCharacter(c);
}
void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd)
......@@ -2117,7 +2117,7 @@ void FakeVimPluginPrivate::indentRegion(int beginBlock, int endBlock,
while (!cursor.atBlockEnd())
cursor.deleteChar();
} else {
bt->baseTextDocument()->indenter()->indentBlock(doc, block, typedChar, tabSettings);
bt->textDocument()->indenter()->indentBlock(doc, block, typedChar, tabSettings);
}
block = block.next();
}
......
......@@ -189,7 +189,7 @@ void GitEditorWidget::setPlainTextFiltered(const QString &text)
break;
}
baseTextDocument()->setPlainText(modText);
textDocument()->setPlainText(modText);
}
void GitEditorWidget::commandFinishedGotoLine(bool ok, int exitCode, const QVariant &v)
......@@ -290,9 +290,9 @@ void GitEditorWidget::init()
VcsBase::VcsBaseEditorWidget::init();
Core::Id editorId = editor()->document()->id();
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
new GitSubmitHighlighter(baseTextDocument());
new GitSubmitHighlighter(textDocument());
else if (editorId == Git::Constants::GIT_REBASE_EDITOR_ID)
new GitRebaseHighlighter(baseTextDocument());
new GitRebaseHighlighter(textDocument());
}
void GitEditorWidget::addDiffActions(QMenu *menu, const VcsBase::DiffChunk &chunk)
......@@ -316,7 +316,7 @@ bool GitEditorWidget::open(QString *errorString, const QString &fileName, const
QFileInfo fi(fileName);
const QString gitPath = fi.absolutePath();
setSource(gitPath);
baseTextDocument()->setCodec(
textDocument()->setCodec(
GitPlugin::instance()->gitClient()->encoding(gitPath, "i18n.commitEncoding"));
}
return VcsBaseEditorWidget::open(errorString, fileName, realFileName);
......
......@@ -166,7 +166,7 @@ void GlslEditorWidget::ctor()
connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument()));
new Highlighter(baseTextDocument());
new Highlighter(textDocument());
// if (m_modelManager) {
// m_semanticHighlighter->setModelManager(m_modelManager);
......@@ -202,7 +202,7 @@ Core::IEditor *GlslEditor::duplicate()
bool GlslEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
baseTextDocument()->setMimeType(Core::MimeDatabase::findByFile(QFileInfo(fileName)).type());
textDocument()->setMimeType(Core::MimeDatabase::findByFile(QFileInfo(fileName)).type());
bool b = TextEditor::BaseTextEditor::open(errorString, fileName, realFileName);
return b;
}
......@@ -260,7 +260,7 @@ void GlslEditorWidget::updateDocumentNow()
{
m_updateDocumentTimer->stop();
int variant = languageVariant(baseTextDocument()->mimeType());
int variant = languageVariant(textDocument()->mimeType());
const QString contents = toPlainText(); // get the code from the editor
const QByteArray preprocessedCode = contents.toLatin1(); // ### use the QtCreator C++ preprocessor.
......@@ -368,7 +368,7 @@ TextEditor::IAssistInterface *GlslEditorWidget::createAssistInterface(
position(),
editor()->document()->filePath(),
reason,
baseTextDocument()->mimeType(),
textDocument()->mimeType(),
m_glslDocument);
return BaseTextEditorWidget::createAssistInterface(kind, reason);
}
......@@ -1212,7 +1212,7 @@ IEditor *PerforcePlugin::showOutputInEditor(const QString &title,
e->setForceReadOnly(true);
e->setSource(source);
s.replace(QLatin1Char(' '), QLatin1Char('_'));
e->baseTextDocument()->setSuggestedFileName(s);
e->textDocument()->setSuggestedFileName(s);
if (codec)
e->setCodec(codec);
return editor;
......
......@@ -71,7 +71,7 @@ EnvironmentItemsWidget::EnvironmentItemsWidget(QWidget *parent) :
QWidget(parent), d(new EnvironmentItemsWidgetPrivate)
{
d->m_editor = new TextEditor::SnippetEditorWidget(this);
d->m_editor->baseTextDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
d->m_editor->textDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(d->m_editor);
}
......
......@@ -68,7 +68,7 @@ bool PythonEditor::open(QString *errorString,
const QString &realFileName)
{
Core::MimeType mimeType = Core::MimeDatabase::findByFile(QFileInfo(fileName));
baseTextDocument()->setMimeType(mimeType.type());
textDocument()->setMimeType(mimeType.type());
return TextEditor::BaseTextEditor::open(errorString, fileName, realFileName);
}
......
......@@ -65,7 +65,7 @@ void PythonEditorWidget::ctor()
setMarksVisible(true);
setCodeFoldingSupported(true);
new PythonHighlighter(baseTextDocument());
new PythonHighlighter(textDocument());
}
TextEditor::BaseTextEditor *PythonEditorWidget::createEditor()
......
......@@ -151,7 +151,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur
}
}
QDir dir(QFileInfo(baseTextDocument()->filePath()).absolutePath());
QDir dir(QFileInfo(textDocument()->filePath()).absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
......
......@@ -49,7 +49,7 @@ void BaseTextEditModifier::indent(int offset, int length)
if (TextEditor::BaseTextEditorWidget *baseTextEditorWidget = qobject_cast<TextEditor::BaseTextEditorWidget*>(plainTextEdit())) {
TextEditor::BaseTextDocument *baseTextEditorDocument = baseTextEditorWidget->baseTextDocument();
TextEditor::BaseTextDocument *baseTextEditorDocument = baseTextEditorWidget->textDocument();
QTextDocument *textDocument = baseTextEditorWidget->document();
TextEditor::BaseTextEditor *baseTextEditor = baseTextEditorWidget->editor();
......@@ -83,7 +83,7 @@ void BaseTextEditModifier::indent(int offset, int length)
int BaseTextEditModifier::indentDepth() const
{
if (TextEditor::BaseTextEditorWidget *bte = qobject_cast<TextEditor::BaseTextEditorWidget*>(plainTextEdit()))
return bte->baseTextDocument()->tabSettings().m_indentSize;
return bte->textDocument()->tabSettings().m_indentSize;
else
return 0;
}
......@@ -92,7 +92,7 @@ bool BaseTextEditModifier::renameId(const QString &oldId, const QString &newId)
{
if (TextEditor::BaseTextEditorWidget *bte = qobject_cast<TextEditor::BaseTextEditorWidget*>(plainTextEdit())) {
if (QmlJSEditor::QmlJSEditorDocument *document
= qobject_cast<QmlJSEditor::QmlJSEditorDocument *>(bte->baseTextDocument())) {
= qobject_cast<QmlJSEditor::QmlJSEditorDocument *>(bte->textDocument())) {
Utils::ChangeSet changeSet;
foreach (const QmlJS::AST::SourceLocation &loc,
document->semanticInfo().idLocations.value(oldId)) {
......
......@@ -111,7 +111,7 @@ QmlJSTextEditorWidget::QmlJSTextEditorWidget(QmlJSTextEditorWidget *other)
void QmlJSTextEditorWidget::ctor()
{
m_qmlJsEditorDocument = static_cast<QmlJSEditorDocument *>(baseTextDocument());
m_qmlJsEditorDocument = static_cast<QmlJSEditorDocument *>(textDocument());
m_outlineCombo = 0;
m_contextPane = 0;