// Copyright (c) 2014-2016 Thomas Fussell // Copyright (c) 2010-2015 openpyxl // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE // // @license: http://www.opensource.org/licenses/mit-license.php // @author: see AUTHORS file #pragma once #include #include #include #include #include #include #include namespace xlnt { class path; class relationship; class workbook; class worksheet; namespace detail { class ZipFileReader; /// /// Handles writing a workbook into an XLSX file. /// class xlsx_consumer { public: xlsx_consumer(workbook &destination); void read(std::istream &source); void read(std::istream &source, const std::string &password); private: /// /// Ignore all remaining elements at the same depth in the current XML parser. /// void skip_remaining_elements(); /// /// Convenience method to dereference the pointer to the current parser to avoid /// having to use "parser_->" constantly. /// xml::parser &parser(); /// /// Read all the files needed from the XLSX archive and initialize all of /// the data in the workbook to match. /// void populate_workbook(); // Package Parts /// /// Parse content types ([Content_Types].xml) and package relationships (_rels/.rels). /// void read_manifest(); /// /// Parse the core properties about the current package (usually docProps/core.xml). /// void read_core_properties(); /// /// Parse extra application-speicific package properties (usually docProps/app.xml). void read_extended_properties(); /// /// Parse custom file properties. These aren't associated with a particular application /// but extensions to OOXML can use this part to hold extra data about the package. /// void read_custom_file_properties(); // SpreadsheetML-Specific Package Parts /// /// Parse the main XML document about the workbook and then all child relationships /// of the workbook (e.g. worksheets). /// void read_workbook(); // Workbook Relationship Target Parts /// /// xl/calcChain.xml /// void read_calculation_chain(); /// /// /// void read_connections(); /// /// /// void read_custom_property(); /// /// /// void read_custom_xml_mappings(); /// /// /// void read_external_workbook_references(); /// /// /// void read_metadata(); /// /// /// void read_pivot_table(); /// /// xl/sharedStrings.xml /// void read_shared_string_table(); /// /// /// void read_shared_workbook_revision_headers(); /// /// /// void read_shared_workbook(); /// /// /// void read_shared_workbook_user_data(); /// /// xl/styles.xml /// void read_stylesheet(); /// /// xl/theme/theme1.xml /// void read_theme(); /// /// /// void read_volatile_dependencies(); /// /// xl/sheets/*.xml /// void read_chartsheet(const std::string &title); /// /// xl/sheets/*.xml /// void read_dialogsheet(const std::string &title); /// /// xl/sheets/*.xml /// void read_worksheet(const std::string &title); // Sheet Relationship Target Parts /// /// /// void read_comments(worksheet ws); /// /// /// void read_drawings(); // Unknown Parts /// /// /// void read_unknown_parts(); /// /// /// void read_unknown_relationships(); /// /// The ZIP file containing the files that make up the OOXML package. /// std::unique_ptr archive_; /// /// Map of sheet titles to relationship IDs. /// std::unordered_map sheet_title_id_map_; /// /// Map of sheet titles to indices. Used to ensure sheets are maintained /// in the correct order. /// std::unordered_map sheet_title_index_map_; /// /// A reference to the workbook which is being read. /// workbook &target_; /// /// This pointer is generally set by instantiating an xml::parser in a function /// scope and then calling a read_*() method which uses xlsx_consumer::parser() /// to access the object. /// xml::parser *parser_; }; } // namespace detail } // namespace xlnt