umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
|
#include <textblock.h>
Public Member Functions | |
TextBlock (CodeDocument *parent, const QString &text=QString()) | |
virtual | ~TextBlock () |
void | setText (const QString &text) |
QString | getText () const |
void | appendText (const QString &text) |
void | setTag (const QString &value) |
QString | getTag () const |
CodeDocument * | getParentDocument () const |
void | setWriteOutText (bool write) |
bool | getWriteOutText () const |
void | setIndentationLevel (int level) |
int | getIndentationLevel () const |
QString | getIndentationString (int level=0) const |
virtual QString | unformatText (const QString &text, const QString &indent=QString()) |
virtual QString | toString () const |
virtual void | saveToXMI (QXmlStreamWriter &writer)=0 |
virtual void | loadFromXMI (QDomElement &root)=0 |
bool | canDelete () const |
virtual void | setAttributesFromObject (TextBlock *obj) |
virtual QString | getNewEditorLine (int amount=0) |
virtual int | firstEditableLine () |
virtual int | lastEditableLine () |
Static Public Member Functions | |
static QString | getIndentation () |
static QString | getNewLineEndingChars () |
static QString | formatMultiLineText (const QString &work, const QString &linePrefix, const QString &breakStr, bool addBreak=true, bool lastLineHasBreak=true) |
static QString | encodeText (const QString &text, const QString &endLine) |
static QString | decodeText (const QString &text, const QString &endLine) |
Protected Member Functions | |
void | setCanDelete (bool canDelete) |
virtual void | release () |
virtual void | setAttributesOnNode (QXmlStreamWriter &writer) |
virtual void | setAttributesFromNode (QDomElement &root) |
Private Attributes | |
QString | m_text |
QString | m_tag |
bool | m_canDelete |
bool | m_writeOutText |
int | m_indentationLevel |
CodeDocument * | m_parentDocument |
Friends | |
class | CodeGenObjectWithTextBlocks |
class | ClassifierCodeDocument |
QDebug | operator<< (QDebug os, const TextBlock &obj) |
The fundamental unit of text within an output file containing code.
|
explicit |
Constructor.
|
virtual |
Destructor.
void TextBlock::appendText | ( | const QString & | text | ) |
Add text to this object.
text | the text to add |
bool TextBlock::canDelete | ( | ) | const |
Determine if its OK to delete this textblock from the document. Used by the text editor to know if deletion could cause a crash of the program.
|
static |
Decode text from XML storage. We simply convert all newLine entity 
 to chosen line ending.
text | the not yet decoded text |
endLine | the chars at the end of each line |
|
static |
Encode text for XML storage. We simply convert all types of newLines to the "\n" or 
 entity.
text | the not yet encoded text |
endLine | the chars at the end of each line |
|
virtual |
TODO: Ush. These are terrifically bad and must one day go away. Both methods indicate the range of lines in this textblock which may be edited by the codeeditor (assuming that any are actually editable). The default case is no lines are editable. The line numbering starts with '0' and a '-1' means no line qualifies.
Reimplemented in CPPCodeDocumentation, DCodeDocumentation, JavaCodeDocumentation, and RubyCodeDocumentation.
|
static |
Format a long text string to be more readable.
work | the original text for formatting |
linePrefix | a line prefix |
breakStr | a break string |
addBreak | control to add always a break string |
lastLineHasBreak | control to add a break string to the last line |
|
static |
Get how much a single "level" of indentation will actually indent.
int TextBlock::getIndentationLevel | ( | ) | const |
Get how many times to indent this text block. The amount of each indentation is determined from the parent codedocument codegeneration policy.
QString TextBlock::getIndentationString | ( | int | level = 0 | ) | const |
Get the actual amount of indentation for a given level of indentation.
level | the level of interest |
|
virtual |
Used by the CodeEditor. It provides it with an appropriate starting string for a new line of text within the given textblock (for example a string with the proper indentation). If the indentation amount is '0' the current indentation string will be used.
TODO: Can be refactored away and replaced with getIndentationString.
amount | the number of indent steps to use |
Reimplemented in CPPCodeComment, CPPCodeDocumentation, DCodeComment, DCodeDocumentation, JavaCodeComment, JavaCodeDocumentation, RubyCodeComment, and RubyCodeDocumentation.
|
static |
Get the new line chars which ends the line.
CodeDocument * TextBlock::getParentDocument | ( | ) | const |
Get the value of m_parentDoc
QString TextBlock::getTag | ( | ) | const |
Get the tag of this text block. This tag may be used to find this text block in the code document to which it belongs.
QString TextBlock::getText | ( | ) | const |
Get the value of m_text The actual text of this code block.
bool TextBlock::getWriteOutText | ( | ) | const |
Get the value of m_writeOutText Whether or not to include the text of this TextBlock into a file.
|
virtual |
Reimplemented in CPPCodeDocumentation, CPPHeaderCodeOperation, DCodeDocumentation, DCodeOperation, JavaCodeDocumentation, JavaCodeOperation, RubyCodeDocumentation, and RubyCodeOperation.
|
pure virtual |
Load params from the appropriate XMI element node.
root | the starting point in the xmi document to load from |
Implemented in CodeAccessorMethod, CodeBlock, CodeBlockWithComments, CodeClassFieldDeclarationBlock, CodeComment, CodeOperation, CPPHeaderClassDeclarationBlock, DClassDeclarationBlock, HierarchicalCodeBlock, JavaClassDeclarationBlock, RubyClassDeclarationBlock, XMLElementCodeBlock, and OwnedHierarchicalCodeBlock.
|
protectedvirtual |
Causes the text block to release all of its connections and any other text blocks that it 'owns'. Needed to be called prior to deletion of the textblock. TODO: Does nothing.
Reimplemented in CodeAccessorMethod, CodeClassFieldDeclarationBlock, CodeMethodBlock, HierarchicalCodeBlock, and OwnedHierarchicalCodeBlock.
|
pure virtual |
Save the XMI representation of this object
writer | the QXmlStreamWriter serialization target |
Implemented in CodeAccessorMethod, CodeBlock, CodeBlockWithComments, CodeClassFieldDeclarationBlock, CodeComment, CodeOperation, CPPCodeComment, CPPCodeDocumentation, CPPHeaderClassDeclarationBlock, DClassDeclarationBlock, DCodeComment, DCodeDocumentation, HierarchicalCodeBlock, JavaClassDeclarationBlock, JavaCodeDocumentation, RubyClassDeclarationBlock, RubyCodeDocumentation, XMLElementCodeBlock, and OwnedHierarchicalCodeBlock.
|
protectedvirtual |
Set the class attributes of this object from the passed element node.
root | the xmi element from which to load |
Reimplemented in CodeAccessorMethod, CodeBlock, CodeBlockWithComments, CodeClassFieldDeclarationBlock, CodeMethodBlock, CodeOperation, DCodeAccessorMethod, HierarchicalCodeBlock, JavaCodeAccessorMethod, OwnedHierarchicalCodeBlock, RubyCodeAccessorMethod, and XMLElementCodeBlock.
|
virtual |
Set the class attributes from a passed object.
obj | text block from which the attributes are taken |
Reimplemented in CodeAccessorMethod, CodeBlock, CodeBlockWithComments, CodeClassFieldDeclarationBlock, CodeMethodBlock, CodeOperation, CPPHeaderClassDeclarationBlock, DClassDeclarationBlock, HierarchicalCodeBlock, and OwnedHierarchicalCodeBlock.
|
protectedvirtual |
Set attributes of the node that represents this class in the XMI document.
writer | the QXmlStreamWriter serialization target |
Reimplemented in CodeAccessorMethod, CodeBlock, CodeBlockWithComments, CodeClassFieldDeclarationBlock, CodeMethodBlock, CodeOperation, DCodeAccessorMethod, HierarchicalCodeBlock, JavaCodeAccessorMethod, OwnedHierarchicalCodeBlock, RubyCodeAccessorMethod, and XMLElementCodeBlock.
|
protected |
Set the attribute m_canDelete.
canDelete | the new value to set |
void TextBlock::setIndentationLevel | ( | int | level | ) |
Set how many times to indent this text block. The amount of each indentation is determined from the parent codedocument codegeneration policy.
level | the new value for the indentation level |
void TextBlock::setTag | ( | const QString & | value | ) |
Set the tag of this text block. This tag may be used to find this text block in the code document to which it belongs.
value | the new value for the tag |
void TextBlock::setText | ( | const QString & | text | ) |
Set the value of m_text The actual text of this code block.
text | the new value of m_text |
void TextBlock::setWriteOutText | ( | bool | write | ) |
Set the value of m_writeOutText Whether or not to include the text of this TextBlock into a file.
write | the new value of m_writeOutText |
|
virtual |
Return the text in the right format. Returned string is empty if m_writeOutText is false.
Reimplemented in CodeBlockWithComments, CodeMethodBlock, CPPCodeComment, CPPCodeDocumentation, DCodeComment, DCodeDocumentation, HierarchicalCodeBlock, JavaCodeComment, JavaCodeDocumentation, RubyCodeComment, RubyCodeDocumentation, and XMLCodeComment.
|
virtual |
UnFormat a long text string. Typically, this means removing the indentation (linePrefix) and/or newline chars from each line. If an indentation is not specified, then the current indentation is used.
text | the original text for unformatting |
indent | the indentation |
Reimplemented in CPPCodeComment, CPPCodeDocumentation, DCodeComment, DCodeDocumentation, JavaCodeComment, JavaCodeDocumentation, RubyCodeComment, and RubyCodeDocumentation.
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |