umbrello/umbrello
codeeditor.cpp
Go to the documentation of this file.
304 KTextEdit::append(text); // put actual text in. Use insert instead of append so history is preserved?
437 void CodeEditor::appendText(CodeComment * comment, TextBlock * parent, UMLObject * umlObj, const QString & componentName)
448 QString text = comment->toString(); // use comment formatting, NOT formatMultiLineText(comment->toString(), indent, "\n");
498 componentName = m_parentDocName + QString::fromLatin1("::attribute_field(") + parentObj->name() + QChar::fromLatin1(')');
502 componentName = m_parentDocName + QString::fromLatin1("::association_field(") + role->name() + QChar::fromLatin1(')');
533 QString startText = mb->formatMultiLineText (mb->getStartMethodText(), indent, QString::fromLatin1("\n"));
535 QString endText = mb->formatMultiLineText(mb->getEndMethodText(), indent, QString::fromLatin1("\n"));
554 componentName = m_parentDocName + QString::fromLatin1("::operation(")+ parentObj->name()+QString::fromLatin1(") constructor method");
556 componentName = m_parentDocName + QString::fromLatin1("::operation(")+ parentObj->name()+QString::fromLatin1(") method");
561 componentName = m_parentDocName + QString::fromLatin1("::attribute_field(") + parentObj->name() + QString::fromLatin1(") accessor method");
565 componentName = m_parentDocName + QString::fromLatin1("::association_field(") + role->name() + QString::fromLatin1(") accessor method");
622 componentName = m_parentDocName + QString::fromLatin1("::") + typeStr + QChar::fromLatin1('(') + parentObj->name() + QChar::fromLatin1(')');
625 componentName = m_parentDocName + QString::fromLatin1("::UNKNOWN(") + parentObj->name() + QChar::fromLatin1(')');
636 QString startText = hblock->formatMultiLineText (hblock->getStartText(), indent, QString::fromLatin1("\n"));
637 QString endText = hblock->formatMultiLineText(hblock->getEndText(), indent, QString::fromLatin1("\n"));
730 int location = m_textBlockList.indexOf(m_selectedTextBlock); // find first para of selected block
732 QString body = newBlock->formatMultiLineText(newBlock->getText(), newBlock->getIndentationString(), QString::fromLatin1("\n"));
755 QString body = newBlock->formatMultiLineText(newBlock->getText(), newBlock->getIndentationString(), QString::fromLatin1("\n"));
816 connect(insCodeBeforeAct, SIGNAL(triggered()), this, SLOT(slotInsertCodeBlockBeforeSelected()));
879 uError() << " ERROR: CodeEditor cannot copy selected block:" << m_selectedTextBlock << " of unknown type";
899 if (m_lastTextBlockToBeEdited && m_lastTextBlockToBeEdited == (CodeBlock*) m_selectedTextBlock) {
1101 if (!m_backspacePressed && !currentParaText.contains(QRegExp(QChar::fromLatin1('^')+baseIndent))) {
1139 contents = baseIndent + contents.left(contents.length()-1); // left is to remove trailing space
1145 if (cmb && contents.contains(QRegExp(QChar::fromLatin1('^')+baseIndent+QString::fromLatin1("\\s$")))) {
1165 if (m_lastTextBlockToBeEdited && (m_lastTextBlockToBeEdited != m_textBlockList.at(para) || !editPara))
1482 componentLabel()->setText(QString::fromLatin1("<b>")+info->displayName()+QString::fromLatin1("</b>"));
1512 //:TODO: setCursorPosition((startCursorPos < new_nrof_para ? startCursorPos : 0), 0); //:TODO: crashes the application
int position() const
Definition: codeeditor.h:35
virtual CodeBlockWithComments * newCodeBlockWithComments()
Create a new CodeBlockWithComments object belonging to this CodeDocument.
Definition: codedocument.cpp:469
virtual CodeBlock * newCodeBlock()
Create a new CodeBlock object belonging to this CodeDocument.
Definition: codedocument.cpp:460
void changeHighlighting(int signal)
Colorizes/uncolorizes type for ALL paragraphs.
Definition: codeeditor.cpp:1346
Definition: codeeditor.h:49
This class defines the non-graphical information required for a UML Classifier (ie a class or interfa...
Definition: classifier.h:39
virtual bool showPropertiesPagedDialog(int page=0, bool assoc=false)
This method is called if you wish to see the properties of a UMLObject.
Definition: umlobject.cpp:119
class OwnedHierarchicalCodeBlock A "chunk" of code within the code document that is "owned" by some u...
Definition: ownedhierarchicalcodeblock.h:26
virtual void synchronize()
Cause this code document to synchronize to current generator policy.
Definition: codedocument.cpp:329
CodeEditor(const QString &text, CodeViewerDialog *parent=0, CodeDocument *doc=0)
Constructor.
Definition: codeeditor.cpp:60
bool contains(const Key &key) const
class ClassifierCodeDocument A CodeDocument which represents a UMLClassifier (e.g.
Definition: classifiercodedocument.h:32
QColor nonEditBlockColor
Definition: codeviewerstate.h:30
void setText(const QString &text)
Set the value of m_text The actual text of this code block.
Definition: textblock.cpp:80
the content was generated by code generation itself
Definition: codeblock.h:28
bool insertTextBlock(TextBlock *newBlock, TextBlock *existingBlock, bool after=true)
Insert a new text block after the existing text block.
Definition: codedocument.cpp:216
CodeClassField * getParentClassField()
Get the value of m_parentclassfield.
Definition: codeaccessormethod.cpp:40
void keyPressEvent(QKeyEvent *e)
Implemented so we may capture certain key presses, namely backspace and 'return' events.
Definition: codeeditor.cpp:227
bool blocksAreHighlighted
Definition: codeviewerstate.h:24
const T & at(int i) const
int size() const
void removeAt(int i)
QString getStartMethodText() const
Get the starting text that begins this method before the body is printed.
Definition: codemethodblock.cpp:42
void slotChangeSelectedBlockCommentView()
Change the status of the comment writeOutText value to opposite of current value. ...
Definition: codeeditor.cpp:705
void removeParagraph(int para)
Remove a paragraph from a given position.
Definition: codeeditor.cpp:663
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()
Create a new HierarchicalCodeBlock object belonging to this CodeDocument.
Definition: codedocument.cpp:478
void loadFromDocument()
(Re) Load the parent code document into the editor.
Definition: codeeditor.cpp:244
Definition: umlattributedialog.h:28
UMLClassifier * getParentClassifier()
Get the value of m_parentclassifier.
Definition: classifiercodedocument.cpp:271
Definition: umloperationdialog.h:37
Used to declare classifier fields (e.g.
Definition: codeclassfielddeclarationblock.h:29
int getIndentationLevel() const
Get how many times to indent this text block.
Definition: textblock.cpp:163
void clear()
int size() const
void slotChangeSelectedBlockView()
Slot to change the view of the selected block.
Definition: codeeditor.cpp:692
virtual bool event(QEvent *e)
int indexOf(const T &value, int from) const
class CodeBlockWithComments A very common type of text block in any type of code. ...
Definition: codeblockwithcomments.h:23
QString number(int n, int base)
int count(const T &value) const
void append(const T &value)
void slotInsertCodeBlockAfterSelected()
Slot to insert a code block after the selection.
Definition: codeeditor.cpp:741
bool isInterface() const
Returns true if this classifier represents an interface.
Definition: classifier.cpp:117
void insertParagraph(const QString &text, int para)
Insert a paragraph at a given position.
Definition: codeeditor.cpp:653
Definition: codeoperation.h:23
QChar fromLatin1(char c)
bool isEmpty() const
void setObjectName(const QString &name)
bool isEmpty() const
QString trimmed() const
const char * constData() const
void slotInsertCodeBlockBeforeSelected()
Slot to insert a code block before the selection.
Definition: codeeditor.cpp:721
void setBackground(const QBrush &brush)
class CodeMethodBlock A common type of "code block" that occurs in OO code.
Definition: codemethodblock.h:28
void setWriteOutText(bool write)
Set the value of m_writeOutText Whether or not to include the text of this TextBlock into a file...
Definition: textblock.cpp:131
QString text() const
void setText(const QString &)
CodeComment * newCodeComment(CodeDocument *cd)
Definition: codegenfactory.cpp:402
iterator end()
Definition: codeeditor.h:66
Definition: codeaccessormethod.h:20
iterator begin()
Definition: umlroledialog.h:24
QString right(int n) const
This class is sooo ugly I don't know where to begin.
Definition: codeviewerdialog.h:27
int key() const
TextBlockList * getTextBlockList() const
Get the list of TextBlock objects held by m_textblockVector.
Definition: codegenobjectwithtextblocks.cpp:46
bool contains(QChar ch, Qt::CaseSensitivity cs) const
void rebuildView(int startCursorPos)
Rebuild our view of the document.
Definition: codeeditor.cpp:1505
bool canDelete() const
Determine if its OK to delete this textblock from the document.
Definition: textblock.cpp:61
void contextMenuEvent(QContextMenuEvent *event)
Shows the context menu.
Definition: codeeditor.cpp:765
UMLOperation * getParentOperation()
Add a Parameter object to the m_parameterVector List.
Definition: codeoperation.cpp:64
configurable params for the code viewer tool
Definition: codeviewerstate.h:20
const Key key(const T &value) const
Definition: hierarchicalcodeblock.h:22
The fundemental unit of text within an output file containing code.
Definition: textblock.h:24
QByteArray toLatin1() const
CodeClassField * getParentClassField()
Get the value of m_parentclassfield.
Definition: codeclassfielddeclarationblock.cpp:40
int blockNumber() const
T takeFirst()
void insert(int i, const T &value)
This class contains the non-graphic representation of an association role.
Definition: umlrole.h:24
int count() const
T & last()
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.
Definition: textblock.cpp:288
void mouseDoubleClickEvent(QMouseEvent *e)
Override the QT event so we can do appropriate things.
Definition: codeeditor.cpp:1436
virtual bool removeTextBlock(TextBlock *remove_object)
Remove a TextBlock object from m_textblockVector list.
Definition: codegenobjectwithtextblocks.cpp:95
int length() const
QString left(int n) const
QString fromLatin1(const char *str, int size)
QString getStartText() const
Definition: hierarchicalcodeblock.cpp:207
QString getIndentationString(int level=0) const
Get the actual amount of indentation for a given level of indentation.
Definition: textblock.cpp:193
iterator insert(const Key &key, const T &value)
const QPoint & pos() const
bool getWriteOutText() const
Get the value of m_writeOutText Whether or not to include the text of this TextBlock into a file...
Definition: textblock.cpp:141
void contentsMouseMoveEvent(QMouseEvent *e)
Override the QT event so we can do appropriate things.
Definition: codeeditor.cpp:1460
void setContentType(ContentType new_var)
Set the value of m_contentType specifies whether the content (text) of this object was generated by t...
Definition: codeblock.cpp:43
void slotCursorPositionChanged()
Slot for cursor position changed signal.
Definition: codeeditor.cpp:1047
virtual void setAttributesFromObject(TextBlock *obj)
Set the class attributes from a passed object.
Definition: textblock.cpp:347
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const
QString getEndMethodText() const
Get the ending text that finishes this method after the body is printed.
Definition: codemethodblock.cpp:50
QString getText() const
Get the value of m_text The actual text of this code block.
Definition: textblock.cpp:99
virtual QString unformatText(const QString &text, const QString &indent=QString())
UnFormat a long text string.
Definition: textblock.cpp:253
const T value(const Key &key) const
QByteArray toUtf8() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.