49
50
* Steps to use a KoTextAnchor are; <ol>
50
51
* <li> Create a new instance with e.g. new KoTextAnchor(myshape);
51
* <li> Use loadOdfFromShape() to load additional attributes like the "text:anchor-type"
52
* <li> Use loadOdf() to load additional attributes like the "text:anchor-type"
52
53
* <li> Position the anchor with updatePosition() what will attach the KoTextAnchor-instance to
53
54
* the TextShape's \a KoTextShapeContainerModel . </ol>
54
* The position of the shape relative to the anchor is called the offset. It's loaded by loadOdfFromShape().
55
* The position of the shape relative to the anchor is called the offset. It's loaded by loadOdf().
55
56
* @see KWAnchorStrategy for more information about the layout of anchors/shapes in KWord.
57
58
class KOTEXT_EXPORT KoTextAnchor : public KoInlineObject
60
61
/// the vertical alignment options for the shape this anchor holds.
61
62
enum AnchorVertical {
63
TopOfPage, ///< Align the anchors top to the top of the page
64
BottomOfPage, ///< Align the anchors bottom to the bottom of the page
65
TopOfPageContent, ///< Align the anchors top to the top of the page content (top margin of page)
66
BottomOfPageContent,///< Align the anchors bottom to the bottom of the content (bottom margin of page)
62
67
TopOfFrame, ///< Align the anchors top to the top of the frame it is laid-out in.
68
BottomOfFrame, ///< Align the anchors bottom to the bottom of the frame.
63
69
TopOfParagraph, ///< Align the anchors top to the top of the paragraph it is anchored in.
70
BottomOfParagraph, ///< Align the anchors bottom to the bottom of the paragraph it is anchord in.
64
71
AboveCurrentLine, ///< Align the anchors top to the top of the line it is anchord in.
65
72
BelowCurrentLine, ///< Align the anchors bottom to the bottom of the line it is anchord in.
66
BottomOfParagraph, ///< Align the anchors bottom to the bottom of the paragraph it is anchord in.
67
BottomOfFrame, ///< Align the anchors bottom to the bottom of the frame.
68
73
VerticalOffset ///< Move the anchor to be an exact vertical distance from the (baseline) of the anchor.
70
76
/// the horizontal alignment options for the shape this anchor holds.
71
77
enum AnchorHorizontal {
78
LeftOfPage, ///< Align the anchors left to the left of the page
79
RightOfPage, ///< Align the anchors right to the right of the page
80
CenterOfPage, ///< Align the anchors center to the center of the page
72
81
Left, ///< Align the anchors left to the left of the frame it is laid-out in.
73
82
Right, ///< Align the anchors rigth to the rigth of the frame it is laid-out in.
74
83
Center, ///< Align the anchors center to the center of the frame it is laid-out in.
132
141
void setOffset(const QPointF &offset);
134
143
/// Load the additional attributes.
135
bool loadOdfFromShape(const KoXmlElement &element);
144
bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
136
145
/// Save the additional attributes.
137
146
void saveOdf(KoShapeSavingContext &context);