umbrello API Documentation

textblock.h

00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  *   copyright (C) 2004-2006                                               *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 /*  This code generated by:
00013  *      Author : thomas
00014  *      Date   : Wed Jun 18 2003
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     // Constructors/Destructors
00039     //
00040 
00044     explicit TextBlock ( CodeDocument * parent, const QString & text = "");
00045 
00046     // destructor
00047     ~TextBlock ( );
00048 
00049     // Public attributes
00050     //
00051 
00052     // Public attribute accessor methods
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     // should be static
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     // The actual text of this code block.
00228     QString m_text;
00229     QString m_tag;
00230 
00231     // Whether or not to include the text of this TextBlock into a file.
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
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:00 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003