Changeset View
Changeset View
Standalone View
Standalone View
libs/flake/KoShape.h
Show All 18 Lines | 1 | /* This file is part of the KDE project | |||
---|---|---|---|---|---|
19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
20 | * Boston, MA 02110-1301, USA. | 20 | * Boston, MA 02110-1301, USA. | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #ifndef KOSHAPE_H | 23 | #ifndef KOSHAPE_H | ||
24 | #define KOSHAPE_H | 24 | #define KOSHAPE_H | ||
25 | 25 | | |||
26 | #include "KoFlake.h" | 26 | #include "KoFlake.h" | ||
27 | #include "KoFlakeTypes.h" | ||||
27 | #include "KoConnectionPoint.h" | 28 | #include "KoConnectionPoint.h" | ||
28 | 29 | | |||
29 | #include <QSharedPointer> | 30 | #include <QSharedPointer> | ||
30 | #include <QSet> | 31 | #include <QSet> | ||
31 | #include <QMetaType> | 32 | #include <QMetaType> | ||
32 | 33 | | |||
33 | #include <KoXmlReaderForward.h> | 34 | #include <KoXmlReaderForward.h> | ||
34 | 35 | | |||
Show All 12 Lines | |||||
47 | class KoShapeSavingContext; | 48 | class KoShapeSavingContext; | ||
48 | class KoShapeLoadingContext; | 49 | class KoShapeLoadingContext; | ||
49 | class KoGenStyle; | 50 | class KoGenStyle; | ||
50 | class KoShapeShadow; | 51 | class KoShapeShadow; | ||
51 | class KoShapePrivate; | 52 | class KoShapePrivate; | ||
52 | class KoFilterEffectStack; | 53 | class KoFilterEffectStack; | ||
53 | class KoSnapData; | 54 | class KoSnapData; | ||
54 | class KoClipPath; | 55 | class KoClipPath; | ||
56 | class KoClipMask; | ||||
55 | class KoShapePaintingContext; | 57 | class KoShapePaintingContext; | ||
56 | class KoShapeAnchor; | 58 | class KoShapeAnchor; | ||
57 | class KoBorder; | 59 | class KoBorder; | ||
58 | struct KoInsets; | 60 | struct KoInsets; | ||
59 | class KoShapeBackground; | 61 | class KoShapeBackground; | ||
62 | class KisHandlePainterHelper; | ||||
60 | 63 | | |||
61 | 64 | | |||
62 | /** | 65 | /** | ||
63 | * | 66 | * | ||
64 | * Base class for all flake shapes. Shapes extend this class | 67 | * Base class for all flake shapes. Shapes extend this class | ||
65 | * to allow themselves to be manipulated. This class just represents | 68 | * to allow themselves to be manipulated. This class just represents | ||
66 | * a graphical shape in the document and can be manipulated by some default | 69 | * a graphical shape in the document and can be manipulated by some default | ||
67 | * tools in this library. | 70 | * tools in this library. | ||
Show All 40 Lines | 110 | public: | |||
108 | /// Used by shapeChanged() to select which change was made | 111 | /// Used by shapeChanged() to select which change was made | ||
109 | enum ChangeType { | 112 | enum ChangeType { | ||
110 | PositionChanged, ///< used after a setPosition() | 113 | PositionChanged, ///< used after a setPosition() | ||
111 | RotationChanged, ///< used after a setRotation() | 114 | RotationChanged, ///< used after a setRotation() | ||
112 | ScaleChanged, ///< used after a scale() | 115 | ScaleChanged, ///< used after a scale() | ||
113 | ShearChanged, ///< used after a shear() | 116 | ShearChanged, ///< used after a shear() | ||
114 | SizeChanged, ///< used after a setSize() | 117 | SizeChanged, ///< used after a setSize() | ||
115 | GenericMatrixChange, ///< used after the matrix was changed without knowing which property explicitly changed | 118 | GenericMatrixChange, ///< used after the matrix was changed without knowing which property explicitly changed | ||
119 | KeepAspectRatioChange, ///< used after setKeepAspectRatio() | ||||
116 | ParentChanged, ///< used after a setParent() | 120 | ParentChanged, ///< used after a setParent() | ||
117 | CollisionDetected, ///< used when another shape moved in our boundingrect | 121 | CollisionDetected, ///< used when another shape moved in our boundingrect | ||
118 | Deleted, ///< the shape was deleted | 122 | Deleted, ///< the shape was deleted | ||
119 | StrokeChanged, ///< the shapes stroke has changed | 123 | StrokeChanged, ///< the shapes stroke has changed | ||
120 | BackgroundChanged, ///< the shapes background has changed | 124 | BackgroundChanged, ///< the shapes background has changed | ||
121 | ShadowChanged, ///< the shapes shadow has changed | 125 | ShadowChanged, ///< the shapes shadow has changed | ||
122 | BorderChanged, ///< the shapes border has changed | 126 | BorderChanged, ///< the shapes border has changed | ||
123 | ParameterChanged, ///< the shapes parameter has changed (KoParameterShape only) | 127 | ParameterChanged, ///< the shapes parameter has changed (KoParameterShape only) | ||
124 | ContentChanged, ///< the content of the shape changed e.g. a new image inside a pixmap/text change inside a textshape | 128 | ContentChanged, ///< the content of the shape changed e.g. a new image inside a pixmap/text change inside a textshape | ||
125 | TextRunAroundChanged, ///< used after a setTextRunAroundSide() | 129 | TextRunAroundChanged, ///< used after a setTextRunAroundSide() | ||
126 | ChildChanged, ///< a child of a container was changed/removed. This is propagated to all parents | 130 | ChildChanged, ///< a child of a container was changed/removed. This is propagated to all parents | ||
127 | ConnectionPointChanged, ///< a connection point has changed | 131 | ConnectionPointChanged, ///< a connection point has changed | ||
128 | ClipPathChanged ///< the shapes clip path has changed | 132 | ClipPathChanged, ///< the shapes clip path has changed | ||
133 | TransparencyChanged ///< the shapetransparency value has changed | ||||
129 | }; | 134 | }; | ||
130 | 135 | | |||
131 | /// The behavior text should do when intersecting this shape. | 136 | /// The behavior text should do when intersecting this shape. | ||
132 | enum TextRunAroundSide { | 137 | enum TextRunAroundSide { | ||
133 | BiggestRunAroundSide, ///< Run other text around the side that has the most space | 138 | BiggestRunAroundSide, ///< Run other text around the side that has the most space | ||
134 | LeftRunAroundSide, ///< Run other text around the left side of the frame | 139 | LeftRunAroundSide, ///< Run other text around the left side of the frame | ||
135 | RightRunAroundSide, ///< Run other text around the right side of the frame | 140 | RightRunAroundSide, ///< Run other text around the right side of the frame | ||
136 | EnoughRunAroundSide, ///< Run other text dynamically around both sides of the shape, provided there is sufficient space left | 141 | EnoughRunAroundSide, ///< Run other text dynamically around both sides of the shape, provided there is sufficient space left | ||
Show All 23 Lines | |||||
160 | KoShape(); | 165 | KoShape(); | ||
161 | 166 | | |||
162 | /** | 167 | /** | ||
163 | * @brief Destructor | 168 | * @brief Destructor | ||
164 | */ | 169 | */ | ||
165 | virtual ~KoShape(); | 170 | virtual ~KoShape(); | ||
166 | 171 | | |||
167 | /** | 172 | /** | ||
173 | * @brief creates a deep copy of thie shape or shapes subtree | ||||
174 | * @return a cloned shape | ||||
175 | */ | ||||
176 | virtual KoShape* cloneShape() const; | ||||
177 | | ||||
178 | /** | ||||
168 | * @brief Paint the shape | 179 | * @brief Paint the shape | ||
169 | * The class extending this one is responsible for painting itself. Since we do not | 180 | * The class extending this one is responsible for painting itself. Since we do not | ||
170 | * assume the shape is square the paint must also clear its background if it will draw | 181 | * assume the shape is square the paint must also clear its background if it will draw | ||
171 | * something transparent on top. | 182 | * something transparent on top. | ||
172 | * This can be done with a method like: | 183 | * This can be done with a method like: | ||
173 | * <code> | 184 | * <code> | ||
174 | painter.fillRect(converter.normalToView(QRectF(QPointF(0.0,0.0), size())), background());</code> | 185 | painter.fillRect(converter.normalToView(QRectF(QPointF(0.0,0.0), size())), background());</code> | ||
175 | * Or equavalent for non-square objects. | 186 | * Or equavalent for non-square objects. | ||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Line(s) | |||||
316 | * | 327 | * | ||
317 | * This includes the line width and the shadow of the shape | 328 | * This includes the line width and the shadow of the shape | ||
318 | * | 329 | * | ||
319 | * @return the bounding box of the shape | 330 | * @return the bounding box of the shape | ||
320 | */ | 331 | */ | ||
321 | virtual QRectF boundingRect() const; | 332 | virtual QRectF boundingRect() const; | ||
322 | 333 | | |||
323 | /** | 334 | /** | ||
335 | * Get the united bounding box of a group of shapes. This is a utility | ||||
336 | * function used in many places in Krita. | ||||
337 | */ | ||||
338 | static QRectF boundingRect(const QList<KoShape*> &shapes); | ||||
339 | | ||||
340 | /** | ||||
341 | * @return the bounding rect of the outline of the shape measured | ||||
342 | * in absolute coordinate system. Please note that in contrast to | ||||
343 | * boundingRect() this rect doesn't include the stroke and other | ||||
344 | * insets. | ||||
345 | */ | ||||
346 | QRectF absoluteOutlineRect(KoViewConverter *converter = 0) const; | ||||
347 | | ||||
348 | /** | ||||
349 | * Same as a member function, but applies to a list of shapes and returns a | ||||
350 | * united rect. | ||||
351 | */ | ||||
352 | static QRectF absoluteOutlineRect(const QList<KoShape*> &shapes, KoViewConverter *converter = 0); | ||||
353 | | ||||
354 | /** | ||||
324 | * @brief Add a connector point to the shape | 355 | * @brief Add a connector point to the shape | ||
325 | * | 356 | * | ||
326 | * A connector is a place on the shape that allows a graphical connection to be made | 357 | * A connector is a place on the shape that allows a graphical connection to be made | ||
327 | * using a line, for example. | 358 | * using a line, for example. | ||
328 | * | 359 | * | ||
329 | * @param point the connection point to add | 360 | * @param point the connection point to add | ||
330 | * @return the id of the new connection point | 361 | * @return the id of the new connection point | ||
331 | */ | 362 | */ | ||
▲ Show 20 Lines • Show All 314 Lines • ▼ Show 20 Line(s) | |||||
646 | KoShapeContainer *parent() const; | 677 | KoShapeContainer *parent() const; | ||
647 | 678 | | |||
648 | /** | 679 | /** | ||
649 | * Set the parent of this shape. | 680 | * Set the parent of this shape. | ||
650 | * @param parent the new parent of this shape. Can be 0 if the shape has no parent anymore. | 681 | * @param parent the new parent of this shape. Can be 0 if the shape has no parent anymore. | ||
651 | */ | 682 | */ | ||
652 | void setParent(KoShapeContainer *parent); | 683 | void setParent(KoShapeContainer *parent); | ||
653 | 684 | | |||
685 | | ||||
686 | /** | ||||
687 | * @brief inheritsTransformFromAny checks if the shape inherits transformation from | ||||
688 | * any of the shapes listed in \p ancestorsInQuestion. The inheritance is checked | ||||
689 | * in recursive way. | ||||
690 | * @return true if there is a (transitive) transformation-wise parent found in \p ancestorsInQuestion | ||||
691 | */ | ||||
692 | bool inheritsTransformFromAny(const QList<KoShape*> ancestorsInQuestion) const; | ||||
693 | | ||||
654 | /** | 694 | /** | ||
655 | * Request a repaint to be queued. | 695 | * Request a repaint to be queued. | ||
656 | * The repaint will be of the entire Shape, including its selection handles should this | 696 | * The repaint will be of the entire Shape, including its selection handles should this | ||
657 | * shape be selected. | 697 | * shape be selected. | ||
658 | * <p>This method will return immediately and only request a repaint. Successive calls | 698 | * <p>This method will return immediately and only request a repaint. Successive calls | ||
659 | * will be merged into an appropriate repaint action. | 699 | * will be merged into an appropriate repaint action. | ||
660 | */ | 700 | */ | ||
661 | virtual void update() const; | 701 | virtual void update() const; | ||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | 721 | /** | |||
726 | * @returns the outline of the shape in the form of a path. | 766 | * @returns the outline of the shape in the form of a path. | ||
727 | */ | 767 | */ | ||
728 | virtual QPainterPath shadowOutline() const; | 768 | virtual QPainterPath shadowOutline() const; | ||
729 | 769 | | |||
730 | /** | 770 | /** | ||
731 | * Returns the currently set stroke, or 0 if there is no stroke. | 771 | * Returns the currently set stroke, or 0 if there is no stroke. | ||
732 | * @return the currently set stroke, or 0 if there is no stroke. | 772 | * @return the currently set stroke, or 0 if there is no stroke. | ||
733 | */ | 773 | */ | ||
734 | KoShapeStrokeModel *stroke() const; | 774 | KoShapeStrokeModelSP stroke() const; | ||
735 | 775 | | |||
736 | /** | 776 | /** | ||
737 | * Set a new stroke, removing the old one. | 777 | * Set a new stroke, removing the old one. | ||
738 | * @param stroke the new stroke, or 0 if there should be no stroke. | 778 | * @param stroke the new stroke, or 0 if there should be no stroke. | ||
739 | */ | 779 | */ | ||
740 | void setStroke(KoShapeStrokeModel *stroke); | 780 | void setStroke(KoShapeStrokeModelSP stroke); | ||
741 | 781 | | |||
742 | /** | 782 | /** | ||
743 | * Return the insets of the stroke. | 783 | * Return the insets of the stroke. | ||
744 | * Convenience method for KoShapeStrokeModel::strokeInsets() | 784 | * Convenience method for KoShapeStrokeModel::strokeInsets() | ||
745 | */ | 785 | */ | ||
746 | KoInsets strokeInsets() const; | 786 | KoInsets strokeInsets() const; | ||
747 | 787 | | |||
748 | /// Sets the new shadow, removing the old one | 788 | /// Sets the new shadow, removing the old one | ||
Show All 9 Lines | |||||
758 | KoBorder *border() const; | 798 | KoBorder *border() const; | ||
759 | 799 | | |||
760 | /// Sets a new clip path, removing the old one | 800 | /// Sets a new clip path, removing the old one | ||
761 | void setClipPath(KoClipPath *clipPath); | 801 | void setClipPath(KoClipPath *clipPath); | ||
762 | 802 | | |||
763 | /// Returns the currently set clip path or 0 if there is no clip path set | 803 | /// Returns the currently set clip path or 0 if there is no clip path set | ||
764 | KoClipPath * clipPath() const; | 804 | KoClipPath * clipPath() const; | ||
765 | 805 | | |||
806 | /// Sets a new clip mask, removing the old one. The mask is owned by the shape. | ||||
807 | void setClipMask(KoClipMask *clipMask); | ||||
808 | | ||||
809 | /// Returns the currently set clip mask or 0 if there is no clip mask set | ||||
810 | KoClipMask* clipMask() const; | ||||
811 | | ||||
766 | /** | 812 | /** | ||
767 | * Setting the shape to keep its aspect-ratio has the effect that user-scaling will | 813 | * Setting the shape to keep its aspect-ratio has the effect that user-scaling will | ||
768 | * keep the width/hight ratio intact so as not to distort shapes that rely on that | 814 | * keep the width/hight ratio intact so as not to distort shapes that rely on that | ||
769 | * ratio. | 815 | * ratio. | ||
770 | * @param keepAspect the new value | 816 | * @param keepAspect the new value | ||
771 | */ | 817 | */ | ||
772 | void setKeepAspectRatio(bool keepAspect); | 818 | void setKeepAspectRatio(bool keepAspect); | ||
773 | 819 | | |||
774 | /** | 820 | /** | ||
775 | * Setting the shape to keep its aspect-ratio has the effect that user-scaling will | 821 | * Setting the shape to keep its aspect-ratio has the effect that user-scaling will | ||
776 | * keep the width/hight ratio intact so as not to distort shapes that rely on that | 822 | * keep the width/hight ratio intact so as not to distort shapes that rely on that | ||
777 | * ratio. | 823 | * ratio. | ||
778 | * @return whether to keep aspect ratio of this shape | 824 | * @return whether to keep aspect ratio of this shape | ||
779 | */ | 825 | */ | ||
780 | bool keepAspectRatio() const; | 826 | bool keepAspectRatio() const; | ||
781 | 827 | | |||
782 | /** | 828 | /** | ||
783 | * Return the position of this shape regardless of rotation/skew/scaling and regardless of | 829 | * Return the position of this shape regardless of rotation/skew/scaling and regardless of | ||
784 | * this shape having a parent (being in a group) or not.<br> | 830 | * this shape having a parent (being in a group) or not.<br> | ||
785 | * @param anchor The place on the (unaltered) shape that you want the position of. | 831 | * @param anchor The place on the (unaltered) shape that you want the position of. | ||
786 | * @return the point that is the absolute, centered position of this shape. | 832 | * @return the point that is the absolute, centered position of this shape. | ||
787 | */ | 833 | */ | ||
788 | QPointF absolutePosition(KoFlake::Position anchor = KoFlake::CenteredPosition) const; | 834 | QPointF absolutePosition(KoFlake::AnchorPosition anchor = KoFlake::Center) const; | ||
789 | 835 | | |||
790 | /** | 836 | /** | ||
791 | * Move this shape to an absolute position where the end location will be the same | 837 | * Move this shape to an absolute position where the end location will be the same | ||
792 | * regardless of the shape's rotation/skew/scaling and regardless of this shape having | 838 | * regardless of the shape's rotation/skew/scaling and regardless of this shape having | ||
793 | * a parent (being in a group) or not.<br> | 839 | * a parent (being in a group) or not.<br> | ||
794 | * The newPosition is going to be the center of the shape. | 840 | * The newPosition is going to be the center of the shape. | ||
795 | * This has the convenient effect that: <pre> | 841 | * This has the convenient effect that: <pre> | ||
796 | shape->setAbsolutePosition(QPointF(0,0)); | 842 | shape->setAbsolutePosition(QPointF(0,0)); | ||
797 | shape->rotate(45);</pre> | 843 | shape->rotate(45);</pre> | ||
798 | Will result in the same visual position of the shape as the opposite:<pre> | 844 | Will result in the same visual position of the shape as the opposite:<pre> | ||
799 | shape->rotate(45); | 845 | shape->rotate(45); | ||
800 | shape->setAbsolutePosition(QPointF(0,0));</pre> | 846 | shape->setAbsolutePosition(QPointF(0,0));</pre> | ||
801 | * @param newPosition the new absolute center of the shape. | 847 | * @param newPosition the new absolute center of the shape. | ||
802 | * @param anchor The place on the (unaltered) shape that you set the position of. | 848 | * @param anchor The place on the (unaltered) shape that you set the position of. | ||
803 | */ | 849 | */ | ||
804 | void setAbsolutePosition(const QPointF &newPosition, KoFlake::Position anchor = KoFlake::CenteredPosition); | 850 | void setAbsolutePosition(const QPointF &newPosition, KoFlake::AnchorPosition anchor = KoFlake::Center); | ||
805 | 851 | | |||
806 | /** | 852 | /** | ||
807 | * Set a data object on the shape to be used by an application. | 853 | * Set a data object on the shape to be used by an application. | ||
808 | * This is specifically useful when a shape is created in a plugin and that data from that | 854 | * This is specifically useful when a shape is created in a plugin and that data from that | ||
809 | * shape should be accessible outside the plugin. | 855 | * shape should be accessible outside the plugin. | ||
810 | * @param userData the new user data, or 0 to delete the current one. | 856 | * @param userData the new user data, or 0 to delete the current one. | ||
811 | */ | 857 | */ | ||
812 | void setUserData(KoShapeUserData *userData); | 858 | void setUserData(KoShapeUserData *userData); | ||
813 | /** | 859 | /** | ||
814 | * Return the current userData. | 860 | * Return the current userData. | ||
815 | */ | 861 | */ | ||
816 | KoShapeUserData *userData() const; | 862 | KoShapeUserData *userData() const; | ||
817 | 863 | | |||
818 | /** | 864 | /** | ||
819 | * Set a data object on the shape to be used by an application. | | |||
820 | * This is specifically useful when an application wants to have data that is per shape | | |||
821 | * and should be deleted when the shape is destructed. | | |||
822 | * @param applicationData the new application data, or 0 to delete the current one. | | |||
823 | */ | | |||
824 | void setApplicationData(KoShapeApplicationData *applicationData); | | |||
825 | | ||||
826 | /** | | |||
827 | * Return the current applicationData. | | |||
828 | */ | | |||
829 | KoShapeApplicationData *applicationData() const; | | |||
830 | | ||||
831 | /** | | |||
832 | * Return the Id of this shape, identifying the type of shape by the id of the factory. | 865 | * Return the Id of this shape, identifying the type of shape by the id of the factory. | ||
833 | * @see KoShapeFactoryBase::shapeId() | 866 | * @see KoShapeFactoryBase::shapeId() | ||
834 | * @return the id of the shape-type | 867 | * @return the id of the shape-type | ||
835 | */ | 868 | */ | ||
836 | QString shapeId() const; | 869 | QString shapeId() const; | ||
837 | 870 | | |||
838 | /** | 871 | /** | ||
839 | * Set the Id of this shape. A shapeFactory is expected to set the Id at creation | 872 | * Set the Id of this shape. A shapeFactory is expected to set the Id at creation | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | |||||
896 | * internal coordinate system directly to paint itself instead of considering the | 929 | * internal coordinate system directly to paint itself instead of considering the | ||
897 | * views zoom. | 930 | * views zoom. | ||
898 | * @param painter the painter to alter the zoom level of. | 931 | * @param painter the painter to alter the zoom level of. | ||
899 | * @param converter the converter for the current views zoom. | 932 | * @param converter the converter for the current views zoom. | ||
900 | */ | 933 | */ | ||
901 | static void applyConversion(QPainter &painter, const KoViewConverter &converter); | 934 | static void applyConversion(QPainter &painter, const KoViewConverter &converter); | ||
902 | 935 | | |||
903 | /** | 936 | /** | ||
937 | * A convenience method that creates a handles helper with applying transformations at | ||||
938 | * the same time. Please note that you shouldn't save/restore additionally. All the work | ||||
939 | * on restoring original painter's transformations is done by the helper. | ||||
940 | */ | ||||
941 | static KisHandlePainterHelper createHandlePainterHelper(QPainter *painter, KoShape *shape, const KoViewConverter &converter, qreal handleRadius = 0.0); | ||||
942 | | ||||
943 | /** | ||||
904 | * @brief Transforms point from shape coordinates to document coordinates | 944 | * @brief Transforms point from shape coordinates to document coordinates | ||
905 | * @param point in shape coordinates | 945 | * @param point in shape coordinates | ||
906 | * @return point in document coordinates | 946 | * @return point in document coordinates | ||
907 | */ | 947 | */ | ||
908 | QPointF shapeToDocument(const QPointF &point) const; | 948 | QPointF shapeToDocument(const QPointF &point) const; | ||
909 | 949 | | |||
910 | /** | 950 | /** | ||
911 | * @brief Transforms rect from shape coordinates to document coordinates | 951 | * @brief Transforms rect from shape coordinates to document coordinates | ||
▲ Show 20 Lines • Show All 173 Lines • ▼ Show 20 Line(s) | |||||
1085 | void setHyperLink(const QString &hyperLink); | 1125 | void setHyperLink(const QString &hyperLink); | ||
1086 | 1126 | | |||
1087 | /** | 1127 | /** | ||
1088 | * \internal | 1128 | * \internal | ||
1089 | * Returns the private object for use within the flake lib | 1129 | * Returns the private object for use within the flake lib | ||
1090 | */ | 1130 | */ | ||
1091 | KoShapePrivate *priv(); | 1131 | KoShapePrivate *priv(); | ||
1092 | 1132 | | |||
1133 | public: | ||||
1134 | | ||||
1135 | struct ShapeChangeListener { | ||||
1136 | virtual ~ShapeChangeListener(); | ||||
1137 | virtual void notifyShapeChanged(ChangeType type, KoShape *shape) = 0; | ||||
1138 | | ||||
1139 | private: | ||||
1140 | friend class KoShape; | ||||
1141 | friend class KoShapePrivate; | ||||
1142 | void registerShape(KoShape *shape); | ||||
1143 | void unregisterShape(KoShape *shape); | ||||
1144 | void notifyShapeChangedImpl(ChangeType type, KoShape *shape); | ||||
1145 | | ||||
1146 | QList<KoShape*> m_registeredShapes; | ||||
1147 | }; | ||||
1148 | | ||||
1149 | void addShapeChangeListener(ShapeChangeListener *listener); | ||||
1150 | void removeShapeChangeListener(ShapeChangeListener *listener); | ||||
1151 | | ||||
1152 | public: | ||||
1153 | static QList<KoShape*> linearizeSubtree(const QList<KoShape*> &shapes); | ||||
1154 | | ||||
1093 | protected: | 1155 | protected: | ||
1094 | /// constructor | 1156 | /// constructor | ||
1095 | KoShape(KoShapePrivate &); | 1157 | KoShape(KoShapePrivate *); | ||
1096 | 1158 | | |||
1097 | /* ** loading saving helper methods */ | 1159 | /* ** loading saving helper methods */ | ||
1098 | /// attributes from ODF 1.1 chapter 9.2.15 Common Drawing Shape Attributes | 1160 | /// attributes from ODF 1.1 chapter 9.2.15 Common Drawing Shape Attributes | ||
1099 | enum OdfAttribute { | 1161 | enum OdfAttribute { | ||
1100 | OdfTransformation = 1, ///< Store transformation information | 1162 | OdfTransformation = 1, ///< Store transformation information | ||
1101 | OdfSize = 2, ///< Store size information | 1163 | OdfSize = 2, ///< Store size information | ||
1102 | OdfPosition = 8, ///< Store position | 1164 | OdfPosition = 8, ///< Store position | ||
1103 | OdfAdditionalAttributes = 4, ///< Store additional attributes of the shape | 1165 | OdfAdditionalAttributes = 4, ///< Store additional attributes of the shape | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
1150 | * Loads the stroke and fill style from the given element. | 1212 | * Loads the stroke and fill style from the given element. | ||
1151 | * | 1213 | * | ||
1152 | * @param element the xml element to load the style from | 1214 | * @param element the xml element to load the style from | ||
1153 | * @param context the loading context used for loading | 1215 | * @param context the loading context used for loading | ||
1154 | */ | 1216 | */ | ||
1155 | virtual void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context); | 1217 | virtual void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context); | ||
1156 | 1218 | | |||
1157 | /// Loads the stroke style | 1219 | /// Loads the stroke style | ||
1158 | KoShapeStrokeModel *loadOdfStroke(const KoXmlElement &element, KoShapeLoadingContext &context) const; | 1220 | KoShapeStrokeModelSP loadOdfStroke(const KoXmlElement &element, KoShapeLoadingContext &context) const; | ||
1159 | 1221 | | |||
1160 | /// Loads the fill style | 1222 | /// Loads the fill style | ||
1161 | QSharedPointer<KoShapeBackground> loadOdfFill(KoShapeLoadingContext &context) const; | 1223 | QSharedPointer<KoShapeBackground> loadOdfFill(KoShapeLoadingContext &context) const; | ||
1162 | 1224 | | |||
1163 | /// Loads the connection points | 1225 | /// Loads the connection points | ||
1164 | void loadOdfGluePoints(const KoXmlElement &element, KoShapeLoadingContext &context); | 1226 | void loadOdfGluePoints(const KoXmlElement &element, KoShapeLoadingContext &context); | ||
1165 | 1227 | | |||
1166 | /// Loads the clip contour | 1228 | /// Loads the clip contour | ||
Show All 23 Lines |