summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2022-06-07 21:31:09 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2022-06-07 21:31:09 -0400
commitdc29c2d295b1b87f4b94e1c1c0c7ecc8e6cfc8ab (patch)
tree169333b00664da88c88ccf4dbd92c227046a4fcb
parent397dfd57390de6a28d0b792d36341a840d6ea668 (diff)
downloadorcus-dc29c2d295b1b87f4b94e1c1c0c7ecc8e6cfc8ab.tar.gz
Remove the old interface and fix a few more places I overlooked
-rw-r--r--include/orcus/spreadsheet/factory.hpp14
-rw-r--r--include/orcus/spreadsheet/import_interface_styles.hpp21
-rw-r--r--src/include/mock_spreadsheet.hpp23
-rw-r--r--src/liborcus/gnumeric_sheet_context.cpp4
-rw-r--r--src/liborcus/xlsx_context.cpp5
-rw-r--r--src/spreadsheet/factory_styles.cpp71
6 files changed, 6 insertions, 132 deletions
diff --git a/include/orcus/spreadsheet/factory.hpp b/include/orcus/spreadsheet/factory.hpp
index 9ec2f882..f0e68061 100644
--- a/include/orcus/spreadsheet/factory.hpp
+++ b/include/orcus/spreadsheet/factory.hpp
@@ -87,20 +87,6 @@ public:
virtual void set_number_format_count(size_t n) override;
virtual void set_xf_count(xf_category_t cat, size_t n) override;
- virtual void set_xf_font(size_t index) override;
- virtual void set_xf_fill(size_t index) override;
- virtual void set_xf_border(size_t index) override;
- virtual void set_xf_protection(size_t index) override;
- virtual void set_xf_number_format(size_t index) override;
- virtual void set_xf_style_xf(size_t index) override;
- virtual void set_xf_apply_alignment(bool b) override;
- virtual void set_xf_horizontal_alignment(hor_alignment_t align) override;
- virtual void set_xf_vertical_alignment(ver_alignment_t align) override;
-
- virtual size_t commit_cell_xf() override;
- virtual size_t commit_cell_style_xf() override;
- virtual size_t commit_dxf() override;
-
virtual void set_cell_style_count(size_t n) override;
virtual void set_cell_style_name(std::string_view s) override;
virtual void set_cell_style_xf(size_t index) override;
diff --git a/include/orcus/spreadsheet/import_interface_styles.hpp b/include/orcus/spreadsheet/import_interface_styles.hpp
index 6509673a..b284770a 100644
--- a/include/orcus/spreadsheet/import_interface_styles.hpp
+++ b/include/orcus/spreadsheet/import_interface_styles.hpp
@@ -149,27 +149,6 @@ public:
virtual void set_xf_count(xf_category_t cat, size_t n) = 0;
- virtual void set_xf_font(size_t index) = 0;
- virtual void set_xf_fill(size_t index) = 0;
- virtual void set_xf_border(size_t index) = 0;
- virtual void set_xf_protection(size_t index) = 0;
- virtual void set_xf_number_format(size_t index) = 0;
-
- /**
- * Set the index into the cell style record to specify a named cell style it
- * uses as its basis.
- *
- * @param index index into the cell style record it uses as its basis.
- */
- virtual void set_xf_style_xf(size_t index) = 0;
- virtual void set_xf_apply_alignment(bool b) = 0;
- virtual void set_xf_horizontal_alignment(hor_alignment_t align) = 0;
- virtual void set_xf_vertical_alignment(ver_alignment_t align) = 0;
-
- virtual size_t commit_cell_xf() = 0;
- virtual size_t commit_cell_style_xf() = 0;
- virtual size_t commit_dxf() = 0;
-
// named cell style. It references the actual cell format data via xf index
// into the cell style format record.
diff --git a/src/include/mock_spreadsheet.hpp b/src/include/mock_spreadsheet.hpp
index 03277b3c..8915b557 100644
--- a/src/include/mock_spreadsheet.hpp
+++ b/src/include/mock_spreadsheet.hpp
@@ -54,29 +54,6 @@ public:
virtual void set_xf_count(xf_category_t cat, size_t n) = 0;
- // cell style xf
-
- virtual size_t commit_cell_style_xf() override;
-
- // cell xf
-
- virtual size_t commit_cell_xf() override;
-
- // dxf
- virtual size_t commit_dxf() override;
-
- // xf (cell format) - used both by cell xf and cell style xf.
-
- virtual void set_xf_number_format(size_t index) override;
- virtual void set_xf_font(size_t index) override;
- virtual void set_xf_fill(size_t index) override;
- virtual void set_xf_border(size_t index) override;
- virtual void set_xf_protection(size_t index) override;
- virtual void set_xf_style_xf(size_t index) override;
- virtual void set_xf_apply_alignment(bool b) override;
- virtual void set_xf_horizontal_alignment(orcus::spreadsheet::hor_alignment_t align) override;
- virtual void set_xf_vertical_alignment(orcus::spreadsheet::ver_alignment_t align) override;
-
// cell style entry
virtual void set_cell_style_count(size_t n) override;
diff --git a/src/liborcus/gnumeric_sheet_context.cpp b/src/liborcus/gnumeric_sheet_context.cpp
index 359d0ffb..cbe4147a 100644
--- a/src/liborcus/gnumeric_sheet_context.cpp
+++ b/src/liborcus/gnumeric_sheet_context.cpp
@@ -759,7 +759,9 @@ void gnumeric_sheet_context::end_font()
font_style->set_color(0, front_color.red, front_color.green, front_color.blue);
font_style->set_name(chars);
size_t font_id = font_style->commit();
- styles->set_xf_font(font_id);
+
+ assert(mp_xf);
+ mp_xf->set_font(font_id);
}
void gnumeric_sheet_context::end_style(bool conditional_format)
diff --git a/src/liborcus/xlsx_context.cpp b/src/liborcus/xlsx_context.cpp
index 9496a7f9..137ae62d 100644
--- a/src/liborcus/xlsx_context.cpp
+++ b/src/liborcus/xlsx_context.cpp
@@ -1040,8 +1040,9 @@ bool xlsx_styles_context::end_element(xmlns_id_t ns, xml_token_t name)
case XML_protection:
{
assert(mp_protection);
- size_t id = mp_protection->commit();
- mp_styles->set_xf_protection(id);
+ size_t prot_id = mp_protection->commit();
+ assert(mp_xf);
+ mp_xf->set_protection(prot_id);
break;
}
case XML_numFmt:
diff --git a/src/spreadsheet/factory_styles.cpp b/src/spreadsheet/factory_styles.cpp
index 2249fb60..afcc58aa 100644
--- a/src/spreadsheet/factory_styles.cpp
+++ b/src/spreadsheet/factory_styles.cpp
@@ -39,7 +39,6 @@ struct import_styles::impl
import_number_format number_format;
import_xf xf;
- cell_format_t cur_cell_format;
cell_style_t cur_cell_style;
impl(styles& _styles_model, string_pool& sp) :
@@ -133,76 +132,6 @@ void import_styles::set_xf_count(xf_category_t cat, size_t n)
}
}
-void import_styles::set_xf_font(size_t index)
-{
- mp_impl->cur_cell_format.font = index;
-}
-
-void import_styles::set_xf_fill(size_t index)
-{
- mp_impl->cur_cell_format.fill = index;
-}
-
-void import_styles::set_xf_border(size_t index)
-{
- mp_impl->cur_cell_format.border = index;
-
- // TODO : we need to decide whether to have interface methods for these
- // apply_foo attributes. For now there is only one, for alignment.
- mp_impl->cur_cell_format.apply_border = index > 0;
-}
-
-void import_styles::set_xf_protection(size_t index)
-{
- mp_impl->cur_cell_format.protection = index;
-}
-
-void import_styles::set_xf_number_format(size_t index)
-{
- mp_impl->cur_cell_format.number_format = index;
-}
-
-void import_styles::set_xf_style_xf(size_t index)
-{
- mp_impl->cur_cell_format.style_xf = index;
-}
-
-void import_styles::set_xf_apply_alignment(bool b)
-{
- mp_impl->cur_cell_format.apply_alignment = b;
-}
-
-void import_styles::set_xf_horizontal_alignment(orcus::spreadsheet::hor_alignment_t align)
-{
- mp_impl->cur_cell_format.hor_align = align;
-}
-
-void import_styles::set_xf_vertical_alignment(orcus::spreadsheet::ver_alignment_t align)
-{
- mp_impl->cur_cell_format.ver_align = align;
-}
-
-size_t import_styles::commit_cell_xf()
-{
- size_t n = mp_impl->styles_model.append_cell_format(mp_impl->cur_cell_format);
- mp_impl->cur_cell_format.reset();
- return n;
-}
-
-size_t import_styles::commit_cell_style_xf()
-{
- size_t n = mp_impl->styles_model.append_cell_style_format(mp_impl->cur_cell_format);
- mp_impl->cur_cell_format.reset();
- return n;
-}
-
-size_t import_styles::commit_dxf()
-{
- size_t n = mp_impl->styles_model.append_diff_cell_format(mp_impl->cur_cell_format);
- mp_impl->cur_cell_format.reset();
- return n;
-}
-
void import_styles::set_cell_style_count(size_t n)
{
mp_impl->styles_model.reserve_cell_style_store(n);