Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeAnchor.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2007, 2009 Thomas Zander <zander@kde.org>
3 * SPDX-FileCopyrightText: 2011 Matus Hanzes <matus.hanzes@ixonos.com>
4 * SPDX-FileCopyrightText: 2013 C. Boemann <cbo@boemann.dk>
5 *
6 * SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8#ifndef KOSHAPEANCHOR_H
9#define KOSHAPEANCHOR_H
10
11#include "kritaflake_export.h"
12
13
14class KoShape;
15#include <QDomDocument>
18class KoShapeAnchorPrivate;
19
20class QTextDocument;
21class QPointF;
22class QString;
23
51class KRITAFLAKE_EXPORT KoShapeAnchor
52{
53public:
58 public:
60 virtual ~PlacementStrategy(){};
61
66 virtual void detachFromModel() = 0;
67
74 virtual void updateContainerModel() = 0;
75 };
76
78 public:
80 virtual ~TextLocation(){};
81 virtual const QTextDocument *document() const = 0;
82 virtual int position() const = 0;
83 };
84
94
110
118
119 enum VerticalRel { //NOTE: update KWAnchoringProperties if you change this
129 VText
130 };
131
138
143 explicit KoShapeAnchor(KoShape *shape);
144 virtual ~KoShapeAnchor();
145
149 KoShape *shape() const;
150
176
180 void setAnchorType(AnchorType type);
181
183 void setHorizontalPos(HorizontalPos);
184
187
189 void setHorizontalRel(HorizontalRel);
190
193
195 void setVerticalPos(VerticalPos);
196
199
201 void setVerticalRel(VerticalRel);
202
205
207 QString wrapInfluenceOnPosition() const;
208
210 bool flowWithText() const;
211
213 int pageNumber() const;
214
216 const QPointF &offset() const;
217
219 void setOffset(const QPointF &offset);
220
223
226 void setTextLocation(TextLocation *textLocation);
227
230
233 void setPlacementStrategy(PlacementStrategy *placementStrategy);
234
235private:
236 class Private;
237 Private * const d;
238};
239
240#endif
virtual void updateContainerModel()=0
virtual int position() const =0
virtual const QTextDocument * document() const =0
VerticalPos verticalPos() const
return the current horizontal-pos
VerticalRel verticalRel() const
return the current horizontal-rel
bool flowWithText() const
return if flow-with-text (odf attribute)
PlacementStrategy * placementStrategy() const
Get placement strategy which is used to position shape linked to text anchor.
AnchorType anchorType() const
HorizontalRel horizontalRel() const
return the current vertical-rel
QString wrapInfluenceOnPosition() const
return the wrap influence on position
int pageNumber() const
return the page number of the shape (valid with page anchoring, -1 indicates auto).
const QPointF & offset() const
return the offset of the shape from the anchor.
HorizontalPos horizontalPos() const
return the current vertical-pos
TextLocation * textLocation() const
Get extra data structure that is what is actually inside a text document.
KoShape * shape() const
Private *const d