2012-05-06 18:25:40 +02:00
|
|
|
<?php
|
|
|
|
|
/**
|
2014-03-26 16:33:20 +07:00
|
|
|
* PHPWord
|
2012-05-06 18:25:40 +02:00
|
|
|
*
|
2014-03-27 23:55:06 +07:00
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
|
|
|
|
* @copyright 2014 PHPWord
|
|
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
2012-05-06 18:25:40 +02:00
|
|
|
*/
|
|
|
|
|
|
2014-03-31 01:13:02 +07:00
|
|
|
namespace PhpOffice\PhpWord\Element;
|
2013-12-11 14:45:44 -05:00
|
|
|
|
2014-04-03 08:44:41 +07:00
|
|
|
use PhpOffice\PhpWord\Style\ListItem as ListItemStyle;
|
|
|
|
|
|
2014-03-24 00:26:10 +07:00
|
|
|
/**
|
|
|
|
|
* List item element
|
|
|
|
|
*/
|
2014-04-08 00:23:49 +07:00
|
|
|
class ListItem extends AbstractElement
|
2014-03-22 10:06:08 +04:00
|
|
|
{
|
2013-12-11 14:45:44 -05:00
|
|
|
/**
|
|
|
|
|
* ListItem Style
|
|
|
|
|
*
|
2014-04-16 17:22:30 +04:00
|
|
|
* @var \PhpOffice\PhpWord\Style\ListItem
|
2013-12-11 14:45:44 -05:00
|
|
|
*/
|
2014-04-03 08:44:41 +07:00
|
|
|
private $style;
|
2013-12-11 14:45:44 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Textrun
|
|
|
|
|
*
|
2014-04-08 16:09:31 +07:00
|
|
|
* @var Text
|
2013-12-11 14:45:44 -05:00
|
|
|
*/
|
2014-04-03 08:44:41 +07:00
|
|
|
private $textObject;
|
2013-12-11 14:45:44 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ListItem Depth
|
|
|
|
|
*
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
2014-04-03 08:44:41 +07:00
|
|
|
private $depth;
|
2013-12-11 14:45:44 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new ListItem
|
|
|
|
|
*
|
|
|
|
|
* @param string $text
|
|
|
|
|
* @param int $depth
|
2014-03-17 07:26:25 +07:00
|
|
|
* @param mixed $styleFont
|
2013-12-11 14:45:44 -05:00
|
|
|
* @param mixed $styleList
|
2014-03-17 07:26:25 +07:00
|
|
|
* @param mixed $styleParagraph
|
2013-12-11 14:45:44 -05:00
|
|
|
*/
|
|
|
|
|
public function __construct($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null)
|
|
|
|
|
{
|
2014-04-03 08:44:41 +07:00
|
|
|
$this->textObject = new Text($text, $styleFont, $styleParagraph);
|
|
|
|
|
$this->depth = $depth;
|
|
|
|
|
$this->style = $this->setStyle(new ListItemStyle(), $styleList, true);
|
2013-12-11 14:45:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get ListItem style
|
|
|
|
|
*/
|
|
|
|
|
public function getStyle()
|
|
|
|
|
{
|
2014-04-03 08:44:41 +07:00
|
|
|
return $this->style;
|
2013-12-11 14:45:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get ListItem TextRun
|
|
|
|
|
*/
|
|
|
|
|
public function getTextObject()
|
|
|
|
|
{
|
2014-04-03 08:44:41 +07:00
|
|
|
return $this->textObject;
|
2013-12-11 14:45:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get ListItem depth
|
|
|
|
|
*/
|
|
|
|
|
public function getDepth()
|
|
|
|
|
{
|
2014-04-03 08:44:41 +07:00
|
|
|
return $this->depth;
|
2013-12-11 14:45:44 -05:00
|
|
|
}
|
2012-05-06 18:25:40 +02:00
|
|
|
}
|