\PhpOffice\Common\XMLWriter -> \PhpOffice\PhpWord\Shared\XMLWriter

This commit is contained in:
Libor M 2021-01-02 08:26:46 +01:00
parent 357e905e8b
commit a2c8d8c2d5
35 changed files with 362 additions and 104 deletions

View File

@ -0,0 +1,184 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
*
* PHPWord is free software distributed under the terms of the GNU Lesser
* General Public License version 3 as published by the Free Software Foundation.
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code. For the full list of
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @see https://github.com/PHPOffice/PHPWord
* @copyright 2010-2018 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Shared;
/**
* XMLWriter
*
* @method bool endElement()
* @method mixed flush(bool $empty = null)
* @method bool openMemory()
* @method string outputMemory(bool $flush = null)
* @method bool setIndent(bool $indent)
* @method bool startDocument(string $version = 1.0, string $encoding = null, string $standalone = null)
* @method bool startElement(string $name)
* @method bool text(string $content)
* @method bool writeCData(string $content)
* @method bool writeComment(string $content)
* @method bool writeElement(string $name, string $content = null)
* @method bool writeRaw(string $content)
*/
class XMLWriter extends \XMLWriter
{
/** Temporary storage method */
const STORAGE_MEMORY = 1;
const STORAGE_DISK = 2;
/**
* Temporary filename
*
* @var string
*/
private $tempFileName = '';
/**
* Create a new \PhpOffice\PhpWord\Shared\XMLWriter instance
*
* @param int $pTemporaryStorage Temporary storage location
* @param string $pTemporaryStorageDir Temporary storage folder
* @param bool $compatibility
*/
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageDir = null, $compatibility = false)
{
// Open temporary storage
if ($pTemporaryStorage == self::STORAGE_MEMORY) {
$this->openMemory();
} else {
if (!is_dir($pTemporaryStorageDir)) {
$pTemporaryStorageDir = sys_get_temp_dir();
}
// Create temporary filename
$this->tempFileName = @tempnam($pTemporaryStorageDir, 'xml');
// Open storage
$this->openUri($this->tempFileName);
}
if ($compatibility) {
$this->setIndent(false);
$this->setIndentString('');
} else {
$this->setIndent(true);
$this->setIndentString(' ');
}
}
/**
* Destructor
*/
public function __destruct()
{
// Unlink temporary files
if (empty($this->tempFileName)) {
return;
}
if (PHP_OS != 'WINNT' && @unlink($this->tempFileName) === false) {
throw new \Exception('The file '.$this->tempFileName.' could not be deleted.');
}
}
/**
* Get written data
*
* @return string
*/
public function getData()
{
if ($this->tempFileName == '') {
return $this->outputMemory(true);
}
$this->flush();
return file_get_contents($this->tempFileName);
}
/**
* Write simple element and attribute(s) block
*
* There are two options:
* 1. If the `$attributes` is an array, then it's an associative array of attributes
* 2. If not, then it's a simple attribute-value pair
*
* @param string $element
* @param string|array $attributes
* @param string $value
* @return void
*/
public function writeElementBlock($element, $attributes, $value = null)
{
$this->startElement($element);
if (!is_array($attributes)) {
$attributes = array($attributes => $value);
}
foreach ($attributes as $attribute => $value) {
$this->writeAttribute($attribute, $value);
}
$this->endElement();
}
/**
* Write element if ...
*
* @param bool $condition
* @param string $element
* @param string $attribute
* @param mixed $value
* @return void
*/
public function writeElementIf($condition, $element, $attribute = null, $value = null)
{
if ($condition == true) {
if (is_null($attribute)) {
$this->writeElement($element, $value);
} else {
$this->startElement($element);
$this->writeAttribute($attribute, $value);
$this->endElement();
}
}
}
/**
* Write attribute if ...
*
* @param bool $condition
* @param string $attribute
* @param mixed $value
* @return void
*/
public function writeAttributeIf($condition, $attribute, $value)
{
if ($condition == true) {
$this->writeAttribute($attribute, $value);
}
}
/**
* @param string $name
* @param mixed $value
* @return bool
*/
public function writeAttribute($name, $value)
{
if (is_float($value)) {
$value = json_encode($value);
}
return parent::writeAttribute($name, $value);
}
}

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord; namespace PhpOffice\PhpWord;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Escaper\RegExp; use PhpOffice\PhpWord\Escaper\RegExp;
use PhpOffice\PhpWord\Escaper\Xml; use PhpOffice\PhpWord\Escaper\Xml;
use PhpOffice\PhpWord\Exception\CopyFileException; use PhpOffice\PhpWord\Exception\CopyFileException;

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\ODText\Element; namespace PhpOffice\PhpWord\Writer\ODText\Element;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\Row as RowElement; use PhpOffice\PhpWord\Element\Row as RowElement;
use PhpOffice\PhpWord\Element\Table as TableElement; use PhpOffice\PhpWord\Element\Table as TableElement;
@ -60,7 +60,7 @@ class Table extends AbstractElement
/** /**
* Write column. * Write column.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Table $element * @param \PhpOffice\PhpWord\Element\Table $element
*/ */
private function writeColumns(XMLWriter $xmlWriter, TableElement $element) private function writeColumns(XMLWriter $xmlWriter, TableElement $element)
@ -77,7 +77,7 @@ class Table extends AbstractElement
/** /**
* Write row. * Write row.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Row $row * @param \PhpOffice\PhpWord\Element\Row $row
*/ */
private function writeRow(XMLWriter $xmlWriter, RowElement $row) private function writeRow(XMLWriter $xmlWriter, RowElement $row)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\ODText\Part; namespace PhpOffice\PhpWord\Writer\ODText\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\Settings;
use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Font;
@ -36,7 +36,7 @@ abstract class AbstractPart extends Word2007AbstractPart
/** /**
* Write common root attributes. * Write common root attributes.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
protected function writeCommonRootAttributes(XMLWriter $xmlWriter) protected function writeCommonRootAttributes(XMLWriter $xmlWriter)
{ {
@ -72,7 +72,7 @@ abstract class AbstractPart extends Word2007AbstractPart
/** /**
* Write font faces declaration. * Write font faces declaration.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
protected function writeFontFaces(XMLWriter $xmlWriter) protected function writeFontFaces(XMLWriter $xmlWriter)
{ {

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\ODText\Part; namespace PhpOffice\PhpWord\Writer\ODText\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\AbstractContainer; use PhpOffice\PhpWord\Element\AbstractContainer;
use PhpOffice\PhpWord\Element\Field; use PhpOffice\PhpWord\Element\Field;
use PhpOffice\PhpWord\Element\Image; use PhpOffice\PhpWord\Element\Image;
@ -151,7 +151,7 @@ class Content extends AbstractPart
* *
* @since 0.11.0 * @since 0.11.0
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
private function writeAutoStyles(XMLWriter $xmlWriter) private function writeAutoStyles(XMLWriter $xmlWriter)
{ {
@ -173,7 +173,7 @@ class Content extends AbstractPart
/** /**
* Write automatic styles. * Write automatic styles.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
private function writeTextStyles(XMLWriter $xmlWriter) private function writeTextStyles(XMLWriter $xmlWriter)
{ {

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\ODText\Part; namespace PhpOffice\PhpWord\Writer\ODText\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
/** /**
* ODText meta part writer: meta.xml * ODText meta part writer: meta.xml
@ -86,7 +86,7 @@ class Meta extends AbstractPart
/** /**
* Write individual property * Write individual property
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $property * @param string $property
* @param string $value * @param string $value
* *

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\ODText\Part; namespace PhpOffice\PhpWord\Writer\ODText\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\Settings;
use PhpOffice\PhpWord\Shared\Converter; use PhpOffice\PhpWord\Shared\Converter;
use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style;
@ -66,7 +66,7 @@ class Styles extends AbstractPart
/** /**
* Write default styles. * Write default styles.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
private function writeDefault(XMLWriter $xmlWriter) private function writeDefault(XMLWriter $xmlWriter)
{ {
@ -118,7 +118,7 @@ class Styles extends AbstractPart
/** /**
* Write named styles. * Write named styles.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
private function writeNamed(XMLWriter $xmlWriter) private function writeNamed(XMLWriter $xmlWriter)
{ {
@ -155,7 +155,7 @@ class Styles extends AbstractPart
/** /**
* call writePageLayoutIndiv to write page layout styles for each page * call writePageLayoutIndiv to write page layout styles for each page
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
private function writePageLayout(XMLWriter $xmlWriter) private function writePageLayout(XMLWriter $xmlWriter)
{ {
@ -169,7 +169,7 @@ class Styles extends AbstractPart
/** /**
* Write page layout styles. * Write page layout styles.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Section $section * @param \PhpOffice\PhpWord\Element\Section $section
* @param int $sectionNbr * @param int $sectionNbr
*/ */
@ -255,7 +255,7 @@ class Styles extends AbstractPart
/** /**
* Write master style. * Write master style.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
private function writeMaster(XMLWriter $xmlWriter) private function writeMaster(XMLWriter $xmlWriter)
{ {

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Element; namespace PhpOffice\PhpWord\Writer\Word2007\Element;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\AbstractElement as Element; use PhpOffice\PhpWord\Element\AbstractElement as Element;
use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\Settings;
use PhpOffice\PhpWord\Shared\Text as SharedText; use PhpOffice\PhpWord\Shared\Text as SharedText;
@ -32,7 +32,7 @@ abstract class AbstractElement
/** /**
* XML writer * XML writer
* *
* @var \PhpOffice\Common\XMLWriter * @var \PhpOffice\PhpWord\Shared\XMLWriter
*/ */
private $xmlWriter; private $xmlWriter;
@ -58,7 +58,7 @@ abstract class AbstractElement
/** /**
* Create new instance * Create new instance
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\AbstractElement $element * @param \PhpOffice\PhpWord\Element\AbstractElement $element
* @param bool $withoutP * @param bool $withoutP
*/ */
@ -72,7 +72,7 @@ abstract class AbstractElement
/** /**
* Get XML Writer * Get XML Writer
* *
* @return \PhpOffice\Common\XMLWriter * @return \PhpOffice\PhpWord\Shared\XMLWriter
*/ */
protected function getXmlWriter() protected function getXmlWriter()
{ {

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Element; namespace PhpOffice\PhpWord\Writer\Word2007\Element;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\AbstractContainer as ContainerElement; use PhpOffice\PhpWord\Element\AbstractContainer as ContainerElement;
use PhpOffice\PhpWord\Element\AbstractElement as Element; use PhpOffice\PhpWord\Element\AbstractElement as Element;
use PhpOffice\PhpWord\Element\TextBreak as TextBreakElement; use PhpOffice\PhpWord\Element\TextBreak as TextBreakElement;
@ -71,7 +71,7 @@ class Container extends AbstractElement
/** /**
* Write individual element * Write individual element
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\AbstractElement $element * @param \PhpOffice\PhpWord\Element\AbstractElement $element
* @param bool $withoutP * @param bool $withoutP
* @return string * @return string

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Element; namespace PhpOffice\PhpWord\Writer\Word2007\Element;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\FormField as FormFieldElement; use PhpOffice\PhpWord\Element\FormField as FormFieldElement;
/** /**
@ -105,7 +105,7 @@ class FormField extends Text
* Write textinput. * Write textinput.
* *
* @see http://www.datypic.com/sc/ooxml/t-w_CT_FFTextInput.html * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFTextInput.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\FormField $element * @param \PhpOffice\PhpWord\Element\FormField $element
*/ */
private function writeTextInput(XMLWriter $xmlWriter, FormFieldElement $element) private function writeTextInput(XMLWriter $xmlWriter, FormFieldElement $element)
@ -121,7 +121,7 @@ class FormField extends Text
* Write checkbox. * Write checkbox.
* *
* @see http://www.datypic.com/sc/ooxml/t-w_CT_FFCheckBox.html * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFCheckBox.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\FormField $element * @param \PhpOffice\PhpWord\Element\FormField $element
*/ */
private function writeCheckBox(XMLWriter $xmlWriter, FormFieldElement $element) private function writeCheckBox(XMLWriter $xmlWriter, FormFieldElement $element)
@ -144,7 +144,7 @@ class FormField extends Text
* Write dropdown. * Write dropdown.
* *
* @see http://www.datypic.com/sc/ooxml/t-w_CT_FFDDList.html * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFDDList.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\FormField $element * @param \PhpOffice\PhpWord\Element\FormField $element
*/ */
private function writeDropDown(XMLWriter $xmlWriter, FormFieldElement $element) private function writeDropDown(XMLWriter $xmlWriter, FormFieldElement $element)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Element; namespace PhpOffice\PhpWord\Writer\Word2007\Element;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\Image as ImageElement; use PhpOffice\PhpWord\Element\Image as ImageElement;
use PhpOffice\PhpWord\Style\Font as FontStyle; use PhpOffice\PhpWord\Style\Font as FontStyle;
use PhpOffice\PhpWord\Style\Frame as FrameStyle; use PhpOffice\PhpWord\Style\Frame as FrameStyle;

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Element; namespace PhpOffice\PhpWord\Writer\Word2007\Element;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\SDT as SDTElement; use PhpOffice\PhpWord\Element\SDT as SDTElement;
/** /**
@ -77,7 +77,7 @@ class SDT extends Text
* Write text. * Write text.
* *
* @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtText.html * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtText.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
private function writePlainText(XMLWriter $xmlWriter) private function writePlainText(XMLWriter $xmlWriter)
{ {
@ -89,7 +89,7 @@ class SDT extends Text
* Write combo box. * Write combo box.
* *
* @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtComboBox.html * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtComboBox.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\SDT $element * @param \PhpOffice\PhpWord\Element\SDT $element
*/ */
private function writeComboBox(XMLWriter $xmlWriter, SDTElement $element) private function writeComboBox(XMLWriter $xmlWriter, SDTElement $element)
@ -108,7 +108,7 @@ class SDT extends Text
* Write drop down list. * Write drop down list.
* *
* @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtDropDownList.html * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtDropDownList.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\SDT $element * @param \PhpOffice\PhpWord\Element\SDT $element
*/ */
private function writeDropDownList(XMLWriter $xmlWriter, SDTElement $element) private function writeDropDownList(XMLWriter $xmlWriter, SDTElement $element)
@ -120,7 +120,7 @@ class SDT extends Text
* Write date. * Write date.
* *
* @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtDate.html * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtDate.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\SDT $element * @param \PhpOffice\PhpWord\Element\SDT $element
*/ */
private function writeDate(XMLWriter $xmlWriter, SDTElement $element) private function writeDate(XMLWriter $xmlWriter, SDTElement $element)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Element; namespace PhpOffice\PhpWord\Writer\Word2007\Element;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\Shape as ShapeElement; use PhpOffice\PhpWord\Element\Shape as ShapeElement;
use PhpOffice\PhpWord\Style\Shape as ShapeStyle; use PhpOffice\PhpWord\Style\Shape as ShapeStyle;
use PhpOffice\PhpWord\Writer\Word2007\Style\Shape as ShapeStyleWriter; use PhpOffice\PhpWord\Writer\Word2007\Style\Shape as ShapeStyleWriter;
@ -77,7 +77,7 @@ class Shape extends AbstractElement
/** /**
* Write arc. * Write arc.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Shape $style * @param \PhpOffice\PhpWord\Style\Shape $style
*/ */
private function writeArc(XMLWriter $xmlWriter, ShapeStyle $style) private function writeArc(XMLWriter $xmlWriter, ShapeStyle $style)
@ -91,7 +91,7 @@ class Shape extends AbstractElement
/** /**
* Write curve. * Write curve.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Shape $style * @param \PhpOffice\PhpWord\Style\Shape $style
*/ */
private function writeCurve(XMLWriter $xmlWriter, ShapeStyle $style) private function writeCurve(XMLWriter $xmlWriter, ShapeStyle $style)
@ -106,7 +106,7 @@ class Shape extends AbstractElement
/** /**
* Write line. * Write line.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Shape $style * @param \PhpOffice\PhpWord\Style\Shape $style
*/ */
private function writeLine(XMLWriter $xmlWriter, ShapeStyle $style) private function writeLine(XMLWriter $xmlWriter, ShapeStyle $style)
@ -120,7 +120,7 @@ class Shape extends AbstractElement
/** /**
* Write polyline. * Write polyline.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Shape $style * @param \PhpOffice\PhpWord\Style\Shape $style
*/ */
private function writePolyline(XMLWriter $xmlWriter, ShapeStyle $style) private function writePolyline(XMLWriter $xmlWriter, ShapeStyle $style)
@ -131,7 +131,7 @@ class Shape extends AbstractElement
/** /**
* Write rectangle. * Write rectangle.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Shape $style * @param \PhpOffice\PhpWord\Style\Shape $style
*/ */
private function writeRoundRect(XMLWriter $xmlWriter, ShapeStyle $style) private function writeRoundRect(XMLWriter $xmlWriter, ShapeStyle $style)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Element; namespace PhpOffice\PhpWord\Writer\Word2007\Element;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\TOC as TOCElement; use PhpOffice\PhpWord\Element\TOC as TOCElement;
use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Writer\Word2007\Style\Font as FontStyleWriter; use PhpOffice\PhpWord\Writer\Word2007\Style\Font as FontStyleWriter;
@ -64,7 +64,7 @@ class TOC extends AbstractElement
/** /**
* Write title * Write title
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\TOC $element * @param \PhpOffice\PhpWord\Element\TOC $element
* @param \PhpOffice\PhpWord\Element\Title $title * @param \PhpOffice\PhpWord\Element\Title $title
* @param bool $writeFieldMark * @param bool $writeFieldMark
@ -132,7 +132,7 @@ class TOC extends AbstractElement
/** /**
* Write style * Write style
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\TOC $element * @param \PhpOffice\PhpWord\Element\TOC $element
* @param int $indent * @param int $indent
*/ */
@ -178,7 +178,7 @@ class TOC extends AbstractElement
/** /**
* Write TOC Field. * Write TOC Field.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\TOC $element * @param \PhpOffice\PhpWord\Element\TOC $element
*/ */
private function writeFieldMark(XMLWriter $xmlWriter, TOCElement $element) private function writeFieldMark(XMLWriter $xmlWriter, TOCElement $element)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Element; namespace PhpOffice\PhpWord\Writer\Word2007\Element;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\Cell as CellElement; use PhpOffice\PhpWord\Element\Cell as CellElement;
use PhpOffice\PhpWord\Element\Row as RowElement; use PhpOffice\PhpWord\Element\Row as RowElement;
use PhpOffice\PhpWord\Element\Table as TableElement; use PhpOffice\PhpWord\Element\Table as TableElement;
@ -71,7 +71,7 @@ class Table extends AbstractElement
/** /**
* Write column. * Write column.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Table $element * @param \PhpOffice\PhpWord\Element\Table $element
*/ */
private function writeColumns(XMLWriter $xmlWriter, TableElement $element) private function writeColumns(XMLWriter $xmlWriter, TableElement $element)
@ -93,7 +93,7 @@ class Table extends AbstractElement
/** /**
* Write row. * Write row.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Row $row * @param \PhpOffice\PhpWord\Element\Row $row
*/ */
private function writeRow(XMLWriter $xmlWriter, RowElement $row) private function writeRow(XMLWriter $xmlWriter, RowElement $row)
@ -119,7 +119,7 @@ class Table extends AbstractElement
/** /**
* Write cell. * Write cell.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Cell $cell * @param \PhpOffice\PhpWord\Element\Cell $cell
*/ */
private function writeCell(XMLWriter $xmlWriter, CellElement $cell) private function writeCell(XMLWriter $xmlWriter, CellElement $cell)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Part; namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Exception\Exception; use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\Settings;
use PhpOffice\PhpWord\Writer\AbstractWriter; use PhpOffice\PhpWord\Writer\AbstractWriter;
@ -73,7 +73,7 @@ abstract class AbstractPart
/** /**
* Get XML Writer * Get XML Writer
* *
* @return \PhpOffice\Common\XMLWriter * @return \PhpOffice\PhpWord\Shared\XMLWriter
*/ */
protected function getXmlWriter() protected function getXmlWriter()
{ {

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Part; namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\Chart as ChartElement; use PhpOffice\PhpWord\Element\Chart as ChartElement;
/** /**
@ -99,7 +99,7 @@ class Chart extends AbstractPart
* Write chart * Write chart
* *
* @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_Chart.html * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_Chart.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
private function writeChart(XMLWriter $xmlWriter) private function writeChart(XMLWriter $xmlWriter)
{ {
@ -121,7 +121,7 @@ class Chart extends AbstractPart
* @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_AreaChart.html * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_AreaChart.html
* @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_RadarChart.html * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_RadarChart.html
* @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_ScatterChart.html * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_ScatterChart.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
*/ */
private function writePlotArea(XMLWriter $xmlWriter) private function writePlotArea(XMLWriter $xmlWriter)
{ {
@ -209,7 +209,7 @@ class Chart extends AbstractPart
/** /**
* Write series. * Write series.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param bool $scatter * @param bool $scatter
*/ */
private function writeSeries(XMLWriter $xmlWriter, $scatter = false) private function writeSeries(XMLWriter $xmlWriter, $scatter = false)
@ -294,7 +294,7 @@ class Chart extends AbstractPart
/** /**
* Write series items. * Write series items.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $type * @param string $type
* @param array $values * @param array $values
*/ */
@ -335,7 +335,7 @@ class Chart extends AbstractPart
* Write axis * Write axis
* *
* @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_CatAx.html * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_CatAx.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $type * @param string $type
*/ */
private function writeAxis(XMLWriter $xmlWriter, $type) private function writeAxis(XMLWriter $xmlWriter, $type)
@ -400,7 +400,7 @@ class Chart extends AbstractPart
* Write shape * Write shape
* *
* @see http://www.datypic.com/sc/ooxml/t-a_CT_ShapeProperties.html * @see http://www.datypic.com/sc/ooxml/t-a_CT_ShapeProperties.html
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param bool $line * @param bool $line
*/ */
private function writeShape(XMLWriter $xmlWriter, $line = false) private function writeShape(XMLWriter $xmlWriter, $line = false)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Part; namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\Comment; use PhpOffice\PhpWord\Element\Comment;
use PhpOffice\PhpWord\Writer\Word2007\Element\Container; use PhpOffice\PhpWord\Writer\Word2007\Element\Container;
@ -70,7 +70,7 @@ class Comments extends AbstractPart
/** /**
* Write comment item. * Write comment item.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Comment $comment * @param \PhpOffice\PhpWord\Element\Comment $comment
*/ */
protected function writeComment(XMLWriter $xmlWriter, Comment $comment) protected function writeComment(XMLWriter $xmlWriter, Comment $comment)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Part; namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
/** /**
* Word2007 contenttypes part writer: [Content_Types].xml * Word2007 contenttypes part writer: [Content_Types].xml
@ -80,7 +80,7 @@ class ContentTypes extends AbstractPart
/** /**
* Write content types element * Write content types element
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter XML Writer * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter XML Writer
* @param array $parts * @param array $parts
* @param bool $isDefault * @param bool $isDefault
*/ */

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Part; namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\Section; use PhpOffice\PhpWord\Element\Section;
use PhpOffice\PhpWord\Writer\Word2007\Element\Container; use PhpOffice\PhpWord\Writer\Word2007\Element\Container;
use PhpOffice\PhpWord\Writer\Word2007\Style\Section as SectionStyleWriter; use PhpOffice\PhpWord\Writer\Word2007\Style\Section as SectionStyleWriter;
@ -80,7 +80,7 @@ class Document extends AbstractPart
/** /**
* Write begin section. * Write begin section.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Section $section * @param \PhpOffice\PhpWord\Element\Section $section
*/ */
private function writeSection(XMLWriter $xmlWriter, Section $section) private function writeSection(XMLWriter $xmlWriter, Section $section)
@ -95,7 +95,7 @@ class Document extends AbstractPart
/** /**
* Write end section. * Write end section.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Section $section * @param \PhpOffice\PhpWord\Element\Section $section
*/ */
private function writeSectionSettings(XMLWriter $xmlWriter, Section $section) private function writeSectionSettings(XMLWriter $xmlWriter, Section $section)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Part; namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\Footnote; use PhpOffice\PhpWord\Element\Footnote;
use PhpOffice\PhpWord\Writer\Word2007\Element\Container; use PhpOffice\PhpWord\Writer\Word2007\Element\Container;
use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter; use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter;
@ -135,7 +135,7 @@ class Footnotes extends AbstractPart
/** /**
* Write note item. * Write note item.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Footnote|\PhpOffice\PhpWord\Element\Endnote $element * @param \PhpOffice\PhpWord\Element\Footnote|\PhpOffice\PhpWord\Element\Endnote $element
*/ */
protected function writeNote(XMLWriter $xmlWriter, $element) protected function writeNote(XMLWriter $xmlWriter, $element)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Part; namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Style\Numbering as NumberingStyle; use PhpOffice\PhpWord\Style\Numbering as NumberingStyle;
use PhpOffice\PhpWord\Style\NumberingLevel; use PhpOffice\PhpWord\Style\NumberingLevel;
@ -97,7 +97,7 @@ class Numbering extends AbstractPart
/** /**
* Write level. * Write level.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\NumberingLevel $level * @param \PhpOffice\PhpWord\Style\NumberingLevel $level
*/ */
private function writeLevel(XMLWriter $xmlWriter, NumberingLevel $level) private function writeLevel(XMLWriter $xmlWriter, NumberingLevel $level)
@ -137,7 +137,7 @@ class Numbering extends AbstractPart
* *
* @since 0.11.0 * @since 0.11.0
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\NumberingLevel $level * @param \PhpOffice\PhpWord\Style\NumberingLevel $level
* @todo Use paragraph style writer * @todo Use paragraph style writer
*/ */
@ -169,7 +169,7 @@ class Numbering extends AbstractPart
* *
* @since 0.11.0 * @since 0.11.0
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\NumberingLevel $level * @param \PhpOffice\PhpWord\Style\NumberingLevel $level
* @todo Use font style writer * @todo Use font style writer
*/ */

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Part; namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Exception\Exception; use PhpOffice\PhpWord\Exception\Exception;
/** /**
@ -49,7 +49,7 @@ class Rels extends AbstractPart
/** /**
* Write relationships. * Write relationships.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param array $xmlRels * @param array $xmlRels
* @param array $mediaRels * @param array $mediaRels
* @param int $relId * @param int $relId
@ -76,7 +76,7 @@ class Rels extends AbstractPart
/** /**
* Write media relationships. * Write media relationships.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param int $relId * @param int $relId
* @param array $mediaRel * @param array $mediaRel
*/ */
@ -101,7 +101,7 @@ class Rels extends AbstractPart
* Format: * Format:
* <Relationship Id="rId..." Type="http://..." Target="....xml" TargetMode="..." /> * <Relationship Id="rId..." Type="http://..." Target="....xml" TargetMode="..." />
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param int $relId Relationship ID * @param int $relId Relationship ID
* @param string $type Relationship type * @param string $type Relationship type
* @param string $target Relationship target * @param string $target Relationship target

View File

@ -69,7 +69,7 @@ class Settings extends AbstractPart
/** /**
* Write indivual setting, recursive to any child settings. * Write indivual setting, recursive to any child settings.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $settingKey * @param string $settingKey
* @param array|string $settingValue * @param array|string $settingValue
*/ */

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Part; namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Style\Font as FontStyle; use PhpOffice\PhpWord\Style\Font as FontStyle;
use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle; use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle;
@ -76,7 +76,7 @@ class Styles extends AbstractPart
/** /**
* Write default font and other default styles. * Write default font and other default styles.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\AbstractStyle[] $styles * @param \PhpOffice\PhpWord\Style\AbstractStyle[] $styles
*/ */
private function writeDefaultStyles(XMLWriter $xmlWriter, $styles) private function writeDefaultStyles(XMLWriter $xmlWriter, $styles)
@ -161,7 +161,7 @@ class Styles extends AbstractPart
/** /**
* Write font style. * Write font style.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $styleName * @param string $styleName
* @param \PhpOffice\PhpWord\Style\Font $style * @param \PhpOffice\PhpWord\Style\Font $style
*/ */
@ -229,7 +229,7 @@ class Styles extends AbstractPart
/** /**
* Write paragraph style. * Write paragraph style.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $styleName * @param string $styleName
* @param \PhpOffice\PhpWord\Style\Paragraph $style * @param \PhpOffice\PhpWord\Style\Paragraph $style
*/ */
@ -261,7 +261,7 @@ class Styles extends AbstractPart
/** /**
* Write table style. * Write table style.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $styleName * @param string $styleName
* @param \PhpOffice\PhpWord\Style\Table $style * @param \PhpOffice\PhpWord\Style\Table $style
*/ */

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Style; namespace PhpOffice\PhpWord\Writer\Word2007\Style;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\Settings;
/** /**
@ -30,7 +30,7 @@ abstract class AbstractStyle
/** /**
* XML writer * XML writer
* *
* @var \PhpOffice\Common\XMLWriter * @var \PhpOffice\PhpWord\Shared\XMLWriter
*/ */
private $xmlWriter; private $xmlWriter;
@ -49,7 +49,7 @@ abstract class AbstractStyle
/** /**
* Create new instance. * Create new instance.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string|\PhpOffice\PhpWord\Style\AbstractStyle $style * @param string|\PhpOffice\PhpWord\Style\AbstractStyle $style
*/ */
public function __construct(XMLWriter $xmlWriter, $style = null) public function __construct(XMLWriter $xmlWriter, $style = null)
@ -61,7 +61,7 @@ abstract class AbstractStyle
/** /**
* Get XML Writer * Get XML Writer
* *
* @return \PhpOffice\Common\XMLWriter * @return \PhpOffice\PhpWord\Shared\XMLWriter
*/ */
protected function getXmlWriter() protected function getXmlWriter()
{ {
@ -106,7 +106,7 @@ abstract class AbstractStyle
/** /**
* Write child style. * Write child style.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $name * @param string $name
* @param mixed $value * @param mixed $value
*/ */

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Style; namespace PhpOffice\PhpWord\Writer\Word2007\Style;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Style\Frame as FrameStyle; use PhpOffice\PhpWord\Style\Frame as FrameStyle;
use PhpOffice\PhpWord\Writer\Word2007\Element\ParagraphAlignment; use PhpOffice\PhpWord\Writer\Word2007\Element\ParagraphAlignment;
@ -108,7 +108,7 @@ class Frame extends AbstractStyle
/** /**
* Write wrap. * Write wrap.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Frame $style * @param \PhpOffice\PhpWord\Style\Frame $style
* @param string $wrap * @param string $wrap
*/ */

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Style; namespace PhpOffice\PhpWord\Writer\Word2007\Style;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
/** /**
* Margin border style writer * Margin border style writer
@ -78,7 +78,7 @@ class MarginBorder extends AbstractStyle
/** /**
* Write side. * Write side.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $side * @param string $side
* @param int $width * @param int $width
* @param string $color * @param string $color

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Style; namespace PhpOffice\PhpWord\Writer\Word2007\Style;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle; use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle;
use PhpOffice\PhpWord\Writer\Word2007\Element\ParagraphAlignment; use PhpOffice\PhpWord\Writer\Word2007\Element\ParagraphAlignment;
@ -146,7 +146,7 @@ class Paragraph extends AbstractStyle
/** /**
* Write tabs. * Write tabs.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Tab[] $tabs * @param \PhpOffice\PhpWord\Style\Tab[] $tabs
*/ */
private function writeTabs(XMLWriter $xmlWriter, $tabs) private function writeTabs(XMLWriter $xmlWriter, $tabs)
@ -164,7 +164,7 @@ class Paragraph extends AbstractStyle
/** /**
* Write numbering. * Write numbering.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param array $numbering * @param array $numbering
*/ */
private function writeNumbering(XMLWriter $xmlWriter, $numbering) private function writeNumbering(XMLWriter $xmlWriter, $numbering)

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Style; namespace PhpOffice\PhpWord\Writer\Word2007\Style;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\SimpleType\TblWidth; use PhpOffice\PhpWord\SimpleType\TblWidth;
use PhpOffice\PhpWord\Style\Table as TableStyle; use PhpOffice\PhpWord\Style\Table as TableStyle;
use PhpOffice\PhpWord\Writer\Word2007\Element\TableAlignment; use PhpOffice\PhpWord\Writer\Word2007\Element\TableAlignment;
@ -59,7 +59,7 @@ class Table extends AbstractStyle
/** /**
* Write full style. * Write full style.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Table $style * @param \PhpOffice\PhpWord\Style\Table $style
*/ */
private function writeStyle(XMLWriter $xmlWriter, TableStyle $style) private function writeStyle(XMLWriter $xmlWriter, TableStyle $style)
@ -106,7 +106,7 @@ class Table extends AbstractStyle
/** /**
* Enable/Disable automatic resizing of the table * Enable/Disable automatic resizing of the table
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $layout autofit / fixed * @param string $layout autofit / fixed
*/ */
private function writeLayout(XMLWriter $xmlWriter, $layout) private function writeLayout(XMLWriter $xmlWriter, $layout)
@ -119,7 +119,7 @@ class Table extends AbstractStyle
/** /**
* Write margin. * Write margin.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Table $style * @param \PhpOffice\PhpWord\Style\Table $style
*/ */
private function writeMargin(XMLWriter $xmlWriter, TableStyle $style) private function writeMargin(XMLWriter $xmlWriter, TableStyle $style)
@ -138,7 +138,7 @@ class Table extends AbstractStyle
/** /**
* Write border. * Write border.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Table $style * @param \PhpOffice\PhpWord\Style\Table $style
*/ */
private function writeBorder(XMLWriter $xmlWriter, TableStyle $style) private function writeBorder(XMLWriter $xmlWriter, TableStyle $style)
@ -158,7 +158,7 @@ class Table extends AbstractStyle
/** /**
* Writes a table width * Writes a table width
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $elementName * @param string $elementName
* @param string $unit * @param string $unit
* @param int|float $width * @param int|float $width
@ -177,7 +177,7 @@ class Table extends AbstractStyle
/** /**
* Write row style. * Write row style.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Table $style * @param \PhpOffice\PhpWord\Style\Table $style
*/ */
private function writeFirstRow(XMLWriter $xmlWriter, TableStyle $style) private function writeFirstRow(XMLWriter $xmlWriter, TableStyle $style)
@ -196,7 +196,7 @@ class Table extends AbstractStyle
/** /**
* Write shading. * Write shading.
* *
* @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Style\Table $style * @param \PhpOffice\PhpWord\Style\Table $style
*/ */
private function writeShading(XMLWriter $xmlWriter, TableStyle $style) private function writeShading(XMLWriter $xmlWriter, TableStyle $style)

View File

@ -0,0 +1,74 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
*
* PHPWord is free software distributed under the terms of the GNU Lesser
* General Public License version 3 as published by the Free Software Foundation.
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code. For the full list of
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @see https://github.com/PHPOffice/PHPWord
* @copyright 2010-2018 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Shared;
/**
* Test class for XMLWriter
*
* @coversDefaultClass \PhpOffice\PhpWord\Shared\XMLWriter
*/
class XMLWriterTest extends \PHPUnit\Framework\TestCase
{
/**
*/
public function testConstruct()
{
// Memory
$object = new XMLWriter();
$object->startElement('element');
$object->text('AAA');
$object->endElement();
$this->assertEquals('<element>AAA</element>'.chr(10), $object->getData());
// Disk
$object = new XMLWriter(XMLWriter::STORAGE_DISK);
$object->startElement('element');
$object->text('BBB');
$object->endElement();
$this->assertEquals('<element>BBB</element>'.chr(10), $object->getData());
}
public function testWriteAttribute()
{
$xmlWriter = new XMLWriter();
$xmlWriter->startElement('element');
$xmlWriter->writeAttribute('name', 'value');
$xmlWriter->endElement();
$this->assertSame('<element name="value"/>' . chr(10), $xmlWriter->getData());
}
public function testWriteAttributeShouldWriteFloatValueLocaleIndependent()
{
$value = 1.2;
$xmlWriter = new XMLWriter();
$xmlWriter->startElement('element');
$xmlWriter->writeAttribute('name', $value);
$xmlWriter->endElement();
$currentLocale = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, 'de_DE.UTF-8', 'de');
$this->assertSame('1,2', (string)$value);
$this->assertSame('<element name="1.2"/>' . chr(10), $xmlWriter->getData());
setlocale(LC_NUMERIC, $currentLocale);
}
}

View File

@ -17,9 +17,9 @@
namespace PhpOffice\PhpWord\Writer\ODText; namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\Common\XMLWriter;
use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\Element\TrackChange;
use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\TestHelperDOCX; use PhpOffice\PhpWord\TestHelperDOCX;
/** /**

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\ODText; namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
/** /**
* Test class for PhpOffice\PhpWord\Writer\ODText\Style subnamespace * Test class for PhpOffice\PhpWord\Writer\ODText\Style subnamespace

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007; namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Element\Comment; use PhpOffice\PhpWord\Element\Comment;
use PhpOffice\PhpWord\Element\TextRun; use PhpOffice\PhpWord\Element\TextRun;
use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\Element\TrackChange;

View File

@ -17,7 +17,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007; namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
/** /**
* Test class for PhpOffice\PhpWord\Writer\Word2007\Style subnamespace * Test class for PhpOffice\PhpWord\Writer\Word2007\Style subnamespace