• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Kate

katescriptdocument.h

Go to the documentation of this file.
00001 // This file is part of the KDE libraries
00002 // Copyright (C) 2008 Paul Giannaros <paul@giannaros.org>
00003 // Copyright (C) 2009 Dominik Haumann <dhaumann kde org>
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Library General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2 of the License, or (at your option) version 3.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Library General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Library General Public License
00016 // along with this library; see the file COPYING.LIB.  If not, write to
00017 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018 // Boston, MA 02110-1301, USA.
00019 
00020 #ifndef KATE_SCRIPT_DOCUMENT_H
00021 #define KATE_SCRIPT_DOCUMENT_H
00022 
00023 #include <QObject>
00024 #include <QStringList>
00025 #include <QtScript/QScriptable>
00026 
00027 #include "katepartprivate_export.h"
00028 
00029 #include <QtScript/QScriptValue>
00030 
00031 #include <ktexteditor/cursor.h>
00032 #include <ktexteditor/range.h>
00033 
00034 class KateDocument;
00035 
00046 class KATEPART_TESTS_EXPORT KateScriptDocument : public QObject, protected QScriptable
00047 {
00048   Q_OBJECT
00049   // Note: we have no Q_PROPERTIES due to consistency: everything is a function.
00050 
00051   public:
00052     KateScriptDocument(QObject *parent=0);
00053     void setDocument(KateDocument *document);
00054     KateDocument *document();
00055 
00056     //BEGIN
00057     Q_INVOKABLE QString fileName();
00058     Q_INVOKABLE QString url();
00059     Q_INVOKABLE QString mimeType();
00060     Q_INVOKABLE QString encoding();
00061     Q_INVOKABLE QString highlightingMode();
00062     Q_INVOKABLE QStringList embeddedHighlightingModes();
00063     Q_INVOKABLE QString highlightingModeAt(const KTextEditor::Cursor& pos);
00064     Q_INVOKABLE bool isModified();
00065     Q_INVOKABLE QString text();
00066     Q_INVOKABLE QString text(int fromLine, int fromColumn, int toLine, int toColumn);
00067     Q_INVOKABLE QString text(const KTextEditor::Cursor& from, const KTextEditor::Cursor& to);
00068     Q_INVOKABLE QString text(const KTextEditor::Range& range);
00069     Q_INVOKABLE QString line(int line);
00070     Q_INVOKABLE QString wordAt(int line, int column);
00071     Q_INVOKABLE QString wordAt(const KTextEditor::Cursor& cursor);
00072     Q_INVOKABLE QString charAt(int line, int column);
00073     Q_INVOKABLE QString charAt(const KTextEditor::Cursor& cursor);
00074     Q_INVOKABLE QString firstChar(int line);
00075     Q_INVOKABLE QString lastChar(int line);
00076     Q_INVOKABLE bool isSpace(int line, int column);
00077     Q_INVOKABLE bool isSpace(const KTextEditor::Cursor& cursor);
00078     Q_INVOKABLE bool matchesAt(int line, int column, const QString &s);
00079     Q_INVOKABLE bool matchesAt(const KTextEditor::Cursor& cursor, const QString &s);
00080     Q_INVOKABLE bool setText(const QString &s);
00081     Q_INVOKABLE bool clear();
00082     Q_INVOKABLE bool truncate(int line, int column);
00083     Q_INVOKABLE bool truncate(const KTextEditor::Cursor& cursor);
00084     Q_INVOKABLE bool insertText(int line, int column, const QString &s);
00085     Q_INVOKABLE bool insertText(const KTextEditor::Cursor& cursor, const QString &s);
00086     Q_INVOKABLE bool removeText(int fromLine, int fromColumn, int toLine, int toColumn);
00087     Q_INVOKABLE bool removeText(const KTextEditor::Cursor& from, const KTextEditor::Cursor& to);
00088     Q_INVOKABLE bool removeText(const KTextEditor::Range& range);
00089     Q_INVOKABLE bool insertLine(int line, const QString &s);
00090     Q_INVOKABLE bool removeLine(int line);
00091     Q_INVOKABLE void joinLines(int startLine, int endLine);
00092     Q_INVOKABLE int lines();
00093     Q_INVOKABLE int length();
00094     Q_INVOKABLE int lineLength(int line);
00095     Q_INVOKABLE void editBegin();
00096     Q_INVOKABLE void editEnd();
00097     Q_INVOKABLE int firstColumn(int line);
00098     Q_INVOKABLE int lastColumn(int line);
00099     Q_INVOKABLE int prevNonSpaceColumn(int line, int column);
00100     Q_INVOKABLE int prevNonSpaceColumn(const KTextEditor::Cursor& cursor);
00101     Q_INVOKABLE int nextNonSpaceColumn(int line, int column);
00102     Q_INVOKABLE int nextNonSpaceColumn(const KTextEditor::Cursor& cursor);
00103     Q_INVOKABLE int prevNonEmptyLine(int line);
00104     Q_INVOKABLE int nextNonEmptyLine(int line);
00105     Q_INVOKABLE bool isInWord(const QString &character, int attribute);
00106     Q_INVOKABLE bool canBreakAt(const QString &character, int attribute);
00107     Q_INVOKABLE bool canComment(int startAttribute, int endAttribute);
00108     Q_INVOKABLE QString commentMarker(int attribute);
00109     Q_INVOKABLE QString commentStart(int attribute);
00110     Q_INVOKABLE QString commentEnd(int attribute);
00111 
00112     Q_INVOKABLE KTextEditor::Range documentRange();
00113     Q_INVOKABLE KTextEditor::Cursor documentEnd();
00114 
00118     Q_INVOKABLE int attribute(int line, int column);
00119     Q_INVOKABLE int attribute(const KTextEditor::Cursor& cursor);
00120 
00124     Q_INVOKABLE bool isAttribute(int line, int column, int attr);
00125     Q_INVOKABLE bool isAttribute(const KTextEditor::Cursor& cursor, int attr);
00126 
00130     Q_INVOKABLE QString attributeName(int line, int column);
00131     Q_INVOKABLE QString attributeName(const KTextEditor::Cursor& cursor);
00132 
00136     Q_INVOKABLE bool isAttributeName(int line, int column, const QString &name);
00137     Q_INVOKABLE bool isAttributeName(const KTextEditor::Cursor& cursor, const QString &name);
00138 
00139     Q_INVOKABLE QString variable(const QString &s);
00140     //END
00141 
00142     Q_INVOKABLE int firstVirtualColumn(int line);
00143     Q_INVOKABLE int lastVirtualColumn(int line);
00144     Q_INVOKABLE int toVirtualColumn(int line, int column);
00145     Q_INVOKABLE int toVirtualColumn(const KTextEditor::Cursor& cursor);
00146     Q_INVOKABLE KTextEditor::Cursor toVirtualCursor(const KTextEditor::Cursor& cursor);
00147     Q_INVOKABLE int fromVirtualColumn(int line, int virtualColumn);
00148     Q_INVOKABLE int fromVirtualColumn(const KTextEditor::Cursor& virtualCursor);
00149     Q_INVOKABLE KTextEditor::Cursor fromVirtualCursor(const KTextEditor::Cursor& virtualCursor);
00150 
00151     Q_INVOKABLE KTextEditor::Cursor anchor(int line, int column, QChar character);
00152     Q_INVOKABLE KTextEditor::Cursor anchor(const KTextEditor::Cursor& cursor, QChar character);
00153     Q_INVOKABLE KTextEditor::Cursor rfind(int line, int column, const QString& text, int attribute = -1);
00154     Q_INVOKABLE KTextEditor::Cursor rfind(const KTextEditor::Cursor& cursor, const QString& text, int attribute = -1);
00155 
00156     Q_INVOKABLE int defStyleNum(int line, int column);
00157     Q_INVOKABLE int defStyleNum(const KTextEditor::Cursor& cursor);
00158     Q_INVOKABLE bool isCode(int line, int column);
00159     Q_INVOKABLE bool isCode(const KTextEditor::Cursor& cursor);
00160     Q_INVOKABLE bool isComment(int line, int column);
00161     Q_INVOKABLE bool isComment(const KTextEditor::Cursor& cursor);
00162     Q_INVOKABLE bool isString(int line, int column);
00163     Q_INVOKABLE bool isString(const KTextEditor::Cursor& cursor);
00164     Q_INVOKABLE bool isRegionMarker(int line, int column);
00165     Q_INVOKABLE bool isRegionMarker(const KTextEditor::Cursor& cursor);
00166     Q_INVOKABLE bool isChar(int line, int column);
00167     Q_INVOKABLE bool isChar(const KTextEditor::Cursor& cursor);
00168     Q_INVOKABLE bool isOthers(int line, int column);
00169     Q_INVOKABLE bool isOthers(const KTextEditor::Cursor& cursor);
00170 
00171 
00172     Q_INVOKABLE bool startsWith (int line, const QString &pattern, bool skipWhiteSpaces);
00173     Q_INVOKABLE bool endsWith (int line, const QString &pattern, bool skipWhiteSpaces);
00174 
00175     Q_INVOKABLE void indent(KTextEditor::Range range, int change);
00176     Q_INVOKABLE void align(const KTextEditor::Range& range);
00177 
00178   private:
00179     bool _isCode(int defaultStyle);
00180 
00181     KateDocument *m_document;
00182 };
00183 
00184 
00185 #endif
00186 
00187 // kate: space-indent on; indent-width 2; replace-tabs on;

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal