Refactor: Fine tune element writing

This commit is contained in:
Ivan Lanin 2014-04-25 23:57:43 +07:00
parent 2567a2223c
commit ec9d90017f
2 changed files with 18 additions and 15 deletions

View File

@ -12,6 +12,8 @@ namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\PhpWord\Media;
use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Element\Text;
use PhpOffice\PhpWord\Element\Table;
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Style\Font;

View File

@ -10,9 +10,10 @@
namespace PhpOffice\PhpWord\Writer;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Element\Text;
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\Shared\Drawing;
use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Writer\RTF\Element\Element as ElementWriter;
@ -98,16 +99,6 @@ class RTF extends AbstractWriter implements WriterInterface
return $this->fontTable;
}
/**
* Set last paragraph style
*
* @param mixed $value
*/
public function setLastParagraphStyle($value = '')
{
$this->lastParagraphStyle = $value;
}
/**
* Get last paragraph style
*
@ -118,6 +109,16 @@ class RTF extends AbstractWriter implements WriterInterface
return $this->lastParagraphStyle;
}
/**
* Set last paragraph style
*
* @param mixed $value
*/
public function setLastParagraphStyle($value = '')
{
$this->lastParagraphStyle = $value;
}
/**
* Get all data
*
@ -125,8 +126,8 @@ class RTF extends AbstractWriter implements WriterInterface
*/
private function writeDocument()
{
$this->fontTable = $this->getDataFont();
$this->colorTable = $this->getDataColor();
$this->fontTable = $this->populateFontTable();
$this->colorTable = $this->populateColorTable();
// Set the default character set
$sRTFContent = '{\rtf1';
@ -200,7 +201,7 @@ class RTF extends AbstractWriter implements WriterInterface
*
* @return array
*/
private function getDataFont()
private function populateFontTable()
{
$phpWord = $this->phpWord;
@ -254,7 +255,7 @@ class RTF extends AbstractWriter implements WriterInterface
*
* @return array
*/
private function getDataColor()
private function populateColorTable()
{
$phpWord = $this->phpWord;