summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2022-06-08 21:07:51 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2022-06-08 21:07:51 -0400
commit98601fdd57d9513ce23254cff9bfd49ffcf936d6 (patch)
tree77b48810c7825c557c998ba7113204718dba339f
parent5d323b0035b32450466acb38c9c80c4b13fd367c (diff)
downloadorcus-98601fdd57d9513ce23254cff9bfd49ffcf936d6.tar.gz
Use import_cell_style in odf styles import
-rw-r--r--src/liborcus/odf_number_formatting_context.cpp9
-rw-r--r--src/liborcus/odf_styles_context.cpp17
2 files changed, 18 insertions, 8 deletions
diff --git a/src/liborcus/odf_number_formatting_context.cpp b/src/liborcus/odf_number_formatting_context.cpp
index 02d48f2f..04b3b544 100644
--- a/src/liborcus/odf_number_formatting_context.cpp
+++ b/src/liborcus/odf_number_formatting_context.cpp
@@ -746,9 +746,12 @@ bool number_formatting_context::end_element(xmlns_id_t ns, xml_token_t name)
xf->set_number_format(id_number_format);
- mp_styles->set_cell_style_name(m_current_style.name);
- mp_styles->set_cell_style_xf(xf->commit());
- mp_styles->commit_cell_style();
+ auto* cell_style = mp_styles->get_cell_style();
+ ENSURE_INTERFACE(cell_style, import_cell_style);
+
+ cell_style->set_name(m_current_style.name);
+ cell_style->set_xf(xf->commit());
+ cell_style->commit();
return true; // TODO: fix this
// return pop_stack(ns, name);
}
diff --git a/src/liborcus/odf_styles_context.cpp b/src/liborcus/odf_styles_context.cpp
index a6d63d14..fca0ffae 100644
--- a/src/liborcus/odf_styles_context.cpp
+++ b/src/liborcus/odf_styles_context.cpp
@@ -243,6 +243,7 @@ bool styles_context::end_element(xmlns_id_t ns, xml_token_t name)
{
// Import it into the direct cell style store
auto* xf = mp_styles->get_xf(ss::xf_category_t::cell);
+ ENSURE_INTERFACE(xf, import_xf);
xf->set_font(cell.font);
xf->set_fill(cell.fill);
xf->set_border(cell.border);
@@ -256,6 +257,7 @@ bool styles_context::end_element(xmlns_id_t ns, xml_token_t name)
// Import it into the cell style xf store, and reference
// its index in the cell style name store.
auto* xf = mp_styles->get_xf(ss::xf_category_t::cell_style);
+ ENSURE_INTERFACE(xf, import_xf);
xf->set_font(cell.font);
xf->set_fill(cell.fill);
xf->set_border(cell.border);
@@ -264,11 +266,14 @@ bool styles_context::end_element(xmlns_id_t ns, xml_token_t name)
xf->set_vertical_alignment(cell.ver_align);
size_t style_xf_id = xf->commit();
- mp_styles->set_cell_style_name(m_current_style->name);
- mp_styles->set_cell_style_xf(style_xf_id);
- mp_styles->set_cell_style_parent_name(m_current_style->parent_name);
+ auto* cell_style = mp_styles->get_cell_style();
+ ENSURE_INTERFACE(cell_style, import_cell_style);
- cell.xf = mp_styles->commit_cell_style();
+ cell_style->set_name(m_current_style->name);
+ cell_style->set_xf(style_xf_id);
+ cell_style->set_parent_name(m_current_style->parent_name);
+
+ cell.xf = cell_style->commit();
}
}
@@ -758,7 +763,9 @@ void styles_context::commit_default_styles()
ENSURE_INTERFACE(xf, import_xf);
xf->commit();
- mp_styles->commit_cell_style();
+ auto* cell_style = mp_styles->get_cell_style();
+ ENSURE_INTERFACE(cell_style, import_cell_style);
+ cell_style->commit();
}
}