Skip to content

Commit f359825

Browse files
author
Roman Syroeshko
committed
Reviewed and merged #658.
1 parent 5781f65 commit f359825

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+162
-1259
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,17 @@ Use the correspondent `getAlignment` and `setAlignment` methods instead. - @Roma
2525
- `left`, `right`, and `justify` alignment options for tables (now are mapped to `Jc::START`, `Jc::END`, and `Jc::CENTER`). - @RomanSyroeshko
2626

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

3540

3641

composer.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
"require": {
3535
"php": ">=5.3.3",
3636
"ext-xml": "*",
37-
"zendframework/zend-validator": "2.5.*"
37+
"zendframework/zend-validator": "2.5.*",
38+
"zendframework/zend-stdlib": "~2.5",
39+
"phpoffice/common": "0.2.*"
3840
},
3941
"require-dev": {
4042
"phpunit/phpunit": "3.7.*",
@@ -43,9 +45,11 @@
4345
"phpmd/phpmd": "2.*",
4446
"phploc/phploc": "2.*",
4547
"dompdf/dompdf":"0.6.*",
46-
"tecnick.com/tcpdf": "6.*",
48+
"tecnickcom/tcpdf": "6.*",
4749
"mpdf/mpdf": "5.*",
48-
"zendframework/zend-validator": "2.5.*"
50+
"zendframework/zend-validator": "2.5.*",
51+
"zendframework/zend-stdlib": "~2.5",
52+
"phpoffice/common": "0.2.*"
4953
},
5054
"suggest": {
5155
"ext-zip": "Allows writing DOCX and ODT",

src/PhpWord/Element/Bookmark.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\Common\Text as CommonText;
2121
use PhpOffice\PhpWord\Style;
2222

2323
/**
@@ -47,7 +47,7 @@ class Bookmark extends AbstractElement
4747
public function __construct($name)
4848
{
4949

50-
$this->name = String::toUTF8($name);
50+
$this->name = CommonText::toUTF8($name);
5151
return $this;
5252
}
5353

src/PhpWord/Element/CheckBox.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\Common\Text as CommonText;
2121

2222
/**
2323
* Check box element
@@ -56,7 +56,7 @@ public function __construct($name = null, $text = null, $fontStyle = null, $para
5656
*/
5757
public function setName($name)
5858
{
59-
$this->name = String::toUTF8($name);
59+
$this->name = CommonText::toUTF8($name);
6060

6161
return $this;
6262
}

src/PhpWord/Element/Link.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\Common\Text as CommonText;
2121
use PhpOffice\PhpWord\Style\Font;
2222
use PhpOffice\PhpWord\Style\Paragraph;
2323

@@ -78,8 +78,8 @@ class Link extends AbstractElement
7878
*/
7979
public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false)
8080
{
81-
$this->source = String::toUTF8($source);
82-
$this->text = is_null($text) ? $this->source : String::toUTF8($text);
81+
$this->source = CommonText::toUTF8($source);
82+
$this->text = is_null($text) ? $this->source : CommonText::toUTF8($text);
8383
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
8484
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
8585
$this->internal = $internal;

src/PhpWord/Element/ListItem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\Common\Text as CommonText;
2121
use PhpOffice\PhpWord\Style\ListItem as ListItemStyle;
2222

2323
/**
@@ -57,7 +57,7 @@ class ListItem extends AbstractElement
5757
*/
5858
public function __construct($text, $depth = 0, $fontStyle = null, $listStyle = null, $paragraphStyle = null)
5959
{
60-
$this->textObject = new Text(String::toUTF8($text), $fontStyle, $paragraphStyle);
60+
$this->textObject = new Text(CommonText::toUTF8($text), $fontStyle, $paragraphStyle);
6161
$this->depth = $depth;
6262

6363
// Version >= 0.10.0 will pass numbering style name. Older version will use old method

src/PhpWord/Element/PreserveText.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\Common\Text as CommonText;
2121
use PhpOffice\PhpWord\Style\Font;
2222
use PhpOffice\PhpWord\Style\Paragraph;
2323

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

64-
$this->text = String::toUTF8($text);
64+
$this->text = CommonText::toUTF8($text);
6565
$matches = preg_split('/({.*?})/', $this->text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
6666
if (isset($matches[0])) {
6767
$this->text = $matches;

src/PhpWord/Element/Text.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\Common\Text as CommonText;
2121
use PhpOffice\PhpWord\Style\Font;
2222
use PhpOffice\PhpWord\Style\Paragraph;
2323

@@ -136,7 +136,7 @@ public function getParagraphStyle()
136136
*/
137137
public function setText($text)
138138
{
139-
$this->text = String::toUTF8($text);
139+
$this->text = CommonText::toUTF8($text);
140140

141141
return $this;
142142
}

src/PhpWord/Element/Title.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Shared\String;
20+
use PhpOffice\Common\Text as CommonText;
2121
use PhpOffice\PhpWord\Style;
2222

2323
/**
@@ -61,7 +61,7 @@ class Title extends AbstractElement
6161
*/
6262
public function __construct($text, $depth = 1)
6363
{
64-
$this->text = String::toUTF8($text);
64+
$this->text = CommonText::toUTF8($text);
6565
$this->depth = $depth;
6666
if (array_key_exists("Heading_{$this->depth}", Style::getStyles())) {
6767
$this->style = "Heading{$this->depth}";

src/PhpWord/Reader/MsDoc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader;
1919

20+
use PhpOffice\Common\Drawing;
2021
use PhpOffice\PhpWord\PhpWord;
21-
use PhpOffice\PhpWord\Shared\Drawing;
2222
use PhpOffice\PhpWord\Shared\OLERead;
2323
use PhpOffice\PhpWord\Style;
2424

src/PhpWord/Reader/ODText.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader;
1919

20+
use PhpOffice\Common\XMLReader;
2021
use PhpOffice\PhpWord\PhpWord;
21-
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Reader for ODText

src/PhpWord/Reader/ODText/Content.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\ODText;
1919

20+
use PhpOffice\Common\XMLReader;
2021
use PhpOffice\PhpWord\PhpWord;
21-
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Content reader

src/PhpWord/Reader/ODText/Meta.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\ODText;
1919

20+
use PhpOffice\Common\XMLReader;
2021
use PhpOffice\PhpWord\PhpWord;
21-
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Meta reader

src/PhpWord/Reader/Word2007.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader;
1919

20+
use PhpOffice\Common\XMLReader;
2021
use PhpOffice\PhpWord\PhpWord;
21-
use PhpOffice\PhpWord\Shared\XMLReader;
2222
use PhpOffice\PhpWord\Shared\ZipArchive;
2323

2424
/**

src/PhpWord/Reader/Word2007/AbstractPart.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20+
use PhpOffice\Common\XMLReader;
2021
use PhpOffice\PhpWord\PhpWord;
21-
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Abstract part reader
@@ -92,7 +92,7 @@ public function setRels($value)
9292
/**
9393
* Read w:p.
9494
*
95-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
95+
* @param \PhpOffice\Common\XMLReader $xmlReader
9696
* @param \DOMElement $domNode
9797
* @param mixed $parent
9898
* @param string $docPart
@@ -183,7 +183,7 @@ protected function readParagraph(XMLReader $xmlReader, \DOMElement $domNode, $pa
183183
/**
184184
* Read w:r.
185185
*
186-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
186+
* @param \PhpOffice\Common\XMLReader $xmlReader
187187
* @param \DOMElement $domNode
188188
* @param mixed $parent
189189
* @param string $docPart
@@ -246,7 +246,7 @@ protected function readRun(XMLReader $xmlReader, \DOMElement $domNode, $parent,
246246
/**
247247
* Read w:tbl.
248248
*
249-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
249+
* @param \PhpOffice\Common\XMLReader $xmlReader
250250
* @param \DOMElement $domNode
251251
* @param mixed $parent
252252
* @param string $docPart
@@ -307,7 +307,7 @@ protected function readTable(XMLReader $xmlReader, \DOMElement $domNode, $parent
307307
/**
308308
* Read w:pPr.
309309
*
310-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
310+
* @param \PhpOffice\Common\XMLReader $xmlReader
311311
* @param \DOMElement $domNode
312312
* @return array|null
313313
*/
@@ -339,7 +339,7 @@ protected function readParagraphStyle(XMLReader $xmlReader, \DOMElement $domNode
339339
/**
340340
* Read w:rPr
341341
*
342-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
342+
* @param \PhpOffice\Common\XMLReader $xmlReader
343343
* @param \DOMElement $domNode
344344
* @return array|null
345345
*/
@@ -382,7 +382,7 @@ protected function readFontStyle(XMLReader $xmlReader, \DOMElement $domNode)
382382
/**
383383
* Read w:tblPr
384384
*
385-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
385+
* @param \PhpOffice\Common\XMLReader $xmlReader
386386
* @param \DOMElement $domNode
387387
* @return string|array|null
388388
* @todo Capture w:tblStylePr w:type="firstRow"
@@ -418,7 +418,7 @@ protected function readTableStyle(XMLReader $xmlReader, \DOMElement $domNode)
418418
/**
419419
* Read w:tcPr
420420
*
421-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
421+
* @param \PhpOffice\Common\XMLReader $xmlReader
422422
* @param \DOMElement $domNode
423423
* @return array
424424
*/
@@ -438,7 +438,7 @@ private function readCellStyle(XMLReader $xmlReader, \DOMElement $domNode)
438438
/**
439439
* Read style definition
440440
*
441-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
441+
* @param \PhpOffice\Common\XMLReader $xmlReader
442442
* @param \DOMElement $parentNode
443443
* @param array $styleDefs
444444
* @ignoreScrutinizerPatch

src/PhpWord/Reader/Word2007/DocPropsCore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20+
use PhpOffice\Common\XMLReader;
2021
use PhpOffice\PhpWord\PhpWord;
21-
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Core properties reader

src/PhpWord/Reader/Word2007/DocPropsCustom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20+
use PhpOffice\Common\XMLReader;
2021
use PhpOffice\PhpWord\Metadata\DocInfo;
2122
use PhpOffice\PhpWord\PhpWord;
22-
use PhpOffice\PhpWord\Shared\XMLReader;
2323

2424
/**
2525
* Custom properties reader

src/PhpWord/Reader/Word2007/Document.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20+
use PhpOffice\Common\XMLReader;
2021
use PhpOffice\PhpWord\Element\Section;
2122
use PhpOffice\PhpWord\PhpWord;
22-
use PhpOffice\PhpWord\Shared\XMLReader;
2323

2424
/**
2525
* Document reader
@@ -99,7 +99,7 @@ private function readHeaderFooter($settings, Section &$section)
9999
/**
100100
* Read w:sectPr
101101
*
102-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
102+
* @param \PhpOffice\Common\XMLReader $xmlReader
103103
* @param \DOMElement $domNode
104104
* @ignoreScrutinizerPatch
105105
* @return array
@@ -142,7 +142,7 @@ private function readSectionStyle(XMLReader $xmlReader, \DOMElement $domNode)
142142
/**
143143
* Read w:p node.
144144
*
145-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
145+
* @param \PhpOffice\Common\XMLReader $xmlReader
146146
* @param \DOMElement $node
147147
* @param \PhpOffice\PhpWord\Element\Section &$section
148148
* @return void
@@ -172,7 +172,7 @@ private function readWPNode(XMLReader $xmlReader, \DOMElement $node, Section &$s
172172
/**
173173
* Read w:sectPr node.
174174
*
175-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
175+
* @param \PhpOffice\Common\XMLReader $xmlReader
176176
* @param \DOMElement $node
177177
* @param \PhpOffice\PhpWord\Element\Section &$section
178178
* @return void

src/PhpWord/Reader/Word2007/Footnotes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20+
use PhpOffice\Common\XMLReader;
2021
use PhpOffice\PhpWord\PhpWord;
21-
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Footnotes reader

src/PhpWord/Reader/Word2007/Numbering.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20+
use PhpOffice\Common\XMLReader;
2021
use PhpOffice\PhpWord\PhpWord;
21-
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Numbering reader
@@ -90,7 +90,7 @@ public function read(PhpWord $phpWord)
9090
/**
9191
* Read numbering level definition from w:abstractNum and w:num
9292
*
93-
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
93+
* @param \PhpOffice\Common\XMLReader $xmlReader
9494
* @param \DOMElement $subnode
9595
* @param integer $levelId
9696
* @return array

0 commit comments

Comments
 (0)