Warning, file /office/calligra/libs/flake/KoShapeGroup.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2006 Thomas Zander <zander@kde.org>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef KOSHAPEGROUP_H
0021 #define KOSHAPEGROUP_H
0022 
0023 #include "KoShapeContainer.h"
0024 
0025 #include <QList>
0026 
0027 #include "flake_export.h"
0028 
0029 class KoShapeSavingContext;
0030 class KoShapeLoadingContext;
0031 class KoShapeGroupPrivate;
0032 
0033 /**
0034  * Provide grouping for shapes.
0035  * The group shape allows you to add children which will then be grouped in selections
0036  * and actions.
0037  * <p>If you have a set of shapes that together make up a bigger shape it is often
0038  * useful to group them together so the user will perceive the different shapes as
0039  * actually being one.  This means that if the user clicks on one shape, all shapes
0040  * in the group will be selected at once, making the tools that works on
0041  * selections alter all of them at the same time.
0042  * <p>Note that while this object is also a shape, it is not actually visible and the user
0043  * can't interact with it.
0044  */
0045 class FLAKE_EXPORT KoShapeGroup : public KoShapeContainer
0046 {
0047 public:
0048     /// Constructor
0049     KoShapeGroup();
0050     /// destructor
0051     ~KoShapeGroup() override;
0052     /// This implementation is empty since a group is itself not visible.
0053     void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
0054     /// always returns false since the group itself can't be selected or hit
0055     bool hitTest(const QPointF &position) const override;
0056     /// a group in flake doesn't have a size, this function just returns QSizeF(0,0)
0057     QSizeF size() const override;
0058     /// a group's boundingRect
0059     QRectF boundingRect() const override;
0060     /// reimplemented from KoShape
0061     void saveOdf(KoShapeSavingContext &context) const override;
0062     // reimplemented
0063     bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
0064 
0065     /**
0066      * @brief Invalidate the size cache of the group
0067      *
0068      * The group shape caches the size of itself as it can be quite expensive to recalculate
0069      * the size if there are a lot of subshapes. This function is called when the cache needs
0070      * to be invalidated.
0071      */
0072     void invalidateSizeCache();
0073 
0074 private:
0075     void shapeChanged(ChangeType type, KoShape *shape = 0) override;
0076 
0077     Q_DECLARE_PRIVATE(KoShapeGroup)
0078 };
0079 
0080 #endif