#[non_exhaustive]pub enum HancomStyleSet {
Classic,
Modern,
Latest,
}Expand description
The set of default styles to inject when building an HWPX file.
Different versions of 한글 ship with different built-in style tables. Choosing the wrong set causes style ID mismatches, which can break automatic numbering, table-of-contents generation, and other features.
§Variant ordering
Use HancomStyleSet::Modern (the default) unless you are targeting
files for 한글 2020 or earlier (Classic)
or 한글 2025+ (Latest).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Classic
18 built-in styles — 한글 2014 through 2020.
개요 8–10 are absent; 쪽 번호 is at ID 9.
Modern
22 built-in styles — 한글 2022 and later.
개요 8–10 are inserted at IDs 9–11, shifting 쪽 번호 to ID 12. 캡션 (Caption) style is added at ID 21.
This is the default variant because 한글 2022+ is now the most widely deployed version.
Latest
23 built-in styles — 한글 2025 and later.
Same as Modern with the addition of
줄 번호 (Line Number) at ID 22.
Implementations§
Source§impl HancomStyleSet
impl HancomStyleSet
Sourcepub fn default_styles(&self) -> &'static [DefaultStyleEntry]
pub fn default_styles(&self) -> &'static [DefaultStyleEntry]
Returns the complete ordered default-style array for this version.
The slice index corresponds directly to the id attribute that
must be written to <hh:style id="…"> in header.xml.
Sourcepub fn count(&self) -> usize
pub fn count(&self) -> usize
Returns the number of default styles for this version.
Equivalent to self.default_styles().len().
Sourcepub fn style_id_for_name(&self, name: &str) -> Option<usize>
pub fn style_id_for_name(&self, name: &str) -> Option<usize>
Looks up the style index for a given Korean or English style name.
Returns None if no matching default style is found in this version’s
style table. The returned index corresponds directly to the styleIDRef
attribute in HWPX <hp:p> elements.
§Examples
use hwpforge_smithy_hwpx::default_styles::HancomStyleSet;
assert_eq!(HancomStyleSet::Modern.style_id_for_name("개요 1"), Some(2));
assert_eq!(HancomStyleSet::Modern.style_id_for_name("Outline 1"), Some(2));
assert_eq!(HancomStyleSet::Modern.style_id_for_name("바탕글"), Some(0));
assert_eq!(HancomStyleSet::Modern.style_id_for_name("unknown"), None);Trait Implementations§
Source§impl Clone for HancomStyleSet
impl Clone for HancomStyleSet
Source§fn clone(&self) -> HancomStyleSet
fn clone(&self) -> HancomStyleSet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HancomStyleSet
impl Debug for HancomStyleSet
Source§impl Default for HancomStyleSet
impl Default for HancomStyleSet
Source§fn default() -> HancomStyleSet
fn default() -> HancomStyleSet
Source§impl PartialEq for HancomStyleSet
impl PartialEq for HancomStyleSet
impl Copy for HancomStyleSet
impl Eq for HancomStyleSet
impl StructuralPartialEq for HancomStyleSet
Auto Trait Implementations§
impl Freeze for HancomStyleSet
impl RefUnwindSafe for HancomStyleSet
impl Send for HancomStyleSet
impl Sync for HancomStyleSet
impl Unpin for HancomStyleSet
impl UnwindSafe for HancomStyleSet
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.