22#include <QTextDocument>
34 , alignment(rhs.alignment)
75 warnFlake <<
"No text shape present in KoTosContainer";
80 shapeData->
document()->setPlainText(text);
96 return d->resizeBehavior;
102 if (textShape == 0) {
103 warnFlake <<
"No text shape present in KoTosContainer";
114 bf.setAlignment(alignment & Qt::AlignHorizontal_Mask);
116 QTextCursor cursor(shapeData->
document());
117 cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
118 cursor.mergeBlockFormat(bf);
120 d->alignment = alignment;
126 if (textShape == 0) {
127 warnFlake <<
"No text shape present in KoTosContainer";
138 QTextCursor cursor(shapeData->
document());
139 answer = answer | (cursor.blockFormat().alignment() & Qt::AlignHorizontal_Mask);
146 d->preferredTextRect =
rect;
158 return d->preferredTextRect;
163 if (!documentResources) {
164 warnFlake <<
"KoDocumentResourceManager not found";
173 QSet<KoShape*> delegates;
200 warnFlake <<
"Text shape factory not found";
209 return subShapes.isEmpty() ? 0 : subShapes.at(0);
T get(const QString &id) const
virtual void containerChanged(KoShapeContainer *container, KoShape::ChangeType type)=0
QList< KoShape * > shapes() const
void setModel(KoShapeContainerModel *model)
void addShape(KoShape *shape)
KoShapeContainerModel * model
virtual KoShape * createDefaultShape(KoDocumentResourceManager *documentResources=0) const
static KoShapeRegistry * instance()
void setToolDelegates(const QSet< KoShape * > &delegates)
KoShapeUserData * userData() const
virtual QSizeF size() const
Get the size of the shape in pt.
void setSelectable(bool selectable)
ChangeType
Used by shapeChanged() to select which change was made.
@ ContentChanged
the content of the shape changed e.g. a new image inside a pixmap/text change inside a textshape
@ SizeChanged
used after a setSize()
virtual void setPosition(const QPointF &position)
Set the position of the shape in pt.
virtual void setRunThrough(short int runThrough)
virtual void setSize(const QSizeF &size)
Resize the shape.
QTextDocument * document() const
return the document
Qt::Alignment verticalAlignment() const
void setVerticalAlignment(Qt::Alignment alignment)
KoShape * createTextShape(KoDocumentResourceManager *documentResources=0)
void setRunThrough(short int runThrough) override
void setResizeBehavior(ResizeBehavior resizeBehavior)
QSharedDataPointer< Private > d
void setPreferredTextRect(const QRectF &rect)
void shapeChanged(ChangeType type, KoShape *shape=0) override
void paintComponent(QPainter &painter) const override
Paint the component Implement this method to allow the shape to paint itself, just like the KoShape::...
virtual bool loadText(const QDomElement &element)
void setPlainText(const QString &text)
KoShape * textShape() const
ResizeBehavior resizeBehavior() const
QRectF preferredTextRect() const
ResizeBehavior
different kinds of resizing behavior to determine how to treat text overflow
@ TextFollowsPreferredTextRect
The size/position of the text area will follow the preferredTextRect property.
~KoTosContainer() override
void setTextAlignment(Qt::Alignment alignment)
Qt::Alignment textAlignment() const