textblock.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef TEXTBLOCK_H
00020 #define TEXTBLOCK_H
00021
00022 #include <qdom.h>
00023 #include <qobject.h>
00024
00025 class CodeDocument;
00026
00032 class TextBlock : virtual public QObject {
00033 friend class CodeGenObjectWithTextBlocks;
00034 friend class ClassifierCodeDocument;
00035 Q_OBJECT
00036 public:
00037
00038
00039
00040
00044 explicit TextBlock ( CodeDocument * parent, const QString & text = "");
00045
00046
00047 ~TextBlock ( );
00048
00049
00050
00051
00052
00053
00054
00060 void setText ( const QString &new_var );
00061
00066 void appendText ( const QString &new_text );
00067
00073 QString getText ( ) const;
00074
00080 QString getTag( ) const;
00081
00087 void setTag( const QString &value );
00088
00093 CodeDocument * getParentDocument ( );
00094
00100 void setWriteOutText ( bool new_var );
00101
00107 bool getWriteOutText ( );
00108
00113 void setIndentationLevel ( int level );
00114
00119 int getIndentationLevel ( );
00120
00123 QString getIndentationString ( int level = 0);
00124
00127 QString getIndentation();
00128
00129 QString getNewLineEndingChars ( );
00130
00133
00134 QString formatMultiLineText ( const QString &text, const QString &linePrefix,
00135 const QString& breakStr,
00136 bool alwaysAddBreak = true, bool lastLineHasBreak = true);
00137
00142 virtual QString unformatText ( const QString & text, const QString & indent = "");
00143
00147 virtual QString toString ( );
00148
00153 static QString encodeText(const QString& text , const QString &endChars);
00154
00155
00159 static QString decodeText(const QString& text, const QString &endChars);
00160
00164 virtual void saveToXMI ( QDomDocument & doc, QDomElement & root ) = 0;
00165
00169 virtual void loadFromXMI ( QDomElement & root ) = 0;
00170
00175 bool canDelete ();
00176
00179 virtual void setAttributesFromObject (TextBlock * obj);
00180
00187 virtual QString getNewEditorLine( int indentAmount = 0 );
00188
00196 virtual int firstEditableLine();
00197 virtual int lastEditableLine();
00198
00199 protected:
00200
00205 virtual void release ();
00206
00211 void setParentDocument ( CodeDocument * new_var );
00212
00216 virtual void setAttributesOnNode ( QDomDocument & doc, QDomElement & blockElement);
00217
00221 virtual void setAttributesFromNode ( QDomElement & element);
00222
00223 bool m_canDelete;
00224
00225 private:
00226
00227
00228 QString m_text;
00229 QString m_tag;
00230
00231
00232 bool m_writeOutText;
00233
00234 int m_indentationLevel;
00235 CodeDocument * m_parentDocument;
00236
00237 void initFields ( CodeDocument * doc);
00238
00239 };
00240
00241 #endif // TEXTBLOCK_H
This file is part of the documentation for umbrello Version 3.1.0.