Krita Source Code Documentation
Loading...
Searching...
No Matches
KoTosContainerModel.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 2010 Thorsten Zachmann <zachmann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
8
10#include "KoTosContainer.h"
11
12#include <FlakeDebug.h>
13#include <QSizeF>
14
16: m_textShape(0)
17{
18}
19
23
25{
26 // make sure shape is a text shape
27 KoTextShapeDataBase *shapeData = qobject_cast<KoTextShapeDataBase*>(shape->userData());
28 Q_ASSERT(shapeData != 0);
29 if (shapeData) {
30 delete m_textShape;
31 m_textShape = shape;
32 }
33}
34
36{
37 Q_ASSERT(m_textShape == 0 || shape == m_textShape);
38 if (shape == m_textShape) {
39 m_textShape = 0;
40 }
41}
42
43void KoTosContainerModel::setClipped(const KoShape *shape, bool clipping)
44{
45 Q_UNUSED(shape);
46 Q_UNUSED(clipping);
47}
48
50{
51 Q_UNUSED(shape);
52 return false;
53}
54
55void KoTosContainerModel::setInheritsTransform(const KoShape *shape, bool inherit)
56{
57 Q_UNUSED(shape);
58 Q_UNUSED(inherit);
59}
60
62{
63 Q_UNUSED(shape);
64 return true;
65}
66
68{
69 return m_textShape != 0 ? 1 : 0;
70}
71
80
82{
83 debugFlake << "change type:" << type << KoShape::SizeChanged << KoShape::ContentChanged;
84 if (type != KoShape::SizeChanged && type != KoShape::ContentChanged) {
85 return;
86 }
87 KoTosContainer *tosContainer = dynamic_cast<KoTosContainer*>(container);
88 debugFlake << "tosContainer" << tosContainer;
89 if (tosContainer) {
91 }
92 if ( m_textShape && tosContainer && tosContainer->resizeBehavior() != KoTosContainer::TextFollowsPreferredTextRect ) {
93 debugFlake << "change type setSize";
94 m_textShape->setSize(tosContainer->size());
95 }
96}
#define debugFlake
Definition FlakeDebug.h:15
KoShapeUserData * userData() const
Definition KoShape.cpp:710
virtual QSizeF size() const
Get the size of the shape in pt.
Definition KoShape.cpp:820
ChangeType
Used by shapeChanged() to select which change was made.
Definition KoShape.h:95
@ ContentChanged
the content of the shape changed e.g. a new image inside a pixmap/text change inside a textshape
Definition KoShape.h:110
@ SizeChanged
used after a setSize()
Definition KoShape.h:100
virtual void setSize(const QSizeF &size)
Resize the shape.
Definition KoShape.cpp:276
bool isClipped(const KoShape *shape) const override
QList< KoShape * > shapes() const override
void containerChanged(KoShapeContainer *container, KoShape::ChangeType type) override
bool inheritsTransform(const KoShape *shape) const override
int count() const override
void setInheritsTransform(const KoShape *shape, bool inherit) override
void setClipped(const KoShape *shape, bool clipping) override
void remove(KoShape *shape) override
void add(KoShape *shape) override
ResizeBehavior resizeBehavior() const
@ TextFollowsPreferredTextRect
The size/position of the text area will follow the preferredTextRect property.