2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef PLAINTEXTEDITOR_H
|
|
|
|
|
#define PLAINTEXTEDITOR_H
|
|
|
|
|
|
|
|
|
|
#include "basetexteditor.h"
|
|
|
|
|
|
2010-05-20 13:56:11 +02:00
|
|
|
#include <utils/uncommentselection.h>
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtCore/QList>
|
2010-05-20 13:56:11 +02:00
|
|
|
#include <QtCore/QScopedPointer>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-05-21 14:15:04 +02:00
|
|
|
namespace Core {
|
|
|
|
|
class MimeType;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace TextEditor {
|
|
|
|
|
|
|
|
|
|
class PlainTextEditor;
|
2010-05-21 14:15:04 +02:00
|
|
|
class Indenter;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
class TEXTEDITOR_EXPORT PlainTextEditorEditable : public BaseTextEditorEditable
|
|
|
|
|
{
|
2010-05-28 14:37:25 +02:00
|
|
|
Q_OBJECT
|
2008-12-02 12:01:29 +01:00
|
|
|
public:
|
|
|
|
|
PlainTextEditorEditable(PlainTextEditor *);
|
|
|
|
|
QList<int> context() const;
|
|
|
|
|
|
|
|
|
|
bool duplicateSupported() const { return true; }
|
|
|
|
|
Core::IEditor *duplicate(QWidget *parent);
|
2009-06-04 12:02:19 +02:00
|
|
|
bool isTemporary() const { return false; }
|
2010-02-26 11:08:17 +01:00
|
|
|
virtual QString id() const;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
private:
|
|
|
|
|
QList<int> m_context;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TEXTEDITOR_EXPORT PlainTextEditor : public BaseTextEditor
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
PlainTextEditor(QWidget *parent);
|
2010-05-21 14:15:04 +02:00
|
|
|
~PlainTextEditor();
|
|
|
|
|
|
|
|
|
|
void configure(const Core::MimeType &mimeType);
|
2010-05-28 14:37:25 +02:00
|
|
|
bool isMissingSyntaxDefinition() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-05-20 13:56:11 +02:00
|
|
|
public slots:
|
|
|
|
|
virtual void unCommentSelection();
|
2010-05-21 14:15:04 +02:00
|
|
|
virtual void setFontSettings(const FontSettings &fs);
|
2010-06-21 13:37:53 +02:00
|
|
|
virtual void setTabSettings(const TextEditor::TabSettings &);
|
2010-05-20 13:56:11 +02:00
|
|
|
|
|
|
|
|
private slots:
|
2010-05-28 14:37:25 +02:00
|
|
|
void fileChanged();
|
2010-05-20 13:56:11 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2010-05-10 12:53:13 +02:00
|
|
|
virtual BaseTextEditorEditable *createEditableInterface() { return new PlainTextEditorEditable(this); }
|
2008-12-02 12:01:29 +01:00
|
|
|
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
|
2010-05-10 12:53:13 +02:00
|
|
|
|
|
|
|
|
private:
|
2010-05-21 14:15:04 +02:00
|
|
|
QString findDefinitionId(const Core::MimeType &mimeType, bool considerParents) const;
|
|
|
|
|
|
2010-05-28 14:37:25 +02:00
|
|
|
bool m_isMissingSyntaxDefinition;
|
2010-05-20 13:56:11 +02:00
|
|
|
Utils::CommentDefinition m_commentDefinition;
|
2010-05-21 14:15:04 +02:00
|
|
|
QScopedPointer<Indenter> m_indenter;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace TextEditor
|
|
|
|
|
|
|
|
|
|
#endif // PLAINTEXTEDITOR_H
|