pub mod bin_data;
pub mod border_paint;
pub mod color;
pub mod control;
pub mod document;
pub mod event;
pub mod footnote;
pub(crate) mod form_script;
pub mod header_footer;
pub(crate) mod hwp3_page_ownership;
pub mod hyperlink;
pub mod hyperlink_format;
pub(crate) mod identity;
pub mod image;
pub(crate) mod line_seg_tags;
pub mod memo_extended;
pub mod memo_shape;
pub(crate) mod native_font_program;
pub(crate) mod owned_work;
pub mod page;
pub mod paragraph;
pub mod path;
pub(crate) mod pdf_stroke;
pub mod provenance;
pub mod raw_provenance;
pub mod section_tail;
pub mod shape;
pub mod style;
pub mod table;
pub(crate) mod table_row_grid;
pub mod text_clip;
pub mod text_paint;
pub type HwpUnit = u32;
pub type SHwpUnit = i32;
pub type HwpUnit16 = i16;
pub type ColorRef = u32;
#[derive(Debug, Clone, Copy, Default, serde::Serialize)]
pub struct Point {
pub x: i32,
pub y: i32,
}
#[derive(Debug, Clone, Copy, Default)]
pub struct Rect {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
impl Rect {
pub fn width(&self) -> i32 {
self.right - self.left
}
pub fn height(&self) -> i32 {
self.bottom - self.top
}
}
#[derive(Debug, Clone, Copy, Default, serde::Serialize)]
pub struct Padding {
pub left: HwpUnit16,
pub right: HwpUnit16,
pub top: HwpUnit16,
pub bottom: HwpUnit16,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_rect_dimensions() {
let r = Rect {
left: 100,
top: 200,
right: 500,
bottom: 700,
};
assert_eq!(r.width(), 400);
assert_eq!(r.height(), 500);
}
#[test]
fn test_colorref_format() {
let red: ColorRef = 0x000000FF;
assert_eq!(red & 0xFF, 0xFF); assert_eq!((red >> 8) & 0xFF, 0x00); assert_eq!((red >> 16) & 0xFF, 0x00); }
}
pub(crate) mod memo_time;