xlnt
relationship.hpp
1 // Copyright (c) 2014-2022 Thomas Fussell
2 // Copyright (c) 2010-2015 openpyxl
3 // Copyright (c) 2024 xlnt-community
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE
22 //
23 // @license: http://www.opensource.org/licenses/mit-license.php
24 // @author: see AUTHORS file
25 
26 #pragma once
27 
28 #include <string>
29 
30 #include <xlnt/xlnt_config.hpp>
31 #include <xlnt/packaging/uri.hpp>
32 #include <xlnt/utils/path.hpp>
33 
34 namespace xlnt {
35 
39 enum class XLNT_API target_mode
40 {
44  internal,
48  external
49 };
50 
54 enum class XLNT_API relationship_type
55 {
56  unknown,
57 
58  // Package parts
59  core_properties,
60  extended_properties,
61  custom_properties,
62  office_document,
63  thumbnail,
64  printer_settings,
65 
66  // SpreadsheetML parts
67  calculation_chain,
68  chartsheet,
69  comments,
70  connections,
71  custom_property,
72  custom_xml_mappings,
73  dialogsheet,
74  drawings,
75  external_workbook_references,
76  pivot_table,
77  pivot_table_cache_definition,
78  pivot_table_cache_records,
79  query_table,
80  shared_string_table,
81  shared_workbook_revision_headers,
82  shared_workbook,
83  theme,
84  revision_log,
85  shared_workbook_user_data,
86  single_cell_table_definitions,
87  stylesheet,
88  table_definition,
89  vml_drawing,
90  volatile_dependencies,
91  worksheet,
92  vbaproject,
93 
94  // Worksheet parts
95  hyperlink,
96  image
97 };
98 
103 class XLNT_API relationship
104 {
105 public:
109  relationship();
110 
114  relationship(const std::string &id, relationship_type t, const uri &source,
115  const uri &target, xlnt::target_mode mode);
116 
120  const std::string &id() const;
121 
125  relationship_type type() const;
126 
131 
135  const uri &source() const;
136 
140  const uri &target() const;
141 
145  bool operator==(const relationship &rhs) const;
146 
150  bool operator!=(const relationship &rhs) const;
151 
152 private:
156  std::string id_;
157 
161  relationship_type type_;
162 
166  uri source_;
167 
171  uri target_;
172 
176  xlnt::target_mode mode_;
177 };
178 
179 } // namespace xlnt
Represents an association between a source Package or part, and a target object which can be a part o...
Definition: relationship.hpp:103
Enumerates the possible types a cell can be determined by it&#39;s current value.
Definition: cell.hpp:37
Encapsulates a uniform resource identifier (URI) as described by RFC 3986.
Definition: uri.hpp:38
A worksheet is a 2D array of cells starting with cell A1 in the top-left corner and extending indefin...
Definition: worksheet.hpp:77
bool operator==(std::nullptr_t, const cell &cell)
Returns true if this cell is uninitialized.
A theme is a combination of fonts, colors, and effects. This isn&#39;t really supported yet...
Definition: theme.hpp:35
relationship_type
All package relationships must be one of these defined types.
Definition: relationship.hpp:54
target_mode
Specifies whether the target of a relationship is inside or outside the Package.
Definition: relationship.hpp:39
bool operator!=(const std::string &reference_string, const range_reference &ref)
Returns true if the string representation of the range is not equivalent to ref.
The relationship references a part that is inside the package.