From 89be485062f130878a94ec665e9c9d28f2948e67 Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Thu, 5 Jun 2014 16:19:31 -0400 Subject: [PATCH] restructure to match openpyxl 2.1 --- build/premake5.lua | 11 +- include/xlnt/{cell.h => cell/cell.hpp} | 27 +- .../cell_reference.hpp} | 24 +- include/xlnt/charts/axis.hpp | 0 include/xlnt/charts/bar_chart.hpp | 0 include/xlnt/charts/chart.hpp | 0 include/xlnt/charts/error_bar.hpp | 0 include/xlnt/charts/graph_chart.hpp | 0 include/xlnt/charts/legend.hpp | 0 include/xlnt/charts/line_chart.hpp | 0 include/xlnt/charts/pie_chart.hpp | 0 include/xlnt/charts/scatter_chart.hpp | 0 include/xlnt/charts/series.hpp | 0 include/xlnt/common/datetime.hpp | 72 + include/xlnt/common/exceptions.hpp | 123 + .../relationship.hpp} | 23 + include/xlnt/common/string_table.hpp | 52 + include/xlnt/common/types.hpp | 28 + .../xlnt/common/zip_file.hpp | 23 + include/xlnt/config.h | 14 - include/xlnt/config.hpp | 36 + include/xlnt/custom_exceptions.h | 40 - include/xlnt/datetime.h | 50 - include/xlnt/drawing.h | 19 - include/xlnt/drawing/drawing.hpp | 42 + include/xlnt/reader.h | 25 - include/xlnt/reader/chart_reader.hpp | 65 + include/xlnt/reader/comment_reader.hpp | 33 + include/xlnt/reader/drawing_reader.hpp | 33 + include/xlnt/reader/excel_reader.hpp | 33 + include/xlnt/reader/reader.hpp | 48 + include/xlnt/reader/string_reader.hpp | 33 + include/xlnt/reader/style_reader.hpp | 42 + include/xlnt/reader/theme_reader.hpp | 33 + include/xlnt/reader/workbook_reader.hpp | 33 + include/xlnt/reader/worksheet_reader.hpp | 33 + include/xlnt/string_table.h | 29 - include/xlnt/style.h | 270 - include/xlnt/style_writer.h | 36 - include/xlnt/styles/alignment.hpp | 59 + include/xlnt/styles/borders.hpp | 75 + include/xlnt/styles/color.hpp | 49 + include/xlnt/styles/fill.hpp | 64 + include/xlnt/styles/font.hpp | 50 + include/xlnt/styles/number_format.hpp | 86 + include/xlnt/styles/protection.hpp | 42 + include/xlnt/styles/style.hpp | 74 + include/xlnt/types.h | 6 - include/xlnt/workbook/document_properties.hpp | 0 include/xlnt/workbook/document_security.hpp | 0 .../{workbook.h => workbook/workbook.hpp} | 23 + include/xlnt/worksheet/column_properties.hpp | 40 + include/xlnt/worksheet/page_margins.hpp | 57 + include/xlnt/worksheet/page_setup.hpp | 95 + include/xlnt/{range.h => worksheet/range.hpp} | 26 +- .../range_reference.hpp} | 24 +- include/xlnt/worksheet/row_properties.hpp | 40 + .../xlnt/worksheet/sheet_protection.hpp | 0 .../{worksheet.h => worksheet/worksheet.hpp} | 25 +- include/xlnt/writer.h | 26 - include/xlnt/writer/chart_writer.hpp | 65 + include/xlnt/writer/comment_writer.hpp | 33 + include/xlnt/writer/drawing_writer.hpp | 33 + include/xlnt/writer/excel_writer.hpp | 33 + include/xlnt/writer/string_writer.hpp | 33 + include/xlnt/writer/style_writer.hpp | 59 + include/xlnt/writer/theme_writer.hpp | 33 + include/xlnt/writer/workbook_writer.hpp | 33 + include/xlnt/writer/worksheet_writer.hpp | 33 + include/xlnt/writer/writer.hpp | 49 + include/xlnt/xlnt.h | 22 - include/xlnt/xlnt.hpp | 46 + source/cell.cpp | 12 +- source/cell_reference.cpp | 8 +- source/constants.cpp | 6 +- source/{constants.h => constants.hpp} | 2 +- source/datetime.cpp | 2 +- source/detail/cell_impl.cpp | 2 +- source/detail/{cell_impl.h => cell_impl.hpp} | 6 +- .../{workbook_impl.h => workbook_impl.hpp} | 0 .../{worksheet_impl.h => worksheet_impl.hpp} | 2 +- source/drawing.cpp | 4 +- .../{custom_exceptions.cpp => exceptions.cpp} | 4 +- source/range.cpp | 8 +- source/range_reference.cpp | 4 +- source/reader.cpp | 12 +- source/relationship.cpp | 2 +- .../{protection.cpp => sheet_protection.cpp} | 4 +- source/string_table.cpp | 2 +- source/style_writer.cpp | 2 +- source/workbook.cpp | 28 +- source/worksheet.cpp | 16 +- source/writer.cpp | 12 +- source/zip_file.cpp | 4 +- tests/{Helper.h => helpers/helper.hpp} | 2 +- .../{PathHelper.h => helpers/path_helper.hpp} | 0 .../temporary_directory.h} | 0 .../temporary_file.hpp} | 2 +- tests/runner-autogen.cpp | 1618 +++--- tests/schemas/dml-chart.xsd | 1499 ++++++ tests/schemas/dml-chartDrawing.xsd | 146 + tests/schemas/dml-compatibility.xsd | 14 + tests/schemas/dml-diagram.xsd | 1091 ++++ tests/schemas/dml-lockedCanvas.xsd | 11 + tests/schemas/dml-main.xsd | 3048 ++++++++++++ tests/schemas/dml-picture.xsd | 23 + tests/schemas/dml-spreadsheetDrawing.xsd | 185 + tests/schemas/dml-wordprocessingDrawing.xsd | 185 + tests/schemas/pml.xsd | 1676 +++++++ .../shared-additionalCharacteristics.xsd | 28 + tests/schemas/shared-bibliography.xsd | 144 + tests/schemas/shared-commonSimpleTypes.xsd | 166 + .../shared-customXmlDataProperties.xsd | 25 + .../shared-customXmlSchemaProperties.xsd | 18 + .../shared-documentPropertiesCustom.xsd | 59 + .../shared-documentPropertiesExtended.xsd | 56 + .../shared-documentPropertiesVariantTypes.xsd | 195 + tests/schemas/shared-math.xsd | 582 +++ .../schemas/shared-relationshipReference.xsd | 25 + tests/schemas/sml.xsd | 4430 +++++++++++++++++ tests/schemas/vml-main.xsd | 569 +++ tests/schemas/vml-officeDrawing.xsd | 509 ++ tests/schemas/vml-presentationDrawing.xsd | 12 + tests/schemas/vml-spreadsheetDrawing.xsd | 108 + tests/schemas/vml-wordprocessingDrawing.xsd | 96 + tests/schemas/wml.xsd | 3644 ++++++++++++++ tests/test_backend.hpp | 11 + tests/{CellTestSuite.h => test_cell.hpp} | 8 +- tests/{ChartTestSuite.h => test_chart.hpp} | 9 +- tests/test_data/Thumbs.db | Bin 0 -> 3072 bytes tests/test_data/genuine/empty-with-styles.zip | Bin 7511 -> 0 bytes tests/test_data/genuine/empty.xlsx | Bin 11005 -> 11395 bytes tests/test_data/genuine/guess_types.xlsx | Bin 0 -> 30133 bytes tests/test_data/genuine/libreoffice_nrt.xlsx | Bin 0 -> 4534 bytes tests/test_data/genuine/unicode.xlsx | Bin 8189 -> 0 bytes tests/test_data/plain.png | Bin 0 -> 493 bytes tests/test_data/reader/a.zip | Bin 257 -> 0 bytes tests/test_data/reader/bigfoot.xlsx | Bin 0 -> 410964 bytes tests/test_data/reader/bug137.xlsx | Bin 0 -> 10004 bytes tests/test_data/reader/bug275.xlsx | Bin 0 -> 30175 bytes tests/test_data/reader/bug304.xlsx | Bin 0 -> 25914 bytes .../reader/contains_chartsheets.xlsx | Bin 0 -> 14649 bytes .../reader/empty-workbook-styles.xml | 53 - tests/test_data/reader/formulae.xlsx | Bin 0 -> 35649 bytes tests/test_data/reader/merged-ranges.xml | 2 +- .../test_data/reader/shared-strings-rich.xml | 2 +- .../reader/sharedStrings-emptystring.xml | 2 +- tests/test_data/reader/sharedStrings.xml | 2 +- tests/test_data/reader/sheet2.xml | 341 +- .../test_data/reader/sheet2_no_dimension.xml | 340 ++ tests/test_data/reader/sheet2_no_span.xml | 340 ++ tests/test_data/reader/simple-styles.xml | 46 - tests/test_data/reader/vba-test.xlsm | Bin 0 -> 52938 bytes tests/test_data/reader/workbook.xml | 2 +- .../test_data/reader/workbook_namedrange.xml | 2 +- tests/test_data/reader/worksheet_formula.xml | 43 + tests/test_data/writer/expected/.rels | 2 +- .../writer/expected/Content_types_vba.xml | 21 + .../writer/expected/[Content_Types].xml | 63 +- tests/test_data/writer/expected/app.xml | 2 +- tests/test_data/writer/expected/core.xml | 17 +- tests/test_data/writer/expected/decimal.xml | 18 +- tests/test_data/writer/expected/font.xml | 2 +- .../test_data/writer/expected/long_number.xml | 44 +- .../writer/expected/sharedStrings.xml | 14 +- tests/test_data/writer/expected/sheet1.xml | 12 +- .../writer/expected/sheet1_auto_filter.xml | 23 +- .../sheet1_auto_filter_filter_column.xml | 28 + .../sheet1_auto_filter_sort_condition.xml | 36 + .../test_data/writer/expected/sheet1_bool.xml | 10 +- .../writer/expected/sheet1_formula.xml | 79 +- .../expected/sheet1_freeze_panes_both.xml | 48 +- .../expected/sheet1_freeze_panes_horiz.xml | 44 +- .../expected/sheet1_freeze_panes_vert.xml | 44 +- .../writer/expected/sheet1_height.xml | 44 +- .../writer/expected/sheet1_hyperlink.xml | 49 +- .../writer/expected/sheet1_hyperlink.xml.rels | 1 - .../writer/expected/sheet1_style.xml | 25 +- .../writer/expected/short_number.xml | 18 +- .../writer/expected/simple-styles.xml | 95 +- tests/test_data/writer/expected/styles.xml | 43 +- tests/test_data/writer/expected/theme1.xml | 283 +- tests/test_data/writer/expected/workbook.xml | 15 +- .../writer/expected/workbook.xml.rels | 9 +- .../writer/expected/workbook_auto_filter.xml | 30 +- tests/test_datavalidation.hpp | 11 + tests/test_datetime.hpp | 14 + tests/test_drawing.hpp | 10 + tests/{DumpTestSuite.h => test_dump.hpp} | 8 +- tests/test_meta.hpp | 10 + ...dRangeTestSuite.h => test_named_range.hpp} | 9 +- ...rmatTestSuite.h => test_number_format.hpp} | 6 +- tests/test_number_style.hpp | 11 + tests/test_password_hash.hpp | 10 + tests/{PropsTestSuite.h => test_props.hpp} | 9 +- tests/{ReadTestSuite.h => test_read.hpp} | 8 +- .../{StringsTestSuite.h => test_strings.hpp} | 6 +- tests/{StyleTestSuite.h => test_style.hpp} | 22 +- tests/{ThemeTestSuite.h => test_theme.hpp} | 11 +- tests/test_units.hpp | 10 + tests/test_vba.hpp | 10 + ...{WorkbookTestSuite.h => test_workbook.hpp} | 9 +- ...orksheetTestSuite.h => test_worksheet.hpp} | 24 +- tests/{WriteTestSuite.h => test_write.hpp} | 15 +- 204 files changed, 23549 insertions(+), 1957 deletions(-) rename include/xlnt/{cell.h => cell/cell.hpp} (76%) rename include/xlnt/{cell_reference.h => cell/cell_reference.hpp} (72%) create mode 100644 include/xlnt/charts/axis.hpp create mode 100644 include/xlnt/charts/bar_chart.hpp create mode 100644 include/xlnt/charts/chart.hpp create mode 100644 include/xlnt/charts/error_bar.hpp create mode 100644 include/xlnt/charts/graph_chart.hpp create mode 100644 include/xlnt/charts/legend.hpp create mode 100644 include/xlnt/charts/line_chart.hpp create mode 100644 include/xlnt/charts/pie_chart.hpp create mode 100644 include/xlnt/charts/scatter_chart.hpp create mode 100644 include/xlnt/charts/series.hpp create mode 100644 include/xlnt/common/datetime.hpp create mode 100644 include/xlnt/common/exceptions.hpp rename include/xlnt/{relationship.h => common/relationship.hpp} (61%) create mode 100644 include/xlnt/common/string_table.hpp create mode 100644 include/xlnt/common/types.hpp rename source/zip_file.h => include/xlnt/common/zip_file.hpp (78%) delete mode 100644 include/xlnt/config.h create mode 100644 include/xlnt/config.hpp delete mode 100644 include/xlnt/custom_exceptions.h delete mode 100644 include/xlnt/datetime.h delete mode 100644 include/xlnt/drawing.h create mode 100644 include/xlnt/drawing/drawing.hpp delete mode 100644 include/xlnt/reader.h create mode 100644 include/xlnt/reader/chart_reader.hpp create mode 100644 include/xlnt/reader/comment_reader.hpp create mode 100644 include/xlnt/reader/drawing_reader.hpp create mode 100644 include/xlnt/reader/excel_reader.hpp create mode 100644 include/xlnt/reader/reader.hpp create mode 100644 include/xlnt/reader/string_reader.hpp create mode 100644 include/xlnt/reader/style_reader.hpp create mode 100644 include/xlnt/reader/theme_reader.hpp create mode 100644 include/xlnt/reader/workbook_reader.hpp create mode 100644 include/xlnt/reader/worksheet_reader.hpp delete mode 100644 include/xlnt/string_table.h delete mode 100644 include/xlnt/style.h delete mode 100644 include/xlnt/style_writer.h create mode 100644 include/xlnt/styles/alignment.hpp create mode 100644 include/xlnt/styles/borders.hpp create mode 100644 include/xlnt/styles/color.hpp create mode 100644 include/xlnt/styles/fill.hpp create mode 100644 include/xlnt/styles/font.hpp create mode 100644 include/xlnt/styles/number_format.hpp create mode 100644 include/xlnt/styles/protection.hpp create mode 100644 include/xlnt/styles/style.hpp delete mode 100644 include/xlnt/types.h create mode 100644 include/xlnt/workbook/document_properties.hpp create mode 100644 include/xlnt/workbook/document_security.hpp rename include/xlnt/{workbook.h => workbook/workbook.hpp} (74%) create mode 100644 include/xlnt/worksheet/column_properties.hpp create mode 100644 include/xlnt/worksheet/page_margins.hpp create mode 100644 include/xlnt/worksheet/page_setup.hpp rename include/xlnt/{range.h => worksheet/range.hpp} (74%) rename include/xlnt/{range_reference.h => worksheet/range_reference.hpp} (55%) create mode 100644 include/xlnt/worksheet/row_properties.hpp rename source/protection.h => include/xlnt/worksheet/sheet_protection.hpp (100%) rename include/xlnt/{worksheet.h => worksheet/worksheet.hpp} (84%) delete mode 100644 include/xlnt/writer.h create mode 100644 include/xlnt/writer/chart_writer.hpp create mode 100644 include/xlnt/writer/comment_writer.hpp create mode 100644 include/xlnt/writer/drawing_writer.hpp create mode 100644 include/xlnt/writer/excel_writer.hpp create mode 100644 include/xlnt/writer/string_writer.hpp create mode 100644 include/xlnt/writer/style_writer.hpp create mode 100644 include/xlnt/writer/theme_writer.hpp create mode 100644 include/xlnt/writer/workbook_writer.hpp create mode 100644 include/xlnt/writer/worksheet_writer.hpp create mode 100644 include/xlnt/writer/writer.hpp delete mode 100644 include/xlnt/xlnt.h create mode 100644 include/xlnt/xlnt.hpp rename source/{constants.h => constants.hpp} (97%) rename source/detail/{cell_impl.h => cell_impl.hpp} (81%) rename source/detail/{workbook_impl.h => workbook_impl.hpp} (100%) rename source/detail/{worksheet_impl.h => worksheet_impl.hpp} (98%) rename source/{custom_exceptions.cpp => exceptions.cpp} (82%) rename source/{protection.cpp => sheet_protection.cpp} (95%) rename tests/{Helper.h => helpers/helper.hpp} (97%) rename tests/{PathHelper.h => helpers/path_helper.hpp} (100%) rename tests/{TemporaryDirectory.h => helpers/temporary_directory.h} (100%) rename tests/{TemporaryFile.h => helpers/temporary_file.hpp} (97%) create mode 100755 tests/schemas/dml-chart.xsd create mode 100755 tests/schemas/dml-chartDrawing.xsd create mode 100755 tests/schemas/dml-compatibility.xsd create mode 100755 tests/schemas/dml-diagram.xsd create mode 100755 tests/schemas/dml-lockedCanvas.xsd create mode 100755 tests/schemas/dml-main.xsd create mode 100755 tests/schemas/dml-picture.xsd create mode 100755 tests/schemas/dml-spreadsheetDrawing.xsd create mode 100755 tests/schemas/dml-wordprocessingDrawing.xsd create mode 100755 tests/schemas/pml.xsd create mode 100755 tests/schemas/shared-additionalCharacteristics.xsd create mode 100755 tests/schemas/shared-bibliography.xsd create mode 100755 tests/schemas/shared-commonSimpleTypes.xsd create mode 100755 tests/schemas/shared-customXmlDataProperties.xsd create mode 100755 tests/schemas/shared-customXmlSchemaProperties.xsd create mode 100755 tests/schemas/shared-documentPropertiesCustom.xsd create mode 100755 tests/schemas/shared-documentPropertiesExtended.xsd create mode 100755 tests/schemas/shared-documentPropertiesVariantTypes.xsd create mode 100755 tests/schemas/shared-math.xsd create mode 100755 tests/schemas/shared-relationshipReference.xsd create mode 100755 tests/schemas/sml.xsd create mode 100755 tests/schemas/vml-main.xsd create mode 100755 tests/schemas/vml-officeDrawing.xsd create mode 100755 tests/schemas/vml-presentationDrawing.xsd create mode 100755 tests/schemas/vml-spreadsheetDrawing.xsd create mode 100755 tests/schemas/vml-wordprocessingDrawing.xsd create mode 100755 tests/schemas/wml.xsd create mode 100644 tests/test_backend.hpp rename tests/{CellTestSuite.h => test_cell.hpp} (98%) rename tests/{ChartTestSuite.h => test_chart.hpp} (99%) create mode 100644 tests/test_data/Thumbs.db delete mode 100644 tests/test_data/genuine/empty-with-styles.zip create mode 100644 tests/test_data/genuine/guess_types.xlsx create mode 100644 tests/test_data/genuine/libreoffice_nrt.xlsx delete mode 100644 tests/test_data/genuine/unicode.xlsx create mode 100644 tests/test_data/plain.png delete mode 100644 tests/test_data/reader/a.zip create mode 100644 tests/test_data/reader/bigfoot.xlsx create mode 100644 tests/test_data/reader/bug137.xlsx create mode 100644 tests/test_data/reader/bug275.xlsx create mode 100644 tests/test_data/reader/bug304.xlsx create mode 100644 tests/test_data/reader/contains_chartsheets.xlsx delete mode 100644 tests/test_data/reader/empty-workbook-styles.xml create mode 100644 tests/test_data/reader/formulae.xlsx create mode 100644 tests/test_data/reader/sheet2_no_dimension.xml create mode 100644 tests/test_data/reader/sheet2_no_span.xml delete mode 100644 tests/test_data/reader/simple-styles.xml create mode 100644 tests/test_data/reader/vba-test.xlsm create mode 100644 tests/test_data/reader/worksheet_formula.xml create mode 100644 tests/test_data/writer/expected/Content_types_vba.xml create mode 100644 tests/test_data/writer/expected/sheet1_auto_filter_filter_column.xml create mode 100644 tests/test_data/writer/expected/sheet1_auto_filter_sort_condition.xml create mode 100644 tests/test_datavalidation.hpp create mode 100644 tests/test_datetime.hpp create mode 100644 tests/test_drawing.hpp rename tests/{DumpTestSuite.h => test_dump.hpp} (96%) create mode 100644 tests/test_meta.hpp rename tests/{NamedRangeTestSuite.h => test_named_range.hpp} (97%) rename tests/{NumberFormatTestSuite.h => test_number_format.hpp} (97%) create mode 100644 tests/test_number_style.hpp create mode 100644 tests/test_password_hash.hpp rename tests/{PropsTestSuite.h => test_props.hpp} (96%) rename tests/{ReadTestSuite.h => test_read.hpp} (98%) rename tests/{StringsTestSuite.h => test_strings.hpp} (94%) rename tests/{StyleTestSuite.h => test_style.hpp} (90%) rename tests/{ThemeTestSuite.h => test_theme.hpp} (78%) create mode 100644 tests/test_units.hpp create mode 100644 tests/test_vba.hpp rename tests/{WorkbookTestSuite.h => test_workbook.hpp} (98%) rename tests/{WorksheetTestSuite.h => test_worksheet.hpp} (95%) rename tests/{WriteTestSuite.h => test_write.hpp} (97%) diff --git a/build/premake5.lua b/build/premake5.lua index b168fe61..d1e359e1 100644 --- a/build/premake5.lua +++ b/build/premake5.lua @@ -28,7 +28,8 @@ project "xlnt.test" "xlnt", "zlib" } - prebuildcommands { "cxxtestgen --runner=ErrorPrinter -o ../../tests/runner-autogen.cpp ../../tests/*.h" } + prebuildcommands { "cxxtestgen --runner=ErrorPrinter -o ../../tests/runner-autogen.cpp ../../tests/*.hpp" } + postbuildcommands { "../../bin/xlnt.test" } flags { "Unicode", "NoEditAndContinue", @@ -65,11 +66,9 @@ project "xlnt" "../third-party/zlib/contrib/minizip" } files { - "../source/*.cpp", - "../source/*.h", - "../source/detail/*.cpp", - "../source/detail/*.h", - "../include/xlnt/*.h" + "../source/**.cpp", + "../source/**.h", + "../include/xlnt/**.h" } flags { "Unicode", diff --git a/include/xlnt/cell.h b/include/xlnt/cell/cell.hpp similarity index 76% rename from include/xlnt/cell.h rename to include/xlnt/cell/cell.hpp index bc45355d..35170ed9 100644 --- a/include/xlnt/cell.h +++ b/include/xlnt/cell/cell.hpp @@ -1,11 +1,34 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 "style.h" -#include "types.h" +#include "../styles/style.hpp" +#include "../common/types.hpp" namespace xlnt { diff --git a/include/xlnt/cell_reference.h b/include/xlnt/cell/cell_reference.hpp similarity index 72% rename from include/xlnt/cell_reference.h rename to include/xlnt/cell/cell_reference.hpp index 6c4ac44c..37711caa 100644 --- a/include/xlnt/cell_reference.h +++ b/include/xlnt/cell/cell_reference.hpp @@ -1,10 +1,32 @@ +// Copyright (c) 2014 Thomas Fussell +// +// 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 "types.h" +#include "../common/types.hpp" namespace xlnt { diff --git a/include/xlnt/charts/axis.hpp b/include/xlnt/charts/axis.hpp new file mode 100644 index 00000000..e69de29b diff --git a/include/xlnt/charts/bar_chart.hpp b/include/xlnt/charts/bar_chart.hpp new file mode 100644 index 00000000..e69de29b diff --git a/include/xlnt/charts/chart.hpp b/include/xlnt/charts/chart.hpp new file mode 100644 index 00000000..e69de29b diff --git a/include/xlnt/charts/error_bar.hpp b/include/xlnt/charts/error_bar.hpp new file mode 100644 index 00000000..e69de29b diff --git a/include/xlnt/charts/graph_chart.hpp b/include/xlnt/charts/graph_chart.hpp new file mode 100644 index 00000000..e69de29b diff --git a/include/xlnt/charts/legend.hpp b/include/xlnt/charts/legend.hpp new file mode 100644 index 00000000..e69de29b diff --git a/include/xlnt/charts/line_chart.hpp b/include/xlnt/charts/line_chart.hpp new file mode 100644 index 00000000..e69de29b diff --git a/include/xlnt/charts/pie_chart.hpp b/include/xlnt/charts/pie_chart.hpp new file mode 100644 index 00000000..e69de29b diff --git a/include/xlnt/charts/scatter_chart.hpp b/include/xlnt/charts/scatter_chart.hpp new file mode 100644 index 00000000..e69de29b diff --git a/include/xlnt/charts/series.hpp b/include/xlnt/charts/series.hpp new file mode 100644 index 00000000..e69de29b diff --git a/include/xlnt/common/datetime.hpp b/include/xlnt/common/datetime.hpp new file mode 100644 index 00000000..5e1d4664 --- /dev/null +++ b/include/xlnt/common/datetime.hpp @@ -0,0 +1,72 @@ +// Copyright (c) 2014 Thomas Fussell +// +// 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 + +namespace xlnt { + +struct date +{ + date(int year, int month, int day) + : year(year), month(month), day(day) + { + } + + int year; + int month; + int day; +}; + +struct time +{ + time(int hour = 0, int minute = 0, int second = 0, int microsecond = 0) + : hour(hour), minute(minute), second(second), microsecond(microsecond) + { + } + + explicit time(long double number); + + int hour; + int minute; + int second; + int microsecond; +}; + +struct datetime +{ + static datetime now(); + + datetime(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int microsecond = 0) + : year(year), month(month), day(day), hour(hour), minute(minute), second(second), microsecond(microsecond) + { + } + + int year; + int month; + int day; + int hour; + int minute; + int second; + int microsecond; +}; + +} // namespace xlnt diff --git a/include/xlnt/common/exceptions.hpp b/include/xlnt/common/exceptions.hpp new file mode 100644 index 00000000..7d287b6f --- /dev/null +++ b/include/xlnt/common/exceptions.hpp @@ -0,0 +1,123 @@ +// Copyright (c) 2014 Thomas Fussell +// +// 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 + +namespace xlnt { + +/// +/// Error for converting between numeric and A1-style cell references. +/// +class cell_coordinates_exception : public std::runtime_error +{ +public: + cell_coordinates_exception(int row, int column); + cell_coordinates_exception(const std::string &coord_string); +}; + +/// +/// The data submitted which cannot be used directly in Excel files. It +/// must be removed or escaped. +/// +class illegal_character_error : public std::runtime_error +{ +public: + illegal_character_error(char c); +}; + +/// +/// Error for bad column names in A1-style cell references. +/// +class column_string_index_exception : public std::runtime_error +{ +public: + column_string_index_exception(); +}; + +/// +/// Error for any data type inconsistencies. +/// +class data_type_exception : public std::runtime_error +{ +public: + data_type_exception(); +}; + +/// +/// Error for badly formatted named ranges. +/// +class named_range_exception : public std::runtime_error +{ +public: + named_range_exception(); +}; + +/// +/// Error for bad sheet names. +/// +class sheet_title_exception : public std::runtime_error +{ +public: + sheet_title_exception(const std::string &title); +}; + +/// +/// Error for trying to open a non-ooxml file. +/// +class invalid_file_exception : public std::runtime_error +{ +public: + invalid_file_exception(); +}; + +/// +/// Error for trying to modify a read-only workbook. +/// +class read_only_workbook_exception : public std::runtime_error +{ +public: + read_only_workbook_exception(); +}; + +/// +/// Error when a references number format is not in the stylesheet. +/// +class missing_number_format : public std::runtime_error +{ +public: + missing_number_format(); +}; + +/// +/// Error when attempting to perform operations on a dump workbook +/// while it has already been dumped once. +/// +class workbook_already_saved : public std::runtime_error +{ +public: + workbook_already_saved(); +}; + +} // namespace xlnt diff --git a/include/xlnt/relationship.h b/include/xlnt/common/relationship.hpp similarity index 61% rename from include/xlnt/relationship.h rename to include/xlnt/common/relationship.hpp index fd6ecb0e..ccf323da 100644 --- a/include/xlnt/relationship.h +++ b/include/xlnt/common/relationship.hpp @@ -1,3 +1,26 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 diff --git a/include/xlnt/common/string_table.hpp b/include/xlnt/common/string_table.hpp new file mode 100644 index 00000000..897cfe5a --- /dev/null +++ b/include/xlnt/common/string_table.hpp @@ -0,0 +1,52 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 + +namespace xlnt { + +class string_table_builder; + +class string_table +{ +public: + int operator[](const std::string &key) const; +private: + friend class string_table_builder; + std::vector strings_; +}; + +class string_table_builder +{ +public: + void add(const std::string &string); + string_table &get_table() { return table_; } + const string_table &get_table() const { return table_; } +private: + string_table table_; +}; + +} // namespace xlnt diff --git a/include/xlnt/common/types.hpp b/include/xlnt/common/types.hpp new file mode 100644 index 00000000..ef3291d9 --- /dev/null +++ b/include/xlnt/common/types.hpp @@ -0,0 +1,28 @@ +// Copyright (c) 2014 Thomas Fussell +// +// 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 + +typedef uint32_t row_t; +typedef uint32_t column_t; diff --git a/source/zip_file.h b/include/xlnt/common/zip_file.hpp similarity index 78% rename from source/zip_file.h rename to include/xlnt/common/zip_file.hpp index 4ade71e7..60fb8b8f 100644 --- a/source/zip_file.h +++ b/include/xlnt/common/zip_file.hpp @@ -1,3 +1,25 @@ +// Copyright (c) 2014 Thomas Fussell +// +// 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 @@ -107,3 +129,4 @@ private: }; } // namespace xlnt + diff --git a/include/xlnt/config.h b/include/xlnt/config.h deleted file mode 100644 index cb4993bb..00000000 --- a/include/xlnt/config.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -namespace xlnt { - -enum class limit_style -{ - openpyxl, - excel, - maximum -}; - -const limit_style LimitStyle = limit_style::openpyxl; - -} diff --git a/include/xlnt/config.hpp b/include/xlnt/config.hpp new file mode 100644 index 00000000..ae5ac096 --- /dev/null +++ b/include/xlnt/config.hpp @@ -0,0 +1,36 @@ +// Copyright (c) 2014 Thomas Fussell +// +// 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 + +namespace xlnt { + +enum class limit_style +{ + openpyxl, + excel, + maximum +}; + +const limit_style LimitStyle = limit_style::openpyxl; + +} diff --git a/include/xlnt/custom_exceptions.h b/include/xlnt/custom_exceptions.h deleted file mode 100644 index f971682a..00000000 --- a/include/xlnt/custom_exceptions.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include -#include - -namespace xlnt { - -class bad_sheet_title : public std::runtime_error -{ -public: - bad_sheet_title(const std::string &title); -}; - -class cell_coordinates_exception : public std::runtime_error -{ -public: - cell_coordinates_exception(int row, int column); - - cell_coordinates_exception(const std::string &coord_string); -}; - -class workbook_already_saved : public std::runtime_error -{ -public: - workbook_already_saved(); -}; - -class data_type_exception : public std::runtime_error -{ -public: - data_type_exception(); -}; - -class column_string_index_exception : public std::runtime_error -{ -public: - column_string_index_exception(); -}; - -} // namespace xlnt diff --git a/include/xlnt/datetime.h b/include/xlnt/datetime.h deleted file mode 100644 index 858d4426..00000000 --- a/include/xlnt/datetime.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -namespace xlnt { - -struct date -{ - date(int year, int month, int day) - : year(year), month(month), day(day) - { - } - - int year; - int month; - int day; -}; - -struct time -{ - time(int hour = 0, int minute = 0, int second = 0, int microsecond = 0) - : hour(hour), minute(minute), second(second), microsecond(microsecond) - { - } - - explicit time(long double number); - - int hour; - int minute; - int second; - int microsecond; -}; - -struct datetime -{ - static datetime now(); - - datetime(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int microsecond = 0) - : year(year), month(month), day(day), hour(hour), minute(minute), second(second), microsecond(microsecond) - { - } - - int year; - int month; - int day; - int hour; - int minute; - int second; - int microsecond; -}; - -} // namespace xlnt diff --git a/include/xlnt/drawing.h b/include/xlnt/drawing.h deleted file mode 100644 index 8ffa4ee7..00000000 --- a/include/xlnt/drawing.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -namespace xlnt { - -class worksheet; -struct drawing_struct; - -class drawing -{ -public: - drawing(); - -private: - friend class worksheet; - drawing(drawing_struct *root); - drawing_struct *root_; -}; - -} // namespace xlnt diff --git a/include/xlnt/drawing/drawing.hpp b/include/xlnt/drawing/drawing.hpp new file mode 100644 index 00000000..b9066180 --- /dev/null +++ b/include/xlnt/drawing/drawing.hpp @@ -0,0 +1,42 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 + +namespace xlnt { + +class worksheet; +struct drawing_struct; + +class drawing +{ +public: + drawing(); + +private: + friend class worksheet; + drawing(drawing_struct *root); + drawing_struct *root_; +}; + +} // namespace xlnt diff --git a/include/xlnt/reader.h b/include/xlnt/reader.h deleted file mode 100644 index 4ce4386a..00000000 --- a/include/xlnt/reader.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace xlnt { - -class workbook; -class worksheet; - -class reader -{ -public: - static std::unordered_map> read_relationships(const std::string &content); - static std::pair, std::unordered_map> read_content_types(const std::string &content); - static std::string determine_document_type(const std::unordered_map> &root_relationships, - const std::unordered_map &override_types); - static worksheet read_worksheet(std::istream &handle, workbook &wb, const std::string &title, const std::vector &string_table); - static void read_worksheet(worksheet ws, const std::string &xml_string, const std::vector &string_table); - static std::vector read_shared_string(const std::string &xml_string); -}; - -} // namespace xlnt diff --git a/include/xlnt/reader/chart_reader.hpp b/include/xlnt/reader/chart_reader.hpp new file mode 100644 index 00000000..37fa5c54 --- /dev/null +++ b/include/xlnt/reader/chart_reader.hpp @@ -0,0 +1,65 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 "charts/chart.h" + +namespace xlnt { + +class chart_reader +{ + +}; + +class pie_chart_reader : public chart_reader +{ + +}; + +class pie_chart_reader : public chart_reader +{ + +}; + +class pie_chart_reader : public chart_reader +{ + +}; + +class pie_chart_reader : public chart_reader +{ + +}; + +class chart_reader_factory +{ +public: + static std::unique_ptr create_reader(chart c); +}; + +} // namespace xlnt diff --git a/include/xlnt/reader/comment_reader.hpp b/include/xlnt/reader/comment_reader.hpp new file mode 100644 index 00000000..34ee32d5 --- /dev/null +++ b/include/xlnt/reader/comment_reader.hpp @@ -0,0 +1,33 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 + +namespace xlnt { + +class comment_reader +{ + +}; + +} // namespace xlnt diff --git a/include/xlnt/reader/drawing_reader.hpp b/include/xlnt/reader/drawing_reader.hpp new file mode 100644 index 00000000..20fb147d --- /dev/null +++ b/include/xlnt/reader/drawing_reader.hpp @@ -0,0 +1,33 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 + +namespace xlnt { + +class drawing_reader +{ + +}; + +} // namespace xlnt diff --git a/include/xlnt/reader/excel_reader.hpp b/include/xlnt/reader/excel_reader.hpp new file mode 100644 index 00000000..d3ad4651 --- /dev/null +++ b/include/xlnt/reader/excel_reader.hpp @@ -0,0 +1,33 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 + +namespace xlnt { + +class excel_reader +{ + +}; + +} // namespace xlnt diff --git a/include/xlnt/reader/reader.hpp b/include/xlnt/reader/reader.hpp new file mode 100644 index 00000000..eb059949 --- /dev/null +++ b/include/xlnt/reader/reader.hpp @@ -0,0 +1,48 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 + +namespace xlnt { + +class workbook; +class worksheet; + +class reader +{ +public: + static std::unordered_map> read_relationships(const std::string &content); + static std::pair, std::unordered_map> read_content_types(const std::string &content); + static std::string determine_document_type(const std::unordered_map> &root_relationships, + const std::unordered_map &override_types); + static worksheet read_worksheet(std::istream &handle, workbook &wb, const std::string &title, const std::vector &string_table); + static void read_worksheet(worksheet ws, const std::string &xml_string, const std::vector &string_table); + static std::vector read_shared_string(const std::string &xml_string); +}; + +} // namespace xlnt diff --git a/include/xlnt/reader/string_reader.hpp b/include/xlnt/reader/string_reader.hpp new file mode 100644 index 00000000..da023d74 --- /dev/null +++ b/include/xlnt/reader/string_reader.hpp @@ -0,0 +1,33 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 + +namespace xlnt { + +class string_reader +{ + +}; + +} // namespace xlnt diff --git a/include/xlnt/reader/style_reader.hpp b/include/xlnt/reader/style_reader.hpp new file mode 100644 index 00000000..3f502120 --- /dev/null +++ b/include/xlnt/reader/style_reader.hpp @@ -0,0 +1,42 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 "style.h" + +namespace xlnt { + +class workbook; + +class style_reader +{ + public: + style_reader(workbook &wb); +}; + +} // namespace xlnt diff --git a/include/xlnt/reader/theme_reader.hpp b/include/xlnt/reader/theme_reader.hpp new file mode 100644 index 00000000..61d8caa8 --- /dev/null +++ b/include/xlnt/reader/theme_reader.hpp @@ -0,0 +1,33 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 + +namespace xlnt { + +class theme_reader +{ + +}; + +} // namespace xlnt diff --git a/include/xlnt/reader/workbook_reader.hpp b/include/xlnt/reader/workbook_reader.hpp new file mode 100644 index 00000000..2de11025 --- /dev/null +++ b/include/xlnt/reader/workbook_reader.hpp @@ -0,0 +1,33 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 + +namespace xlnt { + +class workbook_reader +{ + +}; + +} // namespace xlnt diff --git a/include/xlnt/reader/worksheet_reader.hpp b/include/xlnt/reader/worksheet_reader.hpp new file mode 100644 index 00000000..895084fb --- /dev/null +++ b/include/xlnt/reader/worksheet_reader.hpp @@ -0,0 +1,33 @@ +// Copyright (c) 2014 Thomas Fussell +// Copyright (c) 2010-2014 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 + +namespace xlnt { + +class worksheet_reader +{ + +}; + +} // namespace xlnt diff --git a/include/xlnt/string_table.h b/include/xlnt/string_table.h deleted file mode 100644 index fe71a7a4..00000000 --- a/include/xlnt/string_table.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include -#include - -namespace xlnt { - -class string_table_builder; - -class string_table -{ -public: - int operator[](const std::string &key) const; -private: - friend class string_table_builder; - std::vector strings_; -}; - -class string_table_builder -{ -public: - void add(const std::string &string); - string_table &get_table() { return table_; } - const string_table &get_table() const { return table_; } -private: - string_table table_; -}; - -} // namespace xlnt diff --git a/include/xlnt/style.h b/include/xlnt/style.h deleted file mode 100644 index 545afaf6..00000000 --- a/include/xlnt/style.h +++ /dev/null @@ -1,270 +0,0 @@ -#pragma once - -namespace xlnt { - -/// -/// Alignment options for use in styles. -/// -struct alignment -{ - enum class horizontal_alignment - { - general, - left, - right, - center, - center_continuous, - justify - }; - - enum class vertical_alignment - { - bottom, - top, - center, - justify - }; - - horizontal_alignment horizontal = horizontal_alignment::general; - vertical_alignment vertical = vertical_alignment::bottom; - int text_rotation = 0; - bool wrap_text = false; - bool shrink_to_fit = false; - int indent = 0; -}; - -class number_format -{ -public: - enum class format - { - general, - text, - number, - number00, - number_comma_separated1, - number_comma_separated2, - percentage, - percentage00, - date_yyyymmdd2, - date_yyyymmdd, - date_ddmmyyyy, - date_dmyslash, - date_dmyminus, - date_dmminus, - date_myminus, - date_xlsx14, - date_xlsx15, - date_xlsx16, - date_xlsx17, - date_xlsx22, - date_datetime, - date_time1, - date_time2, - date_time3, - date_time4, - date_time5, - date_time6, - date_time7, - date_time8, - date_timedelta, - date_yyyymmddslash, - currency_usd_simple, - currency_usd, - currency_eur_simple - }; - - static const std::unordered_map builtin_formats; - - static std::string builtin_format_code(int index); - - static bool is_date_format(const std::string &format); - static bool is_builtin(const std::string &format); - - format get_format_code() const { return format_code_; } - void set_format_code(format format_code) { format_code_ = format_code; } - void set_format_code(const std::string &format_code) { custom_format_code_ = format_code; } - -private: - std::string custom_format_code_ = ""; - format format_code_ = format::general; - int format_index_ = 0; -}; - -struct color -{ - static const color black; - static const color white; - static const color red; - static const color darkred; - static const color blue; - static const color darkblue; - static const color green; - static const color darkgreen; - static const color yellow; - static const color darkyellow; - - color(int index) - { - this->index = index; - } - - int index; -}; - -class font -{ - enum class underline - { - none, - double_, - double_accounting, - single, - single_accounting - }; - - /* std::string name = "Calibri"; - int size = 11; - bool bold = false; - bool italic = false; - bool superscript = false; - bool subscript = false; - underline underline = underline::none; - bool strikethrough = false; - color color = color::black;*/ -}; - -class fill -{ -public: - enum class type - { - none, - solid, - gradient_linear, - gradient_path, - pattern_darkdown, - pattern_darkgray, - pattern_darkgrid, - pattern_darkhorizontal, - pattern_darktrellis, - pattern_darkup, - pattern_darkvertical, - pattern_gray0625, - pattern_gray125, - pattern_lightdown, - pattern_lightgray, - pattern_lightgrid, - pattern_lighthorizontal, - pattern_lighttrellis, - pattern_lightup, - pattern_lightvertical, - pattern_mediumgray, - }; - - type type_ = type::none; - int rotation = 0; - color start_color = color::white; - color end_color = color::black; -}; - -class borders -{ - struct border - { - enum class style - { - none, - dashdot, - dashdotdot, - dashed, - dotted, - double_, - hair, - medium, - mediumdashdot, - mediumdashdotdot, - mediumdashed, - slantdashdot, - thick, - thin - }; - - style style_ = style::none; - color color_ = color::black; - }; - - enum class diagonal_direction - { - none, - up, - down, - both - }; - - border left; - border right; - border top; - border bottom; - border diagonal; - // diagonal_direction diagonal_direction = diagonal_direction::none; - border all_borders; - border outline; - border inside; - border vertical; - border horizontal; -}; - -class protection -{ -public: - enum class type - { - inherit, - protected_, - unprotected - }; - - type locked; - type hidden; -}; - -class style -{ -public: - style(bool static_ = false) : static_(static_) {} - - style copy() const; - - font get_font() const; - void set_font(font font); - - fill get_fill() const; - void set_fill(fill fill); - - borders get_borders() const; - void set_borders(borders borders); - - alignment get_alignment() const; - void set_alignment(alignment alignment); - - number_format &get_number_format() { return number_format_; } - const number_format &get_number_format() const { return number_format_; } - void set_number_format(number_format number_format); - - protection get_protection() const; - void set_protection(protection protection); - -private: - style(const style &rhs); - - bool static_ = false; - font font_; - fill fill_; - borders borders_; - alignment alignment_; - number_format number_format_; - protection protection_; -}; - -} // namespace xlnt diff --git a/include/xlnt/style_writer.h b/include/xlnt/style_writer.h deleted file mode 100644 index 4f823222..00000000 --- a/include/xlnt/style_writer.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "style.h" - -namespace xlnt { - -class workbook; - -class style_writer -{ - public: - style_writer(workbook &wb); - std::unordered_map get_style_by_hash() const; - std::string write_table() const; - - private: - std::vector