暂无描述

AbstractElement.php 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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\Writer\HTML\Element;
  18. use PhpOffice\PhpWord\Element\AbstractElement as Element;
  19. use PhpOffice\PhpWord\Writer\AbstractWriter;
  20. /**
  21. * Abstract HTML element writer
  22. *
  23. * @since 0.11.0
  24. */
  25. abstract class AbstractElement
  26. {
  27. /**
  28. * Parent writer
  29. *
  30. * @var \PhpOffice\PhpWord\Writer\AbstractWriter
  31. */
  32. protected $parentWriter;
  33. /**
  34. * Element
  35. *
  36. * @var \PhpOffice\PhpWord\Element\AbstractElement
  37. */
  38. protected $element;
  39. /**
  40. * Without paragraph
  41. *
  42. * @var bool
  43. */
  44. protected $withoutP = false;
  45. /**
  46. * Write element
  47. */
  48. abstract public function write();
  49. /**
  50. * Create new instance
  51. *
  52. * @param \PhpOffice\PhpWord\Writer\AbstractWriter $parentWriter
  53. * @param \PhpOffice\PhpWord\Element\AbstractElement $element
  54. * @param bool $withoutP
  55. */
  56. public function __construct(AbstractWriter $parentWriter, Element $element, $withoutP = false)
  57. {
  58. $this->parentWriter = $parentWriter;
  59. $this->element = $element;
  60. $this->withoutP = $withoutP;
  61. }
  62. /**
  63. * Set without paragraph.
  64. *
  65. * @param bool $value
  66. * @return void
  67. */
  68. public function setWithoutP($value)
  69. {
  70. $this->withoutP = $value;
  71. }
  72. }