OpenXLSX 1.9.1
Loading...
Searching...
No Matches
XLThreadedComments.hpp
Go to the documentation of this file.
1#ifndef OPENXLSX_XLTHREADEDCOMMENTS_HPP
2#define OPENXLSX_XLTHREADEDCOMMENTS_HPP
3
4#include <string>
5#include <vector>
6#include <gsl/pointers>
7#include "OpenXLSX-Exports.hpp"
8#include "XLXmlFile.hpp"
9
10namespace OpenXLSX
11{
12 class XLWorksheet;
16 class OPENXLSX_EXPORT XLThreadedComment
17 {
18 public:
19 XLThreadedComment() = default;
20 explicit XLThreadedComment(XMLNode node, XLWorksheet* wks = nullptr);
21 ~XLThreadedComment() = default;
22 XLThreadedComment(const XLThreadedComment& other) = default;
26
27 bool valid() const;
28
29 std::string ref() const;
30 std::string id() const;
31 std::string parentId() const;
32 std::string personId() const;
33 std::string text() const;
34
35 bool isResolved() const;
36 void setResolved(bool resolved);
37
41 XLThreadedComment& addReply(const std::string& text, const std::string& author = "");
42
43 void setWorksheet(XLWorksheet* wks) { m_wks = wks; }
44
45 private:
46 XMLNode m_node;
47 XLWorksheet* m_wks{nullptr};
48 };
49
50 class XLWorksheet;
51
55 class OPENXLSX_EXPORT XLThreadedComments : public XLXmlFile
56 {
57 public:
59 explicit XLThreadedComments(gsl::not_null<XLXmlData*> xmlData) : XLXmlFile(xmlData) {}
61 XLThreadedComments(const XLThreadedComments& other) = default;
65
69 XLThreadedComment comment(const std::string& ref) const;
70
74 std::vector<XLThreadedComment> replies(const std::string& parentId) const;
75
79 XLThreadedComment addComment(std::string_view ref, std::string_view personId, std::string_view text);
80
84 XLThreadedComment addReply(const std::string& parentId, const std::string& personId, const std::string& text);
85
89 bool deleteComment(const std::string& ref);
90 };
91
95 class OPENXLSX_EXPORT XLPerson
96 {
97 public:
98 XLPerson() = default;
99 explicit XLPerson(XMLNode node);
100 ~XLPerson() = default;
101 XLPerson(const XLPerson& other) = default;
102 XLPerson(XLPerson&& other) = default;
103 XLPerson& operator=(const XLPerson& other) = default;
104 XLPerson& operator=(XLPerson&& other) = default;
105
106 bool valid() const;
107
108 std::string id() const;
109 std::string displayName() const;
110
111 private:
112 XMLNode m_node;
113 };
114
118 class OPENXLSX_EXPORT XLPersons : public XLXmlFile
119 {
120 public:
121 XLPersons() : XLXmlFile(nullptr) {}
122 explicit XLPersons(gsl::not_null<XLXmlData*> xmlData) : XLXmlFile(xmlData) {}
123 ~XLPersons() = default;
124 XLPersons(const XLPersons& other) = default;
125 XLPersons(XLPersons&& other) = default;
126 XLPersons& operator=(const XLPersons& other) = default;
127 XLPersons& operator=(XLPersons&& other) = default;
128
132 XLPerson person(const std::string& id) const;
133
138 std::string addPerson(const std::string& displayName);
139 };
140} // namespace OpenXLSX
141
142#endif // OPENXLSX_XLTHREADEDCOMMENTS_HPP
XLXmlData * xmlData
Definition XLDocument.cpp:1422
Definition XLXmlParser.hpp:84
A proxy class encapsulating a single person (author) entity.
Definition XLThreadedComments.hpp:96
XLPerson & operator=(XLPerson &&other)=default
XLPerson & operator=(const XLPerson &other)=default
XLPerson(XLPerson &&other)=default
XLPerson(const XLPerson &other)=default
A class encapsulating modern Excel persons metadata (persons.xml)
Definition XLThreadedComments.hpp:119
XLPersons(const XLPersons &other)=default
XLPersons & operator=(const XLPersons &other)=default
XLPersons(XLPersons &&other)=default
XLPersons & operator=(XLPersons &&other)=default
XLPersons(gsl::not_null< XLXmlData * > xmlData)
Definition XLThreadedComments.hpp:122
XLPersons()
Definition XLThreadedComments.hpp:121
A proxy class encapsulating a single modern threaded comment.
Definition XLThreadedComments.hpp:17
XLThreadedComment & operator=(XLThreadedComment &&other)=default
void setWorksheet(XLWorksheet *wks)
Definition XLThreadedComments.hpp:43
XLThreadedComment & operator=(const XLThreadedComment &other)=default
XLThreadedComment(const XLThreadedComment &other)=default
XLThreadedComment(XLThreadedComment &&other)=default
A class encapsulating modern Excel threaded comments (ThreadedComments.xml)
Definition XLThreadedComments.hpp:56
XLThreadedComments()
Definition XLThreadedComments.hpp:58
XLThreadedComments(const XLThreadedComments &other)=default
XLThreadedComments(XLThreadedComments &&other)=default
XLThreadedComments & operator=(const XLThreadedComments &other)=default
XLThreadedComments(gsl::not_null< XLXmlData * > xmlData)
Definition XLThreadedComments.hpp:59
XLThreadedComments & operator=(XLThreadedComments &&other)=default
A class encapsulating an Excel worksheet. Access to XLWorksheet objects should be via the workbook ob...
Definition XLWorksheet.hpp:118
The XLXmlFile class provides an interface for derived classes to use. It functions as an ancestor to ...
Definition XLXmlFile.hpp:42
Definition IZipArchive.hpp:18