diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php
index 72b642bbe7..8af70d421d 100644
--- a/src/PhpWord/Element/AbstractContainer.php
+++ b/src/PhpWord/Element/AbstractContainer.php
@@ -277,7 +277,7 @@ public function addObject($src, $style = null)
if (strlen($ext) == 4 && strtolower(substr($ext, -1)) == 'x') {
$ext = substr($ext, 0, -1);
}
- $icon = realpath(__DIR__ . "/../_staticDocParts/_{$ext}.png");
+ $icon = realpath(__DIR__ . "/../resources/{$ext}.png");
$rId = Media::addElement($elementDocPart, 'object', $src);
$object->setRelationId($rId);
$rIdimg = Media::addElement($elementDocPart, 'image', $icon, new Image($icon));
diff --git a/src/PhpWord/Reader/ODText/AbstractPart.php b/src/PhpWord/Reader/ODText/AbstractPart.php
index a0cc75de6e..232b53a79d 100644
--- a/src/PhpWord/Reader/ODText/AbstractPart.php
+++ b/src/PhpWord/Reader/ODText/AbstractPart.php
@@ -9,59 +9,42 @@
namespace PhpOffice\PhpWord\Reader\ODText;
-use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\XMLReader;
/**
* Abstract part reader
*/
-abstract class AbstractPart
+abstract class AbstractPart extends \PhpOffice\PhpWord\Reader\Word2007\AbstractPart
{
/**
- * Document file
+ * Read w:r (override)
*
- * @var string
+ * @param mixed $parent
+ * @param string $docPart
+ * @param mixed $pStyle
*/
- protected $docFile;
-
- /**
- * XML file
- *
- * @var string
- */
- protected $xmlFile;
-
- /**
- * Part relationships
- *
- * @var array
- */
- protected $rels = array();
+ protected function readRun(XMLReader $xmlReader, \DOMElement $domNode, &$parent, $docPart, $pStyle = null)
+ {
+ }
/**
- * Read part
+ * Read w:pPr (override)
*/
- abstract public function read(PhpWord &$phpWord);
+ protected function readParagraphStyle(XMLReader $xmlReader, \DOMElement $domNode)
+ {
+ }
/**
- * Create new instance
- *
- * @param string $docFile
- * @param string $xmlFile
+ * Read w:rPr (override)
*/
- public function __construct($docFile, $xmlFile)
+ protected function readFontStyle(XMLReader $xmlReader, \DOMElement $domNode)
{
- $this->docFile = $docFile;
- $this->xmlFile = $xmlFile;
}
/**
- * Set relationships
- *
- * @param array $value
+ * Read w:tblPr (override)
*/
- public function setRels($value)
+ protected function readTableStyle(XMLReader $xmlReader, \DOMElement $domNode)
{
- $this->rels = $value;
}
}
diff --git a/src/PhpWord/Writer/ODText.php b/src/PhpWord/Writer/ODText.php
index 7b99d050f7..0eb6c5452e 100755
--- a/src/PhpWord/Writer/ODText.php
+++ b/src/PhpWord/Writer/ODText.php
@@ -12,11 +12,6 @@
use PhpOffice\PhpWord\Media;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Exception\Exception;
-use PhpOffice\PhpWord\Writer\ODText\Content;
-use PhpOffice\PhpWord\Writer\ODText\Manifest;
-use PhpOffice\PhpWord\Writer\ODText\Meta;
-use PhpOffice\PhpWord\Writer\ODText\Mimetype;
-use PhpOffice\PhpWord\Writer\ODText\Styles;
/**
* ODText writer
@@ -35,14 +30,16 @@ public function __construct(PhpWord $phpWord = null)
// Assign PhpWord
$this->setPhpWord($phpWord);
- // Set writer parts
- $this->writerParts['content'] = new Content();
- $this->writerParts['manifest'] = new Manifest();
- $this->writerParts['meta'] = new Meta();
- $this->writerParts['mimetype'] = new Mimetype();
- $this->writerParts['styles'] = new Styles();
- foreach ($this->writerParts as $writer) {
- $writer->setParentWriter($this);
+ // Create parts
+ $parts = array('Content', 'Manifest', 'Meta', 'Mimetype', 'Styles');
+ foreach ($parts as $part) {
+ $partName = strtolower($part);
+ $partClass = 'PhpOffice\\PhpWord\\Writer\\ODText\\Part\\' . $part;
+ if (class_exists($partClass)) {
+ $partObject = new $partClass();
+ $partObject->setParentWriter($this);
+ $this->writerParts[$partName] = $partObject;
+ }
}
// Set package paths
diff --git a/src/PhpWord/Writer/ODText/AbstractWriterPart.php b/src/PhpWord/Writer/ODText/AbstractWriterPart.php
deleted file mode 100644
index 1a5831e0c5..0000000000
--- a/src/PhpWord/Writer/ODText/AbstractWriterPart.php
+++ /dev/null
@@ -1,17 +0,0 @@
-xmlWriter = $xmlWriter;
$this->parentWriter = $parentWriter;
diff --git a/src/PhpWord/Writer/ODText/Element/TextRun.php b/src/PhpWord/Writer/ODText/Element/TextRun.php
index 591875838a..be4de23903 100644
--- a/src/PhpWord/Writer/ODText/Element/TextRun.php
+++ b/src/PhpWord/Writer/ODText/Element/TextRun.php
@@ -10,6 +10,7 @@
namespace PhpOffice\PhpWord\Writer\ODText\Element;
use PhpOffice\PhpWord\Element\Text as TextElement;
+use PhpOffice\PhpWord\Element\Link as LinkElement;
use PhpOffice\PhpWord\Writer\ODText\Element\Element as ElementWriter;
/**
diff --git a/src/PhpWord/Writer/ODText/Base.php b/src/PhpWord/Writer/ODText/Part/AbstractPart.php
similarity index 96%
rename from src/PhpWord/Writer/ODText/Base.php
rename to src/PhpWord/Writer/ODText/Part/AbstractPart.php
index d38aef2309..4aa5d79f9f 100644
--- a/src/PhpWord/Writer/ODText/Base.php
+++ b/src/PhpWord/Writer/ODText/Part/AbstractPart.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\ODText;
+namespace PhpOffice\PhpWord\Writer\ODText\Part;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Style;
@@ -15,11 +15,9 @@
use PhpOffice\PhpWord\Shared\XMLWriter;
/**
- * ODT base part writer
- *
- * @since 0.10.0
+ * ODText writer part abstract
*/
-class Base extends AbstractWriterPart
+abstract class AbstractPart extends \PhpOffice\PhpWord\Writer\Word2007\Part\AbstractPart
{
/**
* Write common root attributes
diff --git a/src/PhpWord/Writer/ODText/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php
similarity index 99%
rename from src/PhpWord/Writer/ODText/Content.php
rename to src/PhpWord/Writer/ODText/Part/Content.php
index 69754e817a..6b4a86df11 100644
--- a/src/PhpWord/Writer/ODText/Content.php
+++ b/src/PhpWord/Writer/ODText/Part/Content.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\ODText;
+namespace PhpOffice\PhpWord\Writer\ODText\Part;
use PhpOffice\PhpWord\Media;
use PhpOffice\PhpWord\Style;
@@ -23,7 +23,7 @@
/**
* ODText content part writer
*/
-class Content extends Base
+class Content extends AbstractPart
{
/**
* Write content file to XML format
diff --git a/src/PhpWord/Writer/ODText/Manifest.php b/src/PhpWord/Writer/ODText/Part/Manifest.php
similarity index 96%
rename from src/PhpWord/Writer/ODText/Manifest.php
rename to src/PhpWord/Writer/ODText/Part/Manifest.php
index c3fef79e64..4462e7ef62 100755
--- a/src/PhpWord/Writer/ODText/Manifest.php
+++ b/src/PhpWord/Writer/ODText/Part/Manifest.php
@@ -7,14 +7,14 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\ODText;
+namespace PhpOffice\PhpWord\Writer\ODText\Part;
use PhpOffice\PhpWord\Media;
/**
* ODText manifest part writer
*/
-class Manifest extends AbstractWriterPart
+class Manifest extends AbstractPart
{
/**
* Write Manifest file to XML format
diff --git a/src/PhpWord/Writer/ODText/Meta.php b/src/PhpWord/Writer/ODText/Part/Meta.php
similarity index 97%
rename from src/PhpWord/Writer/ODText/Meta.php
rename to src/PhpWord/Writer/ODText/Part/Meta.php
index 3e04234c3f..355e288ba7 100644
--- a/src/PhpWord/Writer/ODText/Meta.php
+++ b/src/PhpWord/Writer/ODText/Part/Meta.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\ODText;
+namespace PhpOffice\PhpWord\Writer\ODText\Part;
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\PhpWord;
@@ -15,7 +15,7 @@
/**
* ODText meta part writer
*/
-class Meta extends AbstractWriterPart
+class Meta extends AbstractPart
{
/**
* Write Meta file to XML format
diff --git a/src/PhpWord/Writer/ODText/Mimetype.php b/src/PhpWord/Writer/ODText/Part/Mimetype.php
similarity index 83%
rename from src/PhpWord/Writer/ODText/Mimetype.php
rename to src/PhpWord/Writer/ODText/Part/Mimetype.php
index 269c377f5d..3c3af1a502 100644
--- a/src/PhpWord/Writer/ODText/Mimetype.php
+++ b/src/PhpWord/Writer/ODText/Part/Mimetype.php
@@ -7,12 +7,12 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\ODText;
+namespace PhpOffice\PhpWord\Writer\ODText\Part;
/**
* ODText mimetype part writer
*/
-class Mimetype extends AbstractWriterPart
+class Mimetype extends AbstractPart
{
/**
* Write Mimetype to Text format
diff --git a/src/PhpWord/Writer/ODText/Styles.php b/src/PhpWord/Writer/ODText/Part/Styles.php
similarity index 98%
rename from src/PhpWord/Writer/ODText/Styles.php
rename to src/PhpWord/Writer/ODText/Part/Styles.php
index f21502fc64..f53e1bf835 100644
--- a/src/PhpWord/Writer/ODText/Styles.php
+++ b/src/PhpWord/Writer/ODText/Part/Styles.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\ODText;
+namespace PhpOffice\PhpWord\Writer\ODText\Part;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Style;
@@ -16,7 +16,7 @@
/**
* ODText styloes part writer
*/
-class Styles extends Base
+class Styles extends AbstractPart
{
/**
* Write Styles file to XML format
diff --git a/src/PhpWord/Writer/Word2007.php b/src/PhpWord/Writer/Word2007.php
index 6db8bcfcbb..b87f1d2441 100755
--- a/src/PhpWord/Writer/Word2007.php
+++ b/src/PhpWord/Writer/Word2007.php
@@ -13,17 +13,6 @@
use PhpOffice\PhpWord\Media;
use PhpOffice\PhpWord\Element\Section;
use PhpOffice\PhpWord\Exception\Exception;
-use PhpOffice\PhpWord\Writer\Word2007\ContentTypes;
-use PhpOffice\PhpWord\Writer\Word2007\DocProps;
-use PhpOffice\PhpWord\Writer\Word2007\Document;
-use PhpOffice\PhpWord\Writer\Word2007\Footer;
-use PhpOffice\PhpWord\Writer\Word2007\Header;
-use PhpOffice\PhpWord\Writer\Word2007\Notes;
-use PhpOffice\PhpWord\Writer\Word2007\Numbering;
-use PhpOffice\PhpWord\Writer\Word2007\Rels;
-use PhpOffice\PhpWord\Writer\Word2007\Settings;
-use PhpOffice\PhpWord\Writer\Word2007\Styles;
-use PhpOffice\PhpWord\Writer\Word2007\WebSettings;
/**
* Word2007 writer
@@ -54,21 +43,18 @@ public function __construct(PhpWord $phpWord = null)
// Assign PhpWord
$this->setPhpWord($phpWord);
- // Set writer parts
- $this->writerParts['contenttypes'] = new ContentTypes();
- $this->writerParts['rels'] = new Rels();
- $this->writerParts['docprops'] = new DocProps();
- $this->writerParts['document'] = new Document();
- $this->writerParts['styles'] = new Styles();
- $this->writerParts['numbering'] = new Numbering();
- $this->writerParts['settings'] = new Settings();
- $this->writerParts['websettings'] = new WebSettings();
- $this->writerParts['header'] = new Header();
- $this->writerParts['footer'] = new Footer();
- $this->writerParts['footnotes'] = new Notes();
- $this->writerParts['endnotes'] = new Notes();
- foreach ($this->writerParts as $writer) {
- $writer->setParentWriter($this);
+ // Create parts
+ $parts = array('ContentTypes', 'Rels', 'DocProps', 'Document', 'Styles',
+ 'Numbering', 'Settings', 'WebSettings', 'Header', 'Footer', 'Footnotes',
+ 'Endnotes', 'FontTable', 'Theme');
+ foreach ($parts as $part) {
+ $partName = strtolower($part);
+ $partClass = 'PhpOffice\\PhpWord\\Writer\\Word2007\\Part\\' . $part;
+ if (class_exists($partClass)) {
+ $partObject = new $partClass();
+ $partObject->setParentWriter($this);
+ $this->writerParts[$partName] = $partObject;
+ }
}
// Set package paths
@@ -117,7 +103,7 @@ public function save($filename = null)
$this->addNotes($objZip, $rId, 'footnote');
$this->addNotes($objZip, $rId, 'endnote');
- // Write dynamic files
+ // Write parts
$objZip->addFromString('[Content_Types].xml', $this->getWriterPart('contenttypes')->writeContentTypes($this->cTypes));
$objZip->addFromString('_rels/.rels', $this->getWriterPart('rels')->writeMainRels());
$objZip->addFromString('docProps/app.xml', $this->getWriterPart('docprops')->writeDocPropsApp($this->phpWord));
@@ -128,10 +114,8 @@ public function save($filename = null)
$objZip->addFromString('word/numbering.xml', $this->getWriterPart('numbering')->writeNumbering());
$objZip->addFromString('word/settings.xml', $this->getWriterPart('settings')->writeSettings());
$objZip->addFromString('word/webSettings.xml', $this->getWriterPart('websettings')->writeWebSettings());
-
- // Write static files
- $objZip->addFile(__DIR__ . '/../_staticDocParts/theme1.xml', 'word/theme/theme1.xml');
- $objZip->addFile(__DIR__ . '/../_staticDocParts/fontTable.xml', 'word/fontTable.xml');
+ $objZip->addFromString('word/fontTable.xml', $this->getWriterPart('fonttable')->write());
+ $objZip->addFromString('word/theme/theme1.xml', $this->getWriterPart('theme')->write());
// Close file
if ($objZip->close() === false) {
@@ -215,7 +199,7 @@ private function addNotes($objZip, &$rId, $notesType = 'footnote')
$objZip->addFromString($relsFile, $this->getWriterPart('rels')->writeMediaRels($media));
}
$elements = $collection::getElements();
- $objZip->addFromString($xmlPath, $this->getWriterPart($notesTypes)->writeNotes($elements, $notesTypes));
+ $objZip->addFromString($xmlPath, $this->getWriterPart($notesTypes)->write($elements));
$this->cTypes['override']["/{$xmlPath}"] = $notesTypes;
$this->docRels[] = array('target' => $xmlFile, 'type' => $notesTypes, 'rID' => ++$rId);
}
diff --git a/src/PhpWord/Writer/Word2007/AbstractWriterPart.php b/src/PhpWord/Writer/Word2007/AbstractWriterPart.php
deleted file mode 100755
index bef7bd8bff..0000000000
--- a/src/PhpWord/Writer/Word2007/AbstractWriterPart.php
+++ /dev/null
@@ -1,72 +0,0 @@
-parentWriter = $pWriter;
- }
-
- /**
- * Get parent writer
- *
- * @return \PhpOffice\PhpWord\Writer\WriterInterface
- * @throws \PhpOffice\PhpWord\Exception\Exception
- */
- public function getParentWriter()
- {
- if (!is_null($this->parentWriter)) {
- return $this->parentWriter;
- } else {
- throw new Exception("No parent WriterInterface assigned.");
- }
- }
-
- /**
- * Get XML Writer
- *
- * @return \PhpOffice\PhpWord\Shared\XMLWriter
- */
- protected function getXmlWriter()
- {
- $useDiskCaching = false;
- if (!is_null($this->parentWriter)) {
- if ($this->parentWriter->getUseDiskCaching()) {
- $useDiskCaching = true;
- }
- }
- if ($useDiskCaching) {
- return new XMLWriter(XMLWriter::STORAGE_DISK, $this->parentWriter->getDiskCachingDirectory());
- } else {
- return new XMLWriter(XMLWriter::STORAGE_MEMORY);
- }
- }
-}
diff --git a/src/PhpWord/Writer/Word2007/Element/Element.php b/src/PhpWord/Writer/Word2007/Element/Element.php
index f456a10655..9c91beb781 100644
--- a/src/PhpWord/Writer/Word2007/Element/Element.php
+++ b/src/PhpWord/Writer/Word2007/Element/Element.php
@@ -11,7 +11,7 @@
use PhpOffice\PhpWord\Element\AbstractElement;
use PhpOffice\PhpWord\Shared\XMLWriter;
-use PhpOffice\PhpWord\Writer\Word2007\AbstractWriterPart;
+use PhpOffice\PhpWord\Writer\Word2007\Part\AbstractPart;
/**
* Generic element writer
@@ -30,7 +30,7 @@ class Element
/**
* Parent writer
*
- * @var \PhpOffice\PhpWord\Writer\Word2007\AbstractWriterPart
+ * @var \PhpOffice\PhpWord\Writer\Word2007\Part\AbstractPart
*/
protected $parentWriter;
@@ -53,7 +53,7 @@ class Element
*
* @param bool $withoutP
*/
- public function __construct(XMLWriter $xmlWriter, AbstractWriterPart $parentWriter, AbstractElement $element, $withoutP = false)
+ public function __construct(XMLWriter $xmlWriter, AbstractPart $parentWriter, AbstractElement $element, $withoutP = false)
{
$this->xmlWriter = $xmlWriter;
$this->parentWriter = $parentWriter;
diff --git a/src/PhpWord/Writer/Word2007/Base.php b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php
old mode 100644
new mode 100755
similarity index 62%
rename from src/PhpWord/Writer/Word2007/Base.php
rename to src/PhpWord/Writer/Word2007/Part/AbstractPart.php
index bae184109f..afa84caf8f
--- a/src/PhpWord/Writer/Word2007/Base.php
+++ b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Element\AbstractElement;
@@ -15,14 +15,65 @@
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Writer\Word2007\Element\Element as ElementWriter;
+use PhpOffice\PhpWord\Writer\WriterInterface;
/**
- * Word2007 base part writer
- *
- * Write common parts of document.xml, headerx.xml, and footerx.xml
+ * Word2007 writer part abstract class
*/
-class Base extends AbstractWriterPart
+abstract class AbstractPart
{
+ /**
+ * Parent writer
+ *
+ * @var \PhpOffice\PhpWord\Writer\WriterInterface
+ */
+ protected $parentWriter;
+
+ /**
+ * Set parent writer
+ *
+ * @param \PhpOffice\PhpWord\Writer\WriterInterface $pWriter
+ */
+ public function setParentWriter(WriterInterface $pWriter = null)
+ {
+ $this->parentWriter = $pWriter;
+ }
+
+ /**
+ * Get parent writer
+ *
+ * @return \PhpOffice\PhpWord\Writer\WriterInterface
+ * @throws \PhpOffice\PhpWord\Exception\Exception
+ */
+ public function getParentWriter()
+ {
+ if (!is_null($this->parentWriter)) {
+ return $this->parentWriter;
+ } else {
+ throw new Exception("No parent WriterInterface assigned.");
+ }
+ }
+
+ /**
+ * Get XML Writer
+ *
+ * @return \PhpOffice\PhpWord\Shared\XMLWriter
+ */
+ protected function getXmlWriter()
+ {
+ $useDiskCaching = false;
+ if (!is_null($this->parentWriter)) {
+ if ($this->parentWriter->getUseDiskCaching()) {
+ $useDiskCaching = true;
+ }
+ }
+ if ($useDiskCaching) {
+ return new XMLWriter(XMLWriter::STORAGE_DISK, $this->parentWriter->getDiskCachingDirectory());
+ } else {
+ return new XMLWriter(XMLWriter::STORAGE_MEMORY);
+ }
+ }
+
/**
* Write container elements
*
diff --git a/src/PhpWord/Writer/Word2007/ContentTypes.php b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php
similarity index 97%
rename from src/PhpWord/Writer/Word2007/ContentTypes.php
rename to src/PhpWord/Writer/Word2007/Part/ContentTypes.php
index 05f4b4b933..00e05c7619 100755
--- a/src/PhpWord/Writer/Word2007/ContentTypes.php
+++ b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\Shared\XMLWriter;
@@ -15,7 +15,7 @@
/**
* Word2007 contenttypes part writer
*/
-class ContentTypes extends AbstractWriterPart
+class ContentTypes extends AbstractPart
{
/**
* Write [Content_Types].xml
diff --git a/src/PhpWord/Writer/Word2007/DocProps.php b/src/PhpWord/Writer/Word2007/Part/DocProps.php
similarity index 97%
rename from src/PhpWord/Writer/Word2007/DocProps.php
rename to src/PhpWord/Writer/Word2007/Part/DocProps.php
index 28102e18c5..ade15c0afd 100644
--- a/src/PhpWord/Writer/Word2007/DocProps.php
+++ b/src/PhpWord/Writer/Word2007/Part/DocProps.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Exception\Exception;
@@ -15,7 +15,7 @@
/**
* Word2007 document properties part writer
*/
-class DocProps extends AbstractWriterPart
+class DocProps extends AbstractPart
{
/**
* Write docProps/app.xml
diff --git a/src/PhpWord/Writer/Word2007/Document.php b/src/PhpWord/Writer/Word2007/Part/Document.php
similarity index 98%
rename from src/PhpWord/Writer/Word2007/Document.php
rename to src/PhpWord/Writer/Word2007/Part/Document.php
index cb64168ec5..2b30ee54b4 100644
--- a/src/PhpWord/Writer/Word2007/Document.php
+++ b/src/PhpWord/Writer/Word2007/Part/Document.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Element\Section;
@@ -17,7 +17,7 @@
/**
* Word2007 document part writer
*/
-class Document extends Base
+class Document extends AbstractPart
{
/**
* Write word/document.xml
diff --git a/src/PhpWord/Writer/Word2007/Part/Endnotes.php b/src/PhpWord/Writer/Word2007/Part/Endnotes.php
new file mode 100644
index 0000000000..9cecf4028d
--- /dev/null
+++ b/src/PhpWord/Writer/Word2007/Part/Endnotes.php
@@ -0,0 +1,44 @@
+
-
\ No newline at end of file
+
+';
+ }
+}
diff --git a/src/PhpWord/Writer/Word2007/Footer.php b/src/PhpWord/Writer/Word2007/Part/Footer.php
similarity index 95%
rename from src/PhpWord/Writer/Word2007/Footer.php
rename to src/PhpWord/Writer/Word2007/Part/Footer.php
index 76a66cc078..f31ece860c 100644
--- a/src/PhpWord/Writer/Word2007/Footer.php
+++ b/src/PhpWord/Writer/Word2007/Part/Footer.php
@@ -7,14 +7,14 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\Element\Footer as FooterElement;
/**
* Word2007 footer part writer
*/
-class Footer extends Base
+class Footer extends AbstractPart
{
/**
* Write word/footnotes.xml
diff --git a/src/PhpWord/Writer/Word2007/Notes.php b/src/PhpWord/Writer/Word2007/Part/Footnotes.php
similarity index 72%
rename from src/PhpWord/Writer/Word2007/Notes.php
rename to src/PhpWord/Writer/Word2007/Part/Footnotes.php
index cb86628293..2356849e07 100644
--- a/src/PhpWord/Writer/Word2007/Notes.php
+++ b/src/PhpWord/Writer/Word2007/Part/Footnotes.php
@@ -7,33 +7,56 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\Element\Footnote;
-use PhpOffice\PhpWord\Element\Endnote;
use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter;
/**
* Word2007 footnotes part writer
*/
-class Notes extends Base
+class Footnotes extends AbstractPart
{
+ /**
+ * Name of XML root element
+ *
+ * @var string
+ */
+ protected $rootNode = 'w:footnotes';
+
+ /**
+ * Name of XML node element
+ *
+ * @var string
+ */
+ protected $elementNode = 'w:footnote';
+
+ /**
+ * Name of XML reference element
+ *
+ * @var string
+ */
+ protected $refNode = 'w:footnoteRef';
+
+ /**
+ * Reference style name
+ *
+ * @var string
+ */
+ protected $refStyle = 'FootnoteReference';
+
/**
* Write word/(footnotes|endnotes).xml
*
* @param array $elements
- * @param string $notesTypes
*/
- public function writeNotes($elements, $notesTypes = 'footnotes')
+ public function write($elements)
{
- $isFootnote = $notesTypes == 'footnotes';
- $rootNode = $isFootnote ? 'w:footnotes' : 'w:endnotes';
- $elementNode = $isFootnote ? 'w:footnote' : 'w:endnote';
$xmlWriter = $this->getXmlWriter();
$xmlWriter->startDocument('1.0', 'UTF-8', 'yes');
- $xmlWriter->startElement($rootNode);
+ $xmlWriter->startElement($this->rootNode);
$xmlWriter->writeAttribute('xmlns:ve', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
$xmlWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
$xmlWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
@@ -45,7 +68,7 @@ public function writeNotes($elements, $notesTypes = 'footnotes')
$xmlWriter->writeAttribute('xmlns:wne', 'http://schemas.microsoft.com/office/word/2006/wordml');
// Separator and continuation separator
- $xmlWriter->startElement($elementNode);
+ $xmlWriter->startElement($this->elementNode);
$xmlWriter->writeAttribute('w:id', -1);
$xmlWriter->writeAttribute('w:type', 'separator');
$xmlWriter->startElement('w:p');
@@ -54,8 +77,8 @@ public function writeNotes($elements, $notesTypes = 'footnotes')
$xmlWriter->endElement(); // w:separator
$xmlWriter->endElement(); // w:r
$xmlWriter->endElement(); // w:p
- $xmlWriter->endElement(); // $elementNode
- $xmlWriter->startElement($elementNode);
+ $xmlWriter->endElement(); // $this->elementNode
+ $xmlWriter->startElement($this->elementNode);
$xmlWriter->writeAttribute('w:id', 0);
$xmlWriter->writeAttribute('w:type', 'continuationSeparator');
$xmlWriter->startElement('w:p');
@@ -64,16 +87,16 @@ public function writeNotes($elements, $notesTypes = 'footnotes')
$xmlWriter->endElement(); // w:continuationSeparator
$xmlWriter->endElement(); // w:r
$xmlWriter->endElement(); // w:p
- $xmlWriter->endElement(); // $elementNode
+ $xmlWriter->endElement(); // $this->elementNode
// Content
foreach ($elements as $element) {
- if ($element instanceof Footnote || $element instanceof Endnote) {
- $this->writeNote($xmlWriter, $element, $notesTypes);
+ if ($element instanceof Footnote) {
+ $this->writeNote($xmlWriter, $element);
}
}
- $xmlWriter->endElement(); // $rootNode
+ $xmlWriter->endElement(); // $this->rootNode
return $xmlWriter->getData();
}
@@ -83,16 +106,10 @@ public function writeNotes($elements, $notesTypes = 'footnotes')
*
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Footnote|\PhpOffice\PhpWord\Element\Endnote $element
- * @param string $notesTypes
*/
- protected function writeNote(XMLWriter $xmlWriter, $element, $notesTypes = 'footnotes')
+ protected function writeNote(XMLWriter $xmlWriter, $element)
{
- $isFootnote = ($notesTypes == 'footnotes');
- $elementNode = $isFootnote ? 'w:footnote' : 'w:endnote';
- $refNode = $isFootnote ? 'w:footnoteRef' : 'w:endnoteRef';
- $styleName = $isFootnote ? 'FootnoteReference' : 'EndnoteReference';
-
- $xmlWriter->startElement($elementNode);
+ $xmlWriter->startElement($this->elementNode);
$xmlWriter->writeAttribute('w:id', $element->getRelationId());
$xmlWriter->startElement('w:p');
@@ -105,10 +122,10 @@ protected function writeNote(XMLWriter $xmlWriter, $element, $notesTypes = 'foot
$xmlWriter->startElement('w:r');
$xmlWriter->startElement('w:rPr');
$xmlWriter->startElement('w:rStyle');
- $xmlWriter->writeAttribute('w:val', $styleName);
+ $xmlWriter->writeAttribute('w:val', $this->refStyle);
$xmlWriter->endElement(); // w:rStyle
$xmlWriter->endElement(); // w:rPr
- $xmlWriter->writeElement($refNode);
+ $xmlWriter->writeElement($this->refNode);
$xmlWriter->endElement(); // w:r
// Empty space after refence symbol
@@ -122,6 +139,6 @@ protected function writeNote(XMLWriter $xmlWriter, $element, $notesTypes = 'foot
$this->writeContainerElements($xmlWriter, $element);
$xmlWriter->endElement(); // w:p
- $xmlWriter->endElement(); // $elementNode
+ $xmlWriter->endElement(); // $this->elementNode
}
}
diff --git a/src/PhpWord/Writer/Word2007/Header.php b/src/PhpWord/Writer/Word2007/Part/Header.php
similarity index 95%
rename from src/PhpWord/Writer/Word2007/Header.php
rename to src/PhpWord/Writer/Word2007/Part/Header.php
index 6823c434d7..d2af19da29 100644
--- a/src/PhpWord/Writer/Word2007/Header.php
+++ b/src/PhpWord/Writer/Word2007/Part/Header.php
@@ -7,14 +7,14 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\Element\Header as HeaderElement;
/**
* Word2007 header part writer
*/
-class Header extends Base
+class Header extends AbstractPart
{
/**
* Write word/headerx.xml
diff --git a/src/PhpWord/Writer/Word2007/Numbering.php b/src/PhpWord/Writer/Word2007/Part/Numbering.php
similarity index 98%
rename from src/PhpWord/Writer/Word2007/Numbering.php
rename to src/PhpWord/Writer/Word2007/Part/Numbering.php
index 26d86ef5aa..ea1b699bf6 100644
--- a/src/PhpWord/Writer/Word2007/Numbering.php
+++ b/src/PhpWord/Writer/Word2007/Part/Numbering.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Style\Numbering as NumberingStyle;
@@ -16,7 +16,7 @@
/**
* Word2007 numbering part writer
*/
-class Numbering extends Base
+class Numbering extends AbstractPart
{
/**
* Write word/numbering.xml
diff --git a/src/PhpWord/Writer/Word2007/Rels.php b/src/PhpWord/Writer/Word2007/Part/Rels.php
similarity index 98%
rename from src/PhpWord/Writer/Word2007/Rels.php
rename to src/PhpWord/Writer/Word2007/Part/Rels.php
index 58e510fd06..8771b0f6ab 100755
--- a/src/PhpWord/Writer/Word2007/Rels.php
+++ b/src/PhpWord/Writer/Word2007/Part/Rels.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\Shared\XMLWriter;
@@ -17,7 +17,7 @@
*
* @since 0.10.0
*/
-class Rels extends AbstractWriterPart
+class Rels extends AbstractPart
{
/**
* Base relationship URL
diff --git a/src/PhpWord/Writer/Word2007/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php
similarity index 98%
rename from src/PhpWord/Writer/Word2007/Settings.php
rename to src/PhpWord/Writer/Word2007/Part/Settings.php
index 918229c112..81a5967929 100644
--- a/src/PhpWord/Writer/Word2007/Settings.php
+++ b/src/PhpWord/Writer/Word2007/Part/Settings.php
@@ -7,14 +7,14 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\Shared\XMLWriter;
/**
* Word2007 settings part writer
*/
-class Settings extends AbstractWriterPart
+class Settings extends AbstractPart
{
/**
* Write word/settings.xml
diff --git a/src/PhpWord/Writer/Word2007/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php
similarity index 99%
rename from src/PhpWord/Writer/Word2007/Styles.php
rename to src/PhpWord/Writer/Word2007/Part/Styles.php
index dd48aa7d34..579ae8e5c8 100644
--- a/src/PhpWord/Writer/Word2007/Styles.php
+++ b/src/PhpWord/Writer/Word2007/Part/Styles.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Style;
@@ -25,7 +25,7 @@
*
* @todo Do something with the numbering style introduced in 0.10.0
*/
-class Styles extends Base
+class Styles extends AbstractPart
{
/**
* Write word/styles.xml
diff --git a/src/PhpWord/_staticDocParts/theme1.xml b/src/PhpWord/Writer/Word2007/Part/Theme.php
similarity index 93%
rename from src/PhpWord/_staticDocParts/theme1.xml
rename to src/PhpWord/Writer/Word2007/Part/Theme.php
index 4fab507b66..2e0b4c9911 100644
--- a/src/PhpWord/_staticDocParts/theme1.xml
+++ b/src/PhpWord/Writer/Word2007/Part/Theme.php
@@ -1,2 +1,27 @@
-
-
\ No newline at end of file
+
+';
+ }
+}
diff --git a/src/PhpWord/Writer/Word2007/WebSettings.php b/src/PhpWord/Writer/Word2007/Part/WebSettings.php
similarity index 95%
rename from src/PhpWord/Writer/Word2007/WebSettings.php
rename to src/PhpWord/Writer/Word2007/Part/WebSettings.php
index f52be90980..b1b5cc15cb 100644
--- a/src/PhpWord/Writer/Word2007/WebSettings.php
+++ b/src/PhpWord/Writer/Word2007/Part/WebSettings.php
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Writer\Word2007;
+namespace PhpOffice\PhpWord\Writer\Word2007\Part;
/**
* Word2007 web settings part writer
diff --git a/src/PhpWord/_staticDocParts/_doc.png b/src/PhpWord/resources/doc.png
similarity index 100%
rename from src/PhpWord/_staticDocParts/_doc.png
rename to src/PhpWord/resources/doc.png
diff --git a/src/PhpWord/_staticDocParts/_ppt.png b/src/PhpWord/resources/ppt.png
similarity index 100%
rename from src/PhpWord/_staticDocParts/_ppt.png
rename to src/PhpWord/resources/ppt.png
diff --git a/src/PhpWord/_staticDocParts/_xls.png b/src/PhpWord/resources/xls.png
similarity index 100%
rename from src/PhpWord/_staticDocParts/_xls.png
rename to src/PhpWord/resources/xls.png
diff --git a/tests/PhpWord/Tests/Writer/ODText/AbstractWriterPartTest.php b/tests/PhpWord/Tests/Writer/ODText/Part/AbstractPartTest.php
similarity index 71%
rename from tests/PhpWord/Tests/Writer/ODText/AbstractWriterPartTest.php
rename to tests/PhpWord/Tests/Writer/ODText/Part/AbstractPartTest.php
index a88630878f..bde6b4136a 100644
--- a/tests/PhpWord/Tests/Writer/ODText/AbstractWriterPartTest.php
+++ b/tests/PhpWord/Tests/Writer/ODText/Part/AbstractPartTest.php
@@ -6,18 +6,18 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\ODText;
+namespace PhpOffice\PhpWord\Tests\Writer\ODText\Part;
use PhpOffice\PhpWord\Writer\ODText;
use PhpWord\Tests\TestHelperDOCX;
/**
- * Test class for PhpOffice\PhpWord\Writer\ODText\AbstractWriterPart
+ * Test class for PhpOffice\PhpWord\Writer\ODText\Part\AbstractPart
*
- * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\AbstractWriterPart
+ * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\Part\AbstractPart
* @runTestsInSeparateProcesses
*/
-class AbstractWriterPartTest extends \PHPUnit_Framework_TestCase
+class AbstractPartTest extends \PHPUnit_Framework_TestCase
{
/**
* covers ::setParentWriter
@@ -26,7 +26,7 @@ class AbstractWriterPartTest extends \PHPUnit_Framework_TestCase
public function testSetGetParentWriter()
{
$object = $this->getMockForAbstractClass(
- 'PhpOffice\\PhpWord\\Writer\\ODText\\AbstractWriterPart'
+ 'PhpOffice\\PhpWord\\Writer\\ODText\\Part\\AbstractPart'
);
$object->setParentWriter(new ODText());
$this->assertEquals(
@@ -43,7 +43,7 @@ public function testSetGetParentWriter()
public function testSetGetParentWriterNull()
{
$object = $this->getMockForAbstractClass(
- 'PhpOffice\\PhpWord\\Writer\\ODText\\AbstractWriterPart'
+ 'PhpOffice\\PhpWord\\Writer\\ODText\\Part\\AbstractPart'
);
$object->getParentWriter();
}
diff --git a/tests/PhpWord/Tests/Writer/ODText/ContentTest.php b/tests/PhpWord/Tests/Writer/ODText/Part/ContentTest.php
similarity index 88%
rename from tests/PhpWord/Tests/Writer/ODText/ContentTest.php
rename to tests/PhpWord/Tests/Writer/ODText/Part/ContentTest.php
index e4f67102cd..ebbfe470b6 100644
--- a/tests/PhpWord/Tests/Writer/ODText/ContentTest.php
+++ b/tests/PhpWord/Tests/Writer/ODText/Part/ContentTest.php
@@ -6,16 +6,16 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\ODText;
+namespace PhpOffice\PhpWord\Tests\Writer\ODText\Part;
use PhpOffice\PhpWord\PhpWord;
-use PhpOffice\PhpWord\Writer\ODText\Content;
+use PhpOffice\PhpWord\Writer\ODText\Part\Content;
use PhpOffice\PhpWord\Tests\TestHelperDOCX;
/**
- * Test class for PhpOffice\PhpWord\Writer\ODText\Content
+ * Test class for PhpOffice\PhpWord\Writer\ODText\Part\Content
*
- * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\Content
+ * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\Part\Content
* @runTestsInSeparateProcesses
*/
class ContentTest extends \PHPUnit_Framework_TestCase
@@ -45,8 +45,8 @@ public function testConstructNoPhpWord()
*/
public function testWriteContent()
{
- $imageSrc = __DIR__ . "/../../_files/images/PhpWord.png";
- $objectSrc = __DIR__ . "/../../_files/documents/sheet.xls";
+ $imageSrc = __DIR__ . "/../../../_files/images/PhpWord.png";
+ $objectSrc = __DIR__ . "/../../../_files/documents/sheet.xls";
$expected = 'Expected';
$phpWord = new PhpWord();
diff --git a/tests/PhpWord/Tests/Writer/ODText/MetaTest.php b/tests/PhpWord/Tests/Writer/ODText/Part/MetaTest.php
similarity index 71%
rename from tests/PhpWord/Tests/Writer/ODText/MetaTest.php
rename to tests/PhpWord/Tests/Writer/ODText/Part/MetaTest.php
index 9be324116d..fde045793f 100644
--- a/tests/PhpWord/Tests/Writer/ODText/MetaTest.php
+++ b/tests/PhpWord/Tests/Writer/ODText/Part/MetaTest.php
@@ -6,14 +6,14 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\ODText;
+namespace PhpOffice\PhpWord\Tests\Writer\ODText\Part;
-use PhpOffice\PhpWord\Writer\ODText\Meta;
+use PhpOffice\PhpWord\Writer\ODText\Part\Meta;
/**
- * Test class for PhpOffice\PhpWord\Writer\ODText\Meta
+ * Test class for PhpOffice\PhpWord\Writer\ODText\Part\Meta
*
- * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\Meta
+ * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\Part\Meta
* @runTestsInSeparateProcesses
*/
class MetaTest extends \PHPUnit_Framework_TestCase
diff --git a/tests/PhpWord/Tests/Writer/ODText/StylesTest.php b/tests/PhpWord/Tests/Writer/ODText/Part/StylesTest.php
similarity index 71%
rename from tests/PhpWord/Tests/Writer/ODText/StylesTest.php
rename to tests/PhpWord/Tests/Writer/ODText/Part/StylesTest.php
index aa2ce0fae3..556bc80473 100644
--- a/tests/PhpWord/Tests/Writer/ODText/StylesTest.php
+++ b/tests/PhpWord/Tests/Writer/ODText/Part/StylesTest.php
@@ -6,14 +6,14 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\ODText;
+namespace PhpOffice\PhpWord\Tests\Writer\Part\ODText;
-use PhpOffice\PhpWord\Writer\ODText\Styles;
+use PhpOffice\PhpWord\Writer\ODText\Part\Styles;
/**
- * Test class for PhpOffice\PhpWord\Writer\ODText\Styles
+ * Test class for PhpOffice\PhpWord\Writer\ODText\Part\Styles
*
- * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\Styles
+ * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\Part\Styles
* @runTestsInSeparateProcesses
*/
class StylesTest extends \PHPUnit_Framework_TestCase
diff --git a/tests/PhpWord/Tests/Writer/ODTextTest.php b/tests/PhpWord/Tests/Writer/ODTextTest.php
index fad3a6c062..b02c3f9f19 100644
--- a/tests/PhpWord/Tests/Writer/ODTextTest.php
+++ b/tests/PhpWord/Tests/Writer/ODTextTest.php
@@ -30,7 +30,7 @@ public function testConstruct()
$this->assertEquals('./', $object->getDiskCachingDirectory());
foreach (array('Content', 'Manifest', 'Meta', 'Mimetype', 'Styles') as $part) {
$this->assertInstanceOf(
- "PhpOffice\\PhpWord\\Writer\\ODText\\{$part}",
+ "PhpOffice\\PhpWord\\Writer\\ODText\\Part\\{$part}",
$object->getWriterPart($part)
);
$this->assertInstanceOf(
diff --git a/tests/PhpWord/Tests/Writer/Word2007/DocumentTest.php b/tests/PhpWord/Tests/Writer/Word2007/DocumentTest.php
deleted file mode 100644
index 6b783dea5e..0000000000
--- a/tests/PhpWord/Tests/Writer/Word2007/DocumentTest.php
+++ /dev/null
@@ -1,141 +0,0 @@
-writeDocument();
- }
-
- /**
- * Write end section page numbering
- */
- public function testWriteEndSectionPageNumbering()
- {
- $phpWord = new PhpWord();
- $section = $phpWord->addSection();
- $settings = $section->getSettings();
- $settings->setLandscape();
- $settings->setPageNumberingStart(2);
- $settings->setBorderSize(240);
- $settings->setBreakType('nextPage');
-
- $doc = TestHelperDOCX::getDocument($phpWord);
- $element = $doc->getElement('/w:document/w:body/w:sectPr/w:pgNumType');
-
- $this->assertEquals(2, $element->getAttribute('w:start'));
- }
-
- /**
- * Write elements
- */
- public function testElements()
- {
- $objectSrc = __DIR__ . "/../../_files/documents/sheet.xls";
-
- $phpWord = new PhpWord();
- $phpWord->addTitleStyle(1, array('color' => '333333', 'bold'=>true));
- $phpWord->addTitleStyle(2, array('color'=>'666666'));
- $section = $phpWord->addSection();
- $section->addTOC();
- $section->addPageBreak();
- $section->addTitle('Title 1', 1);
- $section->addListItem('List Item 1', 0);
- $section->addListItem('List Item 2', 0);
- $section->addListItem('List Item 3', 0);
- $section = $phpWord->addSection();
- $section->addTitle('Title 2', 2);
- $section->addObject($objectSrc);
- $doc = TestHelperDOCX::getDocument($phpWord);
-
- // TOC
- $element = $doc->getElement('/w:document/w:body/w:p[1]/w:pPr/w:tabs/w:tab');
- $this->assertEquals('right', $element->getAttribute('w:val'));
- $this->assertEquals('dot', $element->getAttribute('w:leader'));
- $this->assertEquals(9062, $element->getAttribute('w:pos'));
-
- // Page break
- $element = $doc->getElement('/w:document/w:body/w:p[4]/w:r/w:br');
- $this->assertEquals('page', $element->getAttribute('w:type'));
-
- // Title
- $element = $doc->getElement('/w:document/w:body/w:p[5]/w:pPr/w:pStyle');
- $this->assertEquals('Heading1', $element->getAttribute('w:val'));
-
- // List item
- $element = $doc->getElement('/w:document/w:body/w:p[6]/w:pPr/w:numPr/w:numId');
- $this->assertEquals(3, $element->getAttribute('w:val'));
-
- // Object
- $element = $doc->getElement('/w:document/w:body/w:p[11]/w:r/w:object/o:OLEObject');
- $this->assertEquals('Embed', $element->getAttribute('Type'));
- }
-
- /**
- * Write element with some styles
- */
- public function testElementStyles()
- {
- $objectSrc = __DIR__ . "/../../_files/documents/sheet.xls";
-
- $phpWord = new PhpWord();
- $phpWord->addParagraphStyle('pStyle', array('align' => 'center')); // Style #1
- $phpWord->addFontStyle('fStyle', array('size' => '20')); // Style #2
- $phpWord->addTitleStyle(1, array('color' => '333333', 'bold' => true)); // Style #3
- $fontStyle = new Font('text', array('align' => 'center'));
- $section = $phpWord->addSection();
- $section->addListItem('List Item', 0, null, null, 'pStyle'); // Style #4
- $section->addObject($objectSrc, array('align' => 'center'));
- $section->addTOC($fontStyle);
- $section->addTitle('Title 1', 1);
- $section->addTOC('fStyle');
- $doc = TestHelperDOCX::getDocument($phpWord);
-
- // List item
- $element = $doc->getElement('/w:document/w:body/w:p[1]/w:pPr/w:numPr/w:numId');
- $this->assertEquals(4, $element->getAttribute('w:val'));
-
- // Object
- $element = $doc->getElement('/w:document/w:body/w:p[2]/w:r/w:object/o:OLEObject');
- $this->assertEquals('Embed', $element->getAttribute('Type'));
-
- // TOC
- $element = $doc->getElement('/w:document/w:body/w:p[3]/w:pPr/w:tabs/w:tab');
- $this->assertEquals('right', $element->getAttribute('w:val'));
- $this->assertEquals('dot', $element->getAttribute('w:leader'));
- $this->assertEquals(9062, $element->getAttribute('w:pos'));
- }
-}
diff --git a/tests/PhpWord/Tests/Writer/Word2007/AbstractWriterPartTest.php b/tests/PhpWord/Tests/Writer/Word2007/Part/AbstractPartTest.php
similarity index 71%
rename from tests/PhpWord/Tests/Writer/Word2007/AbstractWriterPartTest.php
rename to tests/PhpWord/Tests/Writer/Word2007/Part/AbstractPartTest.php
index 33051d6f33..81786b145a 100644
--- a/tests/PhpWord/Tests/Writer/Word2007/AbstractWriterPartTest.php
+++ b/tests/PhpWord/Tests/Writer/Word2007/Part/AbstractPartTest.php
@@ -6,16 +6,16 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\Word2007;
+namespace PhpOffice\PhpWord\Tests\Writer\Word2007\Part;
-use PhpOffice\PhpWord\Writer\Word2007\AbstractWriterPart;
+use PhpOffice\PhpWord\Writer\Word2007\Part\AbstractWriterPart;
use PhpOffice\PhpWord\Writer\Word2007;
use PhpWord\Tests\TestHelperDOCX;
/**
- * Test class for PhpOffice\PhpWord\Writer\Word2007\AbstractWriterPart
+ * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\AbstractWriterPart
*
- * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\AbstractWriterPart
+ * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\AbstractWriterPart
* @runTestsInSeparateProcesses
*/
class AbstractWriterPartTest extends \PHPUnit_Framework_TestCase
@@ -27,7 +27,7 @@ class AbstractWriterPartTest extends \PHPUnit_Framework_TestCase
public function testSetGetParentWriter()
{
$object = $this->getMockForAbstractClass(
- 'PhpOffice\\PhpWord\\Writer\\Word2007\\AbstractWriterPart'
+ 'PhpOffice\\PhpWord\\Writer\\Word2007\\Part\\AbstractPart'
);
$object->setParentWriter(new Word2007());
$this->assertEquals(
@@ -44,7 +44,7 @@ public function testSetGetParentWriter()
public function testSetGetParentWriterNull()
{
$object = $this->getMockForAbstractClass(
- 'PhpOffice\\PhpWord\\Writer\\Word2007\\AbstractWriterPart'
+ 'PhpOffice\\PhpWord\\Writer\\Word2007\\Part\\AbstractPart'
);
$object->getParentWriter();
}
diff --git a/tests/PhpWord/Tests/Writer/Word2007/DocPropsTest.php b/tests/PhpWord/Tests/Writer/Word2007/Part/DocPropsTest.php
similarity index 79%
rename from tests/PhpWord/Tests/Writer/Word2007/DocPropsTest.php
rename to tests/PhpWord/Tests/Writer/Word2007/Part/DocPropsTest.php
index e4a7d03e13..e6db4bf53a 100644
--- a/tests/PhpWord/Tests/Writer/Word2007/DocPropsTest.php
+++ b/tests/PhpWord/Tests/Writer/Word2007/Part/DocPropsTest.php
@@ -6,14 +6,14 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\Word2007;
+namespace PhpOffice\PhpWord\Tests\Writer\Word2007\Part;
-use PhpOffice\PhpWord\Writer\Word2007\DocProps;
+use PhpOffice\PhpWord\Writer\Word2007\Part\DocProps;
/**
- * Test class for PhpOffice\PhpWord\Writer\Word2007\DocProps
+ * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\DocProps
*
- * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\DocProps
+ * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\DocProps
* @runTestsInSeparateProcesses
*/
class DocPropsTest extends \PHPUnit_Framework_TestCase
diff --git a/tests/PhpWord/Tests/Writer/Word2007/BaseTest.php b/tests/PhpWord/Tests/Writer/Word2007/Part/DocumentTest.php
similarity index 73%
rename from tests/PhpWord/Tests/Writer/Word2007/BaseTest.php
rename to tests/PhpWord/Tests/Writer/Word2007/Part/DocumentTest.php
index ba01cb3e98..f84aff428b 100644
--- a/tests/PhpWord/Tests/Writer/Word2007/BaseTest.php
+++ b/tests/PhpWord/Tests/Writer/Word2007/Part/DocumentTest.php
@@ -6,18 +6,19 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\Word2007;
+namespace PhpOffice\PhpWord\Tests\Writer\Word2007\Part;
use PhpOffice\PhpWord\PhpWord;
+use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Tests\TestHelperDOCX;
+use PhpOffice\PhpWord\Writer\Word2007\Part\Document;
/**
- * Test class for PhpOffice\PhpWord\Writer\Word2007\Base
+ * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Document
*
- * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Base
* @runTestsInSeparateProcesses
*/
-class BaseTest extends \PHPUnit_Framework_TestCase
+class DocumentTest extends \PHPUnit_Framework_TestCase
{
/**
* Executed before each method of the class
@@ -27,6 +28,117 @@ public function tearDown()
TestHelperDOCX::clear();
}
+ /**
+ * Test write word/document.xm with no PhpWord
+ *
+ * @expectedException \PhpOffice\PhpWord\Exception\Exception
+ * @expectedExceptionMessage No PhpWord assigned.
+ */
+ public function testWriteDocumentNoPhpWord()
+ {
+ $object = new Document();
+ $object->writeDocument();
+ }
+
+ /**
+ * Write end section page numbering
+ */
+ public function testWriteEndSectionPageNumbering()
+ {
+ $phpWord = new PhpWord();
+ $section = $phpWord->addSection();
+ $settings = $section->getSettings();
+ $settings->setLandscape();
+ $settings->setPageNumberingStart(2);
+ $settings->setBorderSize(240);
+ $settings->setBreakType('nextPage');
+
+ $doc = TestHelperDOCX::getDocument($phpWord);
+ $element = $doc->getElement('/w:document/w:body/w:sectPr/w:pgNumType');
+
+ $this->assertEquals(2, $element->getAttribute('w:start'));
+ }
+
+ /**
+ * Write elements
+ */
+ public function testElements()
+ {
+ $objectSrc = __DIR__ . "/../../../_files/documents/sheet.xls";
+
+ $phpWord = new PhpWord();
+ $phpWord->addTitleStyle(1, array('color' => '333333', 'bold'=>true));
+ $phpWord->addTitleStyle(2, array('color'=>'666666'));
+ $section = $phpWord->addSection();
+ $section->addTOC();
+ $section->addPageBreak();
+ $section->addTitle('Title 1', 1);
+ $section->addListItem('List Item 1', 0);
+ $section->addListItem('List Item 2', 0);
+ $section->addListItem('List Item 3', 0);
+ $section = $phpWord->addSection();
+ $section->addTitle('Title 2', 2);
+ $section->addObject($objectSrc);
+ $doc = TestHelperDOCX::getDocument($phpWord);
+
+ // TOC
+ $element = $doc->getElement('/w:document/w:body/w:p[1]/w:pPr/w:tabs/w:tab');
+ $this->assertEquals('right', $element->getAttribute('w:val'));
+ $this->assertEquals('dot', $element->getAttribute('w:leader'));
+ $this->assertEquals(9062, $element->getAttribute('w:pos'));
+
+ // Page break
+ $element = $doc->getElement('/w:document/w:body/w:p[4]/w:r/w:br');
+ $this->assertEquals('page', $element->getAttribute('w:type'));
+
+ // Title
+ $element = $doc->getElement('/w:document/w:body/w:p[5]/w:pPr/w:pStyle');
+ $this->assertEquals('Heading1', $element->getAttribute('w:val'));
+
+ // List item
+ $element = $doc->getElement('/w:document/w:body/w:p[6]/w:pPr/w:numPr/w:numId');
+ $this->assertEquals(3, $element->getAttribute('w:val'));
+
+ // Object
+ $element = $doc->getElement('/w:document/w:body/w:p[11]/w:r/w:object/o:OLEObject');
+ $this->assertEquals('Embed', $element->getAttribute('Type'));
+ }
+
+ /**
+ * Write element with some styles
+ */
+ public function testElementStyles()
+ {
+ $objectSrc = __DIR__ . "/../../../_files/documents/sheet.xls";
+
+ $phpWord = new PhpWord();
+ $phpWord->addParagraphStyle('pStyle', array('align' => 'center')); // Style #1
+ $phpWord->addFontStyle('fStyle', array('size' => '20')); // Style #2
+ $phpWord->addTitleStyle(1, array('color' => '333333', 'bold' => true)); // Style #3
+ $fontStyle = new Font('text', array('align' => 'center'));
+ $section = $phpWord->addSection();
+ $section->addListItem('List Item', 0, null, null, 'pStyle'); // Style #4
+ $section->addObject($objectSrc, array('align' => 'center'));
+ $section->addTOC($fontStyle);
+ $section->addTitle('Title 1', 1);
+ $section->addTOC('fStyle');
+ $doc = TestHelperDOCX::getDocument($phpWord);
+
+ // List item
+ $element = $doc->getElement('/w:document/w:body/w:p[1]/w:pPr/w:numPr/w:numId');
+ $this->assertEquals(4, $element->getAttribute('w:val'));
+
+ // Object
+ $element = $doc->getElement('/w:document/w:body/w:p[2]/w:r/w:object/o:OLEObject');
+ $this->assertEquals('Embed', $element->getAttribute('Type'));
+
+ // TOC
+ $element = $doc->getElement('/w:document/w:body/w:p[3]/w:pPr/w:tabs/w:tab');
+ $this->assertEquals('right', $element->getAttribute('w:val'));
+ $this->assertEquals('dot', $element->getAttribute('w:leader'));
+ $this->assertEquals(9062, $element->getAttribute('w:pos'));
+ }
+
/**
* Test write text element
*/
@@ -55,7 +167,7 @@ public function testWriteTextRun()
{
$pStyle = 'pStyle';
$aStyle = array('align' => 'justify', 'spaceBefore' => 120, 'spaceAfter' => 120);
- $imageSrc = __DIR__ . "/../../_files/images/earth.jpg";
+ $imageSrc = __DIR__ . "/../../../_files/images/earth.jpg";
$phpWord = new PhpWord();
$phpWord->addParagraphStyle($pStyle, $aStyle);
@@ -156,10 +268,10 @@ public function testWriteImage()
$section = $phpWord->addSection();
foreach ($wraps as $wrap) {
$styles['wrappingStyle'] = $wrap;
- $section->addImage(__DIR__ . "/../../_files/images/earth.jpg", $styles);
+ $section->addImage(__DIR__ . "/../../../_files/images/earth.jpg", $styles);
}
- $archiveFile = realpath(__DIR__ . '/../../_files/documents/reader.docx');
+ $archiveFile = realpath(__DIR__ . '/../../../_files/documents/reader.docx');
$imageFile = 'word/media/image1.jpeg';
$source = 'zip://' . $archiveFile . '#' . $imageFile;
$section->addImage($source);
@@ -181,7 +293,7 @@ public function testWriteImage()
*/
public function testWriteWatermark()
{
- $imageSrc = __DIR__ . "/../../_files/images/earth.jpg";
+ $imageSrc = __DIR__ . "/../../../_files/images/earth.jpg";
$phpWord = new PhpWord();
$section = $phpWord->addSection();
@@ -305,8 +417,8 @@ public function testWriteTableStyle()
$tWidth = 120;
$rHeight = 120;
$cWidth = 120;
- $imageSrc = __DIR__ . "/../../_files/images/earth.jpg";
- $objectSrc = __DIR__ . "/../../_files/documents/sheet.xls";
+ $imageSrc = __DIR__ . "/../../../_files/images/earth.jpg";
+ $objectSrc = __DIR__ . "/../../../_files/documents/sheet.xls";
$tStyles["width"] = 50;
$tStyles["cellMarginTop"] = 120;
diff --git a/tests/PhpWord/Tests/Writer/Word2007/FooterTest.php b/tests/PhpWord/Tests/Writer/Word2007/Part/FooterTest.php
similarity index 78%
rename from tests/PhpWord/Tests/Writer/Word2007/FooterTest.php
rename to tests/PhpWord/Tests/Writer/Word2007/Part/FooterTest.php
index b1bff02b1c..513d4d2c20 100644
--- a/tests/PhpWord/Tests/Writer/Word2007/FooterTest.php
+++ b/tests/PhpWord/Tests/Writer/Word2007/Part/FooterTest.php
@@ -6,16 +6,16 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\Word2007;
+namespace PhpOffice\PhpWord\Tests\Writer\Word2007\Part;
-use PhpOffice\PhpWord\Writer\Word2007\Footer;
+use PhpOffice\PhpWord\Writer\Word2007\Part\Footer;
use PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord\Tests\TestHelperDOCX;
/**
- * Test class for PhpOffice\PhpWord\Writer\Word2007\Footer
+ * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Footer
*
- * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Footer
+ * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\Footer
* @runTestsInSeparateProcesses
*/
class FooterTest extends \PHPUnit_Framework_TestCase
@@ -27,7 +27,7 @@ class FooterTest extends \PHPUnit_Framework_TestCase
*/
public function testWriteFooter()
{
- $imageSrc = __DIR__ . "/../../_files/images/PhpWord.png";
+ $imageSrc = __DIR__ . "/../../../_files/images/PhpWord.png";
$container = new \PhpOffice\PhpWord\Element\Footer(1);
$container->addText('');
$container->addPreserveText('');
diff --git a/tests/PhpWord/Tests/Writer/Word2007/NotesTest.php b/tests/PhpWord/Tests/Writer/Word2007/Part/FootnotesTest.php
similarity index 73%
rename from tests/PhpWord/Tests/Writer/Word2007/NotesTest.php
rename to tests/PhpWord/Tests/Writer/Word2007/Part/FootnotesTest.php
index f883314aca..3f9aaae7e9 100644
--- a/tests/PhpWord/Tests/Writer/Word2007/NotesTest.php
+++ b/tests/PhpWord/Tests/Writer/Word2007/Part/FootnotesTest.php
@@ -6,17 +6,17 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\Word2007;
+namespace PhpOffice\PhpWord\Tests\Writer\Word2007\Part;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Tests\TestHelperDOCX;
/**
- * Test class for PhpOffice\PhpWord\Writer\Word2007\Notes
+ * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Notes
*
* @runTestsInSeparateProcesses
*/
-class NotesTest extends \PHPUnit_Framework_TestCase
+class FootnotesTest extends \PHPUnit_Framework_TestCase
{
/**
* Executed before each method of the class
@@ -39,10 +39,11 @@ public function testWriteFootnotes()
$footnote1->addText('Footnote');
$footnote1->addTextBreak();
$footnote1->addLink('http://google.com');
- $footnote2 = $section->addFootnote(array('align' => 'left'));
- $footnote2->addText('Footnote');
+ $footnote2 = $section->addEndnote(array('align' => 'left'));
+ $footnote2->addText('Endnote');
$doc = TestHelperDOCX::getDocument($phpWord);
$this->assertTrue($doc->elementExists("/w:document/w:body/w:p/w:r/w:footnoteReference"));
+ $this->assertTrue($doc->elementExists("/w:document/w:body/w:p/w:r/w:endnoteReference"));
}
}
diff --git a/tests/PhpWord/Tests/Writer/Word2007/HeaderTest.php b/tests/PhpWord/Tests/Writer/Word2007/Part/HeaderTest.php
similarity index 82%
rename from tests/PhpWord/Tests/Writer/Word2007/HeaderTest.php
rename to tests/PhpWord/Tests/Writer/Word2007/Part/HeaderTest.php
index b836b61941..c3ca6b6bb6 100644
--- a/tests/PhpWord/Tests/Writer/Word2007/HeaderTest.php
+++ b/tests/PhpWord/Tests/Writer/Word2007/Part/HeaderTest.php
@@ -6,14 +6,14 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\Word2007;
+namespace PhpOffice\PhpWord\Tests\Writer\Word2007\Part;
-use PhpOffice\PhpWord\Writer\Word2007\Header;
+use PhpOffice\PhpWord\Writer\Word2007\Part\Header;
use PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord\Tests\TestHelperDOCX;
/**
- * Test class for PhpOffice\PhpWord\Writer\Word2007\Header
+ * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Header
*
* @runTestsInSeparateProcesses
*/
@@ -24,7 +24,7 @@ class HeaderTest extends \PHPUnit_Framework_TestCase
*/
public function testWriteHeader()
{
- $imageSrc = __DIR__ . "/../../_files/images/PhpWord.png";
+ $imageSrc = __DIR__ . "/../../../_files/images/PhpWord.png";
$container = new \PhpOffice\PhpWord\Element\Header(1);
$container->addText('Test');
diff --git a/tests/PhpWord/Tests/Writer/Word2007/NumberingTest.php b/tests/PhpWord/Tests/Writer/Word2007/Part/NumberingTest.php
similarity index 86%
rename from tests/PhpWord/Tests/Writer/Word2007/NumberingTest.php
rename to tests/PhpWord/Tests/Writer/Word2007/Part/NumberingTest.php
index c6a6f7a75d..8d76f016d0 100644
--- a/tests/PhpWord/Tests/Writer/Word2007/NumberingTest.php
+++ b/tests/PhpWord/Tests/Writer/Word2007/Part/NumberingTest.php
@@ -6,18 +6,18 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\Word2007;
+namespace PhpOffice\PhpWord\Tests\Writer\Word2007\Part;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Style\Numbering as NumberingStyle;
use PhpOffice\PhpWord\Style\NumberingLevel;
use PhpOffice\PhpWord\Tests\TestHelperDOCX;
-use PhpOffice\PhpWord\Writer\Word2007\Numbering;
+use PhpOffice\PhpWord\Writer\Word2007\Part\Numbering;
/**
- * Test class for PhpOffice\PhpWord\Writer\Word2007\Numbering
+ * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Numbering
*
- * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Numbering
+ * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\Numbering
* @runTestsInSeparateProcesses
* @since 0.10.0
*/
diff --git a/tests/PhpWord/Tests/Writer/Word2007/StylesTest.php b/tests/PhpWord/Tests/Writer/Word2007/Part/StylesTest.php
similarity index 91%
rename from tests/PhpWord/Tests/Writer/Word2007/StylesTest.php
rename to tests/PhpWord/Tests/Writer/Word2007/Part/StylesTest.php
index 0d333601cc..42c32bbca2 100644
--- a/tests/PhpWord/Tests/Writer/Word2007/StylesTest.php
+++ b/tests/PhpWord/Tests/Writer/Word2007/Part/StylesTest.php
@@ -6,16 +6,16 @@
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
-namespace PhpOffice\PhpWord\Tests\Writer\Word2007;
+namespace PhpOffice\PhpWord\Tests\Writer\Word2007\Part;
use PhpOffice\PhpWord\PhpWord;
-use PhpOffice\PhpWord\Writer\Word2007\Styles;
+use PhpOffice\PhpWord\Writer\Word2007\Part\Styles;
use PhpOffice\PhpWord\Tests\TestHelperDOCX;
/**
- * Test class for PhpOffice\PhpWord\Writer\Word2007\Styles
+ * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Styles
*
- * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Styles
+ * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\Styles
* @runTestsInSeparateProcesses
*/
class StylesTest extends \PHPUnit_Framework_TestCase
diff --git a/tests/PhpWord/Tests/Writer/Word2007Test.php b/tests/PhpWord/Tests/Writer/Word2007Test.php
index ce850c2149..74f3b1fda0 100644
--- a/tests/PhpWord/Tests/Writer/Word2007Test.php
+++ b/tests/PhpWord/Tests/Writer/Word2007Test.php
@@ -45,12 +45,12 @@ public function testConstruct()
'WebSettings' => 'WebSettings',
'Header' => 'Header',
'Footer' => 'Footer',
- 'Footnotes' => 'Notes',
- 'Endnotes' => 'Notes',
+ 'Footnotes' => 'Footnotes',
+ 'Endnotes' => 'Footnotes',
);
foreach ($writerParts as $part => $type) {
$this->assertInstanceOf(
- "PhpOffice\\PhpWord\\Writer\\Word2007\\{$type}",
+ "PhpOffice\\PhpWord\\Writer\\Word2007\\Part\\{$type}",
$object->getWriterPart($part)
);
$this->assertInstanceOf(