pub struct ObjectPlacement {
pub text_wrap: ObjectTextWrap,
pub text_flow: ObjectTextFlow,
pub treat_as_char: bool,
pub flow_with_text: bool,
pub allow_overlap: bool,
pub vert_rel_to: ObjectRelativeTo,
pub horz_rel_to: ObjectRelativeTo,
pub vert_offset: HwpUnit,
pub horz_offset: HwpUnit,
}Expand description
Optional object-placement metadata for a floating drawing object.
Mirrors the HWPX <hp:pos> block (anchor references + offsets +
treat-as-char / overlap / flow flags) together with the owning shape’s
textWrap/textFlow attributes.
ObjectPlacement::legacy_inline_defaults is the canonical “plain inline
object” value: an image or shape that behaves like a character with no
floating offset. Decoders collapse a placement equal to this default back
to None, so the encoder’s untouched legacy path emits the historical
inline bytes (mirrors the Option<ShapeStyle> collapse pattern in the
HWPX shape-style decoder).
Offsets are signed: Hancom persists negative offsets in HWPX hp:pos
as u32 wrap-around decimal strings (e.g. horzOffset="4294965029"
= −2267, dialog-authored fixture measurement), and in HWP5 as plain
signed i32. Codecs must round-trip both encodings losslessly.
Fields§
§text_wrap: ObjectTextWrapText wrapping mode around the object.
text_flow: ObjectTextFlowSide flow policy around the wrapped object.
treat_as_char: boolWhether the object behaves like an inline character.
flow_with_text: boolWhether surrounding text should flow with the object.
allow_overlap: boolWhether overlapping other objects is allowed.
vert_rel_to: ObjectRelativeToVertical anchor reference for vert_offset.
horz_rel_to: ObjectRelativeToHorizontal anchor reference for horz_offset.
vert_offset: HwpUnitVertical offset from vert_rel_to.
horz_offset: HwpUnitHorizontal offset from horz_rel_to.
Implementations§
Source§impl ObjectPlacement
impl ObjectPlacement
Sourcepub fn legacy_inline_defaults() -> Self
pub fn legacy_inline_defaults() -> Self
The canonical inline-object placement: treat-as-char, paragraph-anchored, zero offset, no overlap, top-and-bottom wrap.
Used by the pre-placement HWPX image path and by shape decoders as the
sentinel that collapses to None.
§Examples
use hwpforge_core::placement::{ObjectPlacement, ObjectRelativeTo, ObjectTextFlow};
use hwpforge_foundation::HwpUnit;
let p = ObjectPlacement::legacy_inline_defaults();
assert!(p.treat_as_char);
assert!(!p.allow_overlap);
assert_eq!(p.text_flow, ObjectTextFlow::BothSides);
assert_eq!(p.vert_rel_to, ObjectRelativeTo::Para);
assert_eq!(p.horz_offset, HwpUnit::ZERO);Trait Implementations§
Source§impl Clone for ObjectPlacement
impl Clone for ObjectPlacement
Source§fn clone(&self) -> ObjectPlacement
fn clone(&self) -> ObjectPlacement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ObjectPlacement
impl Debug for ObjectPlacement
Source§impl<'de> Deserialize<'de> for ObjectPlacement
impl<'de> Deserialize<'de> for ObjectPlacement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ObjectPlacement
Source§impl JsonSchema for ObjectPlacement
impl JsonSchema for ObjectPlacement
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for ObjectPlacement
impl PartialEq for ObjectPlacement
Source§impl Serialize for ObjectPlacement
impl Serialize for ObjectPlacement
impl StructuralPartialEq for ObjectPlacement
Auto Trait Implementations§
impl Freeze for ObjectPlacement
impl RefUnwindSafe for ObjectPlacement
impl Send for ObjectPlacement
impl Sync for ObjectPlacement
impl Unpin for ObjectPlacement
impl UnsafeUnpin for ObjectPlacement
impl UnwindSafe for ObjectPlacement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.