Kate
katelinelayout.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2002-2005 Hamish Rodda <rodda@kde.org> 00003 Copyright (C) 2003 Anakim Border <aborder@sources.sourceforge.net> 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 version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef _KATE_LINELAYOUT_H_ 00021 #define _KATE_LINELAYOUT_H_ 00022 00023 #include <ksharedptr.h> 00024 00025 #include "katetextline.h" 00026 00027 #include <ktexteditor/cursor.h> 00028 00029 class QTextLayout; 00030 class KateDocument; 00031 class KateTextLayout; 00032 00033 class KateLineLayout : public KShared 00034 { 00035 public: 00036 KateLineLayout(KateDocument* doc = 0L); 00037 ~KateLineLayout(); 00038 00039 KateDocument* doc() const; 00040 void debugOutput() const; 00041 00042 void clear(); 00043 bool isValid() const; 00044 bool isOutsideDocument() const; 00045 00046 bool isRightToLeft() const; 00047 00048 bool includesCursor(const KTextEditor::Cursor& realCursor) const; 00049 00050 friend bool operator> (const KateLineLayout& r, const KTextEditor::Cursor& c); 00051 friend bool operator>= (const KateLineLayout& r, const KTextEditor::Cursor& c); 00052 friend bool operator< (const KateLineLayout& r, const KTextEditor::Cursor& c); 00053 friend bool operator<= (const KateLineLayout& r, const KTextEditor::Cursor& c); 00054 00055 const Kate::TextLine& textLine(bool forceReload = false) const; 00056 int length() const; 00057 00058 int line() const; 00062 void setLine(int line, int virtualLine = -1); 00063 KTextEditor::Cursor start() const; 00064 00065 int virtualLine() const; 00066 void setVirtualLine(int virtualLine); 00067 00068 bool isDirty(int viewLine) const; 00069 bool setDirty(int viewLine, bool dirty = true); 00070 00071 int width() const; 00072 int widthOfLastLine() const; 00073 00074 int viewLineCount() const; 00075 KateTextLayout viewLine(int viewLine) const; 00076 int viewLineForColumn(int column) const; 00077 00078 bool startsInvisibleBlock() const; 00079 00080 // This variable is used as follows: 00081 // non-dynamic-wrapping mode: unused 00082 // dynamic wrapping mode: 00083 // first viewLine of a line: the X position of the first non-whitespace char 00084 // subsequent viewLines: the X offset from the left of the display. 00085 // 00086 // this is used to provide a dynamic-wrapping-retains-indent feature. 00087 int shiftX() const; 00088 void setShiftX(int shiftX); 00089 00090 QTextLayout* layout() const; 00091 void setLayout(QTextLayout* layout); 00092 void invalidateLayout(); 00093 00094 bool isLayoutDirty() const; 00095 void setLayoutDirty(bool dirty = true); 00096 00097 bool usePlainTextLine () const; 00098 void setUsePlainTextLine (bool plain = true); 00099 00100 private: 00101 // Disable copy 00102 KateLineLayout(const KateLineLayout& copy); 00103 00104 QTextLayout* takeLayout() const; 00105 00106 KateDocument* m_doc; 00107 mutable Kate::TextLine m_textLine; 00108 int m_line; 00109 int m_virtualLine; 00110 int m_shiftX; 00111 00112 QTextLayout* m_layout; 00113 QList<bool> m_dirtyList; 00114 00115 bool m_layoutDirty; 00116 bool m_usePlainTextLine; 00117 }; 00118 00119 typedef KSharedPtr<KateLineLayout> KateLineLayoutPtr; 00120 00121 #endif
KDE 4.6 API Reference