1 /* This file is part of the KDE project
2  * Copyright (C) 2018 Dag Andersen <danders@get2net.dk>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef CALLOUTCONTAINERMODEL_H
21 #define CALLOUTCONTAINERMODEL_H
22 
23 #include "KoShapeContainerDefaultModel.h"
24 
25 #include <QHash>
26 #include <QSizeF>
27 #include <QPointF>
28 #include <QTransform>
29 
30 class KoShapeContainer;
31 class CalloutShape;
32 class PathShape;
33 class KoShape;
34 
35 class CalloutContainerModel : public KoShapeContainerDefaultModel
36 {
37 public:
38     CalloutContainerModel();
39 
40     void containerChanged(KoShapeContainer *container, KoShape::ChangeType type) override;
41 
42     void childChanged(KoShape *shape, KoShape::ChangeType type) override;
43 
44     bool isChildLocked(const KoShape *child) const override;
45 
46     void setIgnore(KoShape *shape, bool state);
47 
48     bool ignore(KoShape *shape) const;
49 
50     void resizePath(PathShape *path, const QPointF &newPos, const QSizeF &newSize);
51 
52 private:
53     QTransform m_prevTrans;
54     QSizeF m_prevSize;
55     QPointF m_prevPosition;
56     bool m_resizing;
57     QHash<KoShape*, bool> m_ignore;
58 };
59 
60 #endif /* CALLOUTCONTAINERMODEL_H */
61