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

Kate

katescriptdocument.cpp

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 #include "katescriptdocument.h"
00021 
00022 #include "katedocument.h"
00023 #include "kateview.h"
00024 #include "katerenderer.h"
00025 #include "kateconfig.h"
00026 #include "katehighlight.h"
00027 #include "katescript.h"
00028 
00029 #include <ktexteditor/highlightinterface.h>
00030 #include <ktexteditor/movingcursor.h>
00031 
00032 #include <QtScript/QScriptEngine>
00033 
00034 KateScriptDocument::KateScriptDocument(QObject *parent)
00035   : QObject(parent), m_document(0)
00036 {
00037 }
00038 
00039 void KateScriptDocument::setDocument(KateDocument *document)
00040 {
00041   m_document = document;
00042 }
00043 
00044 KateDocument *KateScriptDocument::document()
00045 {
00046   return m_document;
00047 }
00048 
00049 int KateScriptDocument::defStyleNum(int line, int column)
00050 {
00051   QList<KTextEditor::Attribute::Ptr> attributes = m_document->highlight()->attributes(((KateView*) m_document->activeView())->renderer()->config()->schema());
00052   KTextEditor::Attribute::Ptr a = attributes[document()->plainKateTextLine(line)->attribute(column)];
00053   return a->property(KateExtendedAttribute::AttributeDefaultStyleIndex).toInt();
00054 }
00055 
00056 int KateScriptDocument::defStyleNum(const KTextEditor::Cursor& cursor)
00057 {
00058   return defStyleNum(cursor.line(), cursor.column());
00059 }
00060 
00061 
00062 bool KateScriptDocument::isCode(int line, int column)
00063 {
00064   const int defaultStyle = defStyleNum(line, column);
00065   return _isCode(defaultStyle);
00066 }
00067 
00068 bool KateScriptDocument::isCode(const KTextEditor::Cursor& cursor)
00069 {
00070   return isCode(cursor.line(), cursor.column());
00071 }
00072 
00073 bool KateScriptDocument::isComment(int line, int column)
00074 {
00075   const int defaultStyle = defStyleNum(line, column);
00076   return defaultStyle == KTextEditor::HighlightInterface::dsComment;
00077 }
00078 
00079 bool KateScriptDocument::isComment(const KTextEditor::Cursor& cursor)
00080 {
00081   return isComment(cursor.line(), cursor.column());
00082 }
00083 
00084 bool KateScriptDocument::isString(int line, int column)
00085 {
00086   const int defaultStyle = defStyleNum(line, column);
00087   return defaultStyle == KTextEditor::HighlightInterface::dsString;
00088 }
00089 
00090 bool KateScriptDocument::isString(const KTextEditor::Cursor& cursor)
00091 {
00092   return isString(cursor.line(), cursor.column());
00093 }
00094 
00095 bool KateScriptDocument::isRegionMarker(int line, int column)
00096 {
00097   const int defaultStyle = defStyleNum(line, column);
00098   return defaultStyle == KTextEditor::HighlightInterface::dsRegionMarker;
00099 }
00100 
00101 bool KateScriptDocument::isRegionMarker(const KTextEditor::Cursor& cursor)
00102 {
00103   return isRegionMarker(cursor.line(), cursor.column());
00104 }
00105 
00106 bool KateScriptDocument::isChar(int line, int column)
00107 {
00108   const int defaultStyle = defStyleNum(line, column);
00109   return defaultStyle == KTextEditor::HighlightInterface::dsChar;
00110 }
00111 
00112 bool KateScriptDocument::isChar(const KTextEditor::Cursor& cursor)
00113 {
00114   return isChar(cursor.line(), cursor.column());
00115 }
00116 
00117 bool KateScriptDocument::isOthers(int line, int column)
00118 {
00119   const int defaultStyle = defStyleNum(line, column);
00120   return defaultStyle == KTextEditor::HighlightInterface::dsOthers;
00121 }
00122 
00123 bool KateScriptDocument::isOthers(const KTextEditor::Cursor& cursor)
00124 {
00125   return isOthers(cursor.line(), cursor.column());
00126 }
00127 
00128 int KateScriptDocument::firstVirtualColumn(int line)
00129 {
00130   const int tabWidth = m_document->config()->tabWidth();
00131   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00132   const int firstPos = textLine ? textLine->firstChar() : -1;
00133   if(!textLine || firstPos == -1)
00134     return -1;
00135   return textLine->indentDepth(tabWidth);
00136 }
00137 
00138 int KateScriptDocument::lastVirtualColumn(int line)
00139 {
00140   const int tabWidth = m_document->config()->tabWidth();
00141   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00142   const int lastPos = textLine ? textLine->lastChar() : -1;
00143   if(!textLine || lastPos == -1)
00144     return -1;
00145   return textLine->toVirtualColumn(lastPos, tabWidth);
00146 }
00147 
00148 int KateScriptDocument::toVirtualColumn(int line, int column)
00149 {
00150   const int tabWidth = m_document->config()->tabWidth();
00151   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00152   if (!textLine || column < 0 || column > textLine->length()) return -1;
00153   return textLine->toVirtualColumn(column, tabWidth);
00154 }
00155 
00156 int KateScriptDocument::toVirtualColumn(const KTextEditor::Cursor& cursor)
00157 {
00158   return toVirtualColumn(cursor.line(), cursor.column());
00159 }
00160 
00161 KTextEditor::Cursor KateScriptDocument::toVirtualCursor(const KTextEditor::Cursor& cursor)
00162 {
00163   return KTextEditor::Cursor(cursor.line(),
00164                              toVirtualColumn(cursor.line(), cursor.column()));
00165 }
00166 
00167 int KateScriptDocument::fromVirtualColumn(int line, int virtualColumn)
00168 {
00169   const int tabWidth = m_document->config()->tabWidth();
00170   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00171   if(!textLine || virtualColumn < 0 || virtualColumn > textLine->virtualLength(tabWidth))
00172     return -1;
00173   return textLine->fromVirtualColumn(virtualColumn, tabWidth);
00174 }
00175 
00176 int KateScriptDocument::fromVirtualColumn(const KTextEditor::Cursor& virtualCursor)
00177 {
00178   return fromVirtualColumn(virtualCursor.line(), virtualCursor.column());
00179 }
00180 
00181 KTextEditor::Cursor KateScriptDocument::fromVirtualCursor(const KTextEditor::Cursor& virtualCursor)
00182 {
00183   return KTextEditor::Cursor(virtualCursor.line(),
00184                              fromVirtualColumn(virtualCursor.line(), virtualCursor.column()));
00185 }
00186 
00187 KTextEditor::Cursor KateScriptDocument::rfind(int line, int column, const QString& text, int attribute)
00188 {
00189   QScopedPointer<KTextEditor::MovingCursor> cursor(document()->newMovingCursor(KTextEditor::Cursor(line, column)));
00190   const int start = cursor->line();
00191   QList<KTextEditor::Attribute::Ptr> attributes =
00192       m_document->highlight()->attributes(((KateView*)m_document->activeView())->renderer()->config()->schema());
00193 
00194   do {
00195     Kate::TextLine textLine = m_document->plainKateTextLine(cursor->line());
00196     if (!textLine)
00197       break;
00198 
00199     if (cursor->line() != start) {
00200       cursor->setColumn(textLine->length());
00201     } else if (column >= textLine->length()) {
00202       cursor->setColumn(qMax(textLine->length(), 0));
00203     }
00204 
00205     int foundAt;
00206     while ((foundAt = textLine->string().left(cursor->column()).lastIndexOf(text, -1, Qt::CaseSensitive)) >= 0) {
00207         bool hasStyle = true;
00208         if (attribute != -1) {
00209           KTextEditor::Attribute::Ptr a = attributes[textLine->attribute(foundAt)];
00210           const int ds = a->property(KateExtendedAttribute::AttributeDefaultStyleIndex).toInt();
00211           hasStyle = (ds == attribute);
00212         }
00213 
00214         if (hasStyle) {
00215           return KTextEditor::Cursor(cursor->line(), foundAt);
00216         } else {
00217           cursor->setColumn(foundAt);
00218         }
00219     }
00220   } while (cursor->gotoPreviousLine());
00221 
00222   return KTextEditor::Cursor::invalid();
00223 }
00224 
00225 KTextEditor::Cursor KateScriptDocument::rfind(const KTextEditor::Cursor& cursor, const QString& text, int attribute)
00226 {
00227   return rfind(cursor.line(), cursor.column(), text, attribute);
00228 }
00229 
00230 KTextEditor::Cursor KateScriptDocument::anchor(int line, int column, QChar character)
00231 {
00232   QList<KTextEditor::Attribute::Ptr> attributes =
00233       m_document->highlight()->attributes(((KateView*) m_document->activeView())->renderer()->config()->schema());
00234   int count = 1;
00235   QChar lc;
00236   QChar rc;
00237   if (character == '(' || character == ')') {
00238     lc = '(';
00239     rc = ')';
00240   } else if (character == '{' || character == '}') {
00241     lc = '{';
00242     rc = '}';
00243   } else if (character == '[' || character == ']') {
00244     lc = '[';
00245     rc = ']';
00246   } else {
00247     kDebug(13060) << "invalid anchor character:" << character << " allowed are: (){}[]";
00248     return KTextEditor::Cursor::invalid();
00249   }
00250 
00251   QScopedPointer<KTextEditor::MovingCursor> cursor(document()->newMovingCursor(KTextEditor::Cursor(line, column)));
00252 
00253   // Move backwards char by char and find the opening character
00254   while (cursor->move(-1)) {
00255     QChar ch = document()->character(cursor->toCursor());
00256     if (ch == lc) {
00257       KTextEditor::Attribute::Ptr a = attributes[document()->plainKateTextLine(cursor->line())->attribute(cursor->column())];
00258       const int ds = a->property(KateExtendedAttribute::AttributeDefaultStyleIndex).toInt();
00259       if (_isCode(ds)) {
00260         --count;
00261       }
00262     }
00263     else if (ch == rc) {
00264       KTextEditor::Attribute::Ptr a = attributes[document()->plainKateTextLine(cursor->line())->attribute(cursor->column())];
00265       const int ds = a->property(KateExtendedAttribute::AttributeDefaultStyleIndex).toInt();
00266       if (_isCode(ds)) {
00267         ++count;
00268       }
00269     }
00270 
00271     if (count == 0) {
00272       return cursor->toCursor();
00273     }
00274   }
00275   return KTextEditor::Cursor::invalid ();
00276 }
00277 
00278 KTextEditor::Cursor KateScriptDocument::anchor(const KTextEditor::Cursor& cursor, QChar character)
00279 {
00280   return anchor(cursor.line(), cursor.column(), character);
00281 }
00282 
00283 bool KateScriptDocument::startsWith (int line, const QString &pattern, bool skipWhiteSpaces)
00284 {
00285   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00286 
00287   if (!textLine)
00288     return false;
00289 
00290   if (skipWhiteSpaces)
00291     return textLine->matchesAt(textLine->firstChar(), pattern);
00292 
00293   return textLine->startsWith (pattern);
00294 }
00295 
00296 bool KateScriptDocument::endsWith (int line, const QString &pattern, bool skipWhiteSpaces)
00297 {
00298   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00299 
00300   if (!textLine)
00301     return false;
00302 
00303   if (skipWhiteSpaces)
00304     return textLine->matchesAt(textLine->lastChar() - pattern.length() + 1, pattern);
00305 
00306   return textLine->endsWith (pattern);
00307 }
00308 
00309 //BEGIN Automatically generated
00310 
00311 QString KateScriptDocument::fileName()
00312 {
00313   return m_document->documentName();
00314 }
00315 
00316 QString KateScriptDocument::url()
00317 {
00318   return m_document->url().prettyUrl();
00319 }
00320 
00321 QString KateScriptDocument::mimeType()
00322 {
00323   return m_document->mimeType();
00324 }
00325 
00326 QString KateScriptDocument::encoding()
00327 {
00328   return m_document->encoding();
00329 }
00330 
00331 QString KateScriptDocument::highlightingMode()
00332 {
00333   return m_document->highlightingMode();
00334 }
00335 
00336 QStringList KateScriptDocument::embeddedHighlightingModes()
00337 {
00338   return m_document->embeddedHighlightingModes();
00339 }
00340 
00341 QString KateScriptDocument::highlightingModeAt(const KTextEditor::Cursor& pos)
00342 {
00343   return m_document->highlightingModeAt(pos);
00344 }
00345 
00346 bool KateScriptDocument::isModified()
00347 {
00348   return m_document->isModified();
00349 }
00350 
00351 QString KateScriptDocument::text()
00352 {
00353   return m_document->text();
00354 }
00355 
00356 QString KateScriptDocument::text(int fromLine, int fromColumn, int toLine, int toColumn)
00357 {
00358   return text(KTextEditor::Range(fromLine, fromColumn, toLine, toColumn));
00359 }
00360 
00361 QString KateScriptDocument::text(const KTextEditor::Cursor& from, const KTextEditor::Cursor& to)
00362 {
00363   return text(KTextEditor::Range(from, to));
00364 }
00365 
00366 QString KateScriptDocument::text(const KTextEditor::Range& range)
00367 {
00368   return m_document->text(range);
00369 }
00370 
00371 QString KateScriptDocument::line(int line)
00372 {
00373   return m_document->line(line);
00374 }
00375 
00376 QString KateScriptDocument::wordAt(int line, int column)
00377 {
00378   return m_document->getWord(KTextEditor::Cursor(line, column));
00379 }
00380 
00381 QString KateScriptDocument::wordAt(const KTextEditor::Cursor& cursor)
00382 {
00383   return m_document->getWord(cursor);
00384 }
00385 
00386 QString KateScriptDocument::charAt(int line, int column)
00387 {
00388   return charAt(KTextEditor::Cursor(line, column));
00389 }
00390 
00391 QString KateScriptDocument::charAt(const KTextEditor::Cursor& cursor)
00392 {
00393   const QChar c = m_document->character(cursor);
00394   return c.isNull() ? "" : QString(c);
00395 }
00396 
00397 QString KateScriptDocument::firstChar(int line)
00398 {
00399   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00400   if(!textLine) return "";
00401   // check for isNull(), as the returned character then would be "\0"
00402   const QChar c = textLine->at(textLine->firstChar());
00403   return c.isNull() ? "" : QString(c);
00404 }
00405 
00406 QString KateScriptDocument::lastChar(int line)
00407 {
00408   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00409   if(!textLine) return "";
00410   // check for isNull(), as the returned character then would be "\0"
00411   const QChar c = textLine->at(textLine->lastChar());
00412   return c.isNull() ? "" : QString(c);
00413 }
00414 
00415 bool KateScriptDocument::isSpace(int line, int column)
00416 {
00417   return isSpace(KTextEditor::Cursor(line, column));
00418 }
00419 
00420 bool KateScriptDocument::isSpace(const KTextEditor::Cursor& cursor)
00421 {
00422   return m_document->character(cursor).isSpace();
00423 }
00424 
00425 bool KateScriptDocument::matchesAt(int line, int column, const QString &s)
00426 {
00427   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00428   return textLine ? textLine->matchesAt(column, s) : false;
00429 }
00430 
00431 bool KateScriptDocument::matchesAt(const KTextEditor::Cursor& cursor, const QString &s)
00432 {
00433   return matchesAt(cursor.line(), cursor.column(), s);
00434 }
00435 
00436 bool KateScriptDocument::setText(const QString &s)
00437 {
00438   return m_document->setText(s);
00439 }
00440 
00441 bool KateScriptDocument::clear()
00442 {
00443   return m_document->clear();
00444 }
00445 
00446 bool KateScriptDocument::truncate(int line, int column)
00447 {
00448   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00449   if (!textLine || textLine->text().size() < column)
00450     return false;
00451 
00452   KTextEditor::Cursor from (line, column), to (line, textLine->text().size() - column);
00453   return removeText(KTextEditor::Range(from, to));
00454 }
00455 
00456 bool KateScriptDocument::truncate(const KTextEditor::Cursor& cursor)
00457 {
00458   return truncate(cursor.line(), cursor.column());
00459 }
00460 
00461 bool KateScriptDocument::insertText(int line, int column, const QString &s)
00462 {
00463   return insertText(KTextEditor::Cursor(line, column), s);
00464 }
00465 
00466 bool KateScriptDocument::insertText(const KTextEditor::Cursor& cursor, const QString &s)
00467 {
00468   return m_document->insertText(cursor, s);
00469 }
00470 
00471 bool KateScriptDocument::removeText(int fromLine, int fromColumn, int toLine, int toColumn)
00472 {
00473   return removeText(KTextEditor::Range(fromLine, fromColumn, toLine, toColumn));
00474 }
00475 
00476 bool KateScriptDocument::removeText(const KTextEditor::Cursor& from, const KTextEditor::Cursor& to)
00477 {
00478   return removeText(KTextEditor::Range(from, to));
00479 }
00480 
00481 bool KateScriptDocument::removeText(const KTextEditor::Range& range)
00482 {
00483   return m_document->removeText(range);
00484 }
00485 
00486 bool KateScriptDocument::insertLine(int line, const QString &s)
00487 {
00488   return m_document->insertLine (line, s);
00489 }
00490 
00491 bool KateScriptDocument::removeLine(int line)
00492 {
00493   return m_document->removeLine (line);
00494 }
00495 
00496 void KateScriptDocument::joinLines(int startLine, int endLine)
00497 {
00498   m_document->joinLines (startLine, endLine);
00499 }
00500 
00501 int KateScriptDocument::lines()
00502 {
00503   return m_document->lines();
00504 }
00505 
00506 int KateScriptDocument::length()
00507 {
00508   return m_document->totalCharacters();
00509 }
00510 
00511 int KateScriptDocument::lineLength(int line)
00512 {
00513   return m_document->lineLength(line);
00514 }
00515 
00516 void KateScriptDocument::editBegin()
00517 {
00518   m_document->editBegin();
00519 }
00520 
00521 void KateScriptDocument::editEnd()
00522 {
00523   m_document->editEnd ();
00524 }
00525 
00526 int KateScriptDocument::firstColumn(int line)
00527 {
00528   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00529   return textLine ? textLine->firstChar() : -1;
00530 }
00531 
00532 int KateScriptDocument::lastColumn(int line)
00533 {
00534   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00535   return textLine ? textLine->lastChar() : -1;
00536 }
00537 
00538 int KateScriptDocument::prevNonSpaceColumn(int line, int column)
00539 {
00540   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00541   if(!textLine) return -1;
00542   return textLine->previousNonSpaceChar(column);
00543 }
00544 
00545 int KateScriptDocument::prevNonSpaceColumn(const KTextEditor::Cursor& cursor)
00546 {
00547   return prevNonSpaceColumn(cursor.line(), cursor.column());
00548 }
00549 
00550 int KateScriptDocument::nextNonSpaceColumn(int line, int column)
00551 {
00552   Kate::TextLine textLine = m_document->plainKateTextLine(line);
00553   if(!textLine) return -1;
00554   return textLine->nextNonSpaceChar(column);
00555 }
00556 
00557 int KateScriptDocument::nextNonSpaceColumn(const KTextEditor::Cursor& cursor)
00558 {
00559   return nextNonSpaceColumn(cursor.line(), cursor.column());
00560 }
00561 
00562 int KateScriptDocument::prevNonEmptyLine(int line)
00563 {
00564   const int startLine = line;
00565   for (int currentLine = startLine; currentLine >= 0; --currentLine) {
00566     Kate::TextLine textLine = m_document->plainKateTextLine(currentLine);
00567     if(!textLine)
00568       return -1;
00569     if(textLine->firstChar() != -1)
00570       return currentLine;
00571   }
00572   return -1;
00573 }
00574 
00575 int KateScriptDocument::nextNonEmptyLine(int line)
00576 {
00577   const int startLine = line;
00578   for (int currentLine = startLine; currentLine < m_document->lines(); ++currentLine) {
00579     Kate::TextLine textLine = m_document->plainKateTextLine(currentLine);
00580     if(!textLine)
00581       return -1;
00582     if(textLine->firstChar() != -1)
00583       return currentLine;
00584   }
00585   return -1;
00586 }
00587 
00588 bool KateScriptDocument::isInWord(const QString &character, int attribute)
00589 {
00590   return m_document->highlight()->isInWord(character.at(0), attribute);
00591 }
00592 
00593 bool KateScriptDocument::canBreakAt(const QString &character, int attribute)
00594 {
00595   return m_document->highlight()->canBreakAt(character.at(0), attribute);
00596 }
00597 
00598 bool KateScriptDocument::canComment(int startAttribute, int endAttribute)
00599 {
00600   return m_document->highlight()->canComment(startAttribute, endAttribute);
00601 }
00602 
00603 QString KateScriptDocument::commentMarker(int attribute)
00604 {
00605   return m_document->highlight()->getCommentSingleLineStart(attribute);
00606 }
00607 
00608 QString KateScriptDocument::commentStart(int attribute)
00609 {
00610   return m_document->highlight()->getCommentStart(attribute);
00611 }
00612 
00613 QString KateScriptDocument::commentEnd(int attribute)
00614 {
00615   return m_document->highlight()->getCommentEnd(attribute);
00616 }
00617 
00618 KTextEditor::Range KateScriptDocument::documentRange()
00619 {
00620   return m_document->documentRange();
00621 }
00622 
00623 KTextEditor::Cursor KateScriptDocument::documentEnd()
00624 {
00625   return m_document->documentEnd();
00626 }
00627 
00628 int KateScriptDocument::attribute(int line, int column)
00629 {
00630   Kate::TextLine textLine = m_document->kateTextLine(line);
00631   if(!textLine) return 0;
00632   return textLine->attribute(column);
00633 }
00634 
00635 int KateScriptDocument::attribute(const KTextEditor::Cursor& cursor)
00636 {
00637   return attribute(cursor.line(), cursor.column());
00638 }
00639 
00640 bool KateScriptDocument::isAttribute(int line, int column, int attr)
00641 {
00642   return attr == attribute(line, column);
00643 }
00644 
00645 bool KateScriptDocument::isAttribute(const KTextEditor::Cursor& cursor, int attr)
00646 {
00647   return isAttribute(cursor.line(), cursor.column(), attr);
00648 }
00649 
00650 QString KateScriptDocument::attributeName(int line, int column)
00651 {
00652   QList<KTextEditor::Attribute::Ptr> attributes = m_document->highlight()->attributes(((KateView*) m_document->activeView())->renderer()->config()->schema());
00653   KTextEditor::Attribute::Ptr a = attributes[document()->plainKateTextLine(line)->attribute(column)];
00654   return a->property(KateExtendedAttribute::AttributeName).toString();
00655 }
00656 
00657 QString KateScriptDocument::attributeName(const KTextEditor::Cursor& cursor)
00658 {
00659   return attributeName(cursor.line(), cursor.column());
00660 }
00661 
00662 bool KateScriptDocument::isAttributeName(int line, int column, const QString &name)
00663 {
00664   return name == attributeName(line, column);
00665 }
00666 
00667 bool KateScriptDocument::isAttributeName(const KTextEditor::Cursor& cursor, const QString &name)
00668 {
00669   return isAttributeName(cursor.line(), cursor.column(), name);
00670 }
00671 
00672 QString KateScriptDocument::variable(const QString &s)
00673 {
00674   return m_document->variable(s);
00675 }
00676 
00677 //END
00678 
00679 bool KateScriptDocument::_isCode(int defaultStyle)
00680 {
00681   return (defaultStyle != KTextEditor::HighlightInterface::dsComment
00682        && defaultStyle != KTextEditor::HighlightInterface::dsString
00683        && defaultStyle != KTextEditor::HighlightInterface::dsRegionMarker
00684        && defaultStyle != KTextEditor::HighlightInterface::dsChar
00685        && defaultStyle != KTextEditor::HighlightInterface::dsOthers);
00686 }
00687 
00688 void KateScriptDocument::indent(KTextEditor::Range range, int change)
00689 {
00690   m_document->indent(range, change);
00691 }
00692 
00693 void KateScriptDocument::align(const KTextEditor::Range& range)
00694 {
00695   if (m_document->activeKateView()) {
00696     m_document->align(m_document->activeKateView(), range);
00697   }
00698 }
00699 
00700 // kate: space-indent on; indent-width 2; replace-tabs on;
00701 

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