Skip to content

Commit

Permalink
feat(hwp): column definition 오류 수정 (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
hahnlee authored Oct 27, 2022
1 parent 1efa552 commit efc2c8b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/hwp/src/hwp/doc_info/border_fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl FromRecord for BorderFill {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Border {
pub width: u8,
pub kind: u8,
Expand Down
18 changes: 10 additions & 8 deletions crates/hwp/src/hwp/paragraph/control/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use num::FromPrimitive;
use num_derive::FromPrimitive;

use crate::hwp::{
doc_info::border_fill::Border,
record::Record,
utils::bits::{get_flag, get_value_range},
};
Expand All @@ -23,6 +24,8 @@ pub struct ColumnControl {
pub gap: i16,
/// 단 너비가 동일하지 않으면, 단의 개수만큼 단의 폭
pub widths: Vec<u16>,
/// 구분선
pub border: Border,
}

impl ColumnControl {
Expand All @@ -40,18 +43,16 @@ impl ColumnControl {
let gap = reader.read_i16::<LittleEndian>().unwrap();

let mut widths = vec![];
for _ in 0..count {
widths.push(reader.read_u16::<LittleEndian>().unwrap());
if !same_width {
for _ in 0..count {
widths.push(reader.read_u16::<LittleEndian>().unwrap());
}
}

// NOTE: (@hahnlee) 속성의 bit 16-32 (표 139 참조)
// TODO: (@hahnlee) 문서에 정의 되어 있지 않음. 확인 필요.
// NOTE: (@hahnlee) 속성의 bit 16-32, 어떤 내용이 담기는지는 표준문서에 정의되어 있지 않다
reader.read_u16::<LittleEndian>().unwrap();

// TODO: (@hahnlee)
// UINT8 1 단 구분선 종류(테두리/배경의 테두리 선 종류 참조)
// UINT8 1 단 구분선 굵기(테두리/배경의 테두리 선 굵기 참조)
// CORORREF 4 단 구분선 색상(테두리/배경의 테두리 선 색상 참조)
let border = Border::from_reader(&mut reader);

Self {
ctrl_id,
Expand All @@ -61,6 +62,7 @@ impl ColumnControl {
same_width,
gap,
widths,
border,
}
}
}
Expand Down

0 comments on commit efc2c8b

Please sign in to comment.