Skip to content

Commit

Permalink
Reviewed and merged #658.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Syroeshko committed Jan 23, 2016
1 parent 5781f65 commit f359825
Show file tree
Hide file tree
Showing 64 changed files with 162 additions and 1,259 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Expand Up @@ -25,12 +25,17 @@ Use the correspondent `getAlignment` and `setAlignment` methods instead. - @Roma
- `left`, `right`, and `justify` alignment options for tables (now are mapped to `Jc::START`, `Jc::END`, and `Jc::CENTER`). - @RomanSyroeshko

### Removed
- `PhpOffice\PhpWord\Style\Alignment`. Style properties, which previously stored instances of this class, now deal with strings.
- `\PhpOffice\PhpWord\Style\Alignment`. Style properties, which previously stored instances of this class, now deal with strings.
In each case set of available string values is defined by the correspondent simple type. - @RomanSyroeshko
- Manual installation support. Since the release we have dependencies on third party libraries,
so installation via ZIP-archive download is not an option anymore. To install PHPWord use [Composer](https://getcomposer.org/).
We also removed `PhpOffice\PhpWord\Autoloader`, because the latter change made it completely useless.
We also removed `\PhpOffice\PhpWord\Autoloader`, because the latter change made it completely useless.
Autoloaders provided by Composer are in use now (see `bootstrap.php`). - @RomanSyroeshko
- `\PhpOffice\PhpWord\Shared\Drawing` replaced by `\PhpOffice\Common\Drawing`. - @Progi1984 #658
- `\PhpOffice\PhpWord\Shared\Font`. - @Progi1984 #658
- `\PhpOffice\PhpWord\Shared\String` replaced by `\PhpOffice\Common\Text`. - @Progi1984 @RomanSyroeshko #658
- `\PhpOffice\PhpWord\Shared\XMLReader` replaced by `\PhpOffice\Common\XMLReader`. - @Progi1984 #658
- `\PhpOffice\PhpWord\Shared\XMLWriter` replaced by `\PhpOffice\Common\XMLWriter`. - @Progi1984 @RomanSyroeshko #658



Expand Down
10 changes: 7 additions & 3 deletions composer.json
Expand Up @@ -34,7 +34,9 @@
"require": {
"php": ">=5.3.3",
"ext-xml": "*",
"zendframework/zend-validator": "2.5.*"
"zendframework/zend-validator": "2.5.*",
"zendframework/zend-stdlib": "~2.5",
"phpoffice/common": "0.2.*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
Expand All @@ -43,9 +45,11 @@
"phpmd/phpmd": "2.*",
"phploc/phploc": "2.*",
"dompdf/dompdf":"0.6.*",
"tecnick.com/tcpdf": "6.*",
"tecnickcom/tcpdf": "6.*",
"mpdf/mpdf": "5.*",
"zendframework/zend-validator": "2.5.*"
"zendframework/zend-validator": "2.5.*",
"zendframework/zend-stdlib": "~2.5",
"phpoffice/common": "0.2.*"
},
"suggest": {
"ext-zip": "Allows writing DOCX and ODT",
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/Bookmark.php
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\Common\Text as CommonText;
use PhpOffice\PhpWord\Style;

/**
Expand Down Expand Up @@ -47,7 +47,7 @@ class Bookmark extends AbstractElement
public function __construct($name)
{

$this->name = String::toUTF8($name);
$this->name = CommonText::toUTF8($name);
return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/CheckBox.php
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\Common\Text as CommonText;

/**
* Check box element
Expand Down Expand Up @@ -56,7 +56,7 @@ public function __construct($name = null, $text = null, $fontStyle = null, $para
*/
public function setName($name)
{
$this->name = String::toUTF8($name);
$this->name = CommonText::toUTF8($name);

return $this;
}
Expand Down
6 changes: 3 additions & 3 deletions src/PhpWord/Element/Link.php
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\Common\Text as CommonText;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph;

Expand Down Expand Up @@ -78,8 +78,8 @@ class Link extends AbstractElement
*/
public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false)
{
$this->source = String::toUTF8($source);
$this->text = is_null($text) ? $this->source : String::toUTF8($text);
$this->source = CommonText::toUTF8($source);
$this->text = is_null($text) ? $this->source : CommonText::toUTF8($text);
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
$this->internal = $internal;
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/ListItem.php
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\Common\Text as CommonText;
use PhpOffice\PhpWord\Style\ListItem as ListItemStyle;

/**
Expand Down Expand Up @@ -57,7 +57,7 @@ class ListItem extends AbstractElement
*/
public function __construct($text, $depth = 0, $fontStyle = null, $listStyle = null, $paragraphStyle = null)
{
$this->textObject = new Text(String::toUTF8($text), $fontStyle, $paragraphStyle);
$this->textObject = new Text(CommonText::toUTF8($text), $fontStyle, $paragraphStyle);
$this->depth = $depth;

// Version >= 0.10.0 will pass numbering style name. Older version will use old method
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/PreserveText.php
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\Common\Text as CommonText;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph;

Expand Down Expand Up @@ -61,7 +61,7 @@ public function __construct($text = null, $fontStyle = null, $paragraphStyle = n
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);

$this->text = String::toUTF8($text);
$this->text = CommonText::toUTF8($text);
$matches = preg_split('/({.*?})/', $this->text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
if (isset($matches[0])) {
$this->text = $matches;
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/Text.php
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\Common\Text as CommonText;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph;

Expand Down Expand Up @@ -136,7 +136,7 @@ public function getParagraphStyle()
*/
public function setText($text)
{
$this->text = String::toUTF8($text);
$this->text = CommonText::toUTF8($text);

return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/Title.php
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\Common\Text as CommonText;
use PhpOffice\PhpWord\Style;

/**
Expand Down Expand Up @@ -61,7 +61,7 @@ class Title extends AbstractElement
*/
public function __construct($text, $depth = 1)
{
$this->text = String::toUTF8($text);
$this->text = CommonText::toUTF8($text);
$this->depth = $depth;
if (array_key_exists("Heading_{$this->depth}", Style::getStyles())) {
$this->style = "Heading{$this->depth}";
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/MsDoc.php
Expand Up @@ -17,8 +17,8 @@

namespace PhpOffice\PhpWord\Reader;

use PhpOffice\Common\Drawing;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\Drawing;
use PhpOffice\PhpWord\Shared\OLERead;
use PhpOffice\PhpWord\Style;

Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/ODText.php
Expand Up @@ -17,8 +17,8 @@

namespace PhpOffice\PhpWord\Reader;

use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;

/**
* Reader for ODText
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/ODText/Content.php
Expand Up @@ -17,8 +17,8 @@

namespace PhpOffice\PhpWord\Reader\ODText;

use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;

/**
* Content reader
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/ODText/Meta.php
Expand Up @@ -17,8 +17,8 @@

namespace PhpOffice\PhpWord\Reader\ODText;

use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;

/**
* Meta reader
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/Word2007.php
Expand Up @@ -17,8 +17,8 @@

namespace PhpOffice\PhpWord\Reader;

use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;
use PhpOffice\PhpWord\Shared\ZipArchive;

/**
Expand Down
18 changes: 9 additions & 9 deletions src/PhpWord/Reader/Word2007/AbstractPart.php
Expand Up @@ -17,8 +17,8 @@

namespace PhpOffice\PhpWord\Reader\Word2007;

use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;

/**
* Abstract part reader
Expand Down Expand Up @@ -92,7 +92,7 @@ public function setRels($value)
/**
* Read w:p.
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $domNode
* @param mixed $parent
* @param string $docPart
Expand Down Expand Up @@ -183,7 +183,7 @@ protected function readParagraph(XMLReader $xmlReader, \DOMElement $domNode, $pa
/**
* Read w:r.
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $domNode
* @param mixed $parent
* @param string $docPart
Expand Down Expand Up @@ -246,7 +246,7 @@ protected function readRun(XMLReader $xmlReader, \DOMElement $domNode, $parent,
/**
* Read w:tbl.
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $domNode
* @param mixed $parent
* @param string $docPart
Expand Down Expand Up @@ -307,7 +307,7 @@ protected function readTable(XMLReader $xmlReader, \DOMElement $domNode, $parent
/**
* Read w:pPr.
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $domNode
* @return array|null
*/
Expand Down Expand Up @@ -339,7 +339,7 @@ protected function readParagraphStyle(XMLReader $xmlReader, \DOMElement $domNode
/**
* Read w:rPr
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $domNode
* @return array|null
*/
Expand Down Expand Up @@ -382,7 +382,7 @@ protected function readFontStyle(XMLReader $xmlReader, \DOMElement $domNode)
/**
* Read w:tblPr
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $domNode
* @return string|array|null
* @todo Capture w:tblStylePr w:type="firstRow"
Expand Down Expand Up @@ -418,7 +418,7 @@ protected function readTableStyle(XMLReader $xmlReader, \DOMElement $domNode)
/**
* Read w:tcPr
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $domNode
* @return array
*/
Expand All @@ -438,7 +438,7 @@ private function readCellStyle(XMLReader $xmlReader, \DOMElement $domNode)
/**
* Read style definition
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $parentNode
* @param array $styleDefs
* @ignoreScrutinizerPatch
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/Word2007/DocPropsCore.php
Expand Up @@ -17,8 +17,8 @@

namespace PhpOffice\PhpWord\Reader\Word2007;

use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;

/**
* Core properties reader
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/Word2007/DocPropsCustom.php
Expand Up @@ -17,9 +17,9 @@

namespace PhpOffice\PhpWord\Reader\Word2007;

use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\Metadata\DocInfo;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;

/**
* Custom properties reader
Expand Down
8 changes: 4 additions & 4 deletions src/PhpWord/Reader/Word2007/Document.php
Expand Up @@ -17,9 +17,9 @@

namespace PhpOffice\PhpWord\Reader\Word2007;

use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\Element\Section;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;

/**
* Document reader
Expand Down Expand Up @@ -99,7 +99,7 @@ private function readHeaderFooter($settings, Section &$section)
/**
* Read w:sectPr
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $domNode
* @ignoreScrutinizerPatch
* @return array
Expand Down Expand Up @@ -142,7 +142,7 @@ private function readSectionStyle(XMLReader $xmlReader, \DOMElement $domNode)
/**
* Read w:p node.
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $node
* @param \PhpOffice\PhpWord\Element\Section &$section
* @return void
Expand Down Expand Up @@ -172,7 +172,7 @@ private function readWPNode(XMLReader $xmlReader, \DOMElement $node, Section &$s
/**
* Read w:sectPr node.
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $node
* @param \PhpOffice\PhpWord\Element\Section &$section
* @return void
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/Word2007/Footnotes.php
Expand Up @@ -17,8 +17,8 @@

namespace PhpOffice\PhpWord\Reader\Word2007;

use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;

/**
* Footnotes reader
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Reader/Word2007/Numbering.php
Expand Up @@ -17,8 +17,8 @@

namespace PhpOffice\PhpWord\Reader\Word2007;

use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;

/**
* Numbering reader
Expand Down Expand Up @@ -90,7 +90,7 @@ public function read(PhpWord $phpWord)
/**
* Read numbering level definition from w:abstractNum and w:num
*
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $subnode
* @param integer $levelId
* @return array
Expand Down

0 comments on commit f359825

Please sign in to comment.