47 #include <QKeySequence>
51 #include <QMouseEvent>
85 void CodeEditor::clearText()
87 m_selectedTextBlock = 0;
93 while (!m_textBlockList.isEmpty()) {
94 m_textBlockList.takeFirst();
105 return m_parentDlg->
state();
112 QLabel * CodeEditor::componentLabel()
114 return m_parentDlg->ui_componentLabel;
122 void CodeEditor::clicked(
int para,
int pos)
124 QString txt =
"position:" + QString::number(para) +
125 " / row (block):" + QString::number(pos);
126 if (m_parentDlg->ui_highlightCheckBox->isChecked()) {
135 componentLabel()->setText(txt);
148 if (m_lastTextBlockToBeEdited) {
149 updateTextBlockFromText (m_lastTextBlockToBeEdited);
150 m_lastTextBlockToBeEdited = 0;
152 return KTextEdit::close();
159 void CodeEditor::editTextBlock(
TextBlock * tBlock,
int para)
170 if ((at = dynamic_cast<UMLAttribute*>(obj))) {
172 if (dlg->exec() == KDialog::Accepted) {
177 else if ((dynamic_cast<UMLClassifier*>(obj))) {
182 else if ((role = dynamic_cast<UMLRole*>(obj))) {
184 if (dlg->exec() == KDialog::Accepted) {
189 else if ((op = dynamic_cast<UMLOperation*>(obj)))
193 if (dlg->exec() == KDialog::Accepted) {
199 uError() <<
"UNKNOWN parent for textBlock";
215 bool CodeEditor::isNonBlank(
const QString &str)
217 if (str.isEmpty() || str.trimmed().isEmpty()) {
229 DEBUG(
DBG_SRC) <<
"KEY PRESS EVENT:[" << e->text().toLatin1() <<
"] ascii CODE:" << e->key();
232 m_backspacePressed =
true;
235 if ((e->key() == 10) || (e->key() == 13) || (e->text() ==
"\r\n")) {
236 m_newLinePressed =
true;
238 KTextEdit::keyPressEvent(e);
251 setWindowTitle(i18n(caption.toUtf8().constData()));
256 QString componentName = QString(
"header for file ") + caption;
257 if (isNonBlank(header)) {
268 textCursor().setPosition(0);
282 void CodeEditor::insertText(
const QString & text,
TextBlock * parent,
283 bool editable,
const QColor & fgcolor,
const QColor & bgcolor,
284 UMLObject * umlobj,
const QString & displayName,
int startLine)
287 bool isInsert =
false;
288 setTextColor(fgcolor);
292 if (startLine == -1) {
294 if (!m_textBlockList.isEmpty()) {
295 TextBlock* lastTb = m_textBlockList.last();
296 if (m_tbInfoMap.contains(lastTb)) {
300 startLine = pi->
end + 1;
304 KTextEdit::append(text);
308 textCursor().setPosition(startLine);
309 textCursor().insertText(text);
312 int endLine = text.count(
'\n') + startLine;
314 if (m_isHighlighted) {
315 for (
int ln = startLine; ln <= endLine; ++ln) {
316 setParagraphBackgroundColor(ln, bgcolor);
323 if (m_tbInfoMap.contains(parent)) {
324 tbinfo = m_tbInfoMap[parent];
330 m_tbInfoMap.insert(parent, tbinfo);
334 if (umlobj && !tbinfo->
parent()) {
337 tbinfo->
isClickable = textBlockIsClickable(umlobj);
341 for (
int ln = startLine; ln <= endLine; ++ln) {
342 m_textBlockList.insert(ln, parent);
347 item->
start = startLine;
348 item->
size = text.size();
354 <<
" / size: " << item->
size <<
" /\ntext: " << text;
362 int increase = item->
size + 1;
363 QMap<TextBlock*, TextBlockInfo*>::Iterator it;
364 for (it = m_tbInfoMap.begin(); it != m_tbInfoMap.end(); ++it) {
367 int firstLoc = m_textBlockList.indexOf(tblock);
370 int minPara = pi->
start + firstLoc;
375 (startLine > (lastPi->
start + firstLoc + lastPi->
size) || endLine < minPara)) {
381 if (pi->
start && minPara >= endLine) {
382 pi->
start += increase;
411 if ((hb = dynamic_cast<HierarchicalCodeBlock *>(tb)))
413 else if ((mb = dynamic_cast<CodeMethodBlock*>(tb)))
415 else if ((db = dynamic_cast<CodeClassFieldDeclarationBlock*>(tb)))
417 else if ((cb = dynamic_cast<CodeBlockWithComments*>(tb)))
449 if (isNonBlank(text))
450 insertText(text, parent,
true,
state().fontColor, bgcolor, umlObj, componentName);
467 QString componentName = QString(
"CodeBlock");
474 if (isNonBlank(body))
494 QString componentName;
498 componentName = m_parentDocName +
"::attribute_field(" + parentObj->
name() +
')';
502 componentName = m_parentDocName +
"::association_field(" + role->
name() +
')';
512 if (isNonBlank(body))
513 insertText(body, db,
false,
state().
fontColor, bgcolor, parentObj);
545 QString componentName = QString(
"<b>parentless method\?</b>");
553 if (((
UMLOperation*)parentObj)->isConstructorOperation())
554 componentName = m_parentDocName +
"::operation("+ parentObj->
name()+
") constructor method";
556 componentName = m_parentDocName +
"::operation("+ parentObj->
name()+
") method";
561 componentName = m_parentDocName +
"::attribute_field(" + parentObj->
name() +
") accessor method";
565 componentName = m_parentDocName +
"::association_field(" + role->
name() +
") accessor method";
572 if (isNonBlank(startText))
573 insertText(startText, mb,
false,
state().
fontColor, bgcolor, parentObj);
576 insertText(body, mb,
true,
state().fontColor, bgcolor, parentObj);
577 if (isNonBlank(endText))
578 insertText(endText, mb,
false,
state().fontColor, bgcolor, parentObj);
596 insertText(str, tb,
false,
state().fontColor, bgcolor);
611 QString componentName;
619 typeStr =
"Interface";
622 componentName = m_parentDocName +
"::" + typeStr +
'(' + parentObj->
name() +
')';
625 componentName = m_parentDocName +
"::UNKNOWN(" + parentObj->
name() +
')';
641 if (isNonBlank(startText))
642 insertText(startText, hblock,
false,
state().
fontColor, paperColor, parentObj);
644 if (isNonBlank(endText))
645 insertText(endText, hblock,
false,
state().fontColor, paperColor);
655 textCursor().setPosition(para);
656 textCursor().insertText(text);
665 textCursor().setPosition(para);
666 textCursor().select(QTextCursor::BlockUnderCursor);
667 textCursor().removeSelectedText();
674 bool CodeEditor::textBlockIsClickable(
UMLObject * obj)
676 if (dynamic_cast<UMLAttribute*>(obj))
678 else if (dynamic_cast<UMLClassifier*>(obj))
680 else if (dynamic_cast<UMLRole*>(obj))
682 else if (dynamic_cast<UMLOperation*>(obj))
709 if (tb && (cb = dynamic_cast<CodeBlockWithComments*>(tb))) {
725 newBlock->
setText(
"<<INSERT>>");
730 int location = m_textBlockList.indexOf(m_selectedTextBlock);
734 insertText(body, newBlock,
true,
state().fontColor,
735 state().editBlockColor, 0, QString(
"CodeBlock"), location);
745 newBlock->
setText(
"<<INSERT>>");
753 int location = m_textBlockList.indexOf(m_selectedTextBlock) + lastpi->
start + lastpi->
size + 1;
757 insertText(body, newBlock,
true,
state().fontColor,
758 state().editBlockColor, 0, QString(
"CodeBlock"), location);
768 menu->exec(event->globalPos());
785 KAction* hideAct =
new KAction(i18n(
"Hide"),
this);
786 hideAct->setShortcut(Qt::Key_H);
788 menu->addAction(hideAct);
791 KAction* showAct =
new KAction(i18n(
"Show"),
this);
792 showAct->setShortcut(Qt::Key_S);
794 menu->addAction(showAct);
800 KAction* hideCommAct =
new KAction(i18n(
"Hide Comment"),
this);
801 hideCommAct->setShortcut(Qt::CTRL + Qt::Key_H);
803 menu->addAction(hideCommAct);
806 KAction* showCommAct =
new KAction(i18n(
"Show Comment"),
this);
807 showCommAct->setShortcut(Qt::CTRL + Qt::Key_S);
809 menu->addAction(showCommAct);
812 menu->addSeparator();
814 KAction* insCodeBeforeAct =
new KAction(i18n(
"Insert Code Block Before"),
this);
815 insCodeBeforeAct->setShortcut(Qt::CTRL + Qt::Key_B);
817 menu->addAction(insCodeBeforeAct);
819 KAction* insCodeAfterAct =
new KAction(i18n(
"Insert Code Block After"),
this);
820 insCodeAfterAct->setShortcut(Qt::CTRL + Qt::Key_A);
822 menu->addAction(insCodeAfterAct);
824 menu->addSeparator();
826 KAction* copyAct =
new KAction(i18n(
"Copy"),
this);
827 copyAct->setShortcut(Qt::CTRL + Qt::Key_C);
829 menu->addAction(copyAct);
831 KAction* pasteAct =
new KAction(i18n(
"Paste"),
this);
832 pasteAct->setShortcut(Qt::CTRL + Qt::Key_V);
834 menu->addAction(pasteAct);
836 KAction* cutAct =
new KAction(i18n(
"Cut"),
this);
837 cutAct->setShortcut(Qt::CTRL + Qt::Key_X);
839 menu->addAction(cutAct);
842 if (m_selectedTextBlock == m_parentDoc->
getHeader())
843 insCodeBeforeAct->setEnabled(
false);
845 if (!m_textBlockToPaste)
846 pasteAct->setEnabled(
false);
849 cutAct->setEnabled(
false);
853 if (dynamic_cast<OwnedCodeBlock*>(m_selectedTextBlock) ||
854 dynamic_cast<HierarchicalCodeBlock*>(m_selectedTextBlock))
855 copyAct->setEnabled(
false);
870 if (dynamic_cast<HierarchicalCodeBlock*>(m_selectedTextBlock))
872 else if (dynamic_cast<CodeBlockWithComments*>(m_selectedTextBlock))
874 else if (dynamic_cast<CodeBlock*>(m_selectedTextBlock))
876 else if (dynamic_cast<CodeComment*>(m_selectedTextBlock))
879 uError() <<
" ERROR: CodeEditor can not copy selected block:" << m_selectedTextBlock <<
" of unknown type";
880 m_textBlockToPaste = 0;
899 if (m_lastTextBlockToBeEdited && m_lastTextBlockToBeEdited == (
CodeBlock*) m_selectedTextBlock) {
900 updateTextBlockFromText (m_lastTextBlockToBeEdited);
901 m_lastTextBlockToBeEdited = 0;
907 m_selectedTextBlock = 0;
916 if (m_textBlockToPaste) {
918 m_textBlockToPaste = 0;
941 setObjectName(
"CodeEditor");
943 m_parentDlg = parentDlg;
944 m_parentDoc = parentDoc;
946 setUndoRedoEnabled(
false);
948 setMouseTracking(
true);
953 m_newLinePressed =
false;
954 m_backspacePressed =
false;
955 m_textBlockToPaste = 0;
956 m_selectedTextBlock = 0;
957 m_lastTextBlockToBeEdited = 0;
959 setFont(
state().font);
966 m_parentDocName =
"";
971 setTextBackgroundColor(
state().paperColor);
987 void CodeEditor::updateTextBlockFromText(
TextBlock * block)
995 int pstart = m_textBlockList.indexOf(block);
1003 int lastpara = item->
start+pstart+item->
size;
1005 int lastLineToAddNewLine = lastpara + endEdit;
1006 for (
int para=(item->
start+pstart); para<=lastpara; ++para) {
1007 textCursor().setPosition(para);
1008 QString paraTxt = textCursor().block().text();
1009 QString line = block->
unformatText(paraTxt, baseIndent);
1013 if (!line.isEmpty() && para != lastLineToAddNewLine)
1020 if (content.isEmpty()) {
1021 uDebug() <<
"nothing to add!";
1024 uDebug() <<
"UPDATE GOT CONTENT:[" << content.toLatin1() <<
"] to block: " << block;
1032 parentObj->
setDoc(content);
1049 QTextCursor tc = textCursor();
1050 int para = tc.position();
1051 int pos = tc.blockNumber();
1059 bool lastParaIsEditable = isParaEditable(m_lastPara);
1063 if (lastParaIsEditable) {
1066 if ((para-1) == m_lastPara && m_newLinePressed)
1067 expandSelectedParagraph (m_lastPara);
1071 if ((para+1) == m_lastPara && m_backspacePressed)
1072 contractSelectedParagraph(para);
1078 bool editPara = isParaEditable(para);
1080 TextBlock * tBlock = m_textBlockList.at(para);
1082 uWarning() <<
"no text block found in list at position " << para;
1089 uWarning() <<
"cast to CodeMethodBlock failed";
1094 textCursor().setPosition(para);
1095 QString currentParaText = textCursor().block().text();
1098 int minPos = baseIndent.length();
1101 if (!m_backspacePressed && !currentParaText.contains(QRegExp(
'^'+baseIndent))) {
1102 textCursor().setPosition(para);
1103 textCursor().insertText(baseIndent);
1109 bool priorParaIsEditable = isParaEditable(para-1);
1110 if (m_backspacePressed && para && priorParaIsEditable) {
1111 textCursor().setPosition(para-1);
1115 QString contents = textCursor().block().text();
1116 contents = contents.right(contents.length()-m_lastPos+1);
1121 if (paraIsNotSingleLine(para)) {
1124 textCursor().setPosition(para-1);
1125 textCursor().insertText(contents);
1135 if (m_backspacePressed && !priorParaIsEditable) {
1136 textCursor().setPosition(para);
1137 QString contents = textCursor().block().text();
1138 contents = contents.right(contents.length()-m_lastPos+1);
1139 contents = baseIndent + contents.left(contents.length()-1);
1145 if (cmb && contents.contains(QRegExp(
'^'+baseIndent+
"\\s$"))) {
1159 if ((editPara && !m_lastTextBlockToBeEdited) || (!editPara && m_lastTextBlockToBeEdited))
1161 setReadOnly(editPara ?
false :
true);
1165 if (m_lastTextBlockToBeEdited && (m_lastTextBlockToBeEdited != m_textBlockList.at(para) || !editPara))
1167 updateTextBlockFromText (m_lastTextBlockToBeEdited);
1168 m_lastTextBlockToBeEdited = 0;
1172 m_lastTextBlockToBeEdited = m_textBlockList.at(para);
1174 m_lastTextBlockToBeEdited = 0;
1179 m_newLinePressed =
false;
1180 m_backspacePressed =
false;
1188 bool CodeEditor::paraIsNotSingleLine(
int para)
1190 TextBlock * tBlock = m_textBlockList.at(para);
1192 int pstart = m_textBlockList.indexOf(tBlock);
1196 if ((pstart+item->
start) <= para && (item->
start+pstart+item->
size) >= para)
1209 TextBlock* CodeEditor::findTextBlockAt(
int characterPos)
1212 for (
int tbIdx = 0; tbIdx < m_textBlockList.count(); ++tbIdx) {
1213 TextBlock* tb = m_textBlockList.at(tbIdx);
1214 if (m_tbInfoMap.contains(tb)) {
1217 for (
int idx = 0; idx < tbi->
m_paraList.count(); ++idx) {
1219 charCount += pi->
size;
1220 if (characterPos < charCount) {
1236 bool CodeEditor::isParaEditable(
int para)
1239 if (!m_textBlockList.isEmpty()) {
1240 TextBlock* lastTb = m_textBlockList.last();
1241 if (m_tbInfoMap.contains(lastTb)) {
1249 if ((para < 0) || (para >= document()->characterCount())) {
1250 DEBUG(
DBG_SRC) <<
"para:" << para <<
" not in range 0.." << document()->characterCount();
1254 TextBlock * tBlock = findTextBlockAt(para);
1258 bool hasEditableRange = (editStart > 0 || editEnd < 0) ?
true :
false;
1261 int pstart = m_textBlockList.indexOf(tBlock);
1262 int relativeLine = para - pstart;
1265 if (item->
start+pstart <= para && item->start+pstart+item->
size >= para) {
1267 if (relativeLine >= editStart && relativeLine <= (item->
size + editEnd))
1278 DEBUG(
DBG_SRC) <<
"TextBlockInfo not found in info map!";
1282 DEBUG(
DBG_SRC) <<
"TextBlock not found at position " << para;
1290 void CodeEditor::changeTextBlockHighlighting(
TextBlock * tBlock,
bool selected)
1295 int pstart = m_textBlockList.indexOf(tBlock);
1297 for (
int p=(item->
start+pstart); p<=(item->
start+pstart+item->
size); ++p) {
1300 setParagraphBackgroundColor(p,
state().selectedColor);
1303 setParagraphBackgroundColor(p,
state().nonEditBlockColor);
1306 else if (m_isHighlighted) {
1307 setParagraphBackgroundColor(p, item->
bgcolor);
1310 setParagraphBackgroundColor(p,
state().paperColor);
1322 void CodeEditor::setParagraphBackgroundColor(
int position,
const QColor& color)
1324 textCursor().setPosition(position);
1325 QTextCharFormat format;
1326 format.setBackground(color);
1327 textCursor().setCharFormat(format);
1336 m_showHiddenBlocks =
true;
1338 m_showHiddenBlocks =
false;
1348 int total_para = textCursor().blockNumber()-1;
1351 m_isHighlighted =
true;
1352 for (
int para = 0; para < total_para; ++para) {
1353 TextBlock * tblock = m_textBlockList.at(para);
1354 changeTextBlockHighlighting(tblock,
false);
1360 m_isHighlighted =
false;
1361 for (
int para = 0; para < total_para; ++para) {
1362 setParagraphBackgroundColor(para,
state().paperColor);
1367 if (m_selectedTextBlock) {
1368 changeTextBlockHighlighting(m_selectedTextBlock,
true);
1375 void CodeEditor::contractSelectedParagraph(
int paraToRemove)
1377 if ((paraToRemove >= 0) && (paraToRemove < m_textBlockList.size())) {
1378 TextBlock * tBlock = m_textBlockList.at(paraToRemove);
1380 int pstart = m_textBlockList.indexOf(tBlock);
1383 bool lowerStartPosition =
false;
1385 if (lowerStartPosition) {
1388 if ((pstart+item->
start) <= paraToRemove && (item->
start+pstart+item->
size) >= paraToRemove) {
1393 if (item->
size < 0) {
1396 lowerStartPosition =
true;
1399 m_textBlockList.removeAt(paraToRemove);
1407 void CodeEditor::expandSelectedParagraph(
int priorPara)
1409 TextBlock * tBlock = m_textBlockList.at(priorPara);
1412 m_textBlockList.insert(priorPara, tBlock);
1415 int pstart = m_textBlockList.indexOf(tBlock);
1418 bool upStartPosition =
false;
1421 if (upStartPosition)
1424 if ((pstart+item->
start) <= priorPara && (item->
start+pstart+item->
size) >= priorPara) {
1427 upStartPosition =
true;
1438 QTextCursor tc = cursorForPosition(e->pos());
1439 int para = tc.position();
1440 int pos = tc.blockNumber();
1448 if ((para >= 0) && (para < document()->characterCount())) {
1449 TextBlock * tBlock = findTextBlockAt(para);
1450 editTextBlock(tBlock, para);
1453 DEBUG(
DBG_SRC) <<
"para:" << para <<
" not in range 0.." << document()->characterCount();
1462 QTextCursor tc = cursorForPosition(e->pos());
1463 int para = tc.position();
1464 int pos = tc.blockNumber();
1470 TextBlock * tblock = m_textBlockList.at(para);
1471 if (tblock && m_selectedTextBlock != tblock) {
1476 changeTextBlockHighlighting(m_selectedTextBlock,
false);
1479 changeTextBlockHighlighting(tblock,
true);
1482 componentLabel()->setText(
"<b>"+info->
displayName()+
"</b>");
1484 m_selectedTextBlock = tblock;
1486 if (m_lastTextBlockToBeEdited) {
1487 updateTextBlockFromText (m_lastTextBlockToBeEdited);
1488 m_lastTextBlockToBeEdited = 0;
1507 Q_UNUSED(startCursorPos);
1515 #include "codeeditor.moc"
void init()
Reinitialize the unique ID counter.
virtual CodeBlockWithComments * newCodeBlockWithComments()
Create a new CodeBlockWithComments object belonging to this CodeDocument.
virtual QString unformatText(const QString &text, const QString &indent="")
UnFormat a long text string.
virtual CodeBlock * newCodeBlock()
Create a new CodeBlock object belonging to this CodeDocument.
void changeHighlighting(int signal)
Colorizes/uncolorizes type for ALL paragraphs.
UMLObject * getParentObject()
Get the value of m_parentObject.
This class defines the non-graphical information required for a UML Classifier (ie a class or interfa...
virtual bool showPropertiesPagedDialog(int page=0, bool assoc=false)
This method is called if you wish to see the properties of a UMLObject.
A "chunk" of code within the code document.
class OwnedHierarchicalCodeBlock A "chunk" of code within the code document that is "owned" by some u...
virtual void synchronize()
Cause this code document to synchronize to current generator policy.
CodeEditor(const QString &text, CodeViewerDialog *parent=0, CodeDocument *doc=0)
Constructor.
class ClassifierCodeDocument A CodeDocument which represents a UMLClassifier (e.g.
virtual QString getNewEditorLine(int amount=0)
Used by the CodeEditor.
Settings::CodeViewerState state()
Return the code viewer state.
void setText(const QString &text)
Set the value of m_text The actual text of this code block.
the content was generated by code generation itself
bool insertTextBlock(TextBlock *newBlock, TextBlock *existingBlock, bool after=true)
Insert a new text block after the existing text block.
void slotPasteTextBlock()
Slot to paste a text block.
CodeClassField * getParentClassField()
Get the value of m_parentclassfield.
void keyPressEvent(QKeyEvent *e)
Implemented so we may capture certain key presses, namely backspace and 'return' events.
bool blocksAreHighlighted
QString getStartMethodText() const
Get the starting text that begins this method before the body is printed.
virtual int firstEditableLine()
TODO: Ush.
This class is used to set up information for an attribute.
void slotChangeSelectedBlockCommentView()
Change the status of the comment writeOutText value to opposite of current value. ...
void removeParagraph(int para)
Remove a paragraph from a given position.
QList< ParaInfo * > m_paraList
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()
Create a new HierarchicalCodeBlock object belonging to this CodeDocument.
void loadFromDocument()
(Re) Load the parent code document into the editor.
UMLClassifier * getParentClassifier()
Get the value of m_parentclassifier.
Used to declare classifier fields (e.g.
int getIndentationLevel() const
Get how many times to indent this text block.
void slotRedrawText()
Slot to redraw the text.
the content was entered by the user
void slotChangeSelectedBlockView()
Slot to change the view of the selected block.
This class is the non-graphical version of UMLWidget.
bool close()
Slot which closes this widget.
void slotInsertCodeBlockAfterSelected()
Slot to insert a code block after the selection.
bool isInterface() const
Returns true if this classifier represents an interface.
bool isCodeAccessorMethod
void insertParagraph(const QString &text, int para)
Insert a paragraph at a given position.
void changeShowHidden(int signal)
:TODO:
QString getEndText() const
Get the value of m_endText.
bool parentIsAttribute() const
Get the value of m_isAbstract.
void setDoc(const QString &d)
Sets the documentation for the object.
void slotInsertCodeBlockBeforeSelected()
Slot to insert a code block before the selection.
Settings::CodeViewerState state()
Return code viewer state.
class CodeMethodBlock A common type of "code block" that occurs in OO code.
void setWriteOutText(bool write)
Set the value of m_writeOutText Whether or not to include the text of this TextBlock into a file...
QString getFileExtension() const
Get the value of m_fileExtension.
void setDisplayName(const QString &name)
A document containing the code for one file.
CodeComment * newCodeComment(CodeDocument *cd)
void slotCopyTextBlock()
Slot to copy a text block.
This class is sooo ugly I don't know where to begin.
void appendText(TextBlock *tblock)
Appends a TextBlock to the widget.
virtual QString toString() const
Return the text in the right format.
TextBlockList * getTextBlockList() const
Get the list of TextBlock objects held by m_textblockVector.
void rebuildView(int startCursorPos)
Rebuild our view of the document.
bool canDelete() const
Determine if its OK to delete this textblock from the document.
virtual int lastEditableLine()
QList< TextBlock * > TextBlockList
void contextMenuEvent(QContextMenuEvent *event)
Shows the context menu.
UMLOperation * getParentOperation()
Add a Parameter object to the m_parameterVector List.
configurable params for the code viewer tool
void setParent(UMLObject *p=0)
The fundemental unit of text within an output file containing code.
This class represents an operation in the UML model.
CodeClassField * getParentClassField()
Get the value of m_parentclassfield.
void slotCutTextBlock()
Slot to cut a text block.
This class contains the non-graphic representation of an association role.
static QString formatMultiLineText(const QString &work, const QString &linePrefix, const QString &breakStr, bool addBreak=true, bool lastLineHasBreak=true)
Format a long text string to be more readable.
void mouseDoubleClickEvent(QMouseEvent *e)
Override the QT event so we can do appropriate things.
virtual bool removeTextBlock(TextBlock *remove_object)
Remove a TextBlock object from m_textblockVector list.
KMenu * createPopup()
Create the popup menu.
#define DEBUG_REGISTER(src)
QString getStartText() const
QString name() const
Returns a copy of m_name.
QString getIndentationString(int level=0) const
Get the actual amount of indentation for a given level of indentation.
bool getWriteOutText() const
Get the value of m_writeOutText Whether or not to include the text of this TextBlock into a file...
void contentsMouseMoveEvent(QMouseEvent *e)
Override the QT event so we can do appropriate things.
void setContentType(ContentType new_var)
Set the value of m_contentType specifies whether the content (text) of this object was generated by t...
void slotCursorPositionChanged()
Slot for cursor position changed signal.
virtual void setAttributesFromObject(TextBlock *obj)
Set the class attributes from a passed object.
virtual void syncToParent()
QString getEndMethodText() const
Get the ending text that finishes this method after the body is printed.
QString getFileName() const
Get the value of m_filename.
QString getText() const
Get the value of m_text The actual text of this code block.
int size
number of characters
UMLObject * getParentObject()
Get the ParentObject object.
CodeComment * getHeader()
Get the Header comment object.