updated a couple packages (#1567)
[openemr.git] / vendor / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Comment.php
blob1b5ab1fd2c1b54c99652e1da55db18e8933e6ed1
1 <?php
3 namespace PhpOffice\PhpSpreadsheet;
5 use PhpOffice\PhpSpreadsheet\RichText\RichText;
7 class Comment implements IComparable
9 /**
10 * Author.
12 * @var string
14 private $author;
16 /**
17 * Rich text comment.
19 * @var RichText
21 private $text;
23 /**
24 * Comment width (CSS style, i.e. XXpx or YYpt).
26 * @var string
28 private $width = '96pt';
30 /**
31 * Left margin (CSS style, i.e. XXpx or YYpt).
33 * @var string
35 private $marginLeft = '59.25pt';
37 /**
38 * Top margin (CSS style, i.e. XXpx or YYpt).
40 * @var string
42 private $marginTop = '1.5pt';
44 /**
45 * Visible.
47 * @var bool
49 private $visible = false;
51 /**
52 * Comment height (CSS style, i.e. XXpx or YYpt).
54 * @var string
56 private $height = '55.5pt';
58 /**
59 * Comment fill color.
61 * @var Style\Color
63 private $fillColor;
65 /**
66 * Alignment.
68 * @var string
70 private $alignment;
72 /**
73 * Create a new Comment.
75 public function __construct()
77 // Initialise variables
78 $this->author = 'Author';
79 $this->text = new RichText();
80 $this->fillColor = new Style\Color('FFFFFFE1');
81 $this->alignment = Style\Alignment::HORIZONTAL_GENERAL;
84 /**
85 * Get Author.
87 * @return string
89 public function getAuthor()
91 return $this->author;
94 /**
95 * Set Author.
97 * @param string $author
99 * @return Comment
101 public function setAuthor($author)
103 $this->author = $author;
105 return $this;
109 * Get Rich text comment.
111 * @return RichText
113 public function getText()
115 return $this->text;
119 * Set Rich text comment.
121 * @param RichText $pValue
123 * @return Comment
125 public function setText(RichText $pValue)
127 $this->text = $pValue;
129 return $this;
133 * Get comment width (CSS style, i.e. XXpx or YYpt).
135 * @return string
137 public function getWidth()
139 return $this->width;
143 * Set comment width (CSS style, i.e. XXpx or YYpt).
145 * @param string $width
147 * @return Comment
149 public function setWidth($width)
151 $this->width = $width;
153 return $this;
157 * Get comment height (CSS style, i.e. XXpx or YYpt).
159 * @return string
161 public function getHeight()
163 return $this->height;
167 * Set comment height (CSS style, i.e. XXpx or YYpt).
169 * @param string $value
171 * @return Comment
173 public function setHeight($value)
175 $this->height = $value;
177 return $this;
181 * Get left margin (CSS style, i.e. XXpx or YYpt).
183 * @return string
185 public function getMarginLeft()
187 return $this->marginLeft;
191 * Set left margin (CSS style, i.e. XXpx or YYpt).
193 * @param string $value
195 * @return Comment
197 public function setMarginLeft($value)
199 $this->marginLeft = $value;
201 return $this;
205 * Get top margin (CSS style, i.e. XXpx or YYpt).
207 * @return string
209 public function getMarginTop()
211 return $this->marginTop;
215 * Set top margin (CSS style, i.e. XXpx or YYpt).
217 * @param string $value
219 * @return Comment
221 public function setMarginTop($value)
223 $this->marginTop = $value;
225 return $this;
229 * Is the comment visible by default?
231 * @return bool
233 public function getVisible()
235 return $this->visible;
239 * Set comment default visibility.
241 * @param bool $value
243 * @return Comment
245 public function setVisible($value)
247 $this->visible = $value;
249 return $this;
253 * Get fill color.
255 * @return Style\Color
257 public function getFillColor()
259 return $this->fillColor;
263 * Set Alignment.
265 * @param string $alignment see Style\Alignment::HORIZONTAL_*
267 * @return Comment
269 public function setAlignment($alignment)
271 $this->alignment = $alignment;
273 return $this;
277 * Get Alignment.
279 * @return string
281 public function getAlignment()
283 return $this->alignment;
287 * Get hash code.
289 * @return string Hash code
291 public function getHashCode()
293 return md5(
294 $this->author .
295 $this->text->getHashCode() .
296 $this->width .
297 $this->height .
298 $this->marginLeft .
299 $this->marginTop .
300 ($this->visible ? 1 : 0) .
301 $this->fillColor->getHashCode() .
302 $this->alignment .
303 __CLASS__
308 * Implement PHP __clone to create a deep clone, not just a shallow copy.
310 public function __clone()
312 $vars = get_object_vars($this);
313 foreach ($vars as $key => $value) {
314 if (is_object($value)) {
315 $this->$key = clone $value;
316 } else {
317 $this->$key = $value;
323 * Convert to string.
325 * @return string
327 public function __toString()
329 return $this->text->getPlainText();