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

Kate

katetextrange.h

Go to the documentation of this file.
00001 /*  This file is part of the Kate project.
00002  *
00003  *  Copyright (C) 2010 Christoph Cullmann <cullmann@kde.org>
00004  *
00005  *  Based on code of the SmartCursor/Range by:
00006  *  Copyright (C) 2003-2005 Hamish Rodda <rodda@kde.org>
00007  *
00008  *  This library is free software; you can redistribute it and/or
00009  *  modify it under the terms of the GNU Library General Public
00010  *  License as published by the Free Software Foundation; either
00011  *  version 2 of the License, or (at your option) any later version.
00012  *
00013  *  This library is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  *  Library General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Library General Public License
00019  *  along with this library; see the file COPYING.LIB.  If not, write to
00020  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021  *  Boston, MA 02110-1301, USA.
00022  */
00023 
00024 #ifndef KATE_TEXTRANGE_H
00025 #define KATE_TEXTRANGE_H
00026 
00027 #include <ktexteditor/view.h>
00028 #include <ktexteditor/movingrange.h>
00029 #include <ktexteditor/movingrangefeedback.h>
00030 
00031 #include "katepartprivate_export.h"
00032 #include "katetextcursor.h"
00033 
00034 namespace Kate {
00035 
00036 class TextBuffer;
00037 
00046 class KATEPART_TESTS_EXPORT TextRange : public KTextEditor::MovingRange {
00047   // this is a friend, block changes might invalidate ranges...
00048   friend class TextBlock;
00049 
00050   public:
00060     TextRange (TextBuffer &buffer, const KTextEditor::Range &range, InsertBehaviors insertBehavior, EmptyBehavior emptyBehavior = AllowEmpty);
00061 
00065     ~TextRange ();
00066 
00071     void setInsertBehaviors (InsertBehaviors insertBehaviors);
00072 
00077     InsertBehaviors insertBehaviors () const;
00078 
00083     void setEmptyBehavior (EmptyBehavior emptyBehavior);
00084 
00089     EmptyBehavior emptyBehavior () const { return m_invalidateIfEmpty ? InvalidateIfEmpty : AllowEmpty; }
00090 
00095     KTextEditor::Document *document () const;
00096 
00103     void setRange (const KTextEditor::Range &range);
00104 
00113     void setRange (const KTextEditor::Cursor &start, const KTextEditor::Cursor &end) { KTextEditor::MovingRange::setRange (start, end); }
00114 
00119     const KTextEditor::MovingCursor &start () const { return m_start; }
00120 
00125     const TextCursor &startInternal() const { return m_start; }
00126 
00131     const KTextEditor::MovingCursor &end () const { return m_end; }
00132 
00137     const TextCursor &endInternal () const { return m_end; }
00138 
00143     const KTextEditor::Range toRange () const { return KTextEditor::Range (start().toCursor(), end().toCursor()); }
00144 
00149     operator const KTextEditor::Range () const { return KTextEditor::Range (start().toCursor(), end().toCursor()); }
00150 
00156     KTextEditor::View *view () const { return m_view; }
00157 
00166     void setView (KTextEditor::View *view);
00167 
00173     KTextEditor::Attribute::Ptr attribute () const { return m_attribute; }
00174 
00179     bool hasAttribute() const { return !m_attribute.isNull(); }
00180 
00188     void setAttribute (KTextEditor::Attribute::Ptr attribute);
00189 
00195     KTextEditor::MovingRangeFeedback *feedback () const { return m_feedback; }
00196 
00204     void setFeedback (KTextEditor::MovingRangeFeedback *feedback);
00205 
00211     bool attributeOnlyForViews () const { return m_attributeOnlyForViews; }
00212 
00217     void setAttributeOnlyForViews (bool onlyForViews);
00218     
00226     qreal zDepth () const { return m_zDepth; }
00227     
00237     void setZDepth (qreal zDepth);
00238 
00239   private:
00248     void checkValidity (int oldStartLine = -1, int oldEndLine = -1, bool notifyAboutChange = true);
00249 
00257     void fixLookup (int oldStartLine, int oldEndLine, int startLine, int endLine);
00258 
00259   private:
00264     TextBuffer &m_buffer;
00265 
00269     TextCursor m_start;
00270 
00274     TextCursor m_end;
00275 
00279     KTextEditor::View *m_view;
00280 
00284     KTextEditor::Attribute::Ptr m_attribute;
00285 
00289     KTextEditor::MovingRangeFeedback *m_feedback;
00290     
00294     qreal m_zDepth;
00295 
00299     bool m_attributeOnlyForViews;
00300 
00304     bool m_invalidateIfEmpty;
00305 };
00306 
00307 }
00308 
00309 #endif

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