KoShape_p.h 4.37 KB
Newer Older
1 2
/* This file is part of the KDE project
 * Copyright (C) 2009 Thomas Zander <zander@kde.org>
3
 * Copyright (C) 2010 Boudewijn Rempt <boud@valdyas.org>
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEPRIVATE_H
#define KOSHAPEPRIVATE_H

#include "KoShape.h"
24

25 26
#include <QPoint>
#include <QPaintDevice>
27
#include <QTransform>
28 29 30
#include <QScopedPointer>

#include <KoClipMask.h>
31

32
class KoBorder;
33
class KoShapeManager;
34 35


36 37 38
class KoShapePrivate
{
public:
39
    explicit KoShapePrivate(KoShape *shape);
40
    virtual ~KoShapePrivate();
41 42 43

    explicit KoShapePrivate(const KoShapePrivate &rhs, KoShape *q);

44 45 46 47
    /**
     * Notify the shape that a change was done. To be used by inheriting shapes.
     * @param type the change type
     */
48 49
    void shapeChanged(KoShape::ChangeType type);

50 51 52
    void addShapeManager(KoShapeManager *manager);
    void removeShapeManager(KoShapeManager *manager);

53 54 55
    /**
     * Fills the style stack and returns the value of the given style property (e.g fill, stroke).
     */
56 57 58 59
    static QString getStyleProperty(const char *property, KoShapeLoadingContext &context);

    /// Loads the shadow style
    KoShapeShadow *loadOdfShadow(KoShapeLoadingContext &context) const;
60

61 62 63
    // Loads the border style.
    KoBorder *loadOdfBorder(KoShapeLoadingContext &context) const;

64
public:
65 66 67
    // Members

    KoShape *q_ptr;             // Points the shape that owns this class.
68

69
    mutable QSizeF size; // size in pt
70 71 72
    QString shapeId;
    QString name; ///< the shapes names

73
    QTransform localMatrix; ///< the shapes local transformation matrix
74

75
    KoConnectionPoints connectors; ///< glue point id to data mapping
76 77 78

    KoShapeContainer *parent;
    QSet<KoShapeManager *> shapeManagers;
79
    QSet<KoShape *> toolDelegates;
80 81
    QScopedPointer<KoShapeUserData> userData;
    QSharedPointer<KoShapeStrokeModel> stroke; ///< points to a stroke, or 0 if there is no stroke
82
    QSharedPointer<KoShapeBackground> fill; ///< Stands for the background color / fill etc.
83
    bool inheritBackground = false;
84
    bool inheritStroke = false;
85
    QList<KoShape*> dependees; ///< list of shape dependent on this shape
86
    QList<KoShape::ShapeChangeListener*> listeners;
87
    KoShapeShadow * shadow; ///< the current shape shadow
88
    KoBorder *border; ///< the current shape border
89
    QScopedPointer<KoClipPath> clipPath; ///< the current clip path
90
    QScopedPointer<KoClipMask> clipMask; ///< the current clip mask
91
    QMap<QString, QString> additionalAttributes;
92
    QMap<QByteArray, QString> additionalStyleAttributes;
93
    KoFilterEffectStack *filterEffectStack; ///< stack of filter effects applied to the shape
Jan Hambrecht's avatar
Jan Hambrecht committed
94
    qreal transparency; ///< the shapes transparency
95
    QString hyperLink; //hyperlink for this shape
96

97
    int zIndex : 16; // keep maxZIndex in sync!
98
    int runThrough : 16;
99 100 101 102 103 104
    int visible : 1;
    int printable : 1;
    int geometryProtected : 1;
    int keepAspect : 1;
    int selectable : 1;
    int detectCollision : 1;
105
    int protectContent : 1;
106

107
    KoShape::TextRunAroundSide textRunAroundSide;
108 109 110 111
    qreal textRunAroundDistanceLeft;
    qreal textRunAroundDistanceTop;
    qreal textRunAroundDistanceRight;
    qreal textRunAroundDistanceBottom;
112
    qreal textRunAroundThreshold;
113
    KoShape::TextRunAroundContour textRunAroundContour;
114 115 116 117


public:
    /// Connection point converters
118

119 120 121 122 123
    /// Convert connection point position from shape coordinates, taking alignment into account
    void convertFromShapeCoordinates(KoConnectionPoint &point, const QSizeF &shapeSize) const;

    /// Convert connection point position to shape coordinates, taking alignment into account
    void convertToShapeCoordinates(KoConnectionPoint &point, const QSizeF &shapeSize) const;
124

125
    Q_DECLARE_PUBLIC(KoShape)
126 127 128
};

#endif