Warning, file /office/calligra/braindump/src/SectionShapeContainerModel.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  Copyright (c) 2006-2007 Thomas Zander <zander@kde.org>
0003  *  Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation;
0008  * either version 2, or (at your option) any later version of the License.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Lesser General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Lesser General Public License
0016  * along with this library; see the file COPYING.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 #include "SectionShapeContainerModel.h"
0021 
0022 #include <KoShapeContainer.h>
0023 #include "Layout.h"
0024 
0025 SectionShapeContainerModel::SectionShapeContainerModel(Section* _section) : m_section(_section), m_updateLayout(true)
0026 {
0027 }
0028 
0029 SectionShapeContainerModel::~SectionShapeContainerModel()
0030 {
0031 }
0032 
0033 void SectionShapeContainerModel::add(KoShape *child)
0034 {
0035     if(m_members.contains(child))
0036         return;
0037     m_members.append(child);
0038     if(m_updateLayout) {
0039         m_section->layout()->addShape(child);
0040     }
0041 }
0042 
0043 void SectionShapeContainerModel::setClipped(const KoShape *, bool)
0044 {
0045 }
0046 
0047 bool SectionShapeContainerModel::isClipped(const KoShape *) const
0048 {
0049     return false;
0050 }
0051 
0052 void SectionShapeContainerModel::setInheritsTransform(const KoShape *, bool)
0053 {
0054 }
0055 
0056 bool SectionShapeContainerModel::inheritsTransform(const KoShape *) const
0057 {
0058     return false;
0059 }
0060 
0061 void SectionShapeContainerModel::remove(KoShape *child)
0062 {
0063     m_members.removeAll(child);
0064     if(m_updateLayout) {
0065         m_section->layout()->removeShape(child);
0066     }
0067 }
0068 
0069 int SectionShapeContainerModel::count() const
0070 {
0071     return m_members.count();
0072 }
0073 
0074 QList<KoShape*> SectionShapeContainerModel::shapes() const
0075 {
0076     return QList<KoShape*>(m_members);
0077 }
0078 
0079 void SectionShapeContainerModel::containerChanged(KoShapeContainer *, KoShape::ChangeType)
0080 {
0081 }
0082 
0083 void SectionShapeContainerModel::childChanged(KoShape *, KoShape::ChangeType)
0084 {
0085 }
0086 
0087 bool SectionShapeContainerModel::isChildLocked(const KoShape *child) const
0088 {
0089     Q_ASSERT(child->parent());
0090     return child->isGeometryProtected() || child->parent()->isGeometryProtected();
0091 }
0092 
0093 void SectionShapeContainerModel::setUpdateLayout(bool v)
0094 {
0095     m_updateLayout = v;
0096 }