summaryrefslogtreecommitdiffstats
path: root/include/orcus/orcus_xlsx.hpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:48:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:48:59 +0000
commitc484829272cd13a738e35412498e12f2c9a194ac (patch)
treea1f5ec09629ee895bd3963fa8820b45f2f4c574b /include/orcus/orcus_xlsx.hpp
parentInitial commit. (diff)
downloadliborcus-c484829272cd13a738e35412498e12f2c9a194ac.tar.xz
liborcus-c484829272cd13a738e35412498e12f2c9a194ac.zip
Adding upstream version 0.19.2.upstream/0.19.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/orcus/orcus_xlsx.hpp')
-rw-r--r--include/orcus/orcus_xlsx.hpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/include/orcus/orcus_xlsx.hpp b/include/orcus/orcus_xlsx.hpp
new file mode 100644
index 0000000..68b01c0
--- /dev/null
+++ b/include/orcus/orcus_xlsx.hpp
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_ORCUS_ORCUS_XLSX_HPP
+#define INCLUDED_ORCUS_ORCUS_XLSX_HPP
+
+#include "interface.hpp"
+
+#include <memory>
+
+namespace orcus {
+
+namespace spreadsheet { namespace iface { class import_factory; }}
+
+struct xlsx_rel_sheet_info;
+struct xlsx_rel_table_info;
+struct xlsx_rel_pivot_cache_info;
+struct xlsx_rel_pivot_cache_record_info;
+struct orcus_xlsx_impl;
+class xlsx_opc_handler;
+
+class ORCUS_DLLPUBLIC orcus_xlsx : public iface::import_filter
+{
+ friend class xlsx_opc_handler;
+ struct impl;
+ std::unique_ptr<impl> mp_impl;
+
+public:
+ orcus_xlsx(spreadsheet::iface::import_factory* factory);
+ ~orcus_xlsx();
+
+ orcus_xlsx(const orcus_xlsx&) = delete;
+ orcus_xlsx& operator= (const orcus_xlsx&) = delete;
+
+ static bool detect(const unsigned char* blob, size_t size);
+
+ virtual void read_file(std::string_view filepath) override;
+ virtual void read_stream(std::string_view stream) override;
+
+ virtual std::string_view get_name() const override;
+
+private:
+
+ void set_formulas_to_doc();
+
+ void read_workbook(const std::string& dir_path, const std::string& file_name);
+
+ /**
+ * Parse a sheet xml part that contains data stored in a single sheet.
+ */
+ void read_sheet(const std::string& dir_path, const std::string& file_name, xlsx_rel_sheet_info* data);
+
+ /**
+ * Parse sharedStrings.xml part that contains a list of strings referenced
+ * in the document.
+ */
+ void read_shared_strings(const std::string& dir_path, const std::string& file_name);
+
+ void read_styles(const std::string& dir_path, const std::string& file_name);
+
+ void read_table(const std::string& dir_path, const std::string& file_name, xlsx_rel_table_info* data);
+
+ void read_pivot_cache_def(
+ const std::string& dir_path, const std::string& file_name,
+ const xlsx_rel_pivot_cache_info* data);
+
+ void read_pivot_cache_rec(
+ const std::string& dir_path, const std::string& file_name,
+ const xlsx_rel_pivot_cache_record_info* data);
+
+ void read_pivot_table(const std::string& dir_path, const std::string& file_name);
+
+ void read_rev_headers(const std::string& dir_path, const std::string& file_name);
+
+ void read_rev_log(const std::string& dir_path, const std::string& file_name);
+
+ void read_drawing(const std::string& dir_path, const std::string& file_name);
+};
+
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */