umbrello 2.39.2 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

textblock.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3
4 SPDX-FileCopyrightText: 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov>
5 SPDX-FileCopyrightText: 2004-2022 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
6*/
7
8#ifndef TEXTBLOCK_H
9#define TEXTBLOCK_H
10
11#include <QDomDocument>
12#include <QDomElement>
13#include <QObject>
14#include <QXmlStreamWriter>
15
16 class CodeDocument;
17 class QXmlStreamWriter;
18
22 class TextBlock
23{
24 friend class CodeGenObjectWithTextBlocks;
25 friend class ClassifierCodeDocument;
26 public:
27
28 explicit TextBlock(CodeDocument * parent, const QString & text = QString());
29 virtual ~TextBlock();
30
31 void setText(const QString & text);
32 QString getText() const;
33 void appendText(const QString & text);
34
35 void setTag(const QString & value);
36 QString getTag() const;
37
38 CodeDocument * getParentDocument() const;
39
40 void setWriteOutText(bool write);
41 bool getWriteOutText() const;
42
43 void setIndentationLevel(int level);
44 int getIndentationLevel() const;
45
46 QString getIndentationString(int level = 0) const;
47
48 static QString getIndentation();
49
50 static QString getNewLineEndingChars();
51
52 static QString formatMultiLineText(const QString & work, const QString & linePrefix,
53 const QString & breakStr,
54 bool addBreak = true, bool lastLineHasBreak = true);
55
56 virtual QString unformatText(const QString & text, const QString & indent = QString());
57
58 virtual QString toString() const;
59
60 static QString encodeText(const QString & text, const QString & endLine);
61 static QString decodeText(const QString & text, const QString & endLine);
62
67 virtual void saveToXMI(QXmlStreamWriter& writer) = 0;
68
73 virtual void loadFromXMI(QDomElement & root) = 0;
74
75 bool canDelete() const;
76
77 virtual void setAttributesFromObject(TextBlock * obj);
78
79 virtual QString getNewEditorLine(int amount = 0);
80
81 virtual int firstEditableLine();
82 virtual int lastEditableLine();
83
84 friend QDebug operator<<(QDebug os, const TextBlock& obj);
85
86 protected:
87
88 void setCanDelete(bool canDelete);
89
90 virtual void release();
91
92 virtual void setAttributesOnNode(QXmlStreamWriter& writer);
93 virtual void setAttributesFromNode(QDomElement & root);
94
95 private:
96
97 QString m_text; //< The actual text of this code block.
98 QString m_tag;
99 bool m_canDelete;
100 bool m_writeOutText; //< Flag to write the text of this TextBlock into a file.
101 int m_indentationLevel;
102 CodeDocument * m_parentDocument;
103
104};
105
106#endif // TEXTBLOCK_H
ClassifierCodeDocument
Definition classifiercodedocument.h:29
CodeDocument
Definition codedocument.h:30
CodeGenObjectWithTextBlocks
Definition codegenobjectwithtextblocks.h:29
TextBlock
Definition textblock.h:23
TextBlock::unformatText
virtual QString unformatText(const QString &text, const QString &indent=QString())
Definition textblock.cpp:249
TextBlock::decodeText
static QString decodeText(const QString &text, const QString &endLine)
Definition textblock.cpp:388
TextBlock::getIndentationLevel
int getIndentationLevel() const
Definition textblock.cpp:159
TextBlock::m_tag
QString m_tag
Definition textblock.h:98
TextBlock::firstEditableLine
virtual int firstEditableLine()
Definition textblock.cpp:211
TextBlock::getNewLineEndingChars
static QString getNewLineEndingChars()
Definition textblock.cpp:168
TextBlock::release
virtual void release()
Definition textblock.cpp:271
TextBlock::setText
void setText(const QString &text)
Definition textblock.cpp:76
TextBlock::appendText
void appendText(const QString &text)
Definition textblock.cpp:85
TextBlock::formatMultiLineText
static QString formatMultiLineText(const QString &work, const QString &linePrefix, const QString &breakStr, bool addBreak=true, bool lastLineHasBreak=true)
Definition textblock.cpp:284
TextBlock::setIndentationLevel
void setIndentationLevel(int level)
Definition textblock.cpp:148
TextBlock::toString
virtual QString toString() const
Definition textblock.cpp:400
TextBlock::setWriteOutText
void setWriteOutText(bool write)
Definition textblock.cpp:127
TextBlock::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)=0
TextBlock::m_canDelete
bool m_canDelete
Definition textblock.h:99
TextBlock::getIndentation
static QString getIndentation()
Definition textblock.cpp:178
TextBlock::canDelete
bool canDelete() const
Definition textblock.cpp:57
TextBlock::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &root)
Definition textblock.cpp:354
TextBlock::setAttributesOnNode
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition textblock.cpp:317
TextBlock::getNewEditorLine
virtual QString getNewEditorLine(int amount=0)
Definition textblock.cpp:236
TextBlock::m_parentDocument
CodeDocument * m_parentDocument
Definition textblock.h:102
TextBlock::getText
QString getText() const
Definition textblock.cpp:95
TextBlock::~TextBlock
virtual ~TextBlock()
Definition textblock.cpp:38
TextBlock::getIndentationString
QString getIndentationString(int level=0) const
Definition textblock.cpp:189
TextBlock::getTag
QString getTag() const
Definition textblock.cpp:106
TextBlock::loadFromXMI
virtual void loadFromXMI(QDomElement &root)=0
TextBlock::getParentDocument
CodeDocument * getParentDocument() const
Definition textblock.cpp:66
TextBlock::TextBlock
TextBlock(CodeDocument *parent, const QString &text=QString())
Definition textblock.cpp:24
TextBlock::operator<<
friend QDebug operator<<(QDebug os, const TextBlock &obj)
Definition textblock.cpp:415
TextBlock::m_text
QString m_text
Definition textblock.h:97
TextBlock::m_indentationLevel
int m_indentationLevel
Definition textblock.h:101
TextBlock::setTag
void setTag(const QString &value)
Definition textblock.cpp:117
TextBlock::setCanDelete
void setCanDelete(bool canDelete)
Definition textblock.cpp:46
TextBlock::m_writeOutText
bool m_writeOutText
Definition textblock.h:100
TextBlock::getWriteOutText
bool getWriteOutText() const
Definition textblock.cpp:137
TextBlock::encodeText
static QString encodeText(const QString &text, const QString &endLine)
Definition textblock.cpp:374
TextBlock::setAttributesFromObject
virtual void setAttributesFromObject(TextBlock *obj)
Definition textblock.cpp:340
TextBlock::lastEditableLine
virtual int lastEditableLine()
Definition textblock.cpp:219