|
Krita Source Code Documentation
|
#include <KoShapeAnchor.h>
Inheritance diagram for KoShapeAnchor:Classes | |
| class | PlacementStrategy |
| class | TextLocation |
Public Types | |
| enum | AnchorType { AnchorAsCharacter , AnchorToCharacter , AnchorParagraph , AnchorPage } |
| enum | HorizontalPos { HCenter , HFromInside , HFromLeft , HInside , HLeft , HOutside , HRight } |
| enum | HorizontalRel { HChar , HPage , HPageContent , HPageStartMargin , HPageEndMargin , HFrame , HFrameContent , HFrameEndMargin , HFrameStartMargin , HParagraph , HParagraphContent , HParagraphEndMargin , HParagraphStartMargin } |
| enum | VerticalPos { VBelow , VBottom , VFromTop , VMiddle , VTop } |
| enum | VerticalRel { VBaseline , VChar , VFrame , VFrameContent , VLine , VPage , VPageContent , VParagraph , VParagraphContent , VText } |
Public Member Functions | |
| AnchorType | anchorType () const |
| bool | flowWithText () const |
| return if flow-with-text (odf attribute) | |
| HorizontalPos | horizontalPos () const |
| return the current vertical-pos | |
| HorizontalRel | horizontalRel () const |
| return the current vertical-rel | |
| KoShapeAnchor (KoShape *shape) | |
| const QPointF & | offset () const |
| return the offset of the shape from the anchor. | |
| int | pageNumber () const |
| return the page number of the shape (valid with page anchoring, -1 indicates auto). | |
| PlacementStrategy * | placementStrategy () const |
| Get placement strategy which is used to position shape linked to text anchor. | |
| QDebug | printDebug (QDebug dbg) const |
| Private (KoShape *s) | |
| void | setAnchorType (AnchorType type) |
| void | setHorizontalPos (HorizontalPos) |
| set the current vertical-pos | |
| void | setHorizontalRel (HorizontalRel) |
| set the current vertical-rel | |
| void | setOffset (const QPointF &offset) |
| set the new offset of the shape. Causes a new layout soon. | |
| void | setPlacementStrategy (PlacementStrategy *placementStrategy) |
| void | setTextLocation (TextLocation *textLocation) |
| void | setVerticalPos (VerticalPos) |
| set the current horizontal-pos | |
| void | setVerticalRel (VerticalRel) |
| set the current horizontal-rel | |
| KoShape * | shape () const |
| TextLocation * | textLocation () const |
| Get extra data structure that is what is actually inside a text document. | |
| VerticalPos | verticalPos () const |
| return the current horizontal-pos | |
| VerticalRel | verticalRel () const |
| return the current horizontal-rel | |
| QString | wrapInfluenceOnPosition () const |
| return the wrap influence on position | |
| virtual | ~KoShapeAnchor () |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Additional Inherited Members | |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
This class is the object that explains how a shape is anchored to something.
The anchored shape will be positioned (in supporting applications) based on the properties defined in this class.
This class can be used in three different ways: -page anchor -as-char -char, paragraph anchor
If it's a page anchor it just provide the info about how the shape relates to a page with a specific page number.
For the other types of anchoring it has to have a TextLocation in a QTextDocument. This TextLocation can either be an inline character (type as-char) or a position (type char or paragraph) The KoShapeAnchor and TextLocation connects the anchored-shape to the text flow so the anchored shape can be repositioned on the canvas if new text is inserted or removed before the anchor character.
For as-char, char and paragraph use cases:
The position of the shape relative to the anchor is called the offset.
Definition at line 21 of file KoShapeAnchor.cpp.
| Enumerator | |
|---|---|
| AnchorAsCharacter | |
| AnchorToCharacter | |
| AnchorParagraph | |
| AnchorPage | |
Definition at line 132 of file KoShapeAnchor.h.
| Enumerator | |
|---|---|
| HCenter | |
| HFromInside | |
| HFromLeft | |
| HInside | |
| HLeft | |
| HOutside | |
| HRight | |
Definition at line 85 of file KoShapeAnchor.h.
| Enumerator | |
|---|---|
| HChar | |
| HPage | |
| HPageContent | |
| HPageStartMargin | |
| HPageEndMargin | |
| HFrame | |
| HFrameContent | |
| HFrameEndMargin | |
| HFrameStartMargin | |
| HParagraph | |
| HParagraphContent | |
| HParagraphEndMargin | |
| HParagraphStartMargin | |
Definition at line 95 of file KoShapeAnchor.h.
| Enumerator | |
|---|---|
| VBaseline | |
| VChar | |
| VFrame | |
| VFrameContent | |
| VLine | |
| VPage | |
| VPageContent | |
| VParagraph | |
| VParagraphContent | |
| VText | |
Definition at line 119 of file KoShapeAnchor.h.
|
explicit |
Constructor for an in-place anchor.
| shape | the anchored shape that this anchor links to. |
Definition at line 63 of file KoShapeAnchor.cpp.
|
virtual |
| AnchorType KoShapeAnchor::anchorType | ( | ) | const |
Returns the type of the anchor.
The text:anchor-type attribute specifies how a frame is bound to a text document. The anchor position is the point at which a frame is bound to a text document. The defined values for the text:anchor-type attribute are;
| bool KoShapeAnchor::flowWithText | ( | ) | const |
return if flow-with-text (odf attribute)
| HorizontalPos KoShapeAnchor::horizontalPos | ( | ) | const |
return the current vertical-pos
| HorizontalRel KoShapeAnchor::horizontalRel | ( | ) | const |
return the current vertical-rel
| const QPointF & KoShapeAnchor::offset | ( | ) | const |
return the offset of the shape from the anchor.
| int KoShapeAnchor::pageNumber | ( | ) | const |
return the page number of the shape (valid with page anchoring, -1 indicates auto).
| PlacementStrategy * KoShapeAnchor::placementStrategy | ( | ) | const |
Get placement strategy which is used to position shape linked to text anchor.
|
inline |
Definition at line 39 of file KoShapeAnchor.cpp.
|
inline |
Definition at line 24 of file KoShapeAnchor.cpp.
| void KoShapeAnchor::setAnchorType | ( | KoShapeAnchor::AnchorType | type | ) |
Set how the anchor behaves
Definition at line 151 of file KoShapeAnchor.cpp.
References AnchorAsCharacter, d, HChar, and HLeft.
| void KoShapeAnchor::setHorizontalPos | ( | HorizontalPos | hp | ) |
| void KoShapeAnchor::setHorizontalRel | ( | HorizontalRel | hr | ) |
| void KoShapeAnchor::setOffset | ( | const QPointF & | offset | ) |
| void KoShapeAnchor::setPlacementStrategy | ( | PlacementStrategy * | placementStrategy | ) |
Set placement strategy which is used to position shape linked to text anchor We take owner ship and will make sure the strategy is deleted
Definition at line 175 of file KoShapeAnchor.cpp.
References d, and placementStrategy.
| void KoShapeAnchor::setTextLocation | ( | TextLocation * | textLocation | ) |
Set extra data structure that is what is actually inside a text document We do NOT take ownership (may change in the future)
Definition at line 165 of file KoShapeAnchor.cpp.
References d, and textLocation.
| void KoShapeAnchor::setVerticalPos | ( | VerticalPos | vp | ) |
| void KoShapeAnchor::setVerticalRel | ( | VerticalRel | vr | ) |
| KoShape * KoShapeAnchor::shape | ( | ) | const |
Return the shape that is linked to from the text anchor.
| TextLocation * KoShapeAnchor::textLocation | ( | ) | const |
Get extra data structure that is what is actually inside a text document.
| VerticalPos KoShapeAnchor::verticalPos | ( | ) | const |
return the current horizontal-pos
| VerticalRel KoShapeAnchor::verticalRel | ( | ) | const |
return the current horizontal-rel
| QString KoShapeAnchor::wrapInfluenceOnPosition | ( | ) | const |
return the wrap influence on position
| KoShapeAnchor::AnchorType KoShapeAnchor::anchorType |
Definition at line 57 of file KoShapeAnchor.cpp.
|
private |
Definition at line 237 of file KoShapeAnchor.h.
| bool KoShapeAnchor::flowWithText |
Definition at line 56 of file KoShapeAnchor.cpp.
| KoShapeAnchor::HorizontalPos KoShapeAnchor::horizontalPos |
Definition at line 53 of file KoShapeAnchor.cpp.
| KoShapeAnchor::HorizontalRel KoShapeAnchor::horizontalRel |
Definition at line 54 of file KoShapeAnchor.cpp.
| const QPointF & KoShapeAnchor::offset |
Definition at line 50 of file KoShapeAnchor.cpp.
| int KoShapeAnchor::pageNumber |
Definition at line 59 of file KoShapeAnchor.cpp.
| KoShapeAnchor::PlacementStrategy * KoShapeAnchor::placementStrategy |
Definition at line 58 of file KoShapeAnchor.cpp.
| KoShape * KoShapeAnchor::shape |
Definition at line 49 of file KoShapeAnchor.cpp.
| KoShapeAnchor::TextLocation * KoShapeAnchor::textLocation |
Definition at line 60 of file KoShapeAnchor.cpp.
| KoShapeAnchor::VerticalPos KoShapeAnchor::verticalPos |
Definition at line 51 of file KoShapeAnchor.cpp.
| KoShapeAnchor::VerticalRel KoShapeAnchor::verticalRel |
Definition at line 52 of file KoShapeAnchor.cpp.
| QString KoShapeAnchor::wrapInfluenceOnPosition |
Definition at line 55 of file KoShapeAnchor.cpp.