暂无描述

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * This file is part of PHPWord - A pure PHP library for reading and writing
  4. * word processing documents.
  5. *
  6. * PHPWord is free software distributed under the terms of the GNU Lesser
  7. * General Public License version 3 as published by the Free Software Foundation.
  8. *
  9. * For the full copyright and license information, please read the LICENSE
  10. * file that was distributed with this source code. For the full list of
  11. * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
  12. *
  13. * @link https://github.com/PHPOffice/PHPWord
  14. * @copyright 2010-2014 PHPWord contributors
  15. * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
  16. */
  17. namespace PhpOffice\PhpWord\Element;
  18. use PhpOffice\PhpWord\Shared\String;
  19. /**
  20. * Check box element
  21. *
  22. * @since 0.10.0
  23. */
  24. class CheckBox extends Text
  25. {
  26. /**
  27. * Name content
  28. *
  29. * @var string
  30. */
  31. private $name;
  32. /**
  33. * Create new instance
  34. *
  35. * @param string $name
  36. * @param string $text
  37. * @param mixed $fontStyle
  38. * @param mixed $paragraphStyle
  39. * @return self
  40. */
  41. public function __construct($name = null, $text = null, $fontStyle = null, $paragraphStyle = null)
  42. {
  43. $this->setName($name);
  44. parent::__construct($text, $fontStyle, $paragraphStyle);
  45. }
  46. /**
  47. * Set name content
  48. *
  49. * @param string $name
  50. * @return self
  51. */
  52. public function setName($name)
  53. {
  54. $this->name = String::toUTF8($name);
  55. return $this;
  56. }
  57. /**
  58. * Get name content
  59. *
  60. * @return string
  61. */
  62. public function getName()
  63. {
  64. return $this->name;
  65. }
  66. }