OpenXLSX 1.12.1
Modern C++ Excel Library (Fork of OpenXLSX by Kenneth Troldal Balslev)
Loading...
Searching...
No Matches
XLStyles_Dxfs.hpp
Go to the documentation of this file.
1/*
2 * OpenXLSX-NX - Modern High-Performance C++ Excel Library
3 *
4 * Original work Copyright (c) 2018-2025, Kenneth Troldal Balslev and OpenXLSX contributors
5 * Modified work Copyright (c) 2026, Curry Tang and OpenXLSX-NX contributors
6 *
7 * Distributed under the BSD 3-Clause License.
8 * See LICENSE.md in the project root or https://opensource.org/licenses/BSD-3-Clause
9 */
10
11#ifndef OPENXLSX_XLSTYLES_DXFS_HPP
12#define OPENXLSX_XLSTYLES_DXFS_HPP
13
14#ifdef _MSC_VER
15# pragma warning(push)
16# pragma warning(disable : 4251)
17# pragma warning(disable : 4275)
18#endif
19
20#include "XLStyles_Common.hpp"
21#include "XLStyles_Borders.hpp"
23#include "XLStyles_Fills.hpp"
24#include "XLStyles_Fonts.hpp"
26#include "XLXmlParser.hpp"
27
28#include <memory>
29#include <string>
30#include <vector>
31
32
33namespace OpenXLSX
34{
35 class OPENXLSX_EXPORT XLDxf
36 {
37 friend class XLDxfs;
38
39 public:
43 XLDxf();
44
49 explicit XLDxf(const XMLNode& node);
50
55 XLDxf(const XLDxf& other);
56
61 XLDxf(XLDxf&& other) noexcept;
62
67
73 XLDxf& operator=(const XLDxf& other);
74
80 XLDxf& operator=(XLDxf&& other) noexcept;
81
86 bool empty() const;
87
92 XLFont font() const;
93 XLNumberFormat numFmt() const;
94 XLFill fill() const;
95 XLAlignment alignment() const;
96 XLBorder border() const;
97
101 bool hasFont() const;
102 bool hasNumFmt() const;
103 bool hasFill() const;
104 bool hasAlignment() const;
105 bool hasBorder() const;
106
110 void clearFont();
111 void clearNumFmt();
112 void clearFill();
113 void clearAlignment();
114 void clearBorder();
115
120
124 bool setExtLst(XLUnsupportedElement const& newExtLst);
125
130 std::string summary() const;
131
135 XMLNode node() const { return m_dxfNode; }
136
137 private:
138 std::unique_ptr<XMLDocument> m_xmlDocument;
139 mutable XMLNode m_dxfNode;
140 };
141
146
150 class OPENXLSX_EXPORT XLDxfs
151 {
152 public:
156 XLDxfs();
157
162 explicit XLDxfs(const XMLNode& node);
163
168 XLDxfs(const XLDxfs& other);
169
174 XLDxfs(XLDxfs&& other);
175
179 ~XLDxfs();
180
186 XLDxfs& operator=(const XLDxfs& other);
187
193 XLDxfs& operator=(XLDxfs&& other) noexcept;
194
199 size_t count() const;
200
205 XLDxf dxfByIndex(XLStyleIndex index) const;
206
212 XLDxf operator[](XLStyleIndex index) const { return dxfByIndex(index); }
213
220 XLStyleIndex create(XLDxf copyFrom = XLDxf{}, std::string_view styleEntriesPrefix = XLDefaultStyleEntriesPrefix);
221
222 private:
223 mutable XMLNode m_dxfsNode;
224 std::vector<XLDxf> m_dxfs;
225 };
226
231
232} // namespace OpenXLSX
233
234#ifdef _MSC_VER
235# pragma warning(pop)
236#endif
237
238#endif // OPENXLSX_XLSTYLES_DXFS_HPP
Definition XLStyles_CellFormats.hpp:34
An encapsulation of a border item.
Definition XLStyles_Borders.hpp:114
Definition XLStyles_Dxfs.hpp:36
bool hasFont() const
Check if specific components are present in the DXF.
Definition XLStyles_Dxfs.cpp:108
void clearNumFmt()
Definition XLStyles_Dxfs.cpp:115
bool empty() const
Test if this is an empty node.
Definition XLStyles_Dxfs.cpp:75
bool hasBorder() const
Definition XLStyles_Dxfs.cpp:112
bool hasNumFmt() const
Definition XLStyles_Dxfs.cpp:109
XLFont font() const
Getter functions, will create empty object on access and can be used to manipulate underlying setters...
Definition XLStyles_Dxfs.cpp:77
XLAlignment alignment() const
Definition XLStyles_Dxfs.cpp:95
XLNumberFormat numFmt() const
Definition XLStyles_Dxfs.cpp:83
XLBorder border() const
Definition XLStyles_Dxfs.cpp:101
void clearFill()
Definition XLStyles_Dxfs.cpp:116
bool hasAlignment() const
Definition XLStyles_Dxfs.cpp:111
XLDxf()
Default constructor. Initializes an empty XLDxf object with a temporary XML document.
Definition XLStyles_Dxfs.cpp:33
void clearBorder()
Definition XLStyles_Dxfs.cpp:118
void clearFont()
Clear specific components from the DXF.
Definition XLStyles_Dxfs.cpp:114
XLDxf & operator=(const XLDxf &other)
Copy assignment operator.
Definition XLStyles_Dxfs.cpp:50
XLUnsupportedElement extLst() const
Unsupported getter.
Definition XLStyles_Dxfs.hpp:119
void clearAlignment()
Definition XLStyles_Dxfs.cpp:117
XLFill fill() const
Definition XLStyles_Dxfs.cpp:89
bool hasFill() const
Definition XLStyles_Dxfs.cpp:110
friend class XLDxfs
Definition XLStyles_Dxfs.hpp:37
~XLDxf()
Destructor.
XMLNode node() const
Access the underlying XML node.
Definition XLStyles_Dxfs.hpp:135
An encapsulation of the XLSX differential cell formats (dxfs).
Definition XLStyles_Dxfs.hpp:151
XLDxfs()
Default constructor.
Definition XLStyles_Dxfs.cpp:141
XLDxf operator[](XLStyleIndex index) const
Operator overload: allow [] as shortcut access to dxfByIndex.
Definition XLStyles_Dxfs.hpp:212
XLDxf dxfByIndex(XLStyleIndex index) const
Get the differential cell format identified by index.
Definition XLStyles_Dxfs.cpp:183
size_t count() const
Get the count of differential cell formats.
Definition XLStyles_Dxfs.cpp:181
XLDxfs & operator=(const XLDxfs &other)
Copy assignment operator.
Definition XLStyles_Dxfs.cpp:162
An encapsulation of a fill item.
Definition XLStyles_Fills.hpp:282
Definition XLStyles_Fonts.hpp:34
Definition XLStyles_NumberFormats.hpp:35
The XLUnsupportedElement class provides a stub implementation that can be used as function parameter ...
Definition XLXmlFile.hpp:42
Definition IXLCellProvider.hpp:24
XLDxf XLDiffCellFormat
Backward compatibility alias.
Definition XLStyles_Dxfs.hpp:145
XLDxfs XLDiffCellFormats
Backward compatibility alias.
Definition XLStyles_Dxfs.hpp:230
OpenXLSX_xml_node XMLNode
Definition XLXmlParser.hpp:64
size_t XLStyleIndex
Definition XLStyles_Common.hpp:36