From f7c07c2802f291d35d2a105389ccb0ee2b5b3210 Mon Sep 17 00:00:00 2001 From: Lars Feyerabend Date: Tue, 23 Sep 2014 11:47:45 +0200 Subject: [PATCH 001/115] PHPExcel calls not compatible with namespacing The non-namespaced PHPExcel components need to be referenced with a leading slash, otherwise the current namespace (PhpOffice\PhpPowerpoint\Writer\PowerPoint2007) will be searched first. --- .../Writer/PowerPoint2007/Chart.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 913a93d38..d8f4560d9 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -220,7 +220,7 @@ public function writeSpreadsheet(PHPPowerPoint $presentation, $chart, $tempName) } // Create new spreadsheet - $workbook = new PHPExcel(); + $workbook = new \PHPExcel(); // Set properties $title = $chart->getTitle()->getText(); @@ -255,7 +255,7 @@ public function writeSpreadsheet(PHPPowerPoint $presentation, $chart, $tempName) } // Save to string - $writer = PHPExcel_IOFactory::createWriter($workbook, 'Excel2007'); + $writer = \PHPExcel_IOFactory::createWriter($workbook, 'Excel2007'); $writer->save($tempName); // Load file in memory @@ -932,7 +932,7 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include // c:tx $objWriter->startElement('c:tx'); - $coords = ($includeSheet ? 'Sheet1!$' . PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); $this->writeSingleValueOrReference($objWriter, $includeSheet, $series->getTitle(), $coords); $objWriter->endElement(); @@ -1058,7 +1058,7 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include // c:val $objWriter->startElement('c:val'); - $coords = ($includeSheet ? 'Sheet1!$' . PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisYData, $coords); $objWriter->endElement(); @@ -1131,7 +1131,7 @@ protected function writeTypePie3D(XMLWriter $objWriter, Pie3D $subject, $include // c:tx $objWriter->startElement('c:tx'); - $coords = ($includeSheet ? 'Sheet1!$' . PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); $this->writeSingleValueOrReference($objWriter, $includeSheet, $series->getTitle(), $coords); $objWriter->endElement(); @@ -1257,7 +1257,7 @@ protected function writeTypePie3D(XMLWriter $objWriter, Pie3D $subject, $include // c:val $objWriter->startElement('c:val'); - $coords = ($includeSheet ? 'Sheet1!$' . PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisYData, $coords); $objWriter->endElement(); @@ -1310,7 +1310,7 @@ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, $includeSh // c:tx $objWriter->startElement('c:tx'); - $coords = ($includeSheet ? 'Sheet1!$' . PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); $this->writeSingleValueOrReference($objWriter, $includeSheet, $series->getTitle(), $coords); $objWriter->endElement(); @@ -1416,7 +1416,7 @@ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, $includeSh // c:val $objWriter->startElement('c:val'); - $coords = ($includeSheet ? 'Sheet1!$' . PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisYData, $coords); $objWriter->endElement(); @@ -1494,7 +1494,7 @@ protected function writeTypeScatter(XMLWriter $objWriter, Scatter $subject, $inc // c:tx $objWriter->startElement('c:tx'); - $coords = ($includeSheet ? 'Sheet1!$' . PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); $this->writeSingleValueOrReference($objWriter, $includeSheet, $series->getTitle(), $coords); $objWriter->endElement(); @@ -1614,7 +1614,7 @@ protected function writeTypeScatter(XMLWriter $objWriter, Scatter $subject, $inc // c:yVal $objWriter->startElement('c:yVal'); - $coords = ($includeSheet ? 'Sheet1!$' . PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisYData, $coords); $objWriter->endElement(); From a67b1870b876c909c47a4e202a298ea9de98c15b Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 29 Sep 2014 15:06:43 +0200 Subject: [PATCH 002/115] Allows to set a bar direction for barcharts --- src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php b/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php index 4fa6b546b..004c4c80e 100644 --- a/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php +++ b/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php @@ -24,6 +24,39 @@ */ class Bar3D extends AbstractType implements ComparableInterface { + /** Orientation of bars */ + const DIRECTION_VERTICAL = 'col'; + const DIRECTION_HORIZONTAL = 'bar'; + + /** + * Orientation of bars + * + * @var string + */ + protected $barDirection = self::DIRECTION_VERTICAL; + + /** + * Set bar orientation + * + * @param string $value + * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D + */ + public function setBarDirection($value = self::DIRECTION_VERTICAL) + { + $this->barDirection = $value; + return $this; + } + + /** + * Get orientation + * + * @return string + */ + public function getBarDirection() + { + return $this->barDirection; + } + /** * Get hash code * From bdef144bda1d20844b9183f0b88b3f2279845a85 Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 29 Sep 2014 15:10:14 +0200 Subject: [PATCH 003/115] Allows to export horizontal bar charts to pptx --- src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 913a93d38..ac41d2eaa 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -906,7 +906,7 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include // c:barDir $objWriter->startElement('c:barDir'); - $objWriter->writeAttribute('val', 'col'); + $objWriter->writeAttribute('val', $subject->getBarDirection()); $objWriter->endElement(); // c:grouping From 6ce8b049580938aa529527de09f2a89d19e0d3de Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 6 Oct 2014 15:00:43 +0200 Subject: [PATCH 004/115] FIXED : #51 - PSR-0 via composer broken --- CHANGELOG.md | 9 +++++++++ composer.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9d1b6df..a1a72c0d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.4.0 - NOT RELEASED + +### Features + +### Bugfix +- PSR-0 via composer broken - @Progi1984 GH-51 + +### Miscellaneous + ## 0.3.0 - 2014-09-22 ### Features diff --git a/composer.json b/composer.json index 62d1c87e1..7cb505fdf 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "autoload": { "psr-0": { - "PHPPowerPoint": "src/" + "PhpOffice\\PhpPowerpoint\\": "src/PhpPowerpoint/" }, "psr-4": { "PhpOffice\\PhpPowerpoint\\": "src/PhpPowerpoint/" From 57dbef5bd49ab48a9d77dfaab54e72e916c2ad17 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 7 Oct 2014 10:19:13 +0200 Subject: [PATCH 005/115] FIXED : #51 - PSR-0 via composer broken --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index 7cb505fdf..71e0c8539 100644 --- a/composer.json +++ b/composer.json @@ -36,9 +36,6 @@ "ext-gd2": "Required to add images" }, "autoload": { - "psr-0": { - "PhpOffice\\PhpPowerpoint\\": "src/PhpPowerpoint/" - }, "psr-4": { "PhpOffice\\PhpPowerpoint\\": "src/PhpPowerpoint/" } From 5f569d9f19ef12f8aa2ace8a81c38065365b8f8a Mon Sep 17 00:00:00 2001 From: James Gordon Date: Thu, 23 Oct 2014 11:28:25 +1100 Subject: [PATCH 006/115] Small correction to PHP 5.3 history --- docs/faq.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.rst b/docs/faq.rst index 59c7629a9..55139fa54 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -16,5 +16,5 @@ I’ve been running PHPPowerPoint from CodePlex flawlessly, but I can’t use th PHPPowerPoint requires PHP 5.3+ since 0.2, while PHPPowerPoint 0.1 from CodePlex can run with PHP 5.2. There’s a lot of new features that we can get from -PHP 5.3 and it’s been around since 2014! You should upgrade your PHP +PHP 5.3 and it’s been around since 2009! You should upgrade your PHP version to use PHPPowerPoint 0.2+. From 38b49add00fd514ec7dbc3e833a63e01058b5617 Mon Sep 17 00:00:00 2001 From: James Gordon Date: Thu, 23 Oct 2014 12:21:25 +1100 Subject: [PATCH 007/115] Include some additional information on resolving autoloading issues --- docs/faq.rst | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/faq.rst b/docs/faq.rst index 55139fa54..cd792aa07 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -18,3 +18,32 @@ PHPPowerPoint requires PHP 5.3+ since 0.2, while PHPPowerPoint 0.1 from CodePlex can run with PHP 5.2. There’s a lot of new features that we can get from PHP 5.3 and it’s been around since 2009! You should upgrade your PHP version to use PHPPowerPoint 0.2+. + +Why am I getting a class not found error? +------------------------------------------------------- + +If you have followed the instructions for either adding this package to your +`composer.json` or registering the autoloader, then perhaps you forgot to +include a `use` statement for the class(es) you are trying to access. + +Here's an example that allows you to refer to the `MemoryDrawing` class +without having to specify the full class name in your code: + +``` +use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing as MemoryDrawing; +``` + +If you *have* followed the installation instructions and you *have* added +the necessary `use` statements to your code, then maybe you are still +referencing the PHPPowerPoint classes using the old PEAR/PSR-0 approach. +The 0.1 approach to naming classes used verbose class names to avoid +namespace collisions with other libraries. For example, the `MemoryDrawing` +class was actually called `PHPPowerPoint_Shape_MemoryDrawing`. Version +0.2 of the library renamed the classes, moved to a namespaced approach +and switched to the PSR-0 autoloader. Interestingly, old code that was +still referencing classes using the verbose approach *still worked* (which +was pretty cool!). This is because the PSR-0 autoloader was correctly +translating the verbose class references into the correct file name and +location. However, `PHPPowerPoint` now relies exclusively on the PSR-4 +autoloader, so old code that may have been referencing the classes with +the verbose class names will need to be updated accordingly. \ No newline at end of file From 1c9f0557164c0db092b76718003552b15b4b99d8 Mon Sep 17 00:00:00 2001 From: James Gordon Date: Thu, 23 Oct 2014 12:46:22 +1100 Subject: [PATCH 008/115] Clean up the formatting --- docs/faq.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index cd792aa07..36eeec6fc 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -23,27 +23,27 @@ Why am I getting a class not found error? ------------------------------------------------------- If you have followed the instructions for either adding this package to your -`composer.json` or registering the autoloader, then perhaps you forgot to -include a `use` statement for the class(es) you are trying to access. +``composer.json`` or registering the autoloader, then perhaps you forgot to +include a ``use`` statement for the class(es) you are trying to access. -Here's an example that allows you to refer to the `MemoryDrawing` class +Here's an example that allows you to refer to the ``MemoryDrawing`` class without having to specify the full class name in your code: -``` -use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing as MemoryDrawing; -``` +.. code-block:: php + + use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing as MemoryDrawing; If you *have* followed the installation instructions and you *have* added -the necessary `use` statements to your code, then maybe you are still -referencing the PHPPowerPoint classes using the old PEAR/PSR-0 approach. +the necessary ``use`` statements to your code, then maybe you are still +referencing the ``PHPPowerPoint`` classes using the old PEAR/PSR-0 approach. The 0.1 approach to naming classes used verbose class names to avoid -namespace collisions with other libraries. For example, the `MemoryDrawing` -class was actually called `PHPPowerPoint_Shape_MemoryDrawing`. Version +namespace collisions with other libraries. For example, the ``MemoryDrawing`` +class was actually called ``PHPPowerPoint_Shape_MemoryDrawing``. Version 0.2 of the library renamed the classes, moved to a namespaced approach and switched to the PSR-0 autoloader. Interestingly, old code that was still referencing classes using the verbose approach *still worked* (which was pretty cool!). This is because the PSR-0 autoloader was correctly translating the verbose class references into the correct file name and -location. However, `PHPPowerPoint` now relies exclusively on the PSR-4 +location. However, ``PHPPowerPoint`` now relies exclusively on the PSR-4 autoloader, so old code that may have been referencing the classes with -the verbose class names will need to be updated accordingly. \ No newline at end of file +the verbose class names will need to be updated accordingly. From 3f995c4ba4cb935390a494252ac73cb7377b2437 Mon Sep 17 00:00:00 2001 From: Joshua Doss Date: Wed, 3 Dec 2014 16:54:08 +0000 Subject: [PATCH 009/115] Added support for Groups in PowerPoint. - Also supports correct extent and offset calculations in PPT Slides. --- CHANGELOG.md | 6 + samples/Sample_09_Group.php | 57 ++++ src/PhpPowerpoint/AbstractShape.php | 87 +++--- src/PhpPowerpoint/GeometryCalculator.php | 108 +++++++ src/PhpPowerpoint/Shape/Group.php | 263 ++++++++++++++++++ src/PhpPowerpoint/ShapeContainerInterface.php | 67 +++++ src/PhpPowerpoint/Slide.php | 110 +++++++- .../Writer/PowerPoint2007/Slide.php | 115 +++++++- .../PhpPowerpoint/Tests/AbstractShapeTest.php | 2 +- tests/PhpPowerpoint/Tests/Shape/GroupTest.php | 92 ++++++ 10 files changed, 861 insertions(+), 46 deletions(-) create mode 100644 samples/Sample_09_Group.php create mode 100644 src/PhpPowerpoint/GeometryCalculator.php create mode 100644 src/PhpPowerpoint/Shape/Group.php create mode 100644 src/PhpPowerpoint/ShapeContainerInterface.php create mode 100644 tests/PhpPowerpoint/Tests/Shape/GroupTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9d1b6df..f5e23ace6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## (New Work) + +### Features +- Added support for grouping shapes together in a Group - @Pr0phet +- Added support for calculating the offset and extent on a Slide. - @Pr0phet + ## 0.3.0 - 2014-09-22 ### Features diff --git a/samples/Sample_09_Group.php b/samples/Sample_09_Group.php new file mode 100644 index 000000000..fd75ed7b0 --- /dev/null +++ b/samples/Sample_09_Group.php @@ -0,0 +1,57 @@ +getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPowerPoint Team') + ->setTitle('Sample 01 Title') + ->setSubject('Sample 01 Subject') + ->setDescription('Sample 01 Description') + ->setKeywords('office 2007 openxml libreoffice odt php') + ->setCategory('Sample Category'); + +// Create slide +echo date('H:i:s') . ' Create slide'.EOL; +$currentGroup = $objPHPPowerPoint->getActiveSlide()->createGroup(); + +// Create a shape (drawing) +echo date('H:i:s') . ' Create a shape (drawing)'.EOL; +$shape = $currentGroup->createDrawingShape(); +$shape->setName('PHPPowerPoint logo') + ->setDescription('PHPPowerPoint logo') + ->setPath('./resources/phppowerpoint_logo.gif') + ->setHeight(36) + ->setOffsetX(10) + ->setOffsetY(10); +$shape->getShadow()->setVisible(true) + ->setDirection(45) + ->setDistance(10); + +// Create a shape (text) +echo date('H:i:s') . ' Create a shape (rich text)'.EOL; +$shape = $currentGroup->createRichTextShape() + ->setHeight(300) + ->setWidth(600) + ->setOffsetX(170) + ->setOffsetY(180); +$shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); +$textRun = $shape->createTextRun('Thank you for using PHPPowerPoint!'); +$textRun->getFont()->setBold(true) + ->setSize(60) + ->setColor( new Color( 'FFE06B20' ) ); + +// Save file +echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/src/PhpPowerpoint/AbstractShape.php b/src/PhpPowerpoint/AbstractShape.php index 97107cf3a..c007d5765 100644 --- a/src/PhpPowerpoint/AbstractShape.php +++ b/src/PhpPowerpoint/AbstractShape.php @@ -27,11 +27,11 @@ abstract class AbstractShape implements ComparableInterface { /** - * Slide + * Container * - * @var \PhpOffice\PhpPowerpoint\Slide + * @var \PhpOffice\PhpPowerpoint\ShapeContainerInterface */ - protected $slide; + protected $container; /** * Offset X @@ -109,68 +109,93 @@ abstract class AbstractShape implements ComparableInterface public function __construct() { // Initialise values - $this->slide = null; - $this->offsetX = 0; - $this->offsetY = 0; - $this->width = 0; - $this->height = 0; - $this->rotation = 0; - $this->fill = new Style\Fill(); - $this->border = new Style\Border(); - $this->shadow = new Style\Shadow(); + $this->container = null; + $this->offsetX = 0; + $this->offsetY = 0; + $this->width = 0; + $this->height = 0; + $this->rotation = 0; + $this->fill = new Style\Fill(); + $this->border = new Style\Border(); + $this->shadow = new Style\Shadow(); $this->border->setLineStyle(Style\Border::LINE_NONE); } /** - * Get Slide + * Get Container, Slide or Group * - * @return \PhpOffice\PhpPowerpoint\Slide + * @return \PhpOffice\PhpPowerpoint\Container */ - public function getSlide() + public function getContainer() { - return $this->slide; + return $this->container; } /** - * Set Slide + * Set Container, Slide or Group * - * @param \PhpOffice\PhpPowerpoint\Slide $pValue + * @param \PhpOffice\PhpPowerpoint\ShapeContainerInterface $pValue * @param bool $pOverrideOld If a Slide has already been assigned, overwrite it and remove image from old Slide? * @throws \Exception * @return self */ - public function setSlide(Slide $pValue = null, $pOverrideOld = false) + public function setContainer(ShapeContainerInterface $pValue = null, $pOverrideOld = false) { - if (is_null($this->slide)) { - // Add drawing to \PhpOffice\PhpPowerpoint\Slide - $this->slide = $pValue; - if (!is_null($this->slide)) { - $this->slide->getShapeCollection()->append($this); + if (is_null($this->container)) { + // Add drawing to \PhpOffice\PhpPowerpoint\ShapeContainerInterface + $this->container = $pValue; + if (!is_null($this->container)) { + $this->container->getShapeCollection()->append($this); } } else { if ($pOverrideOld) { - // Remove drawing from old \PhpOffice\PhpPowerpoint\Slide - $iterator = $this->slide->getShapeCollection()->getIterator(); + // Remove drawing from old \PhpOffice\PhpPowerpoint\ShapeContainerInterface + $iterator = $this->container->getShapeCollection()->getIterator(); while ($iterator->valid()) { if ($iterator->current()->getHashCode() == $this->getHashCode()) { - $this->slide->getShapeCollection()->offsetUnset($iterator->key()); - $this->slide = null; + $this->container->getShapeCollection()->offsetUnset($iterator->key()); + $this->container = null; break; } } // Set new \PhpOffice\PhpPowerpoint\Slide - $this->setSlide($pValue); + $this->setContainer($pValue); } else { - throw new \Exception("A \PhpOffice\PhpPowerpoint\Slide has already been assigned. Shapes can only exist on one \PhpOffice\PhpPowerpoint\Slide."); + throw new \Exception("A \PhpOffice\PhpPowerpoint\ShapeContainerInterface has already been assigned. Shapes can only exist on one \PhpOffice\PhpPowerpoint\ShapeContainerInterface."); } } return $this; } + /** + * Get Slide + * + * @return \PhpOffice\PhpPowerpoint\Container + * @deprecated + */ + public function getSlide() + { + return $this->getContainer(); + } + + /** + * Set Slide + * + * @param \PhpOffice\PhpPowerpoint\Slide $pValue + * @param bool $pOverrideOld If a Slide has already been assigned, overwrite it and remove image from old Slide? + * @throws \Exception + * @return self + * @deprecated + */ + public function setSlide(Slide $pValue = null, $pOverrideOld = false) + { + return $this->setContainer($pValue, $pOverrideOld); + } + /** * Get OffsetX * @@ -395,7 +420,7 @@ public function setHyperlink(Hyperlink $pHyperlink = null) */ public function getHashCode() { - return md5((is_object($this->slide)?$this->slide->getHashCode():'') . $this->offsetX . $this->offsetY . $this->width . $this->height . $this->rotation . $this->getFill()->getHashCode() . $this->shadow->getHashCode() . (is_null($this->hyperlink) ? '' : $this->hyperlink->getHashCode()) . __CLASS__); + return md5((is_object($this->container)?$this->container->getHashCode():'') . $this->offsetX . $this->offsetY . $this->width . $this->height . $this->rotation . $this->getFill()->getHashCode() . $this->shadow->getHashCode() . (is_null($this->hyperlink) ? '' : $this->hyperlink->getHashCode()) . __CLASS__); } /** diff --git a/src/PhpPowerpoint/GeometryCalculator.php b/src/PhpPowerpoint/GeometryCalculator.php new file mode 100644 index 000000000..67b8d6f3b --- /dev/null +++ b/src/PhpPowerpoint/GeometryCalculator.php @@ -0,0 +1,108 @@ + 0, self::Y => 0); + + if ($container !== null && count($container->getShapeCollection()) != 0) + { + $shapes = $container->getShapeCollection(); + if ($shapes[0] !== null) + { + $offsets[self::X] = $shapes[0]->getOffsetX(); + $offsets[self::Y] = $shapes[0]->getOffsetY(); + } + + foreach ($shapes as $shape) + { + if ($shape !== null) + { + if ($shape->getOffsetX() < $offsets[self::X]) + { + $offsets[self::X] = $shape->getOffsetX(); + } + + if ($shape->getOffsetY() < $offsets[self::Y]) + { + $offsets[self::Y] = $shape->getOffsetY(); + } + } + } + } + + return $offsets; + } + + /** + * Calculate X and Y extents for a set of shapes within a container such as a slide or group. + * + * @param \PhpOffice\PhpPowerpoint\ShapeContainerInterface $container + * @return array + */ + public static function calculateExtents(ShapeContainerInterface $container) + { + $offsets = array(self::X => 0, self::Y => 0); + + if ($container !== null && count($container->getShapeCollection()) != 0) + { + $shapes = $container->getShapeCollection(); + if ($shapes[0] !== null) + { + $extents[self::X] = $shapes[0]->getOffsetX() + $shapes[0]->getWidth(); + $extents[self::Y] = $shapes[0]->getOffsetY() + $shapes[0]->getHeight(); + } + + foreach ($shapes as $shape) + { + if ($shape !== null) + { + $extentX = $shape->getOffsetX() + $shape->getWidth(); + $extentY = $shape->getOffsetY() + $shape->getHeight(); + + if ($extentX > $extents[self::X]) + { + $extents[self::X] = $extentX; + } + + if ($extentY > $extents[self::Y]) + { + $extents[self::Y] = $extentY; + } + } + } + } + + return $extents; + } +} diff --git a/src/PhpPowerpoint/Shape/Group.php b/src/PhpPowerpoint/Shape/Group.php new file mode 100644 index 000000000..81dec7750 --- /dev/null +++ b/src/PhpPowerpoint/Shape/Group.php @@ -0,0 +1,263 @@ +offsetX = null; + $this->offsetY = null; + + // Shape collection + $this->shapeCollection = new \ArrayObject(); + } + + /** + * Get collection of shapes + * + * @return \PhpOffice\PhpPowerpoint\AbstractShape[] + */ + public function getShapeCollection() + { + return $this->shapeCollection; + } + + /** + * Add shape to slide + * + * @param \PhpOffice\PhpPowerpoint\AbstractShape $shape + * @return \PhpOffice\PhpPowerpoint\AbstractShape + */ + public function addShape(AbstractShape $shape) + { + $shape->setContainer($this); + + return $shape; + } + + /** + * Get X Offset + * + * @return int + */ + public function getOffsetX() + { + if ($this->offsetX === null) + { + $offsets = GeometryCalculator::calculateOffsets($this); + $this->offsetX = $offsets[GeometryCalculator::X]; + $this->offsetY = $offsets[GeometryCalculator::Y]; + } + + return $this->offsetX; + } + + /** + * Ignores setting the X Offset, preserving the default behavior. + * + * @param int $pValue + * @return self + */ + public function setOffsetX($pValue = 0) + { + return $this; + } + + /** + * Get Y Offset + * + * @return int + */ + public function getOffsetY() + { + if ($this->offsetY === null) + { + $offsets = GeometryCalculator::calculateOffsets($this); + $this->offsetX = $offsets[GeometryCalculator::X]; + $this->offsetY = $offsets[GeometryCalculator::Y]; + } + return $this->offsetY; + } + + /** + * Ignores setting the Y Offset, preserving the default behavior. + * + * @param int $pValue + * @return self + */ + public function setOffsetY($pValue = 0) + { + return $this; + } + + /** + * Get X Extent + * + * @return int + */ + public function getExtentX() + { + if ($this->extentX === null) + { + $extents = GeometryCalculator::calculateExtents($this); + $this->extentX = $extents[GeometryCalculator::X]; + $this->extentY = $extents[GeometryCalculator::Y]; + } + return $this->extentX; + } + + /** + * Get Y Extent + * + * @return int + */ + public function getExtentY() + { + if ($this->extentY === null) + { + $extents = GeometryCalculator::calculateExtents($this); + $this->extentX = $extents[GeometryCalculator::X]; + $this->extentY = $extents[GeometryCalculator::Y]; + } + return $this->extentY; + } + + /** + * Ignores setting the width, preserving the default behavior. + * + * @param int $pValue + * @return self + */ + public function setWidth($pValue = 0) + { + return $this; + } + + /** + * Ignores setting the height, preserving the default behavior. + * + * @param int $pValue + * @return self + */ + public function setHeight($pValue = 0) + { + return $this; + } + + /** + * Create rich text shape + * + * @return \PhpOffice\PhpPowerpoint\Shape\RichText + */ + public function createRichTextShape() + { + $shape = new RichText(); + $this->addShape($shape); + + return $shape; + } + + /** + * Create line shape + * + * @param int $fromX Starting point x offset + * @param int $fromY Starting point y offset + * @param int $toX Ending point x offset + * @param int $toY Ending point y offset + * @return \PhpOffice\PhpPowerpoint\Shape\Line + */ + public function createLineShape($fromX, $fromY, $toX, $toY) + { + $shape = new Line($fromX, $fromY, $toX, $toY); + $this->addShape($shape); + + return $shape; + } + + /** + * Create chart shape + * + * @return \PhpOffice\PhpPowerpoint\Shape\Chart + */ + public function createChartShape() + { + $shape = new Chart(); + $this->addShape($shape); + + return $shape; + } + + /** + * Create drawing shape + * + * @return \PhpOffice\PhpPowerpoint\Shape\Drawing + */ + public function createDrawingShape() + { + $shape = new Drawing(); + $this->addShape($shape); + + return $shape; + } + + /** + * Create table shape + * + * @param int $columns Number of columns + * @return \PhpOffice\PhpPowerpoint\Shape\Table + */ + public function createTableShape($columns = 1) + { + $shape = new Table($columns); + $this->addShape($shape); + + return $shape; + } +} \ No newline at end of file diff --git a/src/PhpPowerpoint/ShapeContainerInterface.php b/src/PhpPowerpoint/ShapeContainerInterface.php new file mode 100644 index 000000000..82d411042 --- /dev/null +++ b/src/PhpPowerpoint/ShapeContainerInterface.php @@ -0,0 +1,67 @@ +setSlide($this); + $shape->setContainer($this); return $shape; } @@ -182,6 +212,18 @@ public function createTableShape($columns = 1) return $shape; } + + /** + * Creates a group within this slide + * + * @return \PhpOffice\PhpPowerpoint\Shape\Group + */ + public function createGroup() { + $shape = new Group(); + $this->addShape($shape); + + return $shape; + } /** * Get parent @@ -300,4 +342,68 @@ public function copy() return $copied; } + + /** + * Get X Offset + * + * @return int + */ + public function getOffsetX() + { + if ($this->offsetX === null) + { + $offsets = GeometryCalculator::calculateOffsets($this); + $this->offsetX = $offsets[GeometryCalculator::X]; + $this->offsetY = $offsets[GeometryCalculator::Y]; + } + return $this->offsetX; + } + + /** + * Get Y Offset + * + * @return int + */ + public function getOffsetY() + { + if ($this->offsetY === null) + { + $offsets = GeometryCalculator::calculateOffsets($this); + $this->offsetX = $offsets[GeometryCalculator::X]; + $this->offsetY = $offsets[GeometryCalculator::Y]; + } + return $this->offsetY; + } + + /** + * Get X Extent + * + * @return int + */ + public function getExtentX() + { + if ($this->extentX === null) + { + $extents = GeometryCalculator::calculateExtents($this); + $this->extentX = $extents[GeometryCalculator::X]; + $this->extentY = $extents[GeometryCalculator::Y]; + } + return $this->extentX; + } + + /** + * Get Y Extent + * + * @return int + */ + public function getExtentY() + { + if ($this->extentY === null) + { + $extents = GeometryCalculator::calculateExtents($this); + $this->extentX = $extents[GeometryCalculator::X]; + $this->extentY = $extents[GeometryCalculator::Y]; + } + return $this->extentY; + } } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 17d9a6d6d..7b64f8a99 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -19,6 +19,7 @@ use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; use PhpOffice\PhpPowerpoint\Shape\Chart as ShapeChart; +use PhpOffice\PhpPowerpoint\Shape\Group; use PhpOffice\PhpPowerpoint\Shape\Line; use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\Shape\RichText\BreakElement; @@ -97,27 +98,27 @@ public function writeSlide(SlideElement $pSlide = null) // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', '0'); - $objWriter->writeAttribute('y', '0'); - $objWriter->endElement(); + $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($pSlide->getOffsetX())); + $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($pSlide->getOffsetY())); + $objWriter->endElement(); // a:off // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', '0'); - $objWriter->writeAttribute('cy', '0'); - $objWriter->endElement(); + $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($pSlide->getExtentX())); + $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($pSlide->getExtentY())); + $objWriter->endElement(); // a:ext // a:chOff $objWriter->startElement('a:chOff'); - $objWriter->writeAttribute('x', '0'); - $objWriter->writeAttribute('y', '0'); - $objWriter->endElement(); + $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($pSlide->getOffsetX())); + $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($pSlide->getOffsetY())); + $objWriter->endElement(); // a:chOff // a:chExt $objWriter->startElement('a:chExt'); - $objWriter->writeAttribute('cx', '0'); - $objWriter->writeAttribute('cy', '0'); - $objWriter->endElement(); + $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($pSlide->getExtentX())); + $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($pSlide->getExtentY())); + $objWriter->endElement(); // a:chExt $objWriter->endElement(); @@ -141,6 +142,8 @@ public function writeSlide(SlideElement $pSlide = null) $this->writeShapeChart($objWriter, $shape, $shapeId); } elseif ($shape instanceof AbstractDrawing) { $this->writeShapePic($objWriter, $shape, $shapeId); + } elseif ($shape instanceof Group) { + $this->writeShapeGroup($objWriter, $shape, $shapeId); } } @@ -163,6 +166,94 @@ public function writeSlide(SlideElement $pSlide = null) return $objWriter->getData(); } + /** + * Write group + * + * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\PhpPowerpoint\Shape\Group $shape + * @param int $shapeId + */ + private function writeShapeGroup(XMLWriter $objWriter, Group $group, &$shapeId) + { + // p:grpSp + $objWriter->startElement('p:grpSp'); + + // p:nvGrpSpPr + $objWriter->startElement('p:nvGrpSpPr'); + + // p:cNvPr + $objWriter->startElement('p:cNvPr'); + $objWriter->writeAttribute('name', 'Group '.$shapeId++); + $objWriter->writeAttribute('id', $shapeId); + $objWriter->endElement(); // p:cNvPr + // NOTE: Re: $shapeId This seems to be how PowerPoint 2010 does business. + + // p:cNvGrpSpPr + $objWriter->writeElement('p:cNvGrpSpPr', null); + + // p:nvPr + $objWriter->writeElement('p:nvPr', null); + + $objWriter->endElement(); // p:nvGrpSpPr + + // p:grpSpPr + $objWriter->startElement('p:grpSpPr'); + + // a:xfrm + $objWriter->startElement('a:xfrm'); + + // a:off + $objWriter->startElement('a:off'); + $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($group->getOffsetX())); + $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($group->getOffsetY())); + $objWriter->endElement(); // a:off + + // a:ext + $objWriter->startElement('a:ext'); + $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($group->getExtentX())); + $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($group->getExtentY())); + $objWriter->endElement(); // a:ext + + // a:chOff + $objWriter->startElement('a:chOff'); + $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($group->getOffsetX())); + $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($group->getOffsetY())); + $objWriter->endElement(); // a:chOff + + // a:chExt + $objWriter->startElement('a:chExt'); + $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($group->getExtentX())); + $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($group->getExtentY())); + $objWriter->endElement(); // a:chExt + + $objWriter->endElement(); // a:xfrm + + $objWriter->endElement(); // p:grpSpPr + + $shapes = $group->getShapeCollection(); + foreach ($shapes as $shape) { + // Increment $shapeId + ++$shapeId; + + // Check type + if ($shape instanceof RichText) { + $this->writeShapeText($objWriter, $shape, $shapeId); + } elseif ($shape instanceof Table) { + $this->writeShapeTable($objWriter, $shape, $shapeId); + } elseif ($shape instanceof Line) { + $this->writeShapeLine($objWriter, $shape, $shapeId); + } elseif ($shape instanceof ShapeChart) { + $this->writeShapeChart($objWriter, $shape, $shapeId); + } elseif ($shape instanceof AbstractDrawing) { + $this->writeShapePic($objWriter, $shape, $shapeId); + } elseif ($shape instanceof Group) { + $this->writeShapeGroup($objWriter, $shape, $shapeId); + } + } + + $objWriter->endElement(); // p:grpSp + } + /** * Write chart * diff --git a/tests/PhpPowerpoint/Tests/AbstractShapeTest.php b/tests/PhpPowerpoint/Tests/AbstractShapeTest.php index 93282a2ba..93c26efb9 100644 --- a/tests/PhpPowerpoint/Tests/AbstractShapeTest.php +++ b/tests/PhpPowerpoint/Tests/AbstractShapeTest.php @@ -147,7 +147,7 @@ public function testSlide() /** * @expectedException \Exception - * @expectedExceptionMessage A \PhpOffice\PhpPowerpoint\Slide has already been assigned. Shapes can only exist on one \PhpOffice\PhpPowerpoint\Slide. + * @expectedExceptionMessage A \PhpOffice\PhpPowerpoint\ShapeContainerInterface has already been assigned. Shapes can only exist on one \PhpOffice\PhpPowerpoint\ShapeContainerInterface. */ public function testSlideException() { diff --git a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php new file mode 100644 index 000000000..40a77bcc2 --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php @@ -0,0 +1,92 @@ +assertEquals(0, $object->getOffsetX()); + $this->assertEquals(0, $object->getOffsetY()); + $this->assertEquals(0, $object->getExtentX()); + $this->assertEquals(0, $object->getExtentY()); + $this->assertEmpty($object->getShapeCollection()); + } + + public function testExtentsAndOffsetsForOneShape() + { + // We record initial values here because + // PhpOffice\PhpPowerpoint\Shape\Line subtracts the offsets + // from the extents to produce a raw width and height. + $offsetX = 100; + $offsetY = 100; + $extentX = 1000; + $extentY = 450; + + $line1 = new Line($offsetX, $offsetY, $extentX, $extentY); + $object = new Group(); + + $object->addShape($line1); + + $this->assertEquals($offsetX, $object->getOffsetX()); + $this->assertEquals($offsetY, $object->getOffsetY()); + $this->assertEquals($extentX, $object->getExtentX()); + $this->assertEquals($extentY, $object->getExtentY()); + } + + public function testExtentsAndOffsetsForTwoShapes() + { + // Since Groups and Slides cache offsets and extents on first + // calculation, this test is separate from the above. + // Should the calculation be performed every GET, this test can be + // combined with the above. + $offsetX = 100; + $offsetY = 100; + $extentX = 1000; + $extentY = 450; + $increase = 50; + + $line1 = new Line($offsetX, $offsetY, $extentX, $extentY); + $line2 = new Line( + $offsetX+$increase, + $offsetY+$increase, + $extentX+$increase, + $extentY+$increase + ); + + $object = new Group(); + + $object->addShape($line1); + $object->addShape($line2); + + $this->assertEquals($offsetX, $object->getOffsetX()); + $this->assertEquals($offsetY, $object->getOffsetY()); + $this->assertEquals($extentX+$increase, $object->getExtentX()); + $this->assertEquals($extentY+$increase, $object->getExtentY()); + } +} From 30849e3e7b2b91e002e79d768659b857490f19cb Mon Sep 17 00:00:00 2001 From: Joshua Doss Date: Wed, 3 Dec 2014 20:21:36 +0000 Subject: [PATCH 010/115] Matching code style of PHPPowerPoint for if's and foreaches. --- src/PhpPowerpoint/GeometryCalculator.php | 36 ++++++++---------------- src/PhpPowerpoint/Shape/Group.php | 12 +++----- src/PhpPowerpoint/Slide.php | 12 +++----- 3 files changed, 20 insertions(+), 40 deletions(-) diff --git a/src/PhpPowerpoint/GeometryCalculator.php b/src/PhpPowerpoint/GeometryCalculator.php index 67b8d6f3b..66ba9c708 100644 --- a/src/PhpPowerpoint/GeometryCalculator.php +++ b/src/PhpPowerpoint/GeometryCalculator.php @@ -35,26 +35,20 @@ public static function calculateOffsets(ShapeContainerInterface $container) { $offsets = array(self::X => 0, self::Y => 0); - if ($container !== null && count($container->getShapeCollection()) != 0) - { + if ($container !== null && count($container->getShapeCollection()) != 0) { $shapes = $container->getShapeCollection(); - if ($shapes[0] !== null) - { + if ($shapes[0] !== null) { $offsets[self::X] = $shapes[0]->getOffsetX(); $offsets[self::Y] = $shapes[0]->getOffsetY(); } - foreach ($shapes as $shape) - { - if ($shape !== null) - { - if ($shape->getOffsetX() < $offsets[self::X]) - { + foreach ($shapes as $shape) { + if ($shape !== null) { + if ($shape->getOffsetX() < $offsets[self::X]) { $offsets[self::X] = $shape->getOffsetX(); } - if ($shape->getOffsetY() < $offsets[self::Y]) - { + if ($shape->getOffsetY() < $offsets[self::Y]) { $offsets[self::Y] = $shape->getOffsetY(); } } @@ -74,29 +68,23 @@ public static function calculateExtents(ShapeContainerInterface $container) { $offsets = array(self::X => 0, self::Y => 0); - if ($container !== null && count($container->getShapeCollection()) != 0) - { + if ($container !== null && count($container->getShapeCollection()) != 0) { $shapes = $container->getShapeCollection(); - if ($shapes[0] !== null) - { + if ($shapes[0] !== null) { $extents[self::X] = $shapes[0]->getOffsetX() + $shapes[0]->getWidth(); $extents[self::Y] = $shapes[0]->getOffsetY() + $shapes[0]->getHeight(); } - foreach ($shapes as $shape) - { - if ($shape !== null) - { + foreach ($shapes as $shape) { + if ($shape !== null) { $extentX = $shape->getOffsetX() + $shape->getWidth(); $extentY = $shape->getOffsetY() + $shape->getHeight(); - if ($extentX > $extents[self::X]) - { + if ($extentX > $extents[self::X]) { $extents[self::X] = $extentX; } - if ($extentY > $extents[self::Y]) - { + if ($extentY > $extents[self::Y]) { $extents[self::Y] = $extentY; } } diff --git a/src/PhpPowerpoint/Shape/Group.php b/src/PhpPowerpoint/Shape/Group.php index 81dec7750..ba46b6379 100644 --- a/src/PhpPowerpoint/Shape/Group.php +++ b/src/PhpPowerpoint/Shape/Group.php @@ -89,8 +89,7 @@ public function addShape(AbstractShape $shape) */ public function getOffsetX() { - if ($this->offsetX === null) - { + if ($this->offsetX === null) { $offsets = GeometryCalculator::calculateOffsets($this); $this->offsetX = $offsets[GeometryCalculator::X]; $this->offsetY = $offsets[GeometryCalculator::Y]; @@ -117,8 +116,7 @@ public function setOffsetX($pValue = 0) */ public function getOffsetY() { - if ($this->offsetY === null) - { + if ($this->offsetY === null) { $offsets = GeometryCalculator::calculateOffsets($this); $this->offsetX = $offsets[GeometryCalculator::X]; $this->offsetY = $offsets[GeometryCalculator::Y]; @@ -144,8 +142,7 @@ public function setOffsetY($pValue = 0) */ public function getExtentX() { - if ($this->extentX === null) - { + if ($this->extentX === null) { $extents = GeometryCalculator::calculateExtents($this); $this->extentX = $extents[GeometryCalculator::X]; $this->extentY = $extents[GeometryCalculator::Y]; @@ -160,8 +157,7 @@ public function getExtentX() */ public function getExtentY() { - if ($this->extentY === null) - { + if ($this->extentY === null) { $extents = GeometryCalculator::calculateExtents($this); $this->extentX = $extents[GeometryCalculator::X]; $this->extentY = $extents[GeometryCalculator::Y]; diff --git a/src/PhpPowerpoint/Slide.php b/src/PhpPowerpoint/Slide.php index ebc6fe9ee..7cd6d6453 100644 --- a/src/PhpPowerpoint/Slide.php +++ b/src/PhpPowerpoint/Slide.php @@ -350,8 +350,7 @@ public function copy() */ public function getOffsetX() { - if ($this->offsetX === null) - { + if ($this->offsetX === null) { $offsets = GeometryCalculator::calculateOffsets($this); $this->offsetX = $offsets[GeometryCalculator::X]; $this->offsetY = $offsets[GeometryCalculator::Y]; @@ -366,8 +365,7 @@ public function getOffsetX() */ public function getOffsetY() { - if ($this->offsetY === null) - { + if ($this->offsetY === null) { $offsets = GeometryCalculator::calculateOffsets($this); $this->offsetX = $offsets[GeometryCalculator::X]; $this->offsetY = $offsets[GeometryCalculator::Y]; @@ -382,8 +380,7 @@ public function getOffsetY() */ public function getExtentX() { - if ($this->extentX === null) - { + if ($this->extentX === null) { $extents = GeometryCalculator::calculateExtents($this); $this->extentX = $extents[GeometryCalculator::X]; $this->extentY = $extents[GeometryCalculator::Y]; @@ -398,8 +395,7 @@ public function getExtentX() */ public function getExtentY() { - if ($this->extentY === null) - { + if ($this->extentY === null) { $extents = GeometryCalculator::calculateExtents($this); $this->extentX = $extents[GeometryCalculator::X]; $this->extentY = $extents[GeometryCalculator::Y]; From ce718852df6f992ca67762634f1a6a815264a357 Mon Sep 17 00:00:00 2001 From: Joshua Doss Date: Wed, 3 Dec 2014 22:10:34 +0000 Subject: [PATCH 011/115] Fixing bugs in the PHPDoc changes I made. More code style cleanup. --- src/PhpPowerpoint/GeometryCalculator.php | 2 +- src/PhpPowerpoint/Shape/Group.php | 461 +++++++++--------- src/PhpPowerpoint/ShapeContainerInterface.php | 76 +-- src/PhpPowerpoint/Slide.php | 5 +- .../Writer/PowerPoint2007/Slide.php | 154 +++--- 5 files changed, 351 insertions(+), 347 deletions(-) diff --git a/src/PhpPowerpoint/GeometryCalculator.php b/src/PhpPowerpoint/GeometryCalculator.php index 66ba9c708..a2909ab1f 100644 --- a/src/PhpPowerpoint/GeometryCalculator.php +++ b/src/PhpPowerpoint/GeometryCalculator.php @@ -66,7 +66,7 @@ public static function calculateOffsets(ShapeContainerInterface $container) */ public static function calculateExtents(ShapeContainerInterface $container) { - $offsets = array(self::X => 0, self::Y => 0); + $extents = array(self::X => 0, self::Y => 0); if ($container !== null && count($container->getShapeCollection()) != 0) { $shapes = $container->getShapeCollection(); diff --git a/src/PhpPowerpoint/Shape/Group.php b/src/PhpPowerpoint/Shape/Group.php index ba46b6379..7401e879d 100644 --- a/src/PhpPowerpoint/Shape/Group.php +++ b/src/PhpPowerpoint/Shape/Group.php @@ -27,233 +27,236 @@ class Group extends AbstractShape implements ShapeContainerInterface { - /** - * Collection of shapes - * - * @var \ArrayObject|\PhpOffice\PhpPowerpoint\AbstractShape[] - */ - private $shapeCollection = null; - - /** - * Extent X - * - * @var int - */ - protected $extentX; - - /** - * Extent Y - * - * @var int - */ - protected $extentY; - - public function __construct() { - parent::__construct(); - - // For logic purposes. - $this->offsetX = null; - $this->offsetY = null; - - // Shape collection - $this->shapeCollection = new \ArrayObject(); - } - - /** - * Get collection of shapes - * - * @return \PhpOffice\PhpPowerpoint\AbstractShape[] - */ - public function getShapeCollection() - { - return $this->shapeCollection; - } - - /** - * Add shape to slide - * - * @param \PhpOffice\PhpPowerpoint\AbstractShape $shape - * @return \PhpOffice\PhpPowerpoint\AbstractShape - */ - public function addShape(AbstractShape $shape) - { - $shape->setContainer($this); - - return $shape; - } - - /** - * Get X Offset - * - * @return int - */ - public function getOffsetX() - { - if ($this->offsetX === null) { - $offsets = GeometryCalculator::calculateOffsets($this); - $this->offsetX = $offsets[GeometryCalculator::X]; - $this->offsetY = $offsets[GeometryCalculator::Y]; - } - - return $this->offsetX; - } - - /** - * Ignores setting the X Offset, preserving the default behavior. - * - * @param int $pValue - * @return self - */ - public function setOffsetX($pValue = 0) - { - return $this; - } - - /** - * Get Y Offset - * - * @return int - */ - public function getOffsetY() - { - if ($this->offsetY === null) { - $offsets = GeometryCalculator::calculateOffsets($this); - $this->offsetX = $offsets[GeometryCalculator::X]; - $this->offsetY = $offsets[GeometryCalculator::Y]; - } - return $this->offsetY; - } - - /** - * Ignores setting the Y Offset, preserving the default behavior. - * - * @param int $pValue - * @return self - */ - public function setOffsetY($pValue = 0) - { - return $this; - } - - /** - * Get X Extent - * - * @return int - */ - public function getExtentX() - { - if ($this->extentX === null) { - $extents = GeometryCalculator::calculateExtents($this); - $this->extentX = $extents[GeometryCalculator::X]; - $this->extentY = $extents[GeometryCalculator::Y]; - } - return $this->extentX; - } - - /** - * Get Y Extent - * - * @return int - */ - public function getExtentY() - { - if ($this->extentY === null) { - $extents = GeometryCalculator::calculateExtents($this); - $this->extentX = $extents[GeometryCalculator::X]; - $this->extentY = $extents[GeometryCalculator::Y]; - } - return $this->extentY; - } - - /** - * Ignores setting the width, preserving the default behavior. - * - * @param int $pValue - * @return self - */ - public function setWidth($pValue = 0) - { - return $this; - } - - /** - * Ignores setting the height, preserving the default behavior. - * - * @param int $pValue - * @return self - */ - public function setHeight($pValue = 0) - { - return $this; - } - - /** - * Create rich text shape - * - * @return \PhpOffice\PhpPowerpoint\Shape\RichText - */ - public function createRichTextShape() - { - $shape = new RichText(); - $this->addShape($shape); - - return $shape; - } - - /** - * Create line shape - * - * @param int $fromX Starting point x offset - * @param int $fromY Starting point y offset - * @param int $toX Ending point x offset - * @param int $toY Ending point y offset - * @return \PhpOffice\PhpPowerpoint\Shape\Line - */ - public function createLineShape($fromX, $fromY, $toX, $toY) - { - $shape = new Line($fromX, $fromY, $toX, $toY); - $this->addShape($shape); - - return $shape; - } - - /** - * Create chart shape - * - * @return \PhpOffice\PhpPowerpoint\Shape\Chart - */ - public function createChartShape() - { - $shape = new Chart(); - $this->addShape($shape); - - return $shape; - } - - /** - * Create drawing shape - * - * @return \PhpOffice\PhpPowerpoint\Shape\Drawing - */ - public function createDrawingShape() - { - $shape = new Drawing(); - $this->addShape($shape); - - return $shape; - } - - /** - * Create table shape - * - * @param int $columns Number of columns - * @return \PhpOffice\PhpPowerpoint\Shape\Table - */ - public function createTableShape($columns = 1) - { - $shape = new Table($columns); - $this->addShape($shape); - - return $shape; - } + /** + * Collection of shapes + * + * @var \ArrayObject|\PhpOffice\PhpPowerpoint\AbstractShape[] + */ + private $shapeCollection = null; + + /** + * Extent X + * + * @var int + */ + protected $extentX; + + /** + * Extent Y + * + * @var int + */ + protected $extentY; + + public function __construct() { + parent::__construct(); + + // For logic purposes. + $this->offsetX = null; + $this->offsetY = null; + + // Shape collection + $this->shapeCollection = new \ArrayObject(); + } + + /** + * Get collection of shapes + * + * @return \ArrayObject|\PhpOffice\PhpPowerpoint\AbstractShape[] + */ + public function getShapeCollection() + { + return $this->shapeCollection; + } + + /** + * Add shape to slide + * + * @param \PhpOffice\PhpPowerpoint\AbstractShape $shape + * @return \PhpOffice\PhpPowerpoint\AbstractShape + */ + public function addShape(AbstractShape $shape) + { + $shape->setContainer($this); + + return $shape; + } + + /** + * Get X Offset + * + * @return int + */ + public function getOffsetX() + { + if ($this->offsetX === null) { + $offsets = GeometryCalculator::calculateOffsets($this); + $this->offsetX = $offsets[GeometryCalculator::X]; + $this->offsetY = $offsets[GeometryCalculator::Y]; + } + + return $this->offsetX; + } + + /** + * Ignores setting the X Offset, preserving the default behavior. + * + * @param int $pValue + * @return self + */ + public function setOffsetX($pValue = 0) + { + return $this; + } + + /** + * Get Y Offset + * + * @return int + */ + public function getOffsetY() + { + if ($this->offsetY === null) { + $offsets = GeometryCalculator::calculateOffsets($this); + $this->offsetX = $offsets[GeometryCalculator::X]; + $this->offsetY = $offsets[GeometryCalculator::Y]; + } + + return $this->offsetY; + } + + /** + * Ignores setting the Y Offset, preserving the default behavior. + * + * @param int $pValue + * @return self + */ + public function setOffsetY($pValue = 0) + { + return $this; + } + + /** + * Get X Extent + * + * @return int + */ + public function getExtentX() + { + if ($this->extentX === null) { + $extents = GeometryCalculator::calculateExtents($this); + $this->extentX = $extents[GeometryCalculator::X]; + $this->extentY = $extents[GeometryCalculator::Y]; + } + + return $this->extentX; + } + + /** + * Get Y Extent + * + * @return int + */ + public function getExtentY() + { + if ($this->extentY === null) { + $extents = GeometryCalculator::calculateExtents($this); + $this->extentX = $extents[GeometryCalculator::X]; + $this->extentY = $extents[GeometryCalculator::Y]; + } + + return $this->extentY; + } + + /** + * Ignores setting the width, preserving the default behavior. + * + * @param int $pValue + * @return self + */ + public function setWidth($pValue = 0) + { + return $this; + } + + /** + * Ignores setting the height, preserving the default behavior. + * + * @param int $pValue + * @return self + */ + public function setHeight($pValue = 0) + { + return $this; + } + + /** + * Create rich text shape + * + * @return \PhpOffice\PhpPowerpoint\Shape\RichText + */ + public function createRichTextShape() + { + $shape = new RichText(); + $this->addShape($shape); + + return $shape; + } + + /** + * Create line shape + * + * @param int $fromX Starting point x offset + * @param int $fromY Starting point y offset + * @param int $toX Ending point x offset + * @param int $toY Ending point y offset + * @return \PhpOffice\PhpPowerpoint\Shape\Line + */ + public function createLineShape($fromX, $fromY, $toX, $toY) + { + $shape = new Line($fromX, $fromY, $toX, $toY); + $this->addShape($shape); + + return $shape; + } + + /** + * Create chart shape + * + * @return \PhpOffice\PhpPowerpoint\Shape\Chart + */ + public function createChartShape() + { + $shape = new Chart(); + $this->addShape($shape); + + return $shape; + } + + /** + * Create drawing shape + * + * @return \PhpOffice\PhpPowerpoint\Shape\Drawing + */ + public function createDrawingShape() + { + $shape = new Drawing(); + $this->addShape($shape); + + return $shape; + } + + /** + * Create table shape + * + * @param int $columns Number of columns + * @return \PhpOffice\PhpPowerpoint\Shape\Table + */ + public function createTableShape($columns = 1) + { + $shape = new Table($columns); + $this->addShape($shape); + + return $shape; + } } \ No newline at end of file diff --git a/src/PhpPowerpoint/ShapeContainerInterface.php b/src/PhpPowerpoint/ShapeContainerInterface.php index 82d411042..fd578fc3f 100644 --- a/src/PhpPowerpoint/ShapeContainerInterface.php +++ b/src/PhpPowerpoint/ShapeContainerInterface.php @@ -22,46 +22,46 @@ */ interface ShapeContainerInterface { - /** - * Get collection of shapes - * - * @return \PhpOffice\PhpPowerpoint\AbstractShape[] - */ - public function getShapeCollection(); - - /** - * Add shape to slide - * - * @param \PhpOffice\PhpPowerpoint\AbstractShape $shape - * @return \PhpOffice\PhpPowerpoint\AbstractShape - */ - public function addShape(AbstractShape $shape); + /** + * Get collection of shapes + * + * @return \ArrayObject|\PhpOffice\PhpPowerpoint\AbstractShape[] + */ + public function getShapeCollection(); - /** - * Get X Offset - * - * @return int - */ - public function getOffsetX(); + /** + * Add shape to slide + * + * @param \PhpOffice\PhpPowerpoint\AbstractShape $shape + * @return \PhpOffice\PhpPowerpoint\AbstractShape + */ + public function addShape(AbstractShape $shape); - /** - * Get Y Offset - * - * @return int - */ - public function getOffsetY(); + /** + * Get X Offset + * + * @return int + */ + public function getOffsetX(); - /** - * Get X Extent - * - * @return int - */ - public function getExtentX(); + /** + * Get Y Offset + * + * @return int + */ + public function getOffsetY(); - /** - * Get Y Extent - * - * @return int - */ - public function getExtentY(); + /** + * Get X Extent + * + * @return int + */ + public function getExtentX(); + + /** + * Get Y Extent + * + * @return int + */ + public function getExtentY(); } diff --git a/src/PhpPowerpoint/Slide.php b/src/PhpPowerpoint/Slide.php index 7cd6d6453..42fd2287d 100644 --- a/src/PhpPowerpoint/Slide.php +++ b/src/PhpPowerpoint/Slide.php @@ -123,7 +123,7 @@ public function __construct(PhpPowerpoint $pParent = null) /** * Get collection of shapes * - * @return \PhpOffice\PhpPowerpoint\AbstractShape[] + * @return \ArrayObject|\PhpOffice\PhpPowerpoint\AbstractShape[] */ public function getShapeCollection() { @@ -218,7 +218,8 @@ public function createTableShape($columns = 1) * * @return \PhpOffice\PhpPowerpoint\Shape\Group */ - public function createGroup() { + public function createGroup() + { $shape = new Group(); $this->addShape($shape); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 7b64f8a99..89d6bf0a1 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -175,83 +175,83 @@ public function writeSlide(SlideElement $pSlide = null) */ private function writeShapeGroup(XMLWriter $objWriter, Group $group, &$shapeId) { - // p:grpSp - $objWriter->startElement('p:grpSp'); - - // p:nvGrpSpPr - $objWriter->startElement('p:nvGrpSpPr'); - - // p:cNvPr - $objWriter->startElement('p:cNvPr'); - $objWriter->writeAttribute('name', 'Group '.$shapeId++); - $objWriter->writeAttribute('id', $shapeId); - $objWriter->endElement(); // p:cNvPr - // NOTE: Re: $shapeId This seems to be how PowerPoint 2010 does business. - - // p:cNvGrpSpPr - $objWriter->writeElement('p:cNvGrpSpPr', null); - - // p:nvPr - $objWriter->writeElement('p:nvPr', null); - - $objWriter->endElement(); // p:nvGrpSpPr - - // p:grpSpPr - $objWriter->startElement('p:grpSpPr'); - - // a:xfrm - $objWriter->startElement('a:xfrm'); - - // a:off - $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($group->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($group->getOffsetY())); - $objWriter->endElement(); // a:off - - // a:ext - $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($group->getExtentX())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($group->getExtentY())); - $objWriter->endElement(); // a:ext - - // a:chOff - $objWriter->startElement('a:chOff'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($group->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($group->getOffsetY())); - $objWriter->endElement(); // a:chOff - - // a:chExt - $objWriter->startElement('a:chExt'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($group->getExtentX())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($group->getExtentY())); - $objWriter->endElement(); // a:chExt - - $objWriter->endElement(); // a:xfrm - - $objWriter->endElement(); // p:grpSpPr - - $shapes = $group->getShapeCollection(); - foreach ($shapes as $shape) { - // Increment $shapeId - ++$shapeId; - - // Check type - if ($shape instanceof RichText) { - $this->writeShapeText($objWriter, $shape, $shapeId); - } elseif ($shape instanceof Table) { - $this->writeShapeTable($objWriter, $shape, $shapeId); - } elseif ($shape instanceof Line) { - $this->writeShapeLine($objWriter, $shape, $shapeId); - } elseif ($shape instanceof ShapeChart) { - $this->writeShapeChart($objWriter, $shape, $shapeId); - } elseif ($shape instanceof AbstractDrawing) { - $this->writeShapePic($objWriter, $shape, $shapeId); - } elseif ($shape instanceof Group) { - $this->writeShapeGroup($objWriter, $shape, $shapeId); - } - } - - $objWriter->endElement(); // p:grpSp + // p:grpSp + $objWriter->startElement('p:grpSp'); + + // p:nvGrpSpPr + $objWriter->startElement('p:nvGrpSpPr'); + + // p:cNvPr + $objWriter->startElement('p:cNvPr'); + $objWriter->writeAttribute('name', 'Group '.$shapeId++); + $objWriter->writeAttribute('id', $shapeId); + $objWriter->endElement(); // p:cNvPr + // NOTE: Re: $shapeId This seems to be how PowerPoint 2010 does business. + + // p:cNvGrpSpPr + $objWriter->writeElement('p:cNvGrpSpPr', null); + + // p:nvPr + $objWriter->writeElement('p:nvPr', null); + + $objWriter->endElement(); // p:nvGrpSpPr + + // p:grpSpPr + $objWriter->startElement('p:grpSpPr'); + + // a:xfrm + $objWriter->startElement('a:xfrm'); + + // a:off + $objWriter->startElement('a:off'); + $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($group->getOffsetX())); + $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($group->getOffsetY())); + $objWriter->endElement(); // a:off + + // a:ext + $objWriter->startElement('a:ext'); + $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($group->getExtentX())); + $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($group->getExtentY())); + $objWriter->endElement(); // a:ext + + // a:chOff + $objWriter->startElement('a:chOff'); + $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($group->getOffsetX())); + $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($group->getOffsetY())); + $objWriter->endElement(); // a:chOff + + // a:chExt + $objWriter->startElement('a:chExt'); + $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($group->getExtentX())); + $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($group->getExtentY())); + $objWriter->endElement(); // a:chExt + + $objWriter->endElement(); // a:xfrm + + $objWriter->endElement(); // p:grpSpPr + + $shapes = $group->getShapeCollection(); + foreach ($shapes as $shape) { + // Increment $shapeId + ++$shapeId; + + // Check type + if ($shape instanceof RichText) { + $this->writeShapeText($objWriter, $shape, $shapeId); + } elseif ($shape instanceof Table) { + $this->writeShapeTable($objWriter, $shape, $shapeId); + } elseif ($shape instanceof Line) { + $this->writeShapeLine($objWriter, $shape, $shapeId); + } elseif ($shape instanceof ShapeChart) { + $this->writeShapeChart($objWriter, $shape, $shapeId); + } elseif ($shape instanceof AbstractDrawing) { + $this->writeShapePic($objWriter, $shape, $shapeId); + } elseif ($shape instanceof Group) { + $this->writeShapeGroup($objWriter, $shape, $shapeId); + } + } + + $objWriter->endElement(); // p:grpSp } /** From b133fea11207eb1964704a7cfd73d32d234f28b5 Mon Sep 17 00:00:00 2001 From: Joshua Doss Date: Wed, 3 Dec 2014 22:33:57 +0000 Subject: [PATCH 012/115] Last bit of code style cleanup. --- src/PhpPowerpoint/Shape/Group.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PhpPowerpoint/Shape/Group.php b/src/PhpPowerpoint/Shape/Group.php index 7401e879d..c1a79b239 100644 --- a/src/PhpPowerpoint/Shape/Group.php +++ b/src/PhpPowerpoint/Shape/Group.php @@ -48,7 +48,8 @@ class Group extends AbstractShape implements ShapeContainerInterface */ protected $extentY; - public function __construct() { + public function __construct() + { parent::__construct(); // For logic purposes. @@ -56,7 +57,7 @@ public function __construct() { $this->offsetY = null; // Shape collection - $this->shapeCollection = new \ArrayObject(); + $this->shapeCollection = new \ArrayObject(); } /** From b4cd7074bea68bf09531cd8062f14ba274c74c27 Mon Sep 17 00:00:00 2001 From: Joshua Doss Date: Wed, 10 Dec 2014 16:06:56 +0000 Subject: [PATCH 013/115] Fixing Travis errors: - https://travis-ci.org/PHPOffice/PHPPowerPoint/jobs/42919909#L297 - https://travis-ci.org/PHPOffice/PHPPowerPoint/jobs/42919909#L320 --- src/PhpPowerpoint/Shape/Group.php | 2 +- tests/PhpPowerpoint/Tests/Shape/GroupTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PhpPowerpoint/Shape/Group.php b/src/PhpPowerpoint/Shape/Group.php index c1a79b239..444e3b691 100644 --- a/src/PhpPowerpoint/Shape/Group.php +++ b/src/PhpPowerpoint/Shape/Group.php @@ -260,4 +260,4 @@ public function createTableShape($columns = 1) return $shape; } -} \ No newline at end of file +} diff --git a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php index 40a77bcc2..36ab4013d 100644 --- a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php @@ -35,7 +35,7 @@ public function testConstruct() $this->assertEquals(0, $object->getOffsetY()); $this->assertEquals(0, $object->getExtentX()); $this->assertEquals(0, $object->getExtentY()); - $this->assertEmpty($object->getShapeCollection()); + $this->assertEquals(0, $object->getShapeCollection()->count()); } public function testExtentsAndOffsetsForOneShape() @@ -61,7 +61,7 @@ public function testExtentsAndOffsetsForOneShape() public function testExtentsAndOffsetsForTwoShapes() { - // Since Groups and Slides cache offsets and extents on first + // Since Groups and Slides cache offsets and extents on first // calculation, this test is separate from the above. // Should the calculation be performed every GET, this test can be // combined with the above. From 8cb7150bfe792af1af108f701cb28043e5d23002 Mon Sep 17 00:00:00 2001 From: Joshua Doss Date: Mon, 15 Dec 2014 13:16:02 +0000 Subject: [PATCH 014/115] Added Group support for ODPresentation classes. Fixed bug wherein grouped pics weren't included in the pptx. Fixed bug wherein hyperlinks within groups were not functional --- .../Writer/ODPresentation/Content.php | 688 +++++++++++------- .../Writer/ODPresentation/Drawing.php | 9 + .../Writer/ODPresentation/Styles.php | 83 ++- .../Writer/PowerPoint2007/Drawing.php | 9 + .../Writer/PowerPoint2007/Rels.php | 69 +- 5 files changed, 561 insertions(+), 297 deletions(-) diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index deb87fc6d..9f91c482c 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -21,6 +21,7 @@ use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; use PhpOffice\PhpPowerpoint\Shape\Chart; use PhpOffice\PhpPowerpoint\Shape\Drawing as ShapeDrawing; +use PhpOffice\PhpPowerpoint\Shape\Group; use PhpOffice\PhpPowerpoint\Shape\Line; use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing; use PhpOffice\PhpPowerpoint\Shape\RichText\BreakElement; @@ -43,6 +44,37 @@ */ class Content extends AbstractPart { + + /** + * Stores bullet styles for text shapes that include lists. + * + * @var array + */ + private $arrStyleBullet = array(); + + + /** + * Stores paragraph information for text shapes. + * + * @var array + */ + private $arrStyleParagraph = array(); + + /** + * Stores font styles for text shapes that include lists. + * + * @var array + */ + private $arrStyleTextFont = array(); + + /** + * Used to track the current shape ID. + * + * @var integer + */ + private $shapeId; + + /** * Write content file to XML format * @@ -92,271 +124,38 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) $objWriter->writeAttribute('xmlns:field', 'urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0'); $objWriter->writeAttribute('office:version', '1.2'); - //=============================================== - // Styles - //=============================================== - $arrStyleBullet = array(); - $arrStyleParagraph = array(); - $arrStyleTextFont = array(); - // office:automatic-styles $objWriter->startElement('office:automatic-styles'); - $shapeId = 0; + $this->shapeId = 0; foreach ($pPHPPowerPoint->getAllSlides() as $pSlide) { // Images $shapes = $pSlide->getShapeCollection(); foreach ($shapes as $shape) { - // Increment $shapeId - ++$shapeId; + // Increment $this->shapeId + ++$this->shapeId; // Check type if ($shape instanceof RichText) { - // style:style - $objWriter->startElement('style:style'); - $objWriter->writeAttribute('style:name', 'gr' . $shapeId); - $objWriter->writeAttribute('style:family', 'graphic'); - $objWriter->writeAttribute('style:parent-style-name', 'standard'); - // style:graphic-properties - $objWriter->startElement('style:graphic-properties'); - if (is_bool($shape->hasAutoShrinkVertical())) { - $objWriter->writeAttribute('draw:auto-grow-height', var_export($shape->hasAutoShrinkVertical(), true)); - } - if (is_bool($shape->hasAutoShrinkHorizontal())) { - $objWriter->writeAttribute('draw:auto-grow-width', var_export($shape->hasAutoShrinkHorizontal(), true)); - } - switch ($shape->getFill()->getFillType()){ - case Fill::FILL_NONE: - default: - $objWriter->writeAttribute('draw:fill', 'none'); - $objWriter->writeAttribute('draw:fill-color', '#'.$shape->getFill()->getStartColor()->getRGB()); - break; - } - switch ($shape->getBorder()->getLineStyle()){ - case Border::LINE_NONE: - default: - $objWriter->writeAttribute('draw:stroke', 'none'); - $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); - } - - $objWriter->writeAttribute('fo:wrap-option', 'wrap'); - // > style:graphic-properties - $objWriter->endElement(); - // > style:style - $objWriter->endElement(); - - $paragraphs = $shape->getParagraphs(); - $paragraphId = 0; - foreach ($paragraphs as $paragraph) { - ++$paragraphId; - - // Style des paragraphes - if (!isset($arrStyleParagraph[$paragraph->getHashCode()])) { - $arrStyleParagraph[$paragraph->getHashCode()] = $paragraph; - } - - // Style des listes - if (!isset($arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()])) { - $arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['oStyle'] = $paragraph->getBulletStyle(); - $arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['level'] = ''; - } - if (strpos($arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['level'], ';' . $paragraph->getAlignment()->getLevel()) === false) { - $arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['level'] .= ';' . $paragraph->getAlignment()->getLevel(); - $arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['oAlign_' . $paragraph->getAlignment()->getLevel()] = $paragraph->getAlignment(); - } - - $richtexts = $paragraph->getRichTextElements(); - $richtextId = 0; - foreach ($richtexts as $richtext) { - ++$richtextId; - // Not a line break - if ($richtext instanceof Run) { - // Style des font text - if (!isset($arrStyleTextFont[$richtext->getFont()->getHashCode()])) { - $arrStyleTextFont[$richtext->getFont()->getHashCode()] = $richtext->getFont(); - } - } - } - } + $this->writeTxtStyle($objWriter, $shape); } if ($shape instanceof AbstractDrawing) { - if ($shape->getShadow()->isVisible()) { - // style:style - $objWriter->startElement('style:style'); - $objWriter->writeAttribute('style:name', 'gr' . $shapeId); - $objWriter->writeAttribute('style:family', 'graphic'); - $objWriter->writeAttribute('style:parent-style-name', 'standard'); - - // style:graphic-properties - $objWriter->startElement('style:graphic-properties'); - $objWriter->writeAttribute('draw:stroke', 'none'); - $objWriter->writeAttribute('draw:fill', 'none'); - $objWriter->writeAttribute('draw:shadow', 'visible'); - $objWriter->writeAttribute('draw:shadow-color', '#' . $shape->getShadow()->getColor()->getRGB()); - if ($shape->getShadow()->getDirection() == 0 || $shape->getShadow()->getDirection() == 360) { - $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '0cm'); - } elseif ($shape->getShadow()->getDirection() == 45) { - $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } elseif ($shape->getShadow()->getDirection() == 90) { - $objWriter->writeAttribute('draw:shadow-offset-x', '0cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } elseif ($shape->getShadow()->getDirection() == 135) { - $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } elseif ($shape->getShadow()->getDirection() == 180) { - $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '0cm'); - } elseif ($shape->getShadow()->getDirection() == 225) { - $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } elseif ($shape->getShadow()->getDirection() == 270) { - $objWriter->writeAttribute('draw:shadow-offset-x', '0cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } elseif ($shape->getShadow()->getDirection() == 315) { - $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } - $objWriter->writeAttribute('draw:shadow-opacity', (100 - $shape->getShadow()->getAlpha()) . '%'); - $objWriter->writeAttribute('style:mirror', 'none'); - $objWriter->endElement(); - - $objWriter->endElement(); - } + $this->writeDrawingStyle($objWriter, $shape); } if ($shape instanceof Line) { - // style:style - $objWriter->startElement('style:style'); - $objWriter->writeAttribute('style:name', 'gr' . $shapeId); - $objWriter->writeAttribute('style:family', 'graphic'); - $objWriter->writeAttribute('style:parent-style-name', 'standard'); - - // style:graphic-properties - $objWriter->startElement('style:graphic-properties'); - $objWriter->writeAttribute('draw:fill', 'none'); - switch ($shape->getBorder()->getLineStyle()) { - case Border::LINE_NONE: - $objWriter->writeAttribute('draw:stroke', 'none'); - break; - case Border::LINE_SINGLE: - $objWriter->writeAttribute('draw:stroke', 'solid'); - break; - default: - $objWriter->writeAttribute('draw:stroke', 'none'); - break; - } - $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); - $objWriter->writeAttribute('svg:stroke-width', String::numberFormat(SharedDrawing::pixelsToCentimeters((SharedDrawing::pointsToPixels($shape->getBorder()->getLineWidth()))), 3).'cm'); - $objWriter->endElement(); - - $objWriter->endElement(); + $this->writeLineStyle($objWriter, $shape); } if ($shape instanceof Table) { - foreach ($shape->getRows() as $keyRow => $shapeRow) { - // style:style - $objWriter->startElement('style:style'); - $objWriter->writeAttribute('style:name', 'gr' . $shapeId.'r'.$keyRow); - $objWriter->writeAttribute('style:family', 'table-row'); - - // style:table-row-properties - $objWriter->startElement('style:table-row-properties'); - $objWriter->writeAttribute('style:row-height', String::numberFormat(SharedDrawing::pixelsToCentimeters(SharedDrawing::pointsToPixels($shapeRow->getHeight())), 3).'cm'); - $objWriter->endElement(); - - $objWriter->endElement(); - - foreach ($shapeRow->getCells() as $keyCell => $shapeCell) { - // style:style - $objWriter->startElement('style:style'); - $objWriter->writeAttribute('style:name', 'gr' . $shapeId.'r'.$keyRow.'c'.$keyCell); - $objWriter->writeAttribute('style:family', 'table-cell'); - - // style:graphic-properties - $objWriter->startElement('style:graphic-properties'); - if ($shapeCell->getFill()->getFillType() == Fill::FILL_SOLID) { - $objWriter->writeAttribute('draw:fill', 'solid'); - $objWriter->writeAttribute('draw:fill-color', '#'.$shapeCell->getFill()->getStartColor()->getRGB()); - } - if ($shapeCell->getFill()->getFillType() == Fill::FILL_GRADIENT_LINEAR) { - $objWriter->writeAttribute('draw:fill', 'gradient'); - $objWriter->writeAttribute('draw:fill-gradient-name', 'gradient_'.$shapeCell->getFill()->getHashCode()); - } - $objWriter->endElement(); - // startElement('style:paragraph-properties'); - if ($shapeCell->getBorders()->getBottom()->getHashCode() == $shapeCell->getBorders()->getTop()->getHashCode() - && $shapeCell->getBorders()->getBottom()->getHashCode() == $shapeCell->getBorders()->getLeft()->getHashCode() - && $shapeCell->getBorders()->getBottom()->getHashCode() == $shapeCell->getBorders()->getRight()->getHashCode()) { - $lineStyle = 'none'; - $lineWidth = String::numberFormat($shapeCell->getBorders()->getBottom()->getLineWidth() / 1.75, 2); - $lineColor = $shapeCell->getBorders()->getBottom()->getColor()->getRGB(); - switch ($shapeCell->getBorders()->getBottom()->getLineStyle()){ - case Border::LINE_SINGLE: - $lineStyle = 'solid'; - } - $objWriter->writeAttribute('fo:border', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); - } else { - $lineStyle = 'none'; - $lineWidth = String::numberFormat($shapeCell->getBorders()->getBottom()->getLineWidth() / 1.75, 2); - $lineColor = $shapeCell->getBorders()->getBottom()->getColor()->getRGB(); - switch ($shapeCell->getBorders()->getBottom()->getLineStyle()){ - case Border::LINE_SINGLE: - $lineStyle = 'solid'; - } - $objWriter->writeAttribute('fo:border-bottom', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); - // TOP - $lineStyle = 'none'; - $lineWidth = String::numberFormat($shapeCell->getBorders()->getTop()->getLineWidth() / 1.75, 2); - $lineColor = $shapeCell->getBorders()->getTop()->getColor()->getRGB(); - switch ($shapeCell->getBorders()->getTop()->getLineStyle()){ - case Border::LINE_SINGLE: - $lineStyle = 'solid'; - } - $objWriter->writeAttribute('fo:border-top', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); - // RIGHT - $lineStyle = 'none'; - $lineWidth = String::numberFormat($shapeCell->getBorders()->getRight()->getLineWidth() / 1.75, 2); - $lineColor = $shapeCell->getBorders()->getRight()->getColor()->getRGB(); - switch ($shapeCell->getBorders()->getRight()->getLineStyle()){ - case Border::LINE_SINGLE: - $lineStyle = 'solid'; - } - $objWriter->writeAttribute('fo:border-right', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); - // LEFT - $lineStyle = 'none'; - $lineWidth = String::numberFormat($shapeCell->getBorders()->getLeft()->getLineWidth() / 1.75, 2); - $lineColor = $shapeCell->getBorders()->getLeft()->getColor()->getRGB(); - switch ($shapeCell->getBorders()->getLeft()->getLineStyle()){ - case Border::LINE_SINGLE: - $lineStyle = 'solid'; - } - $objWriter->writeAttribute('fo:border-left', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); - } - $objWriter->endElement(); - - $objWriter->endElement(); - - foreach ($shapeCell->getParagraphs() as $shapeParagraph) { - foreach ($shapeParagraph->getRichTextElements() as $shapeRichText) { - if ($shapeRichText instanceof Run) { - // Style des font text - if (!isset($arrStyleTextFont[$shapeRichText->getFont()->getHashCode()])) { - $arrStyleTextFont[$shapeRichText->getFont()->getHashCode()] = $shapeRichText->getFont(); - } - } - } - } - } - } + $this->writeTableStyle($objWriter, $shape); + } + if ($shape instanceof Group) { + $this->writeGroupStyle($objWriter, $shape); } } } // Style : Bullet - if (!empty($arrStyleBullet)) { - foreach ($arrStyleBullet as $key => $item) { + if (!empty($this->arrStyleBullet)) { + foreach ($this->arrStyleBullet as $key => $item) { $oStyle = $item['oStyle']; $arrLevel = explode(';', $item['level']); // style:style @@ -394,8 +193,8 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) } } // Style : Paragraph - if (!empty($arrStyleParagraph)) { - foreach ($arrStyleParagraph as $key => $item) { + if (!empty($this->arrStyleParagraph)) { + foreach ($this->arrStyleParagraph as $key => $item) { // style:style $objWriter->startElement('style:style'); $objWriter->writeAttribute('style:name', 'P_' . $key); @@ -427,8 +226,8 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) } } // Style : Text : Font - if (!empty($arrStyleTextFont)) { - foreach ($arrStyleTextFont as $key => $item) { + if (!empty($this->arrStyleTextFont)) { + foreach ($this->arrStyleTextFont as $key => $item) { // style:style $objWriter->startElement('style:style'); $objWriter->writeAttribute('style:name', 'T_' . $key); @@ -459,7 +258,7 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) // Write slides $slideCount = $pPHPPowerPoint->getSlideCount(); - $shapeId = 0; + $this->shapeId = 0; for ($i = 0; $i < $slideCount; ++$i) { $pSlide = $pPHPPowerPoint->getSlide($i); $objWriter->startElement('draw:page'); @@ -468,20 +267,22 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) // Images $shapes = $pSlide->getShapeCollection(); foreach ($shapes as $shape) { - // Increment $shapeId - ++$shapeId; + // Increment $this->shapeId + ++$this->shapeId; // Check type if ($shape instanceof RichText) { - $this->writeShapeTxt($objWriter, $shape, $shapeId); + $this->writeShapeTxt($objWriter, $shape); } elseif ($shape instanceof Table) { - $this->writeShapeTable($objWriter, $shape, $shapeId); + $this->writeShapeTable($objWriter, $shape); } elseif ($shape instanceof Line) { - $this->writeShapeLine($objWriter, $shape, $shapeId); + $this->writeShapeLine($objWriter, $shape); } elseif ($shape instanceof Chart) { - $this->writeShapeChart($objWriter, $shape, $shapeId); + $this->writeShapeChart($objWriter, $shape); } elseif ($shape instanceof AbstractDrawing) { - $this->writeShapePic($objWriter, $shape, $shapeId); + $this->writeShapePic($objWriter, $shape); + } elseif ($shape instanceof Group) { + $this->writeShapeGroup($objWriter, $shape); } } $objWriter->endElement(); @@ -499,9 +300,8 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) * * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter * @param \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing $shape - * @param int $shapeId */ - public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape, $shapeId) + public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape) { // draw:frame $objWriter->startElement('draw:frame'); @@ -511,7 +311,7 @@ public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape, $sha $objWriter->writeAttribute('svg:x', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); $objWriter->writeAttribute('svg:y', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); if ($shape->getShadow()->isVisible()) { - $objWriter->writeAttribute('draw:style-name', 'gr' . $shapeId); + $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId); } // draw:image $objWriter->startElement('draw:image'); @@ -533,13 +333,12 @@ public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape, $sha * * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape - * @param int $shapeId */ - public function writeShapeTxt(XMLWriter $objWriter, RichText $shape, $shapeId) + public function writeShapeTxt(XMLWriter $objWriter, RichText $shape) { // draw:frame $objWriter->startElement('draw:frame'); - $objWriter->writeAttribute('draw:style-name', 'gr' . $shapeId); + $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId); $objWriter->writeAttribute('svg:width', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); $objWriter->writeAttribute('svg:height', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); $objWriter->writeAttribute('svg:x', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); @@ -695,13 +494,12 @@ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape, $shapeId) * * @param XMLWriter $objWriter * @param Line $shape - * @param integer $shapeId */ - public function writeShapeLine(XMLWriter $objWriter, Line $shape, $shapeId) + public function writeShapeLine(XMLWriter $objWriter, Line $shape) { // draw:line $objWriter->startElement('draw:line'); - $objWriter->writeAttribute('draw:style-name', 'gr' . $shapeId); + $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId); $objWriter->writeAttribute('svg:x1', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); $objWriter->writeAttribute('svg:y1', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); $objWriter->writeAttribute('svg:x2', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()+$shape->getWidth()), 3) . 'cm'); @@ -717,9 +515,8 @@ public function writeShapeLine(XMLWriter $objWriter, Line $shape, $shapeId) * Write table Shape * @param XMLWriter $objWriter * @param Table $shape - * @param integer $shapeId */ - public function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) + public function writeShapeTable(XMLWriter $objWriter, Table $shape) { // draw:frame $objWriter->startElement('draw:frame'); @@ -734,7 +531,7 @@ public function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) foreach ($shape->getRows() as $keyRow => $shapeRow) { // table:table-row $objWriter->startElement('table:table-row'); - $objWriter->writeAttribute('table:style-name', 'gr'.$shapeId.'r'.$keyRow); + $objWriter->writeAttribute('table:style-name', 'gr'.$this->shapeId.'r'.$keyRow); //@todo getFill $numColspan = 0; @@ -742,7 +539,7 @@ public function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) if ($numColspan == 0) { // table:table-cell $objWriter->startElement('table:table-cell'); - $objWriter->writeAttribute('table:style-name', 'gr' . $shapeId.'r'.$keyRow.'c'.$keyCell); + $objWriter->writeAttribute('table:style-name', 'gr' . $this->shapeId.'r'.$keyRow.'c'.$keyCell); if ($shapeCell->getColspan() > 1) { $objWriter->writeAttribute('table:number-columns-spanned', $shapeCell->getColspan()); $numColspan = $shapeCell->getColspan() - 1; @@ -785,15 +582,14 @@ public function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) * Write table Chart * @param XMLWriter $objWriter * @param Chart $shape - * @param integer $shapeId */ - public function writeShapeChart(XMLWriter $objWriter, Chart $shape, $shapeId) + public function writeShapeChart(XMLWriter $objWriter, Chart $shape) { $parentWriter = $this->getParentWriter(); if (!$parentWriter instanceof ODPresentation) { throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation'); } - $parentWriter->chartArray[$shapeId] = $shape; + $parentWriter->chartArray[$this->shapeId] = $shape; // draw:frame $objWriter->startElement('draw:frame'); @@ -805,7 +601,7 @@ public function writeShapeChart(XMLWriter $objWriter, Chart $shape, $shapeId) // draw:object $objWriter->startElement('draw:object'); - $objWriter->writeAttribute('xlink:href', './Object '.$shapeId); + $objWriter->writeAttribute('xlink:href', './Object '.$this->shapeId); $objWriter->writeAttribute('xlink:type', 'simple'); $objWriter->writeAttribute('xlink:show', 'embed'); @@ -814,4 +610,348 @@ public function writeShapeChart(XMLWriter $objWriter, Chart $shape, $shapeId) // > draw:frame $objWriter->endElement(); } + + /** + * Writes a group of shapes + * + * @param XMLWriter $objWriter + * @param Group $group + */ + public function writeShapeGroup(XMLWriter $objWriter, Group $group) + { + echo "writeShapeGroup()"; + + // draw:g + $objWriter->startElement('draw:g'); + + $shapes = $group->getShapeCollection(); + foreach ($shapes as $shape) { + // Increment $this->shapeId + ++$this->shapeId; + + // Check type + if ($shape instanceof RichText) { + $this->writeShapeTxt($objWriter, $shape, $this->shapeId); + } elseif ($shape instanceof Table) { + $this->writeShapeTable($objWriter, $shape, $this->shapeId); + } elseif ($shape instanceof Line) { + $this->writeShapeLine($objWriter, $shape, $this->shapeId); + } elseif ($shape instanceof Chart) { + $this->writeShapeChart($objWriter, $shape, $this->shapeId); + } elseif ($shape instanceof AbstractDrawing) { + $this->writeShapePic($objWriter, $shape, $this->shapeId); + } elseif ($shape instanceof Group) { + $this->writeShapeGroup($objWriter, $shape, $this->shapeId); + } + } + + $objWriter->endElement(); // draw:g + } + + /** + * Writes the style information for a group of shapes + * + * @param XMLWriter $objWriter + * @param Group $group + */ + public function writeGroupStyle(XMLWriter $objWriter, Group $group) + { + echo "writeGroupStyle()"; + + $shapes = $group->getShapeCollection(); + foreach ($shapes as $shape) { + // Increment $this->shapeId + ++$this->shapeId; + + // Check type + if ($shape instanceof RichText) { + $this->writeTxtStyle($objWriter, $shape, $this->shapeId); + } + if ($shape instanceof AbstractDrawing) { + $this->writeDrawingStyle($objWriter, $shape, $this->shapeId); + } + if ($shape instanceof Line) { + $this->writeLineStyle($objWriter, $shape, $this->shapeId); + } + if ($shape instanceof Table) { + $this->writeTableStyle($objWriter, $shape, $this->shapeId); + } + if ($shape instanceof Group) { + $this->writeGroupStyle($objWriter, $shape, $this->shapeId); + } + } + } + + /** + * Write the default style information for a RichText shape + * + * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter + * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape + */ + public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) + { + // style:style + $objWriter->startElement('style:style'); + $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId); + $objWriter->writeAttribute('style:family', 'graphic'); + $objWriter->writeAttribute('style:parent-style-name', 'standard'); + // style:graphic-properties + $objWriter->startElement('style:graphic-properties'); + if (is_bool($shape->hasAutoShrinkVertical())) { + $objWriter->writeAttribute('draw:auto-grow-height', var_export($shape->hasAutoShrinkVertical(), true)); + } + if (is_bool($shape->hasAutoShrinkHorizontal())) { + $objWriter->writeAttribute('draw:auto-grow-width', var_export($shape->hasAutoShrinkHorizontal(), true)); + } + switch ($shape->getFill()->getFillType()){ + case Fill::FILL_NONE: + default: + $objWriter->writeAttribute('draw:fill', 'none'); + $objWriter->writeAttribute('draw:fill-color', '#'.$shape->getFill()->getStartColor()->getRGB()); + break; + } + switch ($shape->getBorder()->getLineStyle()){ + case Border::LINE_NONE: + default: + $objWriter->writeAttribute('draw:stroke', 'none'); + $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); + } + + $objWriter->writeAttribute('fo:wrap-option', 'wrap'); + // > style:graphic-properties + $objWriter->endElement(); + // > style:style + $objWriter->endElement(); + + $paragraphs = $shape->getParagraphs(); + $paragraphId = 0; + foreach ($paragraphs as $paragraph) { + ++$paragraphId; + + // Style des paragraphes + if (!isset($this->arrStyleParagraph[$paragraph->getHashCode()])) { + $this->arrStyleParagraph[$paragraph->getHashCode()] = $paragraph; + } + + // Style des listes + if (!isset($this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()])) { + $this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['oStyle'] = $paragraph->getBulletStyle(); + $this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['level'] = ''; + } + if (strpos($this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['level'], ';' . $paragraph->getAlignment()->getLevel()) === false) { + $this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['level'] .= ';' . $paragraph->getAlignment()->getLevel(); + $this->arrStyleBullet[$paragraph->getBulletStyle()->getHashCode()]['oAlign_' . $paragraph->getAlignment()->getLevel()] = $paragraph->getAlignment(); + } + + $richtexts = $paragraph->getRichTextElements(); + $richtextId = 0; + foreach ($richtexts as $richtext) { + ++$richtextId; + // Not a line break + if ($richtext instanceof Run) { + // Style des font text + if (!isset($this->arrStyleTextFont[$richtext->getFont()->getHashCode()])) { + $this->arrStyleTextFont[$richtext->getFont()->getHashCode()] = $richtext->getFont(); + } + } + } + } + } + + /** + * Write the default style information for an AbstractDrawing + * + * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter + * @param \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing $shape + */ + public function writeDrawingStyle(XMLWriter $objWriter, AbstractDrawing $shape) + { + if ($shape->getShadow()->isVisible()) { + // style:style + $objWriter->startElement('style:style'); + $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId); + $objWriter->writeAttribute('style:family', 'graphic'); + $objWriter->writeAttribute('style:parent-style-name', 'standard'); + + // style:graphic-properties + $objWriter->startElement('style:graphic-properties'); + $objWriter->writeAttribute('draw:stroke', 'none'); + $objWriter->writeAttribute('draw:fill', 'none'); + $objWriter->writeAttribute('draw:shadow', 'visible'); + $objWriter->writeAttribute('draw:shadow-color', '#' . $shape->getShadow()->getColor()->getRGB()); + if ($shape->getShadow()->getDirection() == 0 || $shape->getShadow()->getDirection() == 360) { + $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '0cm'); + } elseif ($shape->getShadow()->getDirection() == 45) { + $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + } elseif ($shape->getShadow()->getDirection() == 90) { + $objWriter->writeAttribute('draw:shadow-offset-x', '0cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + } elseif ($shape->getShadow()->getDirection() == 135) { + $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + } elseif ($shape->getShadow()->getDirection() == 180) { + $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '0cm'); + } elseif ($shape->getShadow()->getDirection() == 225) { + $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + } elseif ($shape->getShadow()->getDirection() == 270) { + $objWriter->writeAttribute('draw:shadow-offset-x', '0cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + } elseif ($shape->getShadow()->getDirection() == 315) { + $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); + } + $objWriter->writeAttribute('draw:shadow-opacity', (100 - $shape->getShadow()->getAlpha()) . '%'); + $objWriter->writeAttribute('style:mirror', 'none'); + $objWriter->endElement(); + + $objWriter->endElement(); + } + } + + /** + * Write the default style information for a Line shape. + * + * @param XMLWriter $objWriter + * @param Line $shape + */ + public function writeLineStyle(XMLWriter $objWriter, Line $shape) + { + // style:style + $objWriter->startElement('style:style'); + $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId); + $objWriter->writeAttribute('style:family', 'graphic'); + $objWriter->writeAttribute('style:parent-style-name', 'standard'); + + // style:graphic-properties + $objWriter->startElement('style:graphic-properties'); + $objWriter->writeAttribute('draw:fill', 'none'); + switch ($shape->getBorder()->getLineStyle()) { + case Border::LINE_NONE: + $objWriter->writeAttribute('draw:stroke', 'none'); + break; + case Border::LINE_SINGLE: + $objWriter->writeAttribute('draw:stroke', 'solid'); + break; + default: + $objWriter->writeAttribute('draw:stroke', 'none'); + break; + } + $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); + $objWriter->writeAttribute('svg:stroke-width', String::numberFormat(SharedDrawing::pixelsToCentimeters((SharedDrawing::pointsToPixels($shape->getBorder()->getLineWidth()))), 3).'cm'); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write the default style information for a Table shape + * + * @param XMLWriter $objWriter + * @param Table $shape + */ + public function writeTableStyle(XMLWriter $objWriter, Table $shape) + { + foreach ($shape->getRows() as $keyRow => $shapeRow) { + // style:style + $objWriter->startElement('style:style'); + $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId.'r'.$keyRow); + $objWriter->writeAttribute('style:family', 'table-row'); + + // style:table-row-properties + $objWriter->startElement('style:table-row-properties'); + $objWriter->writeAttribute('style:row-height', String::numberFormat(SharedDrawing::pixelsToCentimeters(SharedDrawing::pointsToPixels($shapeRow->getHeight())), 3).'cm'); + $objWriter->endElement(); + + $objWriter->endElement(); + + foreach ($shapeRow->getCells() as $keyCell => $shapeCell) { + // style:style + $objWriter->startElement('style:style'); + $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId.'r'.$keyRow.'c'.$keyCell); + $objWriter->writeAttribute('style:family', 'table-cell'); + + // style:graphic-properties + $objWriter->startElement('style:graphic-properties'); + if ($shapeCell->getFill()->getFillType() == Fill::FILL_SOLID) { + $objWriter->writeAttribute('draw:fill', 'solid'); + $objWriter->writeAttribute('draw:fill-color', '#'.$shapeCell->getFill()->getStartColor()->getRGB()); + } + if ($shapeCell->getFill()->getFillType() == Fill::FILL_GRADIENT_LINEAR) { + $objWriter->writeAttribute('draw:fill', 'gradient'); + $objWriter->writeAttribute('draw:fill-gradient-name', 'gradient_'.$shapeCell->getFill()->getHashCode()); + } + $objWriter->endElement(); + // startElement('style:paragraph-properties'); + if ($shapeCell->getBorders()->getBottom()->getHashCode() == $shapeCell->getBorders()->getTop()->getHashCode() + && $shapeCell->getBorders()->getBottom()->getHashCode() == $shapeCell->getBorders()->getLeft()->getHashCode() + && $shapeCell->getBorders()->getBottom()->getHashCode() == $shapeCell->getBorders()->getRight()->getHashCode()) { + $lineStyle = 'none'; + $lineWidth = String::numberFormat($shapeCell->getBorders()->getBottom()->getLineWidth() / 1.75, 2); + $lineColor = $shapeCell->getBorders()->getBottom()->getColor()->getRGB(); + switch ($shapeCell->getBorders()->getBottom()->getLineStyle()){ + case Border::LINE_SINGLE: + $lineStyle = 'solid'; + } + $objWriter->writeAttribute('fo:border', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); + } else { + $lineStyle = 'none'; + $lineWidth = String::numberFormat($shapeCell->getBorders()->getBottom()->getLineWidth() / 1.75, 2); + $lineColor = $shapeCell->getBorders()->getBottom()->getColor()->getRGB(); + switch ($shapeCell->getBorders()->getBottom()->getLineStyle()){ + case Border::LINE_SINGLE: + $lineStyle = 'solid'; + } + $objWriter->writeAttribute('fo:border-bottom', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); + // TOP + $lineStyle = 'none'; + $lineWidth = String::numberFormat($shapeCell->getBorders()->getTop()->getLineWidth() / 1.75, 2); + $lineColor = $shapeCell->getBorders()->getTop()->getColor()->getRGB(); + switch ($shapeCell->getBorders()->getTop()->getLineStyle()){ + case Border::LINE_SINGLE: + $lineStyle = 'solid'; + } + $objWriter->writeAttribute('fo:border-top', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); + // RIGHT + $lineStyle = 'none'; + $lineWidth = String::numberFormat($shapeCell->getBorders()->getRight()->getLineWidth() / 1.75, 2); + $lineColor = $shapeCell->getBorders()->getRight()->getColor()->getRGB(); + switch ($shapeCell->getBorders()->getRight()->getLineStyle()){ + case Border::LINE_SINGLE: + $lineStyle = 'solid'; + } + $objWriter->writeAttribute('fo:border-right', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); + // LEFT + $lineStyle = 'none'; + $lineWidth = String::numberFormat($shapeCell->getBorders()->getLeft()->getLineWidth() / 1.75, 2); + $lineColor = $shapeCell->getBorders()->getLeft()->getColor()->getRGB(); + switch ($shapeCell->getBorders()->getLeft()->getLineStyle()){ + case Border::LINE_SINGLE: + $lineStyle = 'solid'; + } + $objWriter->writeAttribute('fo:border-left', $lineWidth.'pt '.$lineStyle.' #'.$lineColor); + } + $objWriter->endElement(); + + $objWriter->endElement(); + + foreach ($shapeCell->getParagraphs() as $shapeParagraph) { + foreach ($shapeParagraph->getRichTextElements() as $shapeRichText) { + if ($shapeRichText instanceof Run) { + // Style des font text + if (!isset($this->arrStyleTextFont[$shapeRichText->getFont()->getHashCode()])) { + $this->arrStyleTextFont[$shapeRichText->getFont()->getHashCode()] = $shapeRichText->getFont(); + } + } + } + } + } + } + } } diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php b/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php index 77b254456..edac85bde 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php @@ -19,6 +19,7 @@ use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; +use PhpOffice\PhpPowerpoint\Shape\Group; use PhpOffice\PhpPowerpoint\Shape\Table; /** @@ -46,6 +47,14 @@ public function allDrawings(PHPPowerPoint $pPHPPowerPoint = null) while ($iterator->valid()) { if ($iterator->current() instanceof AbstractDrawing && !($iterator->current() instanceof Table)) { $aDrawings[] = $iterator->current(); + } elseif ($iterator->current() instanceof Group) { + $iterator2 = $iterator->current()->getShapeCollection()->getIterator(); + while ($iterator2->valid()) { + if ($iterator2->current() instanceof AbstractDrawing && !($iterator2->current() instanceof Table)) { + $aDrawings[] = $iterator2->current(); + } + $iterator2->next(); + } } $iterator->next(); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php b/src/PhpPowerpoint/Writer/ODPresentation/Styles.php index db9b80401..d991d619b 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Styles.php @@ -18,9 +18,11 @@ namespace PhpOffice\PhpPowerpoint\Writer\ODPresentation; use PhpOffice\PhpPowerpoint\PhpPowerpoint; +use PhpOffice\PhpPowerpoint\Shape\Group; use PhpOffice\PhpPowerpoint\Shape\Table; use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; use PhpOffice\PhpPowerpoint\Shared\String; +use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Style\Fill; /** @@ -28,6 +30,13 @@ */ class Styles extends AbstractPart { + /** + * Stores font styles draw:gradient nodes + * + * @var array + */ + private $arrayGradient = array(); + /** * Write Meta file to XML format * @@ -95,31 +104,13 @@ public function writePart(PHPPowerPoint $pPHPPowerPoint) $objWriter->endElement(); // > style:style $objWriter->endElement(); - // draw:gradient - $arrayGradient = array(); + foreach ($pPHPPowerPoint->getAllSlides() as $slide) { foreach ($slide->getShapeCollection() as $shape) { if ($shape instanceof Table) { - foreach ($shape->getRows() as $row) { - foreach ($row->getCells() as $cell) { - if ($cell->getFill()->getFillType() == Fill::FILL_GRADIENT_LINEAR) { - if (!in_array($cell->getFill()->getHashCode(), $arrayGradient)) { - $objWriter->startElement('draw:gradient'); - $objWriter->writeAttribute('draw:name', 'gradient_'.$cell->getFill()->getHashCode()); - $objWriter->writeAttribute('draw:display-name', 'gradient_'.$cell->getFill()->getHashCode()); - $objWriter->writeAttribute('draw:style', 'linear'); - $objWriter->writeAttribute('draw:start-intensity', '100%'); - $objWriter->writeAttribute('draw:end-intensity', '100%'); - $objWriter->writeAttribute('draw:start-color', '#'.$cell->getFill()->getStartColor()->getRGB()); - $objWriter->writeAttribute('draw:end-color', '#'.$cell->getFill()->getEndColor()->getRGB()); - $objWriter->writeAttribute('draw:border', '0%'); - $objWriter->writeAttribute('draw:angle', $cell->getFill()->getRotation() - 90); - $objWriter->endElement(); - $arrayGradient[] = $cell->getFill()->getHashCode(); - } - } - } - } + $this->writeTableStyle($objWriter, $shape); + } elseif ($shape instanceof Group) { + $this->writeGroupStyle($objWriter, $shape); } } } @@ -172,4 +163,52 @@ public function writePart(PHPPowerPoint $pPHPPowerPoint) // Return return $objWriter->getData(); } + + /** + * Write the default style information for a Table shape + * + * @param XMLWriter $objWriter + * @param Table $shape + */ + public function writeTableStyle(XMLWriter $objWriter, Table $shape) + { + foreach ($shape->getRows() as $row) { + foreach ($row->getCells() as $cell) { + if ($cell->getFill()->getFillType() == Fill::FILL_GRADIENT_LINEAR) { + if (!in_array($cell->getFill()->getHashCode(), $this->arrayGradient)) { + $objWriter->startElement('draw:gradient'); + $objWriter->writeAttribute('draw:name', 'gradient_'.$cell->getFill()->getHashCode()); + $objWriter->writeAttribute('draw:display-name', 'gradient_'.$cell->getFill()->getHashCode()); + $objWriter->writeAttribute('draw:style', 'linear'); + $objWriter->writeAttribute('draw:start-intensity', '100%'); + $objWriter->writeAttribute('draw:end-intensity', '100%'); + $objWriter->writeAttribute('draw:start-color', '#'.$cell->getFill()->getStartColor()->getRGB()); + $objWriter->writeAttribute('draw:end-color', '#'.$cell->getFill()->getEndColor()->getRGB()); + $objWriter->writeAttribute('draw:border', '0%'); + $objWriter->writeAttribute('draw:angle', $cell->getFill()->getRotation() - 90); + $objWriter->endElement(); + $this->arrayGradient[] = $cell->getFill()->getHashCode(); + } + } + } + } + } + + /** + * Writes the style information for a group of shapes + * + * @param XMLWriter $objWriter + * @param Group $group + */ + public function writeGroupStyle(XMLWriter $objWriter, Group $group) + { + $shapes = $group->getShapeCollection(); + foreach ($shapes as $shape) { + if ($shape instanceof Table) { + $this->writeTableStyle($objWriter, $shape); + } elseif ($shape instanceof Group) { + $this->writeGroupStyle($objWriter, $shape); + } + } + } } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php index fa49339d3..6d4473b9f 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php @@ -19,6 +19,7 @@ use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; +use PhpOffice\PhpPowerpoint\Shape\Group; use PhpOffice\PhpPowerpoint\Shape\Table; /** @@ -46,6 +47,14 @@ public function allDrawings(PHPPowerPoint $pPHPPowerPoint = null) while ($iterator->valid()) { if ($iterator->current() instanceof AbstractDrawing && !($iterator->current() instanceof Table)) { $aDrawings[] = $iterator->current(); + } elseif ($iterator->current() instanceof Group) { + $iterator2 = $iterator->current()->getShapeCollection()->getIterator(); + while ($iterator2->valid()) { + if ($iterator2->current() instanceof AbstractDrawing && !($iterator2->current() instanceof Table)) { + $aDrawings[] = $iterator2->current(); + } + $iterator2->next(); + } } $iterator->next(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php index 78f205fd6..3b0bfad11 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php @@ -20,6 +20,7 @@ use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\Chart as ShapeChart; use PhpOffice\PhpPowerpoint\Shape\Drawing as ShapeDrawing; +use PhpOffice\PhpPowerpoint\Shape\Group; use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing; use PhpOffice\PhpPowerpoint\Shape\RichText\Run; use PhpOffice\PhpPowerpoint\Shape\RichText; @@ -300,8 +301,28 @@ public function writeSlideRelationships(SlideElement $pSlide) $iterator->current()->relationId = 'rId' . $relId; ++$relId; - } + } elseif ($iterator->current() instanceof Group) { + $iterator2 = $iterator->current()->getShapeCollection()->getIterator(); + while ($iterator2->valid()) { + if ($iterator2->current() instanceof ShapeDrawing || $iterator2->current() instanceof MemoryDrawing) { + // Write relationship for image drawing + $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . str_replace(' ', '_', $iterator2->current()->getIndexedFilename())); + + $iterator2->current()->relationId = 'rId' . $relId; + + ++$relId; + } elseif ($iterator2->current() instanceof ShapeChart) { + // Write relationship for chart drawing + $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', '../charts/' . $iterator2->current()->getIndexedFilename()); + $iterator2->current()->relationId = 'rId' . $relId; + + ++$relId; + } + $iterator2->next(); + } + } + $iterator->next(); } } @@ -348,6 +369,52 @@ public function writeSlideRelationships(SlideElement $pSlide) } } } + + if ($iterator->current() instanceof Group) { + + $iterator2 = $pSlide->getShapeCollection()->getIterator(); + while ($iterator2->valid()) { + // Hyperlink on shape + if ($iterator2->current()->hasHyperlink()) { + // Write relationship for hyperlink + $hyperlink = $iterator2->current()->getHyperlink(); + $hyperlink->relationId = 'rId' . $relId; + + if (!$hyperlink->isInternal()) { + $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External'); + } else { + $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml'); + } + + ++$relId; + } + + // Hyperlink on rich text run + if ($iterator2->current() instanceof RichText) { + foreach ($iterator2->current()->getParagraphs() as $paragraph) { + foreach ($paragraph->getRichTextElements() as $element) { + if ($element instanceof Run || $element instanceof TextElement) { + if ($element->hasHyperlink()) { + // Write relationship for hyperlink + $hyperlink = $element->getHyperlink(); + $hyperlink->relationId = 'rId' . $relId; + + if (!$hyperlink->isInternal()) { + $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External'); + } else { + $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml'); + } + + ++$relId; + } + } + } + } + } + $iterator2->next(); + } + + } $iterator->next(); } From 710fdea1279fe361cc0b36bf8935aad9a19a7b34 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 15 Dec 2014 15:07:57 +0100 Subject: [PATCH 015/115] FIXED : #61 : Add Support for Fill for RichText Shapes in PowerPoint2007 Writer --- CHANGELOG.md | 1 + samples/Sample_09_Fill.php | 72 ++++++++++++++ .../Writer/PowerPoint2007/Slide.php | 4 + .../Tests/Writer/PowerPoint2007/SlideTest.php | 93 ++++++++++++++++--- 4 files changed, 159 insertions(+), 11 deletions(-) create mode 100644 samples/Sample_09_Fill.php diff --git a/CHANGELOG.md b/CHANGELOG.md index a1a72c0d8..dcaf03ae1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 +- PowerPoint2007 Writer : Fill don't work for RichTextShapes - @Progi1984 GH-61 ### Miscellaneous diff --git a/samples/Sample_09_Fill.php b/samples/Sample_09_Fill.php new file mode 100644 index 000000000..d1427dd5c --- /dev/null +++ b/samples/Sample_09_Fill.php @@ -0,0 +1,72 @@ +getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPowerPoint Team') + ->setTitle('Sample 01 Title') + ->setSubject('Sample 01 Subject') + ->setDescription('Sample 01 Description') + ->setKeywords('office 2007 openxml libreoffice odt php') + ->setCategory('Sample Category'); + +// Create slide +echo date('H:i:s') . ' Create slide'.EOL; +$currentSlide = $objPHPPowerPoint->getActiveSlide(); + + +for($inc = 1 ; $inc <= 4 ; $inc++){ + // Create a shape (text) + echo date('H:i:s') . ' Create a shape (rich text)'.EOL; + $shape = $currentSlide->createRichTextShape() + ->setHeight(200) + ->setWidth(300); + if($inc == 1 || $inc == 3){ + $shape->setOffsetX(10); + } else { + $shape->setOffsetX(320); + } + if($inc == 1 || $inc == 2){ + $shape->setOffsetY(10); + } else { + $shape->setOffsetY(220); + } + $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); + + switch ($inc) { + case 1 : + $shape->getFill()->setFillType(Fill::FILL_NONE); + break; + case 2 : + $shape->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR)->setRotation(90)->setStartColor(new Color( 'FF4672A8' ))->setEndColor(new Color( 'FF000000' )); + break; + case 3 : + $shape->getFill()->setFillType(Fill::FILL_GRADIENT_PATH)->setRotation(90)->setStartColor(new Color( 'FF4672A8' ))->setEndColor(new Color( 'FF000000' )); + break; + case 4 : + $shape->getFill()->setFillType(Fill::FILL_SOLID)->setRotation(90)->setStartColor(new Color( 'FF4672A8' ))->setEndColor(new Color( 'FF4672A8' )); + break; + } + + $textRun = $shape->createTextRun('Use PHPPowerPoint!'); + $textRun->getFont()->setBold(true) + ->setSize(30) + ->setColor( new Color('FFE06B20') ); +} + +// Save file +echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 17d9a6d6d..c5b56dc56 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -411,6 +411,10 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) $objWriter->startElement('a:prstGeom'); $objWriter->writeAttribute('prst', 'rect'); $objWriter->endElement(); + + if ($shape->getFill()) { + $this->writeFill($objWriter, $shape->getFill()); + } $objWriter->endElement(); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index 926d9ce73..db83f30da 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -168,7 +168,7 @@ public function testDrawingShapeShadow() $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); } - public function testFillGradientLinear() + public function testFillGradientLinearTable() { $expected1 = 'E06B20'; $expected2 = strrev($expected1); @@ -193,32 +193,82 @@ public function testFillGradientLinear() $this->assertEquals($expected2, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); } - public function testFillGradientPath() + /** + * @link : https://github.com/PHPOffice/PHPPowerPoint/issues/61 + */ + public function testFillGradientLinearRichText() + { + $expected1 = 'E06B20'; + $expected2 = strrev($expected1); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createRichTextShape(); + $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); + $oFill = $oShape->getFill(); + $oFill->setFillType(Fill::FILL_GRADIENT_LINEAR)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill/a:gsLst/a:gs[@pos="0"]/a:srgbClr'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals($expected1, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); + $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill/a:gsLst/a:gs[@pos="100000"]/a:srgbClr'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals($expected2, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); + } + + public function testFillGradientPathTable() + { + $expected1 = 'E06B20'; + $expected2 = strrev($expected1); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createTableShape(1); + $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); + $oRow = $oShape->createRow(); + $oCell = $oRow->getCell(); + $oCell->createTextRun('R1C1'); + $oFill = $oCell->getFill(); + $oFill->setFillType(Fill::FILL_GRADIENT_PATH)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr/a:gradFill/a:gsLst/a:gs[@pos="0"]/a:srgbClr'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals($expected1, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); + $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr/a:gradFill/a:gsLst/a:gs[@pos="100000"]/a:srgbClr'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals($expected2, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); + } + + /** + * @link : https://github.com/PHPOffice/PHPPowerPoint/issues/61 + */ + public function testFillGradientPathText() { $expected1 = 'E06B20'; $expected2 = strrev($expected1); $phpPowerPoint = new PhpPowerpoint(); $oSlide = $phpPowerPoint->getActiveSlide(); - $oShape = $oSlide->createTableShape(1); + $oShape = $oSlide->createRichTextShape(); $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); - $oRow = $oShape->createRow(); - $oCell = $oRow->getCell(); - $oCell->createTextRun('R1C1'); - $oFill = $oCell->getFill(); + $oFill = $oShape->getFill(); $oFill->setFillType(Fill::FILL_GRADIENT_PATH)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); - $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr/a:gradFill/a:gsLst/a:gs[@pos="0"]/a:srgbClr'; + $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill/a:gsLst/a:gs[@pos="0"]/a:srgbClr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); $this->assertEquals($expected1, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); - $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr/a:gradFill/a:gsLst/a:gs[@pos="100000"]/a:srgbClr'; + $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill/a:gsLst/a:gs[@pos="100000"]/a:srgbClr'; $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); $this->assertEquals($expected2, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); } - public function testFillPattern() + public function testFillPatternTable() { $expected1 = 'E06B20'; $expected2 = strrev($expected1); @@ -243,7 +293,7 @@ public function testFillPattern() $this->assertEquals($expected2, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); } - public function testFillSolid() + public function testFillSolidTable() { $expected = 'E06B20'; @@ -263,6 +313,27 @@ public function testFillSolid() $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); $this->assertEquals($expected, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); } + + /** + * @link : https://github.com/PHPOffice/PHPPowerPoint/issues/61 + */ + public function testFillSolidText() + { + $expected = 'E06B20'; + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createRichTextShape(); + $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); + $oFill = $oShape->getFill(); + $oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF'.$expected)); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:solidFill/a:srgbClr'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals($expected, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); + } public function testHyperlink() { From 8fb7723d0dcc5ef15d4f68462d5794797a2605b4 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 15 Dec 2014 15:23:12 +0100 Subject: [PATCH 016/115] FIXED : #61 : Add Support for Fill for RichText Shapes in PowerPoint2007 Writer --- .../Tests/Writer/PowerPoint2007/SlideTest.php | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index db83f30da..cab35f8db 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -198,49 +198,49 @@ public function testFillGradientLinearTable() */ public function testFillGradientLinearRichText() { - $expected1 = 'E06B20'; - $expected2 = strrev($expected1); - - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); - $oShape = $oSlide->createRichTextShape(); - $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); - $oFill = $oShape->getFill(); - $oFill->setFillType(Fill::FILL_GRADIENT_LINEAR)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); - - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); - - $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill/a:gsLst/a:gs[@pos="0"]/a:srgbClr'; - $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); - $this->assertEquals($expected1, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); - $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill/a:gsLst/a:gs[@pos="100000"]/a:srgbClr'; - $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); - $this->assertEquals($expected2, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); + $expected1 = 'E06B20'; + $expected2 = strrev($expected1); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createRichTextShape(); + $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); + $oFill = $oShape->getFill(); + $oFill->setFillType(Fill::FILL_GRADIENT_LINEAR)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill/a:gsLst/a:gs[@pos="0"]/a:srgbClr'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals($expected1, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); + $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill/a:gsLst/a:gs[@pos="100000"]/a:srgbClr'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals($expected2, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); } public function testFillGradientPathTable() { - $expected1 = 'E06B20'; - $expected2 = strrev($expected1); - - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); - $oShape = $oSlide->createTableShape(1); - $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); - $oRow = $oShape->createRow(); - $oCell = $oRow->getCell(); - $oCell->createTextRun('R1C1'); - $oFill = $oCell->getFill(); - $oFill->setFillType(Fill::FILL_GRADIENT_PATH)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); - - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); - - $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr/a:gradFill/a:gsLst/a:gs[@pos="0"]/a:srgbClr'; - $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); - $this->assertEquals($expected1, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); - $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr/a:gradFill/a:gsLst/a:gs[@pos="100000"]/a:srgbClr'; - $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); - $this->assertEquals($expected2, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); + $expected1 = 'E06B20'; + $expected2 = strrev($expected1); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createTableShape(1); + $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); + $oRow = $oShape->createRow(); + $oCell = $oRow->getCell(); + $oCell->createTextRun('R1C1'); + $oFill = $oCell->getFill(); + $oFill->setFillType(Fill::FILL_GRADIENT_PATH)->setStartColor(new Color('FF'.$expected1))->setEndColor(new Color('FF'.$expected2)); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr/a:gradFill/a:gsLst/a:gs[@pos="0"]/a:srgbClr'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals($expected1, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); + $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:tcPr/a:gradFill/a:gsLst/a:gs[@pos="100000"]/a:srgbClr'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals($expected2, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); } /** @@ -319,20 +319,20 @@ public function testFillSolidTable() */ public function testFillSolidText() { - $expected = 'E06B20'; + $expected = 'E06B20'; - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); - $oShape = $oSlide->createRichTextShape(); - $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); - $oFill = $oShape->getFill(); - $oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF'.$expected)); + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createRichTextShape(); + $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); + $oFill = $oShape->getFill(); + $oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF'.$expected)); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); - $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:solidFill/a:srgbClr'; - $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); - $this->assertEquals($expected, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); + $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:solidFill/a:srgbClr'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals($expected, $pres->getElementAttribute($element, 'val', 'ppt/slides/slide1.xml')); } public function testHyperlink() From 43bea92220396a3c7178f649afbc961be28828c1 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 16 Dec 2014 12:34:45 +0100 Subject: [PATCH 017/115] FIXED : #70 : Add Support for Hyperlink in Table Shapes in PowerPoint2007/ODPresentation Writer --- CHANGELOG.md | 2 ++ samples/Sample_06_Table.php | 9 +++++ .../Writer/ODPresentation/Content.php | 14 ++++++-- .../Writer/PowerPoint2007/Rels.php | 34 +++++++++++++++++++ .../Writer/ODPresentation/ContentTest.php | 22 ++++++++++++ .../Tests/Writer/PowerPoint2007/SlideTest.php | 22 ++++++++++++ 6 files changed, 101 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcaf03ae1..128e54690 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 - PowerPoint2007 Writer : Fill don't work for RichTextShapes - @Progi1984 GH-61 +- PowerPoint2007 Writer : Hyperlink in table doesn't work - @Progi1984 GH-70 +- ODPresentation Writer : Hyperlink in table doesn't work - @Progi1984 GH-70 ### Miscellaneous diff --git a/samples/Sample_06_Table.php b/samples/Sample_06_Table.php index e16007f1c..9d3b8c84e 100644 --- a/samples/Sample_06_Table.php +++ b/samples/Sample_06_Table.php @@ -90,6 +90,15 @@ $row->nextCell()->createTextRun('R3C2'); $row->nextCell()->createTextRun('R3C3'); +// Add row +echo date('H:i:s') . ' Add row'.EOL; +$row = $shape->createRow(); +$row->getFill()->setFillType(Fill::FILL_SOLID) + ->setStartColor(new Color( 'FFE06B20' )) + ->setEndColor(new Color('FFE06B20')); +$textRun = $row->nextCell()->createTextRun('Link'); +$textRun->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); + // Save file echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); if (!CLI) { diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index deb87fc6d..f3bfb1563 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -755,8 +755,18 @@ public function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) foreach ($shapeCell->getParagraphs() as $shapeParagraph) { foreach ($shapeParagraph->getRichTextElements() as $shapeRichText) { $objWriter->startElement('text:span'); - $objWriter->writeAttribute('text:style-name', 'T_' . $shapeRichText->getFont()->getHashCode()); - $objWriter->text($shapeRichText->getText()); + if ($shapeRichText instanceof Run) { + $objWriter->writeAttribute('text:style-name', 'T_' . $shapeRichText->getFont()->getHashCode()); + } + if ($shapeRichText->hasHyperlink() == true && $shapeRichText->getHyperlink()->getUrl() != '') { + // text:a + $objWriter->startElement('text:a'); + $objWriter->writeAttribute('xlink:href', $shapeRichText->getHyperlink()->getUrl()); + $objWriter->text($shapeRichText->getText()); + $objWriter->endElement(); + } else { + $objWriter->text($shapeRichText->getText()); + } $objWriter->endElement(); } } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php index 78f205fd6..77fbc614c 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php @@ -24,6 +24,7 @@ use PhpOffice\PhpPowerpoint\Shape\RichText\Run; use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\Shape\RichText\TextElement; +use PhpOffice\PhpPowerpoint\Shape\Table as ShapeTable; use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Slide as SlideElement; use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; @@ -348,6 +349,39 @@ public function writeSlideRelationships(SlideElement $pSlide) } } } + + // Hyperlink in table + if ($iterator->current() instanceof ShapeTable) { + // Rows + for ($row = 0; $row < count($iterator->current()->getRows()); $row++) { + // Cells in rows + for ($cell = 0; $cell < count($iterator->current()->getRow($row)->getCells()); $cell++) { + $currentCell = $iterator->current()->getRow($row)->getCell($cell); + // Paragraphs in cell + foreach ($currentCell->getParagraphs() as $paragraph) { + // RichText in paragraph + foreach ($paragraph->getRichTextElements() as $element) { + // Run or Text in RichText + if ($element instanceof Run || $element instanceof TextElement) { + if ($element->hasHyperlink()) { + // Write relationship for hyperlink + $hyperlink = $element->getHyperlink(); + $hyperlink->relationId = 'rId' . $relId; + + if (!$hyperlink->isInternal()) { + $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', $hyperlink->getUrl(), 'External'); + } else { + $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slide' . $hyperlink->getSlideNumber() . '.xml'); + } + + ++$relId; + } + } + } + } + } + } + } $iterator->next(); } diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index d4acceaad..0295ad545 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -274,6 +274,28 @@ public function testTableWithColspan() $this->assertEquals($value, $pres->getElementAttribute($element, 'table:number-columns-spanned', 'content.xml')); } + /** + * @link : https://github.com/PHPOffice/PHPPowerPoint/issues/70 + */ + public function testTableWithHyperlink() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createTableShape(4); + $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); + $oRow = $oShape->createRow(); + $oCell = $oRow->getCell(); + $oTextRun = $oCell->createTextRun('AAA'); + $oHyperlink = $oTextRun->getHyperlink(); + $oHyperlink->setUrl('https://github.com/PHPOffice/PHPPowerPoint/'); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/table:table/table:table-row/table:table-cell/text:p/text:span/text:a'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertEquals('https://github.com/PHPOffice/PHPPowerPoint/', $pres->getElementAttribute($element, 'xlink:href', 'content.xml')); + } + public function testTableWithText() { $oRun = new Run(); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index cab35f8db..2555252e4 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -610,4 +610,26 @@ public function testTableWithRowspan() $this->assertTrue($pres->elementExists($element.'[@rowSpan="2"]', 'ppt/slides/slide1.xml')); $this->assertTrue($pres->elementExists($element.'[@vMerge="1"]', 'ppt/slides/slide1.xml')); } + + /** + * @link : https://github.com/PHPOffice/PHPPowerPoint/issues/70 + */ + public function testTableWithHyperlink() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createTableShape(4); + $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); + $oRow = $oShape->createRow(); + $oCell = $oRow->getCell(); + $oTextRun = $oCell->createTextRun('AAA'); + $oHyperlink = $oTextRun->getHyperlink(); + $oHyperlink->setUrl('https://github.com/PHPOffice/PHPPowerPoint/'); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc/a:txBody/a:p/a:r/a:rPr/a:hlinkClick'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals('rId2', $pres->getElementAttribute($element, 'r:id', 'ppt/slides/slide1.xml')); + } } From 16b183ba4ca09588fe93381b1b046f3211921aa2 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 16 Dec 2014 13:40:32 +0100 Subject: [PATCH 018/115] FIXED : #70 : Add Support for Hyperlink in Table Shapes in PowerPoint2007/ODPresentation Writer --- .../Writer/ODPresentation/ContentTest.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index 0295ad545..dbef65d69 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -279,21 +279,21 @@ public function testTableWithColspan() */ public function testTableWithHyperlink() { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); - $oShape = $oSlide->createTableShape(4); - $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); - $oRow = $oShape->createRow(); - $oCell = $oRow->getCell(); - $oTextRun = $oCell->createTextRun('AAA'); - $oHyperlink = $oTextRun->getHyperlink(); - $oHyperlink->setUrl('https://github.com/PHPOffice/PHPPowerPoint/'); + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createTableShape(4); + $oShape->setHeight(200)->setWidth(600)->setOffsetX(150)->setOffsetY(300); + $oRow = $oShape->createRow(); + $oCell = $oRow->getCell(); + $oTextRun = $oCell->createTextRun('AAA'); + $oHyperlink = $oTextRun->getHyperlink(); + $oHyperlink->setUrl('https://github.com/PHPOffice/PHPPowerPoint/'); - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); - $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/table:table/table:table-row/table:table-cell/text:p/text:span/text:a'; - $this->assertTrue($pres->elementExists($element, 'content.xml')); - $this->assertEquals('https://github.com/PHPOffice/PHPPowerPoint/', $pres->getElementAttribute($element, 'xlink:href', 'content.xml')); + $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/table:table/table:table-row/table:table-cell/text:p/text:span/text:a'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertEquals('https://github.com/PHPOffice/PHPPowerPoint/', $pres->getElementAttribute($element, 'xlink:href', 'content.xml')); } public function testTableWithText() From 700946e10fc80a2ec11eb2c1f7bd5424631ba514 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Dec 2014 12:27:30 +0100 Subject: [PATCH 019/115] FIXED : #71 : PowerPoint2007 Writer : AutoFitNormal works with options (fontScale & lineSpacingReduction) --- CHANGELOG.md | 2 + docs/shapes.rst | 2 + samples/Sample_10_Border.php | 63 +++++++++++++++++++ src/PhpPowerpoint/Shape/RichText.php | 46 +++++++++++++- .../Writer/PowerPoint2007/Slide.php | 35 +++++++++-- .../Tests/Writer/PowerPoint2007/SlideTest.php | 16 +++++ 6 files changed, 156 insertions(+), 8 deletions(-) create mode 100644 samples/Sample_10_Border.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 128e54690..fe1d2208a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,10 @@ ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 - PowerPoint2007 Writer : Fill don't work for RichTextShapes - @Progi1984 GH-61 +- PowerPoint2007 Writer : Border don't work for RichTextShapes - @Progi1984 GH-61 - PowerPoint2007 Writer : Hyperlink in table doesn't work - @Progi1984 GH-70 - ODPresentation Writer : Hyperlink in table doesn't work - @Progi1984 GH-70 +- PowerPoint2007 Writer : AutoFitNormal works with options (fontScale & lineSpacingReduction) - @Progi1984 @desigennaro GH-71 ### Miscellaneous diff --git a/docs/shapes.rst b/docs/shapes.rst index e996f111d..12d4ed31d 100644 --- a/docs/shapes.rst +++ b/docs/shapes.rst @@ -35,6 +35,8 @@ Below are the properties that you can set for a rich text shape. - ``wrap`` - ``autoFit`` +- ``fontScale`` : font scale (in percentage) when autoFit = RichText::AUTOFIT_NORMAL +- ``lnSpcReduction`` : line spacing reduction (in percentage) when autoFit = RichText::AUTOFIT_NORMAL - ``horizontalOverflow`` - ``verticalOverflow`` - ``upright`` diff --git a/samples/Sample_10_Border.php b/samples/Sample_10_Border.php new file mode 100644 index 000000000..e1648a8f4 --- /dev/null +++ b/samples/Sample_10_Border.php @@ -0,0 +1,63 @@ +getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPowerPoint Team')->setTitle('Sample 01 Title')->setSubject('Sample 01 Subject')->setDescription('Sample 01 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category'); + +// Create slide +echo date('H:i:s') . ' Create slide' . EOL; +$currentSlide = $objPHPPowerPoint->getActiveSlide(); + + +for ($inc = 1; $inc <= 4; $inc++) { + // Create a shape (text) + echo date('H:i:s') . ' Create a shape (rich text)' . EOL; + $shape = $currentSlide->createRichTextShape()->setHeight(200)->setWidth(300); + if ($inc == 1 || $inc == 3) { + $shape->setOffsetX(10); + } else { + $shape->setOffsetX(320); + } + if ($inc == 1 || $inc == 2) { + $shape->setOffsetY(10); + } else { + $shape->setOffsetY(220); + } + $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); + + switch ($inc) { + case 1: + $shape->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_SOLID)->setLineStyle(Border::LINE_DOUBLE); + break; + case 2: + $shape->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_DASH)->setLineStyle(Border::LINE_SINGLE); + break; + case 3: + $shape->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_DOT)->setLineStyle(Border::LINE_THICKTHIN); + break; + case 4: + $shape->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_LARGEDASHDOT)->setLineStyle(Border::LINE_THINTHICK); + break; + } + + $textRun = $shape->createTextRun('Use PHPPowerPoint!'); + $textRun->getFont()->setBold(true)->setSize(30)->setColor(new Color('FFE06B20')); +} + +// Save file +echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/src/PhpPowerpoint/Shape/RichText.php b/src/PhpPowerpoint/Shape/RichText.php index f3c1f1194..fb5e07ed6 100644 --- a/src/PhpPowerpoint/Shape/RichText.php +++ b/src/PhpPowerpoint/Shape/RichText.php @@ -35,7 +35,7 @@ class RichText extends AbstractShape implements ComparableInterface const AUTOFIT_DEFAULT = 'spAutoFit'; const AUTOFIT_SHAPE = 'spAutoFit'; const AUTOFIT_NOAUTOFIT = 'noAutofit'; - const AUTOFIT_NORMAL = 'normAutoFit'; + const AUTOFIT_NORMAL = 'normAutofit'; /** Overflow */ const OVERFLOW_CLIP = 'clip'; @@ -143,6 +143,18 @@ class RichText extends AbstractShape implements ComparableInterface * @var boolean */ private $autoShrinkVertical; + + /** + * The percentage of the original font size to which the text is scaled + * @var float + */ + private $fontScale; + + /** + * The percentage of the reduction of the line spacing + * @var float + */ + private $lnSpcReduction; /** * Create a new \PhpOffice\PhpPowerpoint\Shape\RichText instance @@ -374,15 +386,45 @@ public function getAutoFit() return $this->autoFit; } + /** + * Get pourcentage of fontScale + * + * @return float + */ + public function getFontScale() + { + return $this->fontScale; + } + + /** + * Get pourcentage of the line space reduction + * + * @return float + */ + public function getLineSpaceReduction() + { + return $this->lnSpcReduction; + } + /** * Set autofit * * @param $value string + * @param $fontScale float + * @param $lnSpcReduction float * @return \PhpOffice\PhpPowerpoint\Shape\RichText */ - public function setAutoFit($value = self::AUTOFIT_DEFAULT) + public function setAutoFit($value = self::AUTOFIT_DEFAULT, $fontScale = null, $lnSpcReduction = null) { $this->autoFit = $value; + + if(!is_null($fontScale)){ + $this->fontScale = $fontScale; + } + + if(!is_null($lnSpcReduction)){ + $this->lnSpcReduction = $lnSpcReduction; + } return $this; } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index c5b56dc56..078f3ec81 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -415,6 +415,10 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) if ($shape->getFill()) { $this->writeFill($objWriter, $shape->getFill()); } + + if ($shape->getBorder()->getLineStyle() != Border::LINE_NONE) { + $this->writeBorder($objWriter, $shape->getBorder(), ''); + } $objWriter->endElement(); @@ -422,16 +426,23 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) $objWriter->startElement('p:txBody'); // a:bodyPr + //@link :http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.bodyproperties%28v=office.14%29.aspx $objWriter->startElement('a:bodyPr'); $verticalAlign = $shape->getActiveParagraph()->getAlignment()->getVertical(); if ($verticalAlign != Alignment::VERTICAL_BASE && $verticalAlign != Alignment::VERTICAL_AUTO) { $objWriter->writeAttribute('anchor', $verticalAlign); } - $objWriter->writeAttribute('wrap', $shape->getWrap()); + if($shape->getWrap() != RichText::WRAP_SQUARE){ + $objWriter->writeAttribute('wrap', $shape->getWrap()); + } $objWriter->writeAttribute('rtlCol', '0'); - $objWriter->writeAttribute('horzOverflow', $shape->getHorizontalOverflow()); - $objWriter->writeAttribute('vertOverflow', $shape->getVerticalOverflow()); + if ($shape->getHorizontalOverflow() != RichText::OVERFLOW_OVERFLOW) { + $objWriter->writeAttribute('horzOverflow', $shape->getHorizontalOverflow()); + } + if ($shape->getVerticalOverflow() != RichText::OVERFLOW_OVERFLOW) { + $objWriter->writeAttribute('vertOverflow', $shape->getVerticalOverflow()); + } if ($shape->isUpright()) { $objWriter->writeAttribute('upright', '1'); @@ -445,16 +456,28 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) $objWriter->writeAttribute('rIns', SharedDrawing::pixelsToEmu($shape->getInsetRight())); $objWriter->writeAttribute('tIns', SharedDrawing::pixelsToEmu($shape->getInsetTop())); - $objWriter->writeAttribute('numCol', $shape->getColumns()); + if($shape->getColumns() <> 1){ + $objWriter->writeAttribute('numCol', $shape->getColumns()); + } // a:spAutoFit - $objWriter->writeElement('a:' . $shape->getAutoFit(), null); + $objWriter->startElement('a:' . $shape->getAutoFit()); + if($shape->getAutoFit() == RichText::AUTOFIT_NORMAL){ + if (!is_null($shape->getFontScale())) { + $objWriter->writeAttribute('fontScale', (int)($shape->getFontScale() * 1000)); + } + if (!is_null($shape->getLineSpaceReduction())) { + $objWriter->writeAttribute('lnSpcReduction', (int)($shape->getLineSpaceReduction() * 1000)); + } + } + + $objWriter->endElement(); $objWriter->endElement(); // a:lstStyle $objWriter->writeElement('a:lstStyle', null); - + // Write paragraphs $this->writeParagraphs($objWriter, $shape->getParagraphs()); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index 2555252e4..807366f02 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -28,6 +28,7 @@ use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Shape\Hyperlink; use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Slide; +use PhpOffice\PhpPowerpoint\Shape\RichText; /** * Test class for PowerPoint2007 @@ -440,6 +441,21 @@ public function testLine() $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); } + public function testRichTextAutoFitNormal() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oRichText = $oSlide->createRichTextShape(); + $oRichText->setAutoFit(RichText::AUTOFIT_NORMAL, 47.5, 20); + $oRichText->createTextRun('This is my text for the test.'); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:normAutofit'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals(47500, $pres->getElementAttribute($element, 'fontScale', 'ppt/slides/slide1.xml')); + $this->assertEquals(20000, $pres->getElementAttribute($element, 'lnSpcReduction', 'ppt/slides/slide1.xml')); + } + public function testRichTextBreak() { $phpPowerPoint = new PhpPowerpoint(); From cadbeab6a215c81a702acad8b8ed9da594b2c936 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Dec 2014 13:28:46 +0100 Subject: [PATCH 020/115] FIXED : #71 : PowerPoint2007 Writer : AutoFitNormal works with options (fontScale & lineSpacingReduction) --- src/PhpPowerpoint/Shape/RichText.php | 4 ++-- src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PhpPowerpoint/Shape/RichText.php b/src/PhpPowerpoint/Shape/RichText.php index fb5e07ed6..6aecc79f8 100644 --- a/src/PhpPowerpoint/Shape/RichText.php +++ b/src/PhpPowerpoint/Shape/RichText.php @@ -418,11 +418,11 @@ public function setAutoFit($value = self::AUTOFIT_DEFAULT, $fontScale = null, $l { $this->autoFit = $value; - if(!is_null($fontScale)){ + if (!is_null($fontScale)) { $this->fontScale = $fontScale; } - if(!is_null($lnSpcReduction)){ + if (!is_null($lnSpcReduction)) { $this->lnSpcReduction = $lnSpcReduction; } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 078f3ec81..583785890 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -432,7 +432,7 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) if ($verticalAlign != Alignment::VERTICAL_BASE && $verticalAlign != Alignment::VERTICAL_AUTO) { $objWriter->writeAttribute('anchor', $verticalAlign); } - if($shape->getWrap() != RichText::WRAP_SQUARE){ + if ($shape->getWrap() != RichText::WRAP_SQUARE) { $objWriter->writeAttribute('wrap', $shape->getWrap()); } $objWriter->writeAttribute('rtlCol', '0'); @@ -456,13 +456,13 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) $objWriter->writeAttribute('rIns', SharedDrawing::pixelsToEmu($shape->getInsetRight())); $objWriter->writeAttribute('tIns', SharedDrawing::pixelsToEmu($shape->getInsetTop())); - if($shape->getColumns() <> 1){ + if ($shape->getColumns() <> 1) { $objWriter->writeAttribute('numCol', $shape->getColumns()); } // a:spAutoFit $objWriter->startElement('a:' . $shape->getAutoFit()); - if($shape->getAutoFit() == RichText::AUTOFIT_NORMAL){ + if ($shape->getAutoFit() == RichText::AUTOFIT_NORMAL) { if (!is_null($shape->getFontScale())) { $objWriter->writeAttribute('fontScale', (int)($shape->getFontScale() * 1000)); } From 017455251a2e3f2a2f022f5efda22d2417033cb0 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 22 Dec 2014 12:29:41 +0100 Subject: [PATCH 021/115] FIXED : #68 : Group support --- CHANGELOG.md | 4 +- ...ample_09_Group.php => Sample_11_Group.php} | 0 src/PhpPowerpoint/Reader/PowerPoint97.php | 85 ++++++++++--------- .../Writer/ODPresentation/Content.php | 4 - tests/PhpPowerpoint/Tests/Shape/GroupTest.php | 12 +++ tests/PhpPowerpoint/Tests/SlideTest.php | 8 ++ 6 files changed, 65 insertions(+), 48 deletions(-) rename samples/{Sample_09_Group.php => Sample_11_Group.php} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9e27cf41..b496122f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,8 @@ ## 0.4.0 - NOT RELEASED ### Features -- Added support for grouping shapes together in a Group - @Pr0phet -- Added support for calculating the offset and extent on a Slide. - @Pr0phet +- Added support for grouping shapes together in a Group - @Pr0phet GH-68 +- Added support for calculating the offset and extent on a Slide. - @Pr0phet GH-68 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/samples/Sample_09_Group.php b/samples/Sample_11_Group.php similarity index 100% rename from samples/Sample_09_Group.php rename to samples/Sample_11_Group.php diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index 64ebd16a0..85221ff47 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -308,7 +308,7 @@ class PowerPoint97 implements ReaderInterface private $rgPersistDirEntry; /** * Offset (in bytes) from the beginning of the PowerPoint Document Stream to the PersistDirectoryAtom record for this user edit - * @var int[] + * @var int */ private $offsetPersistDirectory; /** @@ -426,7 +426,7 @@ private function loadFile($pFilename) /** * Read OLE Part - * @param unknown $pFilename + * @param string $pFilename */ private function loadOLE($pFilename) { @@ -489,7 +489,6 @@ private function loadPicturesStream() break; default: throw new \Exception('Feature not implemented (l.'.__LINE__.' : '.dechex($arrayRH['recType'].')')); - break; } } } else { @@ -567,7 +566,6 @@ private function loadCurrentUserStream() // ansiUserName $ansiUserName = ''; - $char = false; do { $char = self::getInt1d($this->streamCurrentUser, $pos); if (($char >= 0x00 && $char <= 0x1F) || ($char >= 0x7F && $char <= 0x9F)) { @@ -664,7 +662,7 @@ private function loadUserEditAtom() // offsetLastEdit $pos += 4; // offsetPersistDirectory - $this->offsetPersistDirectory = self::getInt4d($this->streamPowerpointDocument, $pos); + $this->offsetPersistDirectory = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; // docPersistIdRef @@ -837,16 +835,16 @@ private function readRTSlide($pos) // print_r('$shapeGroup'.EOL); $pos += 8; $rHeader['recLen'] -= 8; - $arrShapeGroup['xLeft'] = self::getInt4d($this->streamPowerpointDocument, $pos); + //$arrShapeGroup['xLeft'] = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; - $arrShapeGroup['yTop'] = self::getInt4d($this->streamPowerpointDocument, $pos); + //$arrShapeGroup['yTop'] = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; - $arrShapeGroup['xRight'] = self::getInt4d($this->streamPowerpointDocument, $pos); + //$arrShapeGroup['xRight'] = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; - $arrShapeGroup['yBottom'] = self::getInt4d($this->streamPowerpointDocument, $pos); + //$arrShapeGroup['yBottom'] = self::getInt4d($this->streamPowerpointDocument, $pos); $pos += 4; $rHeader['recLen'] -= 4; } @@ -1129,7 +1127,6 @@ private function readRTSlide($pos) break; default: throw new \Exception('Feature not implemented (l.'.__LINE__.' : '.dechex($opt['opid'].')')); - break; } } $pos += $shapePrimaryOptions['recLen']; @@ -1339,13 +1336,13 @@ private function readRTSlide($pos) $arrClientTextBox['text'.$arrClientTextBox['numTexts']]['bulletChar'] = chr($data); } if ($masksData['bulletFont'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['bulletSize'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; @@ -1406,19 +1403,19 @@ private function readRTSlide($pos) } } if ($masksData['lineSpacing'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['spaceBefore'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['spaceAfter'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; @@ -1438,7 +1435,7 @@ private function readRTSlide($pos) $arrClientTextBox['text'.$arrClientTextBox['numTexts']]['indent'] = (int)round($data/6); } if ($masksData['defaultTabSize'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; @@ -1453,7 +1450,7 @@ private function readRTSlide($pos) $clientTextbox['recLen'] -= 2; } if ($masksData['charWrap'] == 1 || $masksData['wordWrap'] == 1 || $masksData['overflow'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; @@ -1509,7 +1506,8 @@ private function readRTSlide($pos) $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; - + + $fontStyleFlags = array(); $fontStyleFlags['bold'] = ($data >> 0) & bindec('1'); $fontStyleFlags['italic'] = ($data >> 1) & bindec('1'); $fontStyleFlags['underline'] = ($data >> 2) & bindec('1'); @@ -1660,13 +1658,13 @@ private function readRTSlide($pos) $masksSpell['grammar'] = ($data >> 2) & bindec('1'); } if ($masksData['lang'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['altLang'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; @@ -1732,61 +1730,61 @@ private function readRTSlide($pos) } } if ($masksData['fLeftMargin1'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fIndent1'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fLeftMargin2'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fIndent2'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fLeftMargin3'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fIndent3'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fLeftMargin4'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fIndent4'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fLeftMargin5'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; } if ($masksData['fIndent5'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; @@ -1971,19 +1969,22 @@ private function readRTSlide($pos) } } - if (isset($arrShpPrimaryOpt['insetBottom'])) { - $shape->setInsetBottom($arrShpPrimaryOpt['insetBottom']); - } - if (isset($arrShpPrimaryOpt['insetLeft'])) { - $shape->setInsetLeft($arrShpPrimaryOpt['insetLeft']); - } - if (isset($arrShpPrimaryOpt['insetRight'])) { - $shape->setInsetRight($arrShpPrimaryOpt['insetRight']); - } - if (isset($arrShpPrimaryOpt['insetTop'])) { - $shape->setInsetTop($arrShpPrimaryOpt['insetTop']); + if($shape instanceof RichText){ + if (isset($arrShpPrimaryOpt['insetBottom'])) { + $shape->setInsetBottom($arrShpPrimaryOpt['insetBottom']); + } + if (isset($arrShpPrimaryOpt['insetLeft'])) { + $shape->setInsetLeft($arrShpPrimaryOpt['insetLeft']); + } + if (isset($arrShpPrimaryOpt['insetRight'])) { + $shape->setInsetRight($arrShpPrimaryOpt['insetRight']); + } + if (isset($arrShpPrimaryOpt['insetTop'])) { + $shape->setInsetTop($arrShpPrimaryOpt['insetTop']); + } } + if (!is_null($shape) && $shape instanceof AbstractShape) { // echo '//SHAPE'.EOL; $oSlide->addShape($shape); @@ -2206,7 +2207,7 @@ private function readRTDocument($pos) /** * Read a record header * @param string $stream - * @param intger $pos + * @param integer $pos * @return multitype:boolean Ambigous */ private function loadRecordHeader($stream, $pos) diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index cc81fb4e7..d29f9c72b 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -629,8 +629,6 @@ public function writeShapeChart(XMLWriter $objWriter, Chart $shape) */ public function writeShapeGroup(XMLWriter $objWriter, Group $group) { - echo "writeShapeGroup()"; - // draw:g $objWriter->startElement('draw:g'); @@ -666,8 +664,6 @@ public function writeShapeGroup(XMLWriter $objWriter, Group $group) */ public function writeGroupStyle(XMLWriter $objWriter, Group $group) { - echo "writeGroupStyle()"; - $shapes = $group->getShapeCollection(); foreach ($shapes as $shape) { // Increment $this->shapeId diff --git a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php index 36ab4013d..2c91cf3a0 100644 --- a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php @@ -38,6 +38,18 @@ public function testConstruct() $this->assertEquals(0, $object->getShapeCollection()->count()); } + public function testAdd() + { + $object = new Group(); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart', $object->createChartShape()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Drawing', $object->createDrawingShape()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Line', $object->createLineShape(10, 10, 10, 10)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->createRichTextShape()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Table', $object->createTableShape()); + $this->assertEquals(5, $object->getShapeCollection()->count()); + } + public function testExtentsAndOffsetsForOneShape() { // We record initial values here because diff --git a/tests/PhpPowerpoint/Tests/SlideTest.php b/tests/PhpPowerpoint/Tests/SlideTest.php index 7af850a2d..9386c5c55 100644 --- a/tests/PhpPowerpoint/Tests/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/SlideTest.php @@ -58,4 +58,12 @@ public function testSlideMasterId() $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->setSlideMasterId($value)); $this->assertEquals($value, $object->getSlideMasterId()); } + + public function testGroup() + { + $value = rand(1, 100); + + $object = new Slide(); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->createGroup()); + } } From 30957a4fd52870e300cea0b5882d5a95ba6fe3ac Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 22 Dec 2014 12:57:35 +0100 Subject: [PATCH 022/115] FIXED : #68 : Group support --- src/PhpPowerpoint/Reader/PowerPoint97.php | 8 ++++---- src/PhpPowerpoint/Shape/Chart/PlotArea.php | 2 +- src/PhpPowerpoint/Writer/ODPresentation.php | 12 ++++++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index 85221ff47..b43db3071 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -1444,7 +1444,7 @@ private function readRTSlide($pos) // echo '@todo l.'.__LINE__; } if ($masksData['fontAlign'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); + // $data = self::getInt2d($this->streamPowerpointDocument, $pos); $pos += 2; $rHeader['recLen'] -= 2; $clientTextbox['recLen'] -= 2; @@ -1902,7 +1902,7 @@ private function readRTSlide($pos) $sHyperlinkURL = ''; if (empty($sText)) { // Is there a hyperlink ? - if (!empty($arrClientTextBox['hyperlink'])) { + if (isset($arrClientTextBox['hyperlink']) && is_array($arrClientTextBox['hyperlink']) && !empty($arrClientTextBox['hyperlink'])) { foreach ($arrClientTextBox['hyperlink'] as $itmHyperlink) { if ($itmHyperlink['start'] == $start && ($itmHyperlink['end'] - $itmHyperlink['start']) == $arrClientTextBox['part'.$inc]['length']) { $sText = $this->arrayHyperlinks[$itmHyperlink['id']]['text']; @@ -1969,7 +1969,7 @@ private function readRTSlide($pos) } } - if($shape instanceof RichText){ + if ($shape instanceof RichText) { if (isset($arrShpPrimaryOpt['insetBottom'])) { $shape->setInsetBottom($arrShpPrimaryOpt['insetBottom']); } @@ -2208,7 +2208,7 @@ private function readRTDocument($pos) * Read a record header * @param string $stream * @param integer $pos - * @return multitype:boolean Ambigous + * @return multitype */ private function loadRecordHeader($stream, $pos) { diff --git a/src/PhpPowerpoint/Shape/Chart/PlotArea.php b/src/PhpPowerpoint/Shape/Chart/PlotArea.php index e5e717365..0630ef9dd 100644 --- a/src/PhpPowerpoint/Shape/Chart/PlotArea.php +++ b/src/PhpPowerpoint/Shape/Chart/PlotArea.php @@ -102,7 +102,7 @@ public function getType() /** * Set type * - * @param \PhpOffice\PhpPowerpoint\Shape\Chart\AbstractType $value + * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractType $value * @return \PhpOffice\PhpPowerpoint\Shape\Chart\PlotArea */ public function setType(AbstractType $value) diff --git a/src/PhpPowerpoint/Writer/ODPresentation.php b/src/PhpPowerpoint/Writer/ODPresentation.php index 81d52fcc7..b70e3cc7a 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation.php +++ b/src/PhpPowerpoint/Writer/ODPresentation.php @@ -131,6 +131,14 @@ public function save($pFilename) if (!$writerPartDrawing instanceof Drawing) { throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Drawing'); } + $writerPartMimetype = $this->getWriterPart('mimetype'); + if (!$writerPartMimetype instanceof Mimetype) { + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Mimetype'); + } + $writerPartContent = $this->getWriterPart('content'); + if (!$writerPartContent instanceof Content) { + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Content'); + } // Create drawing dictionary $this->drawingHashTable->addFromSource($writerPartDrawing->allDrawings($this->presentation)); @@ -147,10 +155,10 @@ public function save($pFilename) // Add mimetype to ZIP file //@todo Not in ZIPARCHIVE::CM_STORE mode - $objZip->addFromString('mimetype', $this->getWriterPart('mimetype')->writePart()); + $objZip->addFromString('mimetype', $writerPartMimetype->writePart()); // Add content.xml to ZIP file - $objZip->addFromString('content.xml', $this->getWriterPart('content')->writePart($this->presentation)); + $objZip->addFromString('content.xml', $writerPartContent->writePart($this->presentation)); // Add meta.xml to ZIP file $objZip->addFromString('meta.xml', $this->getWriterPart('meta')->writePart($this->presentation)); From fa24cb3ced87d40ef1db750077e61a62cf57ff33 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 22 Dec 2014 13:46:17 +0100 Subject: [PATCH 023/115] FIXED : #58 : Added support for Horizontal bar chart --- CHANGELOG.md | 1 + samples/Sample_07_Chart.php | 34 +++++++++++++++++++ src/PhpPowerpoint/Shape/Chart/PlotArea.php | 3 +- .../Writer/ODPresentation/ObjectsChart.php | 8 +++++ .../Tests/Shape/Chart/Type/Bar3DTest.php | 12 ++++++- tests/PhpPowerpoint/Tests/SlideTest.php | 2 -- .../Writer/ODPresentation/ChartsTest.php | 32 +++++++++++++++++ .../Tests/Writer/PowerPoint2007/ChartTest.php | 27 +++++++++++++++ 8 files changed, 114 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b496122f3..b8a32bd9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features - Added support for grouping shapes together in a Group - @Pr0phet GH-68 - Added support for calculating the offset and extent on a Slide. - @Pr0phet GH-68 +- Added support for Horizontal bar chart - @rdoepke @Progi1984 GH-58 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/samples/Sample_07_Chart.php b/samples/Sample_07_Chart.php index 9be81e9ee..db95cc2c1 100644 --- a/samples/Sample_07_Chart.php +++ b/samples/Sample_07_Chart.php @@ -87,6 +87,40 @@ $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); $shape->getLegend()->getFont()->setItalic(true); + +// Create templated slide +echo date('H:i:s') . ' Create templated slide'.EOL; +$currentSlide = createTemplatedSlide($objPHPPowerPoint); + +// Create a bar chart (that should be inserted in a shape) +echo date('H:i:s') . ' Create a horizontal bar chart (that should be inserted in a chart shape) '.EOL; +$bar3DChartHorz = clone $bar3DChart; +$bar3DChartHorz->setBarDirection(Bar3D::DIRECTION_HORIZONTAL); + +// Create a shape (chart) +echo date('H:i:s') . ' Create a shape (chart)'.EOL; +$shape = $currentSlide->createChartShape(); +$shape->setName('PHPPowerPoint Monthly Downloads') + ->setResizeProportional(false) + ->setHeight(550) + ->setWidth(700) + ->setOffsetX(120) + ->setOffsetY(80); +$shape->setShadow($oShadow); +$shape->setFill($oFill); +$shape->getBorder()->setLineStyle(Border::LINE_SINGLE); +$shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); +$shape->getTitle()->getFont()->setItalic(true); +$shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); +$shape->getPlotArea()->getAxisX()->setTitle('Month'); +$shape->getPlotArea()->getAxisY()->setTitle('Downloads'); +$shape->getPlotArea()->setType($bar3DChartHorz); +$shape->getView3D()->setRightAngleAxes(true); +$shape->getView3D()->setRotationX(20); +$shape->getView3D()->setRotationY(20); +$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); +$shape->getLegend()->getFont()->setItalic(true); + // Create templated slide echo date('H:i:s') . ' Create templated slide'.EOL; $currentSlide = createTemplatedSlide($objPHPPowerPoint); diff --git a/src/PhpPowerpoint/Shape/Chart/PlotArea.php b/src/PhpPowerpoint/Shape/Chart/PlotArea.php index 0630ef9dd..c243b2025 100644 --- a/src/PhpPowerpoint/Shape/Chart/PlotArea.php +++ b/src/PhpPowerpoint/Shape/Chart/PlotArea.php @@ -18,7 +18,6 @@ namespace PhpOffice\PhpPowerpoint\Shape\Chart; use PhpOffice\PhpPowerpoint\ComparableInterface; -use PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractType; /** * \PhpOffice\PhpPowerpoint\Shape\Chart\PlotArea @@ -105,7 +104,7 @@ public function getType() * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractType $value * @return \PhpOffice\PhpPowerpoint\Shape\Chart\PlotArea */ - public function setType(AbstractType $value) + public function setType(Type\AbstractType $value) { $this->type = $value; diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index 4202bbab7..7a09f4887 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -437,6 +437,7 @@ private function writePlotArea(Chart $chart) /** * @param Chart $chart + * @link : http://books.evc-cit.info/odbook/ch08.html#chart-plot-area-section */ private function writePlotAreaStyle(Chart $chart) { @@ -452,6 +453,13 @@ private function writePlotAreaStyle(Chart $chart) $this->xmlContent->writeAttribute('chart:three-dimensional', 'true'); $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true'); } + if ($chartType instanceof Bar3D) { + if ($chartType->getBarDirection() == Bar3D::DIRECTION_HORIZONTAL) { + $this->xmlContent->writeAttribute('chart:vertical', 'true'); + } else { + $this->xmlContent->writeAttribute('chart:vertical', 'false'); + } + } $this->xmlContent->writeAttribute('chart:data-label-number', 'value'); // > style:text-properties $this->xmlContent->endElement(); diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php index 4e5332c9d..067892fe9 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php @@ -45,13 +45,23 @@ public function testData() $this->assertCount(count($array), $object->getData()); } - public function testSerties() + public function testSeries() { $object = new Bar3D(); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar3D', $object->addSeries(new Series())); $this->assertCount(1, $object->getData()); } + + public function testBarDirection() + { + $object = new Bar3D(); + $this->assertEquals(Bar3D::DIRECTION_VERTICAL, $object->getBarDirection()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar3D', $object->setBarDirection(Bar3D::DIRECTION_HORIZONTAL)); + $this->assertEquals(Bar3D::DIRECTION_HORIZONTAL, $object->getBarDirection()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar3D', $object->setBarDirection(Bar3D::DIRECTION_VERTICAL)); + $this->assertEquals(Bar3D::DIRECTION_VERTICAL, $object->getBarDirection()); + } public function testHashCode() { diff --git a/tests/PhpPowerpoint/Tests/SlideTest.php b/tests/PhpPowerpoint/Tests/SlideTest.php index 9386c5c55..c670ec9e8 100644 --- a/tests/PhpPowerpoint/Tests/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/SlideTest.php @@ -61,8 +61,6 @@ public function testSlideMasterId() public function testGroup() { - $value = rand(1, 100); - $object = new Slide(); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->createGroup()); } diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php index 44345d7a5..90b1074c4 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php @@ -83,6 +83,38 @@ public function testChartBar3D() $element = '/office:document-content/office:body/office:chart/chart:chart/chart:plot-area/chart:series/chart:data-point'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePlotArea\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('false', $pres->getElementAttribute($element, 'chart:vertical', 'Object 1/content.xml')); + } + + public function testChartBar3DHorizontal() + { + $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2)); + $oSeries->setShowSeriesName(true); + $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8')); + $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744')); + $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F')); + + $oBar3D = new Bar3D(); + $oBar3D->setBarDirection(Bar3D::DIRECTION_HORIZONTAL); + $oBar3D->addSeries($oSeries); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oChart = $oSlide->createChartShape(); + $oChart->getPlotArea()->setType($oBar3D); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:body/office:chart/chart:chart'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('chart:bar', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml')); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePlotArea\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:vertical', 'Object 1/content.xml')); } public function testChartLine() diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php index 016be9d21..9d11168de 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php @@ -162,6 +162,33 @@ public function testTypeBar3DSuperScript() $this->assertEquals('30000', $oXMLDoc->getElementAttribute($element, 'baseline', 'ppt/charts/'.$oShape->getIndexedFilename())); } + public function testTypeBar3DBarDirection() + { + $seriesData = array( + 'A' => 1, + 'B' => 2, + 'C' => 4, + 'D' => 3, + 'E' => 2, + ); + + $oPHPPowerPoint = new PhpPowerpoint(); + $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oShape = $oSlide->createChartShape(); + $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); + $oBar3D = new Bar3D(); + $oBar3D->setBarDirection(Bar3D::DIRECTION_HORIZONTAL); + $oSeries = new Series('Downloads', $seriesData); + $oBar3D->addSeries($oSeries); + $oShape->getPlotArea()->setType($oBar3D); + + $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + + $element = '/c:chartSpace/c:chart/c:plotArea/c:bar3DChart/c:barDir'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $this->assertEquals(Bar3D::DIRECTION_HORIZONTAL, $oXMLDoc->getElementAttribute($element, 'val', 'ppt/charts/'.$oShape->getIndexedFilename())); + } + public function testTypeLine() { $seriesData = array( From bfad16c019277776cc74df1aab81e645eb97bc84 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 22 Dec 2014 13:51:03 +0100 Subject: [PATCH 024/115] FIXED : #58 : Added support for Horizontal bar chart --- tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php index 067892fe9..79dfbc12c 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php @@ -61,7 +61,7 @@ public function testBarDirection() $this->assertEquals(Bar3D::DIRECTION_HORIZONTAL, $object->getBarDirection()); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar3D', $object->setBarDirection(Bar3D::DIRECTION_VERTICAL)); $this->assertEquals(Bar3D::DIRECTION_VERTICAL, $object->getBarDirection()); - } + } public function testHashCode() { From 5a6b313c83ee5985bbb5a790841770d93748cdd5 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 22 Dec 2014 13:56:43 +0100 Subject: [PATCH 025/115] FIXED : #58 : Added support for Horizontal bar chart --- src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index 7a09f4887..e6356567e 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -449,16 +449,17 @@ private function writePlotAreaStyle(Chart $chart) $this->xmlContent->writeAttribute('style:family', 'chart'); // style:text-properties $this->xmlContent->startElement('style:chart-properties'); - if ($chartType instanceof Bar3D || $chartType instanceof Pie3D) { + if ($chartType instanceof Bar3D) { $this->xmlContent->writeAttribute('chart:three-dimensional', 'true'); $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true'); - } - if ($chartType instanceof Bar3D) { if ($chartType->getBarDirection() == Bar3D::DIRECTION_HORIZONTAL) { $this->xmlContent->writeAttribute('chart:vertical', 'true'); } else { $this->xmlContent->writeAttribute('chart:vertical', 'false'); } + } elseif ($chartType instanceof Pie3D) { + $this->xmlContent->writeAttribute('chart:three-dimensional', 'true'); + $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true'); } $this->xmlContent->writeAttribute('chart:data-label-number', 'value'); // > style:text-properties From dc8ae30e6a30136dcc39997066e0932bd2b4f70c Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 23 Dec 2014 13:11:15 +0100 Subject: [PATCH 026/115] #49 : Added support for hyperlink on picture (ODPresentation & PowerPoint2007) --- CHANGELOG.md | 1 + samples/Sample_01_Simple.php | 1 + .../Writer/ODPresentation/Content.php | 18 ++++++++++++++++++ .../Writer/PowerPoint2007/Slide.php | 6 +++++- .../Writer/ODPresentation/ContentTest.php | 15 +++++++++++++++ .../Tests/Writer/PowerPoint2007/SlideTest.php | 15 +++++++++++++++ 6 files changed, 55 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8a32bd9b..dc2239943 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Added support for grouping shapes together in a Group - @Pr0phet GH-68 - Added support for calculating the offset and extent on a Slide. - @Pr0phet GH-68 - Added support for Horizontal bar chart - @rdoepke @Progi1984 GH-58 +- Added support for hyperlink on picture (ODPresentation & PowerPoint2007) - @Progi1984 GH-49 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/samples/Sample_01_Simple.php b/samples/Sample_01_Simple.php index b9526d61a..bc6440ce1 100644 --- a/samples/Sample_01_Simple.php +++ b/samples/Sample_01_Simple.php @@ -36,6 +36,7 @@ $shape->getShadow()->setVisible(true) ->setDirection(45) ->setDistance(10); +$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); // Create a shape (text) echo date('H:i:s') . ' Create a shape (rich text)'.EOL; diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index d29f9c72b..b9ab76a1e 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -325,6 +325,24 @@ public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape) $objWriter->writeAttribute('xlink:actuate', 'onLoad'); $objWriter->writeElement('text:p'); $objWriter->endElement(); + + if ($shape->getHyperlink()) { + // office:event-listeners + $objWriter->startElement('office:event-listeners'); + // presentation:event-listener + $objWriter->startElement('presentation:event-listener'); + $objWriter->writeAttribute('script:event-name', 'dom:click'); + $objWriter->writeAttribute('presentation:action', 'show'); + $objWriter->writeAttribute('xlink:href', $shape->getHyperlink()->getUrl()); + $objWriter->writeAttribute('xlink:type', 'simple'); + $objWriter->writeAttribute('xlink:show', 'embed'); + $objWriter->writeAttribute('xlink:actuate', 'onRequest'); + // > presentation:event-listener + $objWriter->endElement(); + // > office:event-listeners + $objWriter->endElement(); + } + $objWriter->endElement(); } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 7e205dce3..1b0623e44 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -345,6 +345,11 @@ private function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape, $sh $objWriter->writeAttribute('name', $shape->getName()); $objWriter->writeAttribute('descr', $shape->getDescription()); + // a:hlinkClick + if ($shape->hasHyperlink()) { + $this->writeHyperlink($objWriter, $shape); + } + $objWriter->endElement(); // p:cNvPicPr @@ -359,7 +364,6 @@ private function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape, $sh // p:nvPr $objWriter->writeElement('p:nvPr', null); - $objWriter->endElement(); // p:blipFill diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index dbef65d69..c04772adb 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -39,6 +39,21 @@ public function tearDown() TestHelperDOCX::clear(); } + public function testDrawingWithHyperlink() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createDrawingShape(); + $oShape->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.'/resources/images/PHPPowerPointLogo.png'); + $oShape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/'); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/office:event-listeners/presentation:event-listener'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertEquals('https://github.com/PHPOffice/PHPPowerPoint/', $pres->getElementAttribute($element, 'xlink:href', 'content.xml')); + } + public function testList() { $phpPowerPoint = new PhpPowerpoint(); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index 807366f02..49b973dc4 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -140,6 +140,21 @@ public function testAlignmentShapeTop() $this->assertEquals(Alignment::VERTICAL_TOP, $pres->getElementAttribute($element, 'anchor', 'ppt/slides/slide1.xml')); } + public function testDrawingWithHyperlink() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createDrawingShape(); + $oShape->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.'/resources/images/PHPPowerPointLogo.png'); + $oShape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/'); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertEquals('rId3', $pres->getElementAttribute($element, 'r:id', 'ppt/slides/slide1.xml')); + } + public function testDrawingShapeBorder() { $phpPowerPoint = new PhpPowerpoint(); From 64107092e9254e4d4c24fb494757d16a289020e3 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 23 Dec 2014 13:35:16 +0100 Subject: [PATCH 027/115] IMPROVED : QA (Tests PHPUnit) --- tests/PhpPowerpoint/Tests/Shape/GroupTest.php | 51 ++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php index 2c91cf3a0..bdfdcdd86 100644 --- a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php @@ -36,6 +36,8 @@ public function testConstruct() $this->assertEquals(0, $object->getExtentX()); $this->assertEquals(0, $object->getExtentY()); $this->assertEquals(0, $object->getShapeCollection()->count()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->setWidth(rand(1, 100))); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->setHeight(rand(1, 100))); } public function testAdd() @@ -50,6 +52,52 @@ public function testAdd() $this->assertEquals(5, $object->getShapeCollection()->count()); } + public function testExtentX() + { + $value = rand(1, 100); + + $object = new Group(); + $line1 = new Line(10, 20, 30, 40); + $object->addShape($line1); + + $this->assertEquals(30, $object->getExtentX()); + } + + public function testExtentY() + { + $value = rand(1, 100); + + $object = new Group(); + $line1 = new Line(10, 20, 30, 40); + $object->addShape($line1); + + $this->assertEquals(40, $object->getExtentY()); + } + + public function testOffsetX() + { + $object = new Group(); + $line1 = new Line(10, 20, 30, 40); + $object->addShape($line1); + + $this->assertEquals(10, $object->getOffsetX()); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->setOffsetY(rand(1, 100))); + $this->assertEquals(10, $object->getOffsetX()); + } + + public function testOffsetY() + { + $object = new Group(); + $line1 = new Line(10, 20, 30, 40); + $object->addShape($line1); + + $this->assertEquals(20, $object->getOffsetY()); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->setOffsetY(rand(1, 100))); + $this->assertEquals(20, $object->getOffsetY()); + } + public function testExtentsAndOffsetsForOneShape() { // We record initial values here because @@ -60,9 +108,8 @@ public function testExtentsAndOffsetsForOneShape() $extentX = 1000; $extentY = 450; - $line1 = new Line($offsetX, $offsetY, $extentX, $extentY); $object = new Group(); - + $line1 = new Line($offsetX, $offsetY, $extentX, $extentY); $object->addShape($line1); $this->assertEquals($offsetX, $object->getOffsetX()); From 632cd703bf1cfa7571c20647e81db21bfe418993 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 26 Dec 2014 12:10:00 +0100 Subject: [PATCH 028/115] #63 : Added support for notes slide (ODPresentation & PowerPoint2007) --- .gitignore | 3 + samples/Sample_12_SlideNote.php | 63 +++++ src/PhpPowerpoint/Note.php | 254 ++++++++++++++++++ src/PhpPowerpoint/Slide.php | 32 ++- .../Writer/ODPresentation/Content.php | 34 ++- src/PhpPowerpoint/Writer/PowerPoint2007.php | 3 + .../Writer/PowerPoint2007/ContentTypes.php | 3 + .../Writer/PowerPoint2007/Rels.php | 6 + .../Writer/PowerPoint2007/Slide.php | 117 ++++++++ tests/PhpPowerpoint/Tests/NoteTest.php | 65 +++++ .../Writer/ODPresentation/ContentTest.php | 15 ++ .../Tests/Writer/PowerPoint2007/SlideTest.php | 22 ++ 12 files changed, 612 insertions(+), 5 deletions(-) create mode 100644 samples/Sample_12_SlideNote.php create mode 100644 src/PhpPowerpoint/Note.php create mode 100644 tests/PhpPowerpoint/Tests/NoteTest.php diff --git a/.gitignore b/.gitignore index 534ea9100..c6b3da4e8 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ vendor /phpunit.bat /todo.txt /samples/Sample_00_Test.php +/samples/#47 +/samples/#70 +/samples/#71 diff --git a/samples/Sample_12_SlideNote.php b/samples/Sample_12_SlideNote.php new file mode 100644 index 000000000..152d92d6a --- /dev/null +++ b/samples/Sample_12_SlideNote.php @@ -0,0 +1,63 @@ +getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPowerPoint Team')->setTitle('Sample 01 Title')->setSubject('Sample 01 Subject')->setDescription('Sample 01 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category'); + +// Create slide +echo date('H:i:s') . ' Create slide' . EOL; +$currentSlide = $objPHPPowerPoint->getActiveSlide(); + +// Create a shape (drawing) +echo date('H:i:s') . ' Create a shape (drawing)'.EOL; +$shape = $currentSlide->createDrawingShape(); +$shape->setName('PHPPowerPoint logo') +->setDescription('PHPPowerPoint logo') +->setPath('./resources/phppowerpoint_logo.gif') +->setHeight(36) +->setOffsetX(10) +->setOffsetY(10); +$shape->getShadow()->setVisible(true) +->setDirection(45) +->setDistance(10); +$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); + +// Create a shape (text) +echo date('H:i:s') . ' Create a shape (rich text)'.EOL; +$shape = $currentSlide->createRichTextShape() + ->setHeight(300) + ->setWidth(600) + ->setOffsetX(170) + ->setOffsetY(180); +$shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); +$textRun = $shape->createTextRun('Thank you for using PHPPowerPoint!'); +$textRun->getFont()->setBold(true) +->setSize(60) +->setColor( new Color( 'FFE06B20' ) ); + +// Set Note +echo date('H:i:s') . ' Set Note' . EOL; +$oNote = $currentSlide->getNote(); +$oRichText = $oNote->createRichTextShape()->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);; +$oRichText->createTextRun('A class library'); +$oRichText->createParagraph()->createTextRun('Written in PHP'); +$oRichText->createParagraph()->createTextRun('Representing a presentation'); +$oRichText->createParagraph()->createTextRun('Supports writing to different file formats'); + +// Save file +echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/src/PhpPowerpoint/Note.php b/src/PhpPowerpoint/Note.php new file mode 100644 index 000000000..50a334beb --- /dev/null +++ b/src/PhpPowerpoint/Note.php @@ -0,0 +1,254 @@ +parent = $pParent; + + // Shape collection + $this->shapeCollection = new \ArrayObject(); + + // Set identifier + $this->identifier = md5(rand(0, 9999) . time()); + } + + /** + * Get collection of shapes + * + * @return \ArrayObject|\PhpOffice\PhpPowerpoint\AbstractShape[] + */ + public function getShapeCollection() + { + return $this->shapeCollection; + } + + /** + * Add shape to slide + * + * @param \PhpOffice\PhpPowerpoint\AbstractShape $shape + * @return \PhpOffice\PhpPowerpoint\AbstractShape + */ + public function addShape(AbstractShape $shape) + { + $shape->setContainer($this); + + return $shape; + } + + /** + * Create rich text shape + * + * @return \PhpOffice\PhpPowerpoint\Shape\RichText + */ + public function createRichTextShape() + { + $shape = new RichText(); + $this->addShape($shape); + + return $shape; + } + + /** + * Get parent + * + * @return Slide + */ + public function getParent() + { + return $this->parent; + } + + /** + * Set parent + * + * @param Slide $parent + * @return Note + */ + public function setParent(Slide $parent) + { + $this->parent = $parent; + return $this; + } + + + /** + * Get X Offset + * + * @return int + */ + public function getOffsetX () + { + if ($this->offsetX === null) { + $offsets = GeometryCalculator::calculateOffsets($this); + $this->offsetX = $offsets[GeometryCalculator::X]; + $this->offsetY = $offsets[GeometryCalculator::Y]; + } + return $this->offsetX; + } + + /** + * Get Y Offset + * + * @return int + */ + public function getOffsetY () + { + if ($this->offsetY === null) { + $offsets = GeometryCalculator::calculateOffsets($this); + $this->offsetX = $offsets[GeometryCalculator::X]; + $this->offsetY = $offsets[GeometryCalculator::Y]; + } + return $this->offsetY; + } + + /** + * Get X Extent + * + * @return int + */ + public function getExtentX () + { + if ($this->extentX === null) { + $extents = GeometryCalculator::calculateExtents($this); + $this->extentX = $extents[GeometryCalculator::X]; + $this->extentY = $extents[GeometryCalculator::Y]; + } + return $this->extentX; + } + + /** + * Get Y Extent + * + * @return int + */ + public function getExtentY () + { + if ($this->extentY === null) { + $extents = GeometryCalculator::calculateExtents($this); + $this->extentX = $extents[GeometryCalculator::X]; + $this->extentY = $extents[GeometryCalculator::Y]; + } + return $this->extentY; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() + { + return md5($this->identifier . __CLASS__); + } + + /** + * Get hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @return string Hash index + */ + public function getHashIndex() + { + return $this->hashIndex; + } + + /** + * Set hash index + * + * Note that this index may vary during script execution! Only reliable moment is + * while doing a write of a workbook and when changes are not allowed. + * + * @param string $value Hash index + */ + public function setHashIndex($value) + { + $this->hashIndex = $value; + } +} diff --git a/src/PhpPowerpoint/Slide.php b/src/PhpPowerpoint/Slide.php index 42fd2287d..bbb608f46 100644 --- a/src/PhpPowerpoint/Slide.php +++ b/src/PhpPowerpoint/Slide.php @@ -65,7 +65,12 @@ class Slide implements ComparableInterface, ShapeContainerInterface * @var integer */ private $slideMasterId = 1; - + /** + * + * @var \PhpOffice\PhpPowerpoint\Note + */ + private $slideNote; + /** * Hash index * @@ -403,4 +408,29 @@ public function getExtentY() } return $this->extentY; } + + /** + * + * @return \PhpOffice\PhpPowerpoint\Note + */ + public function getNote() + { + if (is_null($this->slideNote)) { + $this->setNote(); + } + return $this->slideNote; + } + + /** + * + * @param \PhpOffice\PhpPowerpoint\Note $note + * @return \PhpOffice\PhpPowerpoint\Slide + */ + public function setNote (Note $note = null) + { + $this->slideNote = (is_null($note) ? new Note() : $note); + $this->slideNote->setParent($this); + + return $this; + } } diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index b9ab76a1e..053a2ab43 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -17,6 +17,7 @@ namespace PhpOffice\PhpPowerpoint\Writer\ODPresentation; +use PhpOffice\PhpPowerpoint\Note; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; use PhpOffice\PhpPowerpoint\Shape\Chart; @@ -51,8 +52,7 @@ class Content extends AbstractPart * @var array */ private $arrStyleBullet = array(); - - + /** * Stores paragraph information for text shapes. * @@ -66,14 +66,13 @@ class Content extends AbstractPart * @var array */ private $arrStyleTextFont = array(); - + /** * Used to track the current shape ID. * * @var integer */ private $shapeId; - /** * Write content file to XML format @@ -285,6 +284,9 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) $this->writeShapeGroup($objWriter, $shape); } } + // Slide Note + $this->writeSlideNote($objWriter, $pSlide->getNote()); + $objWriter->endElement(); } $objWriter->endElement(); @@ -978,4 +980,28 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) } } } + + /** + * Write the slide note + * @param XMLWriter $objWriter + * @param PhpOffice\PhpPowerpoint\Note $note + */ + public function writeSlideNote(XMLWriter $objWriter, Note $note) + { + $shapesNote = $note->getShapeCollection(); + if(count($shapesNote) > 0){ + $objWriter->startElement('presentation:notes'); + + foreach ($shapesNote as $shape) { + // Increment $this->shapeId + ++$this->shapeId; + + if ($shape instanceof RichText) { + $this->writeShapeTxt($objWriter, $shape); + } + } + + $objWriter->endElement(); + } + } } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007.php b/src/PhpPowerpoint/Writer/PowerPoint2007.php index 950f527b6..d83a5f9a8 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007.php @@ -271,6 +271,9 @@ public function save($pFilename) // Add slide $objZip->addFromString('ppt/slides/_rels/slide' . ($i + 1) . '.xml.rels', $wPartRels->writeSlideRelationships($this->presentation->getSlide($i))); $objZip->addFromString('ppt/slides/slide' . ($i + 1) . '.xml', $wPartSlide->writeSlide($this->presentation->getSlide($i))); + if ($this->presentation->getSlide($i)->getNote()->getShapeCollection()->count() > 0) { + $objZip->addFromString('ppt/notesSlides/notesSlide' . ($i + 1) . '.xml', $wPartSlide->writeNote($this->presentation->getSlide($i)->getNote())); + } } // Add media diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php b/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php index cd476557a..5784ad4eb 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php @@ -93,6 +93,9 @@ public function writeContentTypes(PHPPowerPoint $pPHPPowerPoint = null) $slideCount = $pPHPPowerPoint->getSlideCount(); for ($i = 0; $i < $slideCount; ++$i) { $this->writeOverrideContentType($objWriter, '/ppt/slides/slide' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.presentationml.slide+xml'); + if ($pPHPPowerPoint->getSlide($i)->getNote()->getShapeCollection()->count() > 0) { + $this->writeOverrideContentType($objWriter, '/ppt/notesSlides/notesSlide' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml'); + } } // Add layoutpack content types diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php index 995cf975c..6ae66ca1a 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php @@ -273,6 +273,7 @@ public function writeSlideRelationships(SlideElement $pSlide) // Starting relation id $relId = 1; + $idxSlide = $pSlide->getParent()->getIndex($pSlide); // Write slideLayout relationship $parentWriter = $this->getParentWriter(); @@ -487,6 +488,11 @@ public function writeSlideRelationships(SlideElement $pSlide) $iterator->next(); } } + + if ($pSlide->getNote()->getShapeCollection()->count() > 0) { + $this->writeRelationship($objWriter, $relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide', '../notesSlides/notesSlide'.($idxSlide + 1).'.xml'); + ++$relId; + } $objWriter->endElement(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 1b0623e44..6997d177f 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -17,6 +17,7 @@ namespace PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; +use PhpOffice\PhpPowerpoint\Note; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; use PhpOffice\PhpPowerpoint\Shape\Chart as ShapeChart; use PhpOffice\PhpPowerpoint\Shape\Group; @@ -1243,4 +1244,120 @@ private function writeHyperlink(XMLWriter $objWriter, $shape) } $objWriter->endElement(); } + + /** + * Write Note Slide + * @param Note $pNote + * @throws \Exception + */ + private function writeNote(Note $pNote = null) + { + // Check slide + if (is_null($pNote)) { + throw new \Exception("Invalid \PhpOffice\PhpPowerpoint\Note object passed."); + } + + // Create XML writer + $objWriter = $this->getXMLWriter(); + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // p:notes + $objWriter->startElement('p:notes'); + $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); + $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main'); + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + + // p:cSld + $objWriter->startElement('p:cSld'); + + // p:spTree + $objWriter->startElement('p:spTree'); + + // p:nvGrpSpPr + $objWriter->startElement('p:nvGrpSpPr'); + + // p:cNvPr + $objWriter->startElement('p:cNvPr'); + $objWriter->writeAttribute('id', '1'); + $objWriter->writeAttribute('name', ''); + $objWriter->endElement(); + + // p:cNvGrpSpPr + $objWriter->writeElement('p:cNvGrpSpPr', null); + + // p:nvPr + $objWriter->startElement('p:nvPr'); + + // p:ph + $objWriter->startElement('p:ph'); + $objWriter->writeAttribute('type', 'body'); + $objWriter->endElement(); + + // ## p:nvPr + $objWriter->endElement(); + + // ## p:cNvGrpSpPr + $objWriter->endElement(); + + // p:grpSpPr + $objWriter->startElement('p:grpSpPr'); + + // a:xfrm + $objWriter->startElement('a:xfrm'); + + // a:off + $objWriter->startElement('a:off'); + $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($pNote->getOffsetX())); + $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($pNote->getOffsetY())); + $objWriter->endElement(); // a:off + + // a:ext + $objWriter->startElement('a:ext'); + $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($pNote->getExtentX())); + $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($pNote->getExtentY())); + $objWriter->endElement(); // a:ext + + // a:chOff + $objWriter->startElement('a:chOff'); + $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($pNote->getOffsetX())); + $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($pNote->getOffsetY())); + $objWriter->endElement(); // a:chOff + + // a:chExt + $objWriter->startElement('a:chExt'); + $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($pNote->getExtentX())); + $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($pNote->getExtentY())); + $objWriter->endElement(); // a:chExt + + // ## a:xfrm + $objWriter->endElement(); + + // ## p:grpSpPr + $objWriter->endElement(); + + // Loop shapes + $shapeId = 0; + $shapes = $pNote->getShapeCollection(); + foreach ($shapes as $shape) { + // Increment $shapeId + ++$shapeId; + + // Check type + if ($shape instanceof RichText) { + $this->writeShapeText($objWriter, $shape, $shapeId); + } + } + + $objWriter->endElement(); + + $objWriter->endElement(); + + // > p:notes + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } } diff --git a/tests/PhpPowerpoint/Tests/NoteTest.php b/tests/PhpPowerpoint/Tests/NoteTest.php new file mode 100644 index 000000000..8f3d92a3b --- /dev/null +++ b/tests/PhpPowerpoint/Tests/NoteTest.php @@ -0,0 +1,65 @@ +assertNull($object->getParent()); + + $oPhpPowerpoint = new PhpPowerpoint(); + $oSlide = $oPhpPowerpoint->createSlide(); + $oSlide->setNote($object); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->getParent()); + } + + public function testShape() + { + $object = new Note(); + $this->assertEquals(0, $object->getShapeCollection()->count()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->createRichTextShape()); + $this->assertEquals(1, $object->getShapeCollection()->count()); + + $oRichText = new RichText(); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->addShape($oRichText)); + $this->assertEquals(2, $object->getShapeCollection()->count()); + } + + /** + * Test get/set hash index + */ + public function testSetGetHashIndex() + { + $object = new Note(); + $value = rand(1, 100); + $this->assertNull($object->getHashIndex()); + $object->setHashIndex($value); + $this->assertEquals($value, $object->getHashIndex()); + } +} \ No newline at end of file diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index c04772adb..2653522df 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -152,6 +152,21 @@ public function testListWithRichText() $this->assertTrue($pres->elementExists($element, 'content.xml')); } + public function testNote() + { + $oPHPPowerPoint = new PhpPowerpoint(); + $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oNote = $oSlide->getNote(); + $oRichText = $oNote->createRichTextShape()->setHeight(300)->setWidth(600); + $oRichText->createTextRun('testNote'); + + $pres = TestHelperDOCX::getDocument($oPHPPowerPoint, 'ODPresentation'); + $element = '/office:document-content/office:body/office:presentation/draw:page/presentation:notes'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $element = '/office:document-content/office:body/office:presentation/draw:page/presentation:notes/draw:frame/draw:text-box/text:p/text:span'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + } + public function testRichtextAutoShrink() { $phpPowerPoint = new PhpPowerpoint(); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index 49b973dc4..617a90909 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -456,6 +456,28 @@ public function testLine() $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); } + public function testNote() + { + $oPHPPowerPoint = new PhpPowerpoint(); + $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oNote = $oSlide->getNote(); + $oRichText = $oNote->createRichTextShape()->setHeight(300)->setWidth(600); + $oRichText->createTextRun('testNote'); + + $pres = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + // Content Types + // $element = '/Types/Override[@PartName="/ppt/notesSlides/notesSlide1.xml"][@ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"]'; + // $this->assertTrue($pres->elementExists($element, '[Content_Types].xml')); + // Rels + // $element = '/Relationships/Relationship[@Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"][@Target="../notesSlides/notesSlide1.xml"]'; + // $this->assertTrue($pres->elementExists($element, 'ppt/slides/_rels/slide1.xml.rels')); + // Slide + $element = '/p:notes'; + $this->assertTrue($pres->elementExists($element, 'ppt/notesSlides/notesSlide1.xml')); + $element = '/p:notes/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:t'; + $this->assertTrue($pres->elementExists($element, 'ppt/notesSlides/notesSlide1.xml')); + } + public function testRichTextAutoFitNormal() { $phpPowerPoint = new PhpPowerpoint(); From efa7bd6c07c912c45db32724af57d8a04ce6aca5 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 26 Dec 2014 12:10:30 +0100 Subject: [PATCH 029/115] IMPROVED : Validation of PowerPoint2007 files with Open XML SDK 2.5 Productivity Tool (http://www.microsoft.com/en-us/download/details.aspx?id=30425) --- .../Writer/PowerPoint2007/Chart.php | 64 +++---- .../PowerPoint2007/LayoutPack/PackDefault.php | 172 +++++++++--------- 2 files changed, 118 insertions(+), 118 deletions(-) diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 84361aa8b..7966a0b43 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -29,6 +29,7 @@ use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Style\Border; +use PhpOffice\PhpPowerpoint\Style\Fill; /** * \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Chart @@ -945,14 +946,16 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include // c:idx $this->writeElementWithValAttribute($objWriter, 'c:idx', $key); - // c:spPr - $objWriter->startElement('c:spPr'); - - // Write fill - $this->writeFill($objWriter, $value); - - $objWriter->endElement(); + if($value->getFillType() != Fill::FILL_NONE) { + // c:spPr + $objWriter->startElement('c:spPr'); + // Write fill + $this->writeFill($objWriter, $value); + // ## c:spPr + $objWriter->endElement(); + } + // ## c:dPt $objWriter->endElement(); } @@ -1037,13 +1040,13 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include $objWriter->endElement(); - // c:spPr - $objWriter->startElement('c:spPr'); +// // c:spPr +// $objWriter->startElement('c:spPr'); - // Write fill - $this->writeFill($objWriter, $series->getFill()); +// // Write fill +// $this->writeFill($objWriter, $series->getFill()); - $objWriter->endElement(); +// $objWriter->endElement(); // Write X axis data $axisXData = array_keys($series->getValues()); @@ -1395,13 +1398,14 @@ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, $includeSh $objWriter->endElement(); - // c:spPr - $objWriter->startElement('c:spPr'); - - // Write fill - $this->writeFill($objWriter, $series->getFill()); - - $objWriter->endElement(); + if($series->getFill()->getFillType() != Fill::FILL_NONE) { + // c:spPr + $objWriter->startElement('c:spPr'); + // Write fill + $this->writeFill($objWriter, $series->getFill()); + // ## c:spPr + $objWriter->endElement(); + } // Write X axis data $axisXData = array_keys($series->getValues()); @@ -1445,11 +1449,6 @@ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, $includeSh $objWriter->writeAttribute('val', '52749440'); $objWriter->endElement(); - // c:axId - $objWriter->startElement('c:axId'); - $objWriter->writeAttribute('val', '0'); - $objWriter->endElement(); - $objWriter->endElement(); } @@ -1592,15 +1591,16 @@ protected function writeTypeScatter(XMLWriter $objWriter, Scatter $subject, $inc $this->writeElementWithValAttribute($objWriter, 'c:showLeaderLines', $series->hasShowLeaderLines() ? '1' : '0'); $objWriter->endElement(); - /* - // c:spPr - $objWriter->startElement('c:spPr'); - - // Write fill - $this->writeFill($objWriter, $series->getFill()); + + if($series->getFill()->getFillType() != Fill::FILL_NONE) { + // c:spPr + // $objWriter->startElement('c:spPr'); + // Write fill + // $this->writeFill($objWriter, $series->getFill()); + // ## c:spPr + // $objWriter->endElement(); + } - $objWriter->endElement(); - */ // Write X axis data $axisXData = array_keys($series->getValues()); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php b/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php index 5e988726d..47fb9a1cf 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php @@ -82,7 +82,7 @@ public function __construct() - + Click to edit Master title style @@ -116,35 +116,35 @@ public function __construct() - + Click to edit Master text styles - + Second level - + Third level - + Fourth level - + Fifth level @@ -185,7 +185,7 @@ public function __construct() - + 16/04/2009 @@ -263,7 +263,7 @@ public function __construct() - + <#> @@ -876,7 +876,7 @@ public function __construct() - + Click to edit Master title style @@ -995,7 +995,7 @@ public function __construct() - + Click to edit Master subtitle style @@ -1018,7 +1018,7 @@ public function __construct() - + 16/04/2009 @@ -1060,7 +1060,7 @@ public function __construct() - + ?#? @@ -1111,7 +1111,7 @@ public function __construct() - + Click to edit Master title style @@ -1135,35 +1135,35 @@ public function __construct() - + Click to edit Master text styles - + Second level - + Third level - + Fourth level - + Fifth level @@ -1186,7 +1186,7 @@ public function __construct() - + 16/04/2009 @@ -1228,7 +1228,7 @@ public function __construct() - + ?#? @@ -1288,7 +1288,7 @@ public function __construct() - + Click to edit Master title style @@ -1408,7 +1408,7 @@ public function __construct() - + Click to edit Master text styles @@ -1430,7 +1430,7 @@ public function __construct() - + 16/04/2009 @@ -1472,7 +1472,7 @@ public function __construct() - + ?#? @@ -1523,7 +1523,7 @@ public function __construct() - + Click to edit Master title style @@ -1580,35 +1580,35 @@ public function __construct() - + Click to edit Master text styles - + Second level - + Third level - + Fourth level - + Fifth level @@ -1665,35 +1665,35 @@ public function __construct() - + Click to edit Master text styles - + Second level - + Third level - + Fourth level - + Fifth level @@ -1716,7 +1716,7 @@ public function __construct() - + 16/04/2009 @@ -1758,7 +1758,7 @@ public function __construct() - + ?#? @@ -1813,7 +1813,7 @@ public function __construct() - + Click to edit Master title style @@ -1879,7 +1879,7 @@ public function __construct() - + Click to edit Master text styles @@ -1935,35 +1935,35 @@ public function __construct() - + Click to edit Master text styles - + Second level - + Third level - + Fourth level - + Fifth level @@ -2029,7 +2029,7 @@ public function __construct() - + Click to edit Master text styles @@ -2085,35 +2085,35 @@ public function __construct() - + Click to edit Master text styles - + Second level - + Third level - + Fourth level - + Fifth level @@ -2136,7 +2136,7 @@ public function __construct() - + 16/04/2009 @@ -2178,7 +2178,7 @@ public function __construct() - + ?#? @@ -2229,7 +2229,7 @@ public function __construct() - + Click to edit Master title style @@ -2252,7 +2252,7 @@ public function __construct() - + 16/04/2009 @@ -2294,7 +2294,7 @@ public function __construct() - + ?#? @@ -2345,7 +2345,7 @@ public function __construct() - + 16/04/2009 @@ -2387,7 +2387,7 @@ public function __construct() - + ?#? @@ -2447,7 +2447,7 @@ public function __construct() - + Click to edit Master title style @@ -2504,35 +2504,35 @@ public function __construct() - + Click to edit Master text styles - + Second level - + Third level - + Fourth level - + Fifth level @@ -2598,7 +2598,7 @@ public function __construct() - + Click to edit Master text styles @@ -2620,7 +2620,7 @@ public function __construct() - + 16/04/2009 @@ -2662,7 +2662,7 @@ public function __construct() - + ?#? @@ -2722,7 +2722,7 @@ public function __construct() - + Click to edit Master title style @@ -2849,7 +2849,7 @@ public function __construct() - + Click to edit Master text styles @@ -2871,7 +2871,7 @@ public function __construct() - + 16/04/2009 @@ -2913,7 +2913,7 @@ public function __construct() - + ?#? @@ -2964,7 +2964,7 @@ public function __construct() - + Click to edit Master title style @@ -2988,35 +2988,35 @@ public function __construct() - + Click to edit Master text styles - + Second level - + Third level - + Fourth level - + Fifth level @@ -3039,7 +3039,7 @@ public function __construct() - + 16/04/2009 @@ -3081,7 +3081,7 @@ public function __construct() - + ?#? @@ -3137,7 +3137,7 @@ public function __construct() - + Click to edit Master title style @@ -3166,35 +3166,35 @@ public function __construct() - + Click to edit Master text styles - + Second level - + Third level - + Fourth level - + Fifth level @@ -3217,7 +3217,7 @@ public function __construct() - + 16/04/2009 @@ -3259,7 +3259,7 @@ public function __construct() - + ?#? From 53bdc903dfed291a4da7b4dfcf920a14ad233739 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 26 Dec 2014 12:47:22 +0100 Subject: [PATCH 030/115] #63 : Added support for notes slide (ODPresentation & PowerPoint2007) --- src/PhpPowerpoint/Slide.php | 22 ++++---- src/PhpPowerpoint/{ => Slide}/Note.php | 55 ++++++++++--------- .../Writer/ODPresentation/Content.php | 4 +- .../Writer/PowerPoint2007/Chart.php | 6 +- .../Writer/PowerPoint2007/Slide.php | 6 +- tests/PhpPowerpoint/Tests/Shape/GroupTest.php | 4 -- .../Tests/{ => Slide}/NoteTest.php | 4 +- 7 files changed, 52 insertions(+), 49 deletions(-) rename src/PhpPowerpoint/{ => Slide}/Note.php (76%) rename tests/PhpPowerpoint/Tests/{ => Slide}/NoteTest.php (98%) diff --git a/src/PhpPowerpoint/Slide.php b/src/PhpPowerpoint/Slide.php index bbb608f46..5cc978677 100644 --- a/src/PhpPowerpoint/Slide.php +++ b/src/PhpPowerpoint/Slide.php @@ -25,6 +25,7 @@ use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\Shape\Table; use PhpOffice\PhpPowerpoint\Slide\Layout; +use PhpOffice\PhpPowerpoint\Slide\Note; /** * Slide class @@ -65,9 +66,10 @@ class Slide implements ComparableInterface, ShapeContainerInterface * @var integer */ private $slideMasterId = 1; + /** * - * @var \PhpOffice\PhpPowerpoint\Note + * @var \PhpOffice\PhpPowerpoint\Slide\Note */ private $slideNote; @@ -411,26 +413,26 @@ public function getExtentY() /** * - * @return \PhpOffice\PhpPowerpoint\Note + * @return \PhpOffice\PhpPowerpoint\Slide\Note */ public function getNote() { - if (is_null($this->slideNote)) { - $this->setNote(); - } - return $this->slideNote; + if (is_null($this->slideNote)) { + $this->setNote(); + } + return $this->slideNote; } /** * - * @param \PhpOffice\PhpPowerpoint\Note $note + * @param \PhpOffice\PhpPowerpoint\Slide\Note $note * @return \PhpOffice\PhpPowerpoint\Slide */ public function setNote (Note $note = null) { - $this->slideNote = (is_null($note) ? new Note() : $note); - $this->slideNote->setParent($this); + $this->slideNote = (is_null($note) ? new Note() : $note); + $this->slideNote->setParent($this); - return $this; + return $this; } } diff --git a/src/PhpPowerpoint/Note.php b/src/PhpPowerpoint/Slide/Note.php similarity index 76% rename from src/PhpPowerpoint/Note.php rename to src/PhpPowerpoint/Slide/Note.php index 50a334beb..e22dba2f0 100644 --- a/src/PhpPowerpoint/Note.php +++ b/src/PhpPowerpoint/Slide/Note.php @@ -15,8 +15,13 @@ * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ -namespace PhpOffice\PhpPowerpoint; +namespace PhpOffice\PhpPowerpoint\Slide; +use PhpOffice\PhpPowerpoint\AbstractShape; +use PhpOffice\PhpPowerpoint\ComparableInterface; +use PhpOffice\PhpPowerpoint\GeometryCalculator; +use PhpOffice\PhpPowerpoint\ShapeContainerInterface; +use PhpOffice\PhpPowerpoint\Slide; use PhpOffice\PhpPowerpoint\Shape\RichText; /** @@ -163,12 +168,12 @@ public function setParent(Slide $parent) */ public function getOffsetX () { - if ($this->offsetX === null) { - $offsets = GeometryCalculator::calculateOffsets($this); - $this->offsetX = $offsets[GeometryCalculator::X]; - $this->offsetY = $offsets[GeometryCalculator::Y]; - } - return $this->offsetX; + if ($this->offsetX === null) { + $offsets = GeometryCalculator::calculateOffsets($this); + $this->offsetX = $offsets[GeometryCalculator::X]; + $this->offsetY = $offsets[GeometryCalculator::Y]; + } + return $this->offsetX; } /** @@ -178,12 +183,12 @@ public function getOffsetX () */ public function getOffsetY () { - if ($this->offsetY === null) { - $offsets = GeometryCalculator::calculateOffsets($this); - $this->offsetX = $offsets[GeometryCalculator::X]; - $this->offsetY = $offsets[GeometryCalculator::Y]; - } - return $this->offsetY; + if ($this->offsetY === null) { + $offsets = GeometryCalculator::calculateOffsets($this); + $this->offsetX = $offsets[GeometryCalculator::X]; + $this->offsetY = $offsets[GeometryCalculator::Y]; + } + return $this->offsetY; } /** @@ -193,12 +198,12 @@ public function getOffsetY () */ public function getExtentX () { - if ($this->extentX === null) { - $extents = GeometryCalculator::calculateExtents($this); - $this->extentX = $extents[GeometryCalculator::X]; - $this->extentY = $extents[GeometryCalculator::Y]; - } - return $this->extentX; + if ($this->extentX === null) { + $extents = GeometryCalculator::calculateExtents($this); + $this->extentX = $extents[GeometryCalculator::X]; + $this->extentY = $extents[GeometryCalculator::Y]; + } + return $this->extentX; } /** @@ -208,12 +213,12 @@ public function getExtentX () */ public function getExtentY () { - if ($this->extentY === null) { - $extents = GeometryCalculator::calculateExtents($this); - $this->extentX = $extents[GeometryCalculator::X]; - $this->extentY = $extents[GeometryCalculator::Y]; - } - return $this->extentY; + if ($this->extentY === null) { + $extents = GeometryCalculator::calculateExtents($this); + $this->extentX = $extents[GeometryCalculator::X]; + $this->extentY = $extents[GeometryCalculator::Y]; + } + return $this->extentY; } /** diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index 053a2ab43..e0ed41c73 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -17,7 +17,6 @@ namespace PhpOffice\PhpPowerpoint\Writer\ODPresentation; -use PhpOffice\PhpPowerpoint\Note; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; use PhpOffice\PhpPowerpoint\Shape\Chart; @@ -35,6 +34,7 @@ use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; use PhpOffice\PhpPowerpoint\Shared\String; use PhpOffice\PhpPowerpoint\Shared\XMLWriter; +use PhpOffice\PhpPowerpoint\Slide\Note; use PhpOffice\PhpPowerpoint\Style\Alignment; use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Fill; @@ -989,7 +989,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) public function writeSlideNote(XMLWriter $objWriter, Note $note) { $shapesNote = $note->getShapeCollection(); - if(count($shapesNote) > 0){ + if (count($shapesNote) > 0) { $objWriter->startElement('presentation:notes'); foreach ($shapesNote as $shape) { diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 7966a0b43..d99d4a8d1 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -946,7 +946,7 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include // c:idx $this->writeElementWithValAttribute($objWriter, 'c:idx', $key); - if($value->getFillType() != Fill::FILL_NONE) { + if ($value->getFillType() != Fill::FILL_NONE) { // c:spPr $objWriter->startElement('c:spPr'); // Write fill @@ -1398,7 +1398,7 @@ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, $includeSh $objWriter->endElement(); - if($series->getFill()->getFillType() != Fill::FILL_NONE) { + if ($series->getFill()->getFillType() != Fill::FILL_NONE) { // c:spPr $objWriter->startElement('c:spPr'); // Write fill @@ -1592,7 +1592,7 @@ protected function writeTypeScatter(XMLWriter $objWriter, Scatter $subject, $inc $objWriter->endElement(); - if($series->getFill()->getFillType() != Fill::FILL_NONE) { + if ($series->getFill()->getFillType() != Fill::FILL_NONE) { // c:spPr // $objWriter->startElement('c:spPr'); // Write fill diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 6997d177f..76c96869e 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -17,7 +17,6 @@ namespace PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; -use PhpOffice\PhpPowerpoint\Note; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; use PhpOffice\PhpPowerpoint\Shape\Chart as ShapeChart; use PhpOffice\PhpPowerpoint\Shape\Group; @@ -31,6 +30,7 @@ use PhpOffice\PhpPowerpoint\Shared\String; use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Slide as SlideElement; +use PhpOffice\PhpPowerpoint\Slide\Note; use PhpOffice\PhpPowerpoint\Style\Alignment; use PhpOffice\PhpPowerpoint\Style\Borders; use PhpOffice\PhpPowerpoint\Style\Border; @@ -1250,11 +1250,11 @@ private function writeHyperlink(XMLWriter $objWriter, $shape) * @param Note $pNote * @throws \Exception */ - private function writeNote(Note $pNote = null) + public function writeNote(Note $pNote = null) { // Check slide if (is_null($pNote)) { - throw new \Exception("Invalid \PhpOffice\PhpPowerpoint\Note object passed."); + throw new \Exception("Invalid \PhpOffice\PhpPowerpoint\Slide\Note object passed."); } // Create XML writer diff --git a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php index bdfdcdd86..4cb2de864 100644 --- a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php @@ -54,8 +54,6 @@ public function testAdd() public function testExtentX() { - $value = rand(1, 100); - $object = new Group(); $line1 = new Line(10, 20, 30, 40); $object->addShape($line1); @@ -65,8 +63,6 @@ public function testExtentX() public function testExtentY() { - $value = rand(1, 100); - $object = new Group(); $line1 = new Line(10, 20, 30, 40); $object->addShape($line1); diff --git a/tests/PhpPowerpoint/Tests/NoteTest.php b/tests/PhpPowerpoint/Tests/Slide/NoteTest.php similarity index 98% rename from tests/PhpPowerpoint/Tests/NoteTest.php rename to tests/PhpPowerpoint/Tests/Slide/NoteTest.php index 8f3d92a3b..2dd64e3e7 100644 --- a/tests/PhpPowerpoint/Tests/NoteTest.php +++ b/tests/PhpPowerpoint/Tests/Slide/NoteTest.php @@ -17,9 +17,9 @@ namespace PhpOffice\PhpPowerpoint\Tests; -use PhpOffice\PhpPowerpoint\Note; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\RichText; +use PhpOffice\PhpPowerpoint\Slide\Note; /** * Test class for PhpPowerpoint @@ -62,4 +62,4 @@ public function testSetGetHashIndex() $object->setHashIndex($value); $this->assertEquals($value, $object->getHashIndex()); } -} \ No newline at end of file +} From 85d60c33bcf74f92534126531b11bebb95362966 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 30 Dec 2014 12:10:00 +0100 Subject: [PATCH 031/115] #76 : Added option for explosion in Pie3D Chart (ODPresentation & PowerPoint2007) --- CHANGELOG.md | 2 ++ samples/Sample_07_Chart.php | 2 ++ src/PhpPowerpoint/Shape/Chart/Type/Pie3D.php | 29 +++++++++++++++++++ .../Writer/ODPresentation/ObjectsChart.php | 3 +- .../Writer/PowerPoint2007/Chart.php | 2 +- .../Writer/PowerPoint2007/Slide.php | 2 +- .../Tests/Shape/Chart/Type/Pie3DTest.php | 13 ++++++++- .../Writer/ODPresentation/ChartsTest.php | 23 +++++++++++++++ .../Tests/Writer/PowerPoint2007/ChartTest.php | 28 ++++++++++++++++++ 9 files changed, 99 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc2239943..2045232b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ - Added support for calculating the offset and extent on a Slide. - @Pr0phet GH-68 - Added support for Horizontal bar chart - @rdoepke @Progi1984 GH-58 - Added support for hyperlink on picture (ODPresentation & PowerPoint2007) - @Progi1984 GH-49 +- Added support for notes slide (ODPresentation & PowerPoint2007) - @Progi1984 GH-63 +- Added option for explosion in Pie3D Chart (ODPresentation & PowerPoint2007) - @Progi1984 GH-76 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/samples/Sample_07_Chart.php b/samples/Sample_07_Chart.php index db95cc2c1..9acd9abdf 100644 --- a/samples/Sample_07_Chart.php +++ b/samples/Sample_07_Chart.php @@ -132,6 +132,7 @@ // Create a pie chart (that should be inserted in a shape) echo date('H:i:s') . ' Create a pie chart (that should be inserted in a chart shape)'.EOL; $pie3DChart = new Pie3D(); +$pie3DChart->setExplosion(20); $series = new Series('Downloads', $seriesData); $series->setShowSeriesName(true); $series->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8')); @@ -176,6 +177,7 @@ $lineChart = new Line(); $series = new Series('Downloads', $seriesData); $series->setShowSeriesName(true); +$series->setShowValue(false); $lineChart->addSeries($series); // Create a shape (chart) diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Pie3D.php b/src/PhpPowerpoint/Shape/Chart/Type/Pie3D.php index 8d6b78aaf..29aa24c00 100644 --- a/src/PhpPowerpoint/Shape/Chart/Type/Pie3D.php +++ b/src/PhpPowerpoint/Shape/Chart/Type/Pie3D.php @@ -24,6 +24,13 @@ */ class Pie3D extends AbstractType implements ComparableInterface { + /** + * Explosion of the Pie3D + * + * @var integer + */ + protected $explosion = 0; + /** * Create a new self instance */ @@ -32,6 +39,28 @@ public function __construct() $this->hasAxisX = false; $this->hasAxisY = false; } + + /** + * Set explosion + * + * @param integer $value + * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D + */ + public function setExplosion($value = 0) + { + $this->explosion = $value; + return $this; + } + + /** + * Get orientation + * + * @return string + */ + public function getExplosion() + { + return $this->explosion; + } /** * Get hash code diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index e6356567e..9f1013ccb 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -557,8 +557,7 @@ private function writeSeriesStyle(Chart $chart, Chart\Series $series) $this->xmlContent->writeAttribute('chart:data-label-number', 'value'); $this->xmlContent->writeAttribute('chart:label-position', 'right'); if ($chartType instanceof Pie3D) { - //@todo : Permit edit the offset of a pie - $this->xmlContent->writeAttribute('chart:pie-offset', '20'); + $this->xmlContent->writeAttribute('chart:pie-offset', $chartType->getExplosion()); } if ($chartType instanceof Line) { //@todo : Permit edit the symbol of a line diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index d99d4a8d1..0602bbb87 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -1140,7 +1140,7 @@ protected function writeTypePie3D(XMLWriter $objWriter, Pie3D $subject, $include // c:explosion $objWriter->startElement('c:explosion'); - $objWriter->writeAttribute('val', '20'); + $objWriter->writeAttribute('val', $subject->getExplosion()); $objWriter->endElement(); // Fills for points? diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 76c96869e..090d58f47 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -157,7 +157,7 @@ public function writeSlide(SlideElement $pSlide = null) $objWriter->startElement('p:clrMapOvr'); // a:masterClrMapping - $objWriter->writeElement('a:masterClrMapping', ''); + $objWriter->writeElement('a:masterClrMapping', null); $objWriter->endElement(); diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Pie3DTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Pie3DTest.php index 16c0a54ad..2b5895e24 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Pie3DTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Pie3DTest.php @@ -45,7 +45,7 @@ public function testData() $this->assertCount(count($array), $object->getData()); } - public function testSerties() + public function testSeries() { $object = new Pie3D(); @@ -53,6 +53,17 @@ public function testSerties() $this->assertCount(1, $object->getData()); } + public function testExplosion() + { + $value = rand(0, 100); + + $object = new Pie3D(); + + $this->assertEquals(0, $object->getExplosion()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie3D', $object->setExplosion($value)); + $this->assertEquals($value, $object->getExplosion()); + } + public function testHashCode() { $oSeries = new Series(); diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php index 90b1074c4..a1095c91e 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php @@ -163,6 +163,29 @@ public function testChartPie3D() $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); } + public function testChartPie3DExplosion() + { + $value = rand(0, 100); + + $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2)); + $oSeries->setShowSeriesName(true); + + $oPie3D = new Pie3D(); + $oPie3D->setExplosion($value); + $oPie3D->addSeries($oSeries); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oChart = $oSlide->createChartShape(); + $oChart->getPlotArea()->setType($oPie3D); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleSeries0\'][@style:family=\'chart\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals($value, $pres->getElementAttribute($element, 'chart:pie-offset', 'Object 1/content.xml')); + } + public function testChartScatter() { $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2)); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php index 9d11168de..e699b76ab 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php @@ -312,6 +312,34 @@ public function testTypePie3D() $this->assertEquals($oSeries->getTitle(), $oXMLDoc->getElement($element, 'ppt/charts/'.$oShape->getIndexedFilename())->nodeValue); } + public function testTypePie3DExplosion() + { + $value = rand(1, 100); + $seriesData = array( + 'A' => 1, + 'B' => 2, + 'C' => 4, + 'D' => 3, + 'E' => 2, + ); + + $oPHPPowerPoint = new PhpPowerpoint(); + $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oShape = $oSlide->createChartShape(); + $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); + $oPie3D = new Pie3D(); + $oPie3D->setExplosion($value); + $oSeries = new Series('Downloads', $seriesData); + $oPie3D->addSeries($oSeries); + $oShape->getPlotArea()->setType($oPie3D); + + $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + + $element = '/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser/c:explosion'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $this->assertEquals($value, $oXMLDoc->getElementAttribute($element, 'val', 'ppt/charts/'.$oShape->getIndexedFilename())); + } + public function testTypePie3DSubScript() { $seriesData = array( From aae558f0f024196869fe3587e7c77cf53a787dd0 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 30 Dec 2014 15:44:53 +0100 Subject: [PATCH 032/115] #46 : Fix Unicode characters in LayoutPack/PackDefault.php & Add some forgotten relations --- src/PhpPowerpoint/Writer/PowerPoint2007.php | 2 +- .../PowerPoint2007/LayoutPack/PackDefault.php | 16 ++++++++-------- src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php | 6 +++++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007.php b/src/PhpPowerpoint/Writer/PowerPoint2007.php index d83a5f9a8..73f0745b8 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007.php @@ -230,7 +230,7 @@ public function save($pFilename) foreach ($masterSlides as $masterSlide) { // Add themes to ZIP file $objZip->addFromString('ppt/theme/_rels/theme' . $masterSlide['masterid'] . '.xml.rels', $wPartRels->writeThemeRelationships($masterSlide['masterid'])); - $objZip->addFromString('ppt/theme/theme' . $masterSlide['masterid'] . '.xml', utf8_encode($wPartTheme->writeTheme($masterSlide['masterid']))); + $objZip->addFromString('ppt/theme/theme' . $masterSlide['masterid'] . '.xml', $wPartTheme->writeTheme($masterSlide['masterid'])); // Add slide masters to ZIP file $objZip->addFromString('ppt/slideMasters/_rels/slideMaster' . $masterSlide['masterid'] . '.xml.rels', $wPartRels->writeSlideMasterRelationships($masterSlide['masterid'])); $objZip->addFromString('ppt/slideMasters/slideMaster' . $masterSlide['masterid'] . '.xml', $masterSlide['body']); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php b/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php index 47fb9a1cf..c37a67964 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/PackDefault.php @@ -593,10 +593,10 @@ public function __construct() - - - - + + + + @@ -627,10 +627,10 @@ public function __construct() - - - - + + + + diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php index 6ae66ca1a..4c94445be 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php @@ -107,9 +107,13 @@ public function writePresentationRelationships(PHPPowerPoint $pPHPPowerPoint = n // Relationships with slides $slideCount = $pPHPPowerPoint->getSlideCount(); for ($i = 0; $i < $slideCount; ++$i) { - $this->writeRelationship($objWriter, ($i + $relationId), 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slides/slide' . ($i + 1) . '.xml'); + $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'slides/slide' . ($i + 1) . '.xml'); } + $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps', 'presProps.xml'); + $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps', 'viewProps.xml'); + $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles', 'tableStyles.xml'); + $objWriter->endElement(); // Return From 55a4cfeb95127b92fd719adda63f0e877406884f Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 31 Dec 2014 15:08:23 +0100 Subject: [PATCH 033/115] #76 : Sample for Line Chart --- samples/Sample_07_Chart.php | 45 +------- samples/Sample_07_Chart_Line.php | 102 ++++++++++++++++++ src/PhpPowerpoint/AbstractShape.php | 8 ++ src/PhpPowerpoint/HashTable.php | 1 + src/PhpPowerpoint/Shape/AbstractDrawing.php | 8 ++ src/PhpPowerpoint/Shape/Chart.php | 9 ++ src/PhpPowerpoint/Shape/Chart/PlotArea.php | 5 + .../Writer/PowerPoint2007/Chart.php | 14 +-- .../Writer/PowerPoint2007/Presentation.php | 2 - 9 files changed, 142 insertions(+), 52 deletions(-) create mode 100644 samples/Sample_07_Chart_Line.php diff --git a/samples/Sample_07_Chart.php b/samples/Sample_07_Chart.php index 9acd9abdf..0b904f8a1 100644 --- a/samples/Sample_07_Chart.php +++ b/samples/Sample_07_Chart.php @@ -40,7 +40,7 @@ $oShadow->setVisible(true)->setDirection(45)->setDistance(10); // Create templated slide -echo date('H:i:s') . ' Create templated slide'.EOL; +echo EOL.date('H:i:s') . ' Create templated slide'.EOL; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // Generate sample data for first chart @@ -89,7 +89,7 @@ // Create templated slide -echo date('H:i:s') . ' Create templated slide'.EOL; +echo EOL.date('H:i:s') . ' Create templated slide'.EOL; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // Create a bar chart (that should be inserted in a shape) @@ -122,7 +122,7 @@ $shape->getLegend()->getFont()->setItalic(true); // Create templated slide -echo date('H:i:s') . ' Create templated slide'.EOL; +echo EOL.date('H:i:s') . ' Create templated slide'.EOL; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // Generate sample data for second chart @@ -165,44 +165,7 @@ $shape->getLegend()->getFont()->setItalic(true); // Create templated slide -echo date('H:i:s') . ' Create templated slide'.EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function - -// Generate sample data for third chart -echo date('H:i:s') . ' Generate sample data for third chart'.EOL; -$seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7); - -// Create a line chart (that should be inserted in a shape) -echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)'.EOL; -$lineChart = new Line(); -$series = new Series('Downloads', $seriesData); -$series->setShowSeriesName(true); -$series->setShowValue(false); -$lineChart->addSeries($series); - -// Create a shape (chart) -echo date('H:i:s') . ' Create a shape (chart)'.EOL; -$shape = $currentSlide->createChartShape(); -$shape->setName('PHPPowerPoint Daily Downloads') - ->setResizeProportional(false) - ->setHeight(550) - ->setWidth(700) - ->setOffsetX(120) - ->setOffsetY(80); -$shape->setShadow($oShadow); -$shape->setFill($oFill); -$shape->getBorder()->setLineStyle(Border::LINE_SINGLE); -$shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); -$shape->getTitle()->getFont()->setItalic(true); -$shape->getPlotArea()->setType($lineChart); -$shape->getView3D()->setRotationX(30); -$shape->getView3D()->setPerspective(30); -$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); -$shape->getLegend()->getFont()->setItalic(true); - - -// Create templated slide -echo date('H:i:s') . ' Create templated slide'.EOL; +echo EOL.date('H:i:s') . ' Create templated slide'.EOL; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function // Generate sample data for fourth chart diff --git a/samples/Sample_07_Chart_Line.php b/samples/Sample_07_Chart_Line.php new file mode 100644 index 000000000..534b1e815 --- /dev/null +++ b/samples/Sample_07_Chart_Line.php @@ -0,0 +1,102 @@ +getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPowerPoint Team') + ->setTitle('Sample 07 Title') + ->setSubject('Sample 07 Subject') + ->setDescription('Sample 07 Description') + ->setKeywords('office 2007 openxml libreoffice odt php') + ->setCategory('Sample Category'); + +// Remove first slide +echo date('H:i:s') . ' Remove first slide'.EOL; +$objPHPPowerPoint->removeSlideByIndex(0); + +// Set Style +$oFill = new Fill(); +$oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20')); + +$oShadow = new Shadow(); +$oShadow->setVisible(true)->setDirection(45)->setDistance(10); + +// Generate sample data for chart +echo date('H:i:s') . ' Generate sample data for chart'.EOL; +$seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7); + +// Create templated slide +echo EOL.date('H:i:s') . ' Create templated slide'.EOL; +$currentSlide = createTemplatedSlide($objPHPPowerPoint); + +// Create a line chart (that should be inserted in a shape) +echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)'.EOL; +$lineChart = new Line(); +$series = new Series('Downloads', $seriesData); +$series->setShowSeriesName(true); +$series->setShowValue(true); +$lineChart->addSeries($series); + +// Create a shape (chart) +echo date('H:i:s') . ' Create a shape (chart)'.EOL; +$shape = $currentSlide->createChartShape(); +$shape->setName('PHPPowerPoint Daily Downloads') + ->setResizeProportional(false) + ->setHeight(550) + ->setWidth(700) + ->setOffsetX(120) + ->setOffsetY(80); +$shape->setShadow($oShadow); +$shape->setFill($oFill); +$shape->getBorder()->setLineStyle(Border::LINE_SINGLE); +$shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); +$shape->getTitle()->getFont()->setItalic(true); +$shape->getPlotArea()->setType($lineChart); +$shape->getView3D()->setRotationX(30); +$shape->getView3D()->setPerspective(30); +$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); +$shape->getLegend()->getFont()->setItalic(true); + +// Create templated slide +echo EOL.date('H:i:s') . ' Create templated slide'.EOL; +$currentSlide = createTemplatedSlide($objPHPPowerPoint); + +// Create a line chart (that should be inserted in a shape) +echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)'.EOL; +$lineChart1 = clone $lineChart; + +// Create a shape (chart) +echo date('H:i:s') . ' Create a shape (chart)'.EOL; +echo date('H:i:s') . ' Differences with previous : Values on right axis and Legend hidden'.EOL; +$shape1 = clone $shape; +$shape1->getLegend()->setVisible(false); +$shape1->setName('PHPPowerPoint Weekly Downloads'); +$shape1->getTitle()->setText('PHPPowerPoint Weekly Downloads'); +$shape1->getPlotArea()->setType($lineChart1); +$shape1->getPlotArea()->getAxisY()->setFormatCode('#,##0'); +$currentSlide->addShape($shape1); + +// Save file +echo EOL.write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); + +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/src/PhpPowerpoint/AbstractShape.php b/src/PhpPowerpoint/AbstractShape.php index c007d5765..431d375f5 100644 --- a/src/PhpPowerpoint/AbstractShape.php +++ b/src/PhpPowerpoint/AbstractShape.php @@ -121,6 +121,13 @@ public function __construct() $this->border->setLineStyle(Style\Border::LINE_NONE); } + + public function __clone() { + $this->container = null; + $this->fill = clone $this->fill; + $this->border = clone $this->border; + $this->shadow = clone $this->shadow; + } /** * Get Container, Slide or Group @@ -159,6 +166,7 @@ public function setContainer(ShapeContainerInterface $pValue = null, $pOverrideO $this->container = null; break; } + $iterator->next(); } // Set new \PhpOffice\PhpPowerpoint\Slide diff --git a/src/PhpPowerpoint/HashTable.php b/src/PhpPowerpoint/HashTable.php index 82dc80776..c9ead1efe 100644 --- a/src/PhpPowerpoint/HashTable.php +++ b/src/PhpPowerpoint/HashTable.php @@ -81,6 +81,7 @@ public function add(ComparableInterface $pSource) { // Determine hashcode $hashIndex = $pSource->getHashIndex(); + if (is_null($hashIndex)) { $hashCode = $pSource->getHashCode(); } elseif (isset($this->keyMap[$hashIndex])) { diff --git a/src/PhpPowerpoint/Shape/AbstractDrawing.php b/src/PhpPowerpoint/Shape/AbstractDrawing.php index 89c9439b3..b5e915a36 100644 --- a/src/PhpPowerpoint/Shape/AbstractDrawing.php +++ b/src/PhpPowerpoint/Shape/AbstractDrawing.php @@ -84,6 +84,14 @@ public function __construct() // Initialize parent parent::__construct(); } + + public function __clone() + { + parent::__clone(); + + self::$imageCounter++; + $this->imageIndex = self::$imageCounter; + } /** * Get image index diff --git a/src/PhpPowerpoint/Shape/Chart.php b/src/PhpPowerpoint/Shape/Chart.php index 57b04b3a0..4155f67cc 100644 --- a/src/PhpPowerpoint/Shape/Chart.php +++ b/src/PhpPowerpoint/Shape/Chart.php @@ -77,6 +77,15 @@ public function __construct() // Initialize parent parent::__construct(); } + + public function __clone() { + parent::__clone(); + + $this->title = clone $this->title; + $this->legend = clone $this->legend; + $this->plotArea = clone $this->plotArea; + $this->view3D = clone $this->view3D; + } /** * Get Title diff --git a/src/PhpPowerpoint/Shape/Chart/PlotArea.php b/src/PhpPowerpoint/Shape/Chart/PlotArea.php index c243b2025..75de80bfc 100644 --- a/src/PhpPowerpoint/Shape/Chart/PlotArea.php +++ b/src/PhpPowerpoint/Shape/Chart/PlotArea.php @@ -82,6 +82,11 @@ public function __construct() $this->axisX = new Axis(); $this->axisY = new Axis(); } + + public function __clone() { + $this->axisX = clone $this->axisX; + $this->axisY = clone $this->axisY; + } /** * Get type diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 0602bbb87..5b295d574 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -636,6 +636,7 @@ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeC $objWriter->writeAttribute('val', 'minMax'); $objWriter->endElement(); + // ## c:scaling $objWriter->endElement(); // c:axPos @@ -649,10 +650,6 @@ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeC $objWriter->writeAttribute('sourceLinked', '0'); $objWriter->endElement(); - // c:majorGridlines - //$objWriter->startElement('c:majorGridlines'); - //$objWriter->endElement(); - // c:majorTickMark $objWriter->startElement('c:majorTickMark'); $objWriter->writeAttribute('val', 'none'); @@ -681,6 +678,7 @@ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeC // a:defRPr $objWriter->writeElement('a:defRPr', null); + // ## a:pPr $objWriter->endElement(); // a:r @@ -695,6 +693,7 @@ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeC // a:t $objWriter->writeElement('a:t', $subject->getAxisY()->getTitle()); + // ## a:r $objWriter->endElement(); // a:endParaRPr @@ -703,8 +702,10 @@ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeC $objWriter->writeAttribute('dirty', '0'); $objWriter->endElement(); + // ## a:p $objWriter->endElement(); + // ## c:txPr $objWriter->endElement(); // c:crossAx @@ -1290,11 +1291,6 @@ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, $includeSh $objWriter->writeAttribute('val', 'standard'); $objWriter->endElement(); - // c:varyColors - $objWriter->startElement('c:varyColors'); - $objWriter->writeAttribute('val', '0'); - $objWriter->endElement(); - // Write series $seriesIndex = 0; foreach ($subject->getData() as $series) { diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php index 59544f401..0ebd71c54 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php @@ -82,8 +82,6 @@ public function writePresentation(PHPPowerPoint $pPHPPowerPoint = null) // p:sldSz $objWriter->startElement('p:sldSz'); - //$objWriter->writeAttribute('cx', '9144000'); - //$objWriter->writeAttribute('cy', '6858000'); $objWriter->writeAttribute('cx', $pPHPPowerPoint->getLayout()->getCX()); $objWriter->writeAttribute('cy', $pPHPPowerPoint->getLayout()->getCY()); if ($pPHPPowerPoint->getLayout()->getDocumentLayout() != DocumentLayout::LAYOUT_CUSTOM) { From 5b9494903adb2a101cd5a7266f83de5e0f5dea53 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 31 Dec 2014 15:21:41 +0100 Subject: [PATCH 034/115] #76 : Sample for Line Chart --- src/PhpPowerpoint/AbstractShape.php | 5 +++-- src/PhpPowerpoint/Shape/Chart.php | 3 ++- src/PhpPowerpoint/Shape/Chart/PlotArea.php | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/PhpPowerpoint/AbstractShape.php b/src/PhpPowerpoint/AbstractShape.php index 431d375f5..3da295916 100644 --- a/src/PhpPowerpoint/AbstractShape.php +++ b/src/PhpPowerpoint/AbstractShape.php @@ -122,7 +122,8 @@ public function __construct() $this->border->setLineStyle(Style\Border::LINE_NONE); } - public function __clone() { + public function __clone() + { $this->container = null; $this->fill = clone $this->fill; $this->border = clone $this->border; @@ -166,7 +167,7 @@ public function setContainer(ShapeContainerInterface $pValue = null, $pOverrideO $this->container = null; break; } - $iterator->next(); + $iterator->next(); } // Set new \PhpOffice\PhpPowerpoint\Slide diff --git a/src/PhpPowerpoint/Shape/Chart.php b/src/PhpPowerpoint/Shape/Chart.php index 4155f67cc..46cbffac0 100644 --- a/src/PhpPowerpoint/Shape/Chart.php +++ b/src/PhpPowerpoint/Shape/Chart.php @@ -78,7 +78,8 @@ public function __construct() parent::__construct(); } - public function __clone() { + public function __clone() + { parent::__clone(); $this->title = clone $this->title; diff --git a/src/PhpPowerpoint/Shape/Chart/PlotArea.php b/src/PhpPowerpoint/Shape/Chart/PlotArea.php index 75de80bfc..6c2d0c9ef 100644 --- a/src/PhpPowerpoint/Shape/Chart/PlotArea.php +++ b/src/PhpPowerpoint/Shape/Chart/PlotArea.php @@ -83,7 +83,8 @@ public function __construct() $this->axisY = new Axis(); } - public function __clone() { + public function __clone() + { $this->axisX = clone $this->axisX; $this->axisY = clone $this->axisY; } From b860ab3f0fc0eb3a11a5becafd02d7a008f3b177 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 7 Jan 2015 12:48:45 +0100 Subject: [PATCH 035/115] #63 : Added support for notes slide (ODPresentation & PowerPoint2007) --- CHANGELOG.md | 2 +- composer.lock | 1208 ++++++++++------- .../Writer/PowerPoint2007/Slide.php | 75 +- 3 files changed, 783 insertions(+), 502 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2045232b0..93fe2d48e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - Added support for calculating the offset and extent on a Slide. - @Pr0phet GH-68 - Added support for Horizontal bar chart - @rdoepke @Progi1984 GH-58 - Added support for hyperlink on picture (ODPresentation & PowerPoint2007) - @Progi1984 GH-49 -- Added support for notes slide (ODPresentation & PowerPoint2007) - @Progi1984 GH-63 +- Added support for notes slide (ODPresentation & PowerPoint2007) - @Progi1984 @JewrassicPark GH-63 - Added option for explosion in Pie3D Chart (ODPresentation & PowerPoint2007) - @Progi1984 GH-76 ### Bugfix diff --git a/composer.lock b/composer.lock index d060f16dd..ccffe0321 100644 --- a/composer.lock +++ b/composer.lock @@ -4,10 +4,8 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "53951d1b3a8e84bcddf6ded82f7dfb46", - "packages": [ - - ], + "hash": "62ddcf9c34f2ad80fcef2409104808b0", + "packages": [], "packages-dev": [ { "name": "cilex/cilex", @@ -129,16 +127,16 @@ }, { "name": "doctrine/annotations", - "version": "v1.1.2", + "version": "v1.2.3", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "40db0c96985aab2822edbc4848b3bd2429e02670" + "reference": "eeda578cbe24a170331a1cfdf78be723412df7a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/40db0c96985aab2822edbc4848b3bd2429e02670", - "reference": "40db0c96985aab2822edbc4848b3bd2429e02670", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/eeda578cbe24a170331a1cfdf78be723412df7a4", + "reference": "eeda578cbe24a170331a1cfdf78be723412df7a4", "shasum": "" }, "require": { @@ -146,12 +144,13 @@ "php": ">=5.3.2" }, "require-dev": { - "doctrine/cache": "1.*" + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -164,17 +163,6 @@ "MIT" ], "authors": [ - { - "name": "Jonathan H. Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": "Creator" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -183,11 +171,17 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, { "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", - "role": "Developer of wrapped JMSSerializerBundle" + "email": "schmittjoh@gmail.com" } ], "description": "Docblock Annotations Parser", @@ -197,26 +191,31 @@ "docblock", "parser" ], - "time": "2013-06-16 21:33:03" + "time": "2014-12-20 20:49:38" }, { "name": "doctrine/lexer", - "version": "v1.0", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "2f708a85bb3aab5d99dab8be435abd73e0b18acb" + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/2f708a85bb3aab5d99dab8be435abd73e0b18acb", - "reference": "2f708a85bb3aab5d99dab8be435abd73e0b18acb", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", "shasum": "" }, "require": { "php": ">=5.3.2" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-0": { "Doctrine\\Common\\Lexer\\": "lib/" @@ -227,20 +226,17 @@ "MIT" ], "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, { "name": "Roman Borschel", "email": "roman@code-factory.org" }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", - "role": "Developer of wrapped JMSSerializerBundle" + "email": "schmittjoh@gmail.com" } ], "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", @@ -249,7 +245,7 @@ "lexer", "parser" ], - "time": "2013-01-12 18:59:04" + "time": "2014-09-09 13:34:57" }, { "name": "dompdf/dompdf", @@ -294,16 +290,16 @@ }, { "name": "erusev/parsedown", - "version": "0.9.4", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "d29ff18299210b52a75a631a70963e7c8b35b04f" + "reference": "495e7ac73bb5fde6b857b88ff2bb1b5e79a4263a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/d29ff18299210b52a75a631a70963e7c8b35b04f", - "reference": "d29ff18299210b52a75a631a70963e7c8b35b04f", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/495e7ac73bb5fde6b857b88ff2bb1b5e79a4263a", + "reference": "495e7ac73bb5fde6b857b88ff2bb1b5e79a4263a", "shasum": "" }, "type": "library", @@ -329,20 +325,139 @@ "markdown", "parser" ], - "time": "2014-02-06 12:16:14" + "time": "2014-11-29 02:29:14" + }, + { + "name": "herrera-io/json", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/herrera-io/php-json.git", + "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/herrera-io/php-json/zipball/60c696c9370a1e5136816ca557c17f82a6fa83f1", + "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1", + "shasum": "" + }, + "require": { + "ext-json": "*", + "justinrainbow/json-schema": ">=1.0,<2.0-dev", + "php": ">=5.3.3", + "seld/jsonlint": ">=1.0,<2.0-dev" + }, + "require-dev": { + "herrera-io/phpunit-test-case": "1.*", + "mikey179/vfsstream": "1.1.0", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "files": [ + "src/lib/json_version.php" + ], + "psr-0": { + "Herrera\\Json": "src/lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kevin Herrera", + "email": "kevin@herrera.io", + "homepage": "http://kevin.herrera.io/", + "role": "Developer" + } + ], + "description": "A library for simplifying JSON linting and validation.", + "homepage": "http://herrera-io.github.com/php-json", + "keywords": [ + "json", + "lint", + "schema", + "validate" + ], + "time": "2013-10-30 16:51:34" + }, + { + "name": "herrera-io/phar-update", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/herrera-io/php-phar-update.git", + "reference": "00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/herrera-io/php-phar-update/zipball/00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b", + "reference": "00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b", + "shasum": "" + }, + "require": { + "herrera-io/json": "1.*", + "kherge/version": "1.*", + "php": ">=5.3.3" + }, + "require-dev": { + "herrera-io/phpunit-test-case": "1.*", + "mikey179/vfsstream": "1.1.0", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "files": [ + "src/lib/constants.php" + ], + "psr-0": { + "Herrera\\Phar\\Update": "src/lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kevin Herrera", + "email": "kevin@herrera.io", + "homepage": "http://kevin.herrera.io/", + "role": "Developer" + } + ], + "description": "A library for self-updating Phars.", + "homepage": "http://herrera-io.github.com/php-phar-update", + "keywords": [ + "phar", + "update" + ], + "time": "2013-10-30 17:23:01" }, { "name": "jms/metadata", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/schmittjoh/metadata.git", - "reference": "88ffa28bc987e4c26229fc84a2e541b6ed4e1459" + "reference": "22b72455559a25777cfd28c4ffda81ff7639f353" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/88ffa28bc987e4c26229fc84a2e541b6ed4e1459", - "reference": "88ffa28bc987e4c26229fc84a2e541b6ed4e1459", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/22b72455559a25777cfd28c4ffda81ff7639f353", + "reference": "22b72455559a25777cfd28c4ffda81ff7639f353", "shasum": "" }, "require": { @@ -368,9 +483,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -381,7 +496,7 @@ "xml", "yaml" ], - "time": "2013-11-05 23:02:36" + "time": "2014-07-12 07:13:19" }, { "name": "jms/parser-lib", @@ -471,9 +586,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -489,94 +604,143 @@ "time": "2014-03-18 08:39:00" }, { - "name": "knplabs/knp-menu", - "version": "v1.1.2", + "name": "justinrainbow/json-schema", + "version": "1.3.7", "source": { "type": "git", - "url": "https://github.com/KnpLabs/KnpMenu.git", - "reference": "f8e867268f63f561c1adadd6cbb5d8524f921873" + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "87b54b460febed69726c781ab67462084e97a105" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/KnpMenu/zipball/f8e867268f63f561c1adadd6cbb5d8524f921873", - "reference": "f8e867268f63f561c1adadd6cbb5d8524f921873", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/87b54b460febed69726c781ab67462084e97a105", + "reference": "87b54b460febed69726c781ab67462084e97a105", "shasum": "" }, "require": { "php": ">=5.3.0" }, "require-dev": { - "pimple/pimple": "*", - "silex/silex": "1.0.*", - "twig/twig": ">=1.2,<2.0-dev" - }, - "suggest": { - "pimple/pimple": "for the built-in implementations of the menu provider and renderer provider", - "silex/silex": "for the integration with your silex application", - "twig/twig": "for the TwigRenderer and the integration with your templates" + "json-schema/json-schema-test-suite": "1.1.0", + "phpdocumentor/phpdocumentor": "~2", + "phpunit/phpunit": "~3.7" }, + "bin": [ + "bin/validate-json" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { "psr-0": { - "Knp\\Menu\\": "src/" + "JsonSchema": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Christophe Coevoet", - "email": "stof@notk.org" + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" }, { - "name": "KnpLabs", - "homepage": "http://knplabs.com" + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" }, { - "name": "Symfony Community", - "homepage": "https://github.com/KnpLabs/KnpMenu/contributors" + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" } ], - "description": "An object oriented menu library", - "homepage": "http://knplabs.com", + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", "keywords": [ - "menu", - "tree" + "json", + "schema" ], - "time": "2012-06-10 16:20:40" + "time": "2014-08-25 02:48:14" + }, + { + "name": "kherge/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/kherge-unmaintained/Version.git", + "reference": "f07cf83f8ce533be8f93d2893d96d674bbeb7e30" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kherge-unmaintained/Version/zipball/f07cf83f8ce533be8f93d2893d96d674bbeb7e30", + "reference": "f07cf83f8ce533be8f93d2893d96d674bbeb7e30", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "KevinGH\\Version": "src/lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kevin Herrera", + "email": "me@kevingh.com", + "homepage": "http://www.kevingh.com/" + } + ], + "description": "A parsing and comparison library for semantic versioning.", + "homepage": "http://github.com/kherge/Version", + "time": "2012-08-16 17:13:03" }, { "name": "monolog/monolog", - "version": "1.10.0", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "25b16e801979098cb2f120e697bfce454b18bf23" + "reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/25b16e801979098cb2f120e697bfce454b18bf23", - "reference": "25b16e801979098cb2f120e697bfce454b18bf23", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1fbe8c2641f2b163addf49cc5e18f144bec6b19f", + "reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f", "shasum": "" }, "require": { "php": ">=5.3.0", "psr/log": "~1.0" }, + "provide": { + "psr/log-implementation": "1.0.0" + }, "require-dev": { "aws/aws-sdk-php": "~2.4, >2.4.8", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", - "phpunit/phpunit": "~3.7.0", + "phpunit/phpunit": "~4.0", "raven/raven": "~0.5", - "ruflin/elastica": "0.90.*" + "ruflin/elastica": "0.90.*", + "videlalvaro/php-amqplib": "~2.4" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", @@ -586,12 +750,13 @@ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "raven/raven": "Allow sending log messages to a Sentry server", "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10.x-dev" + "dev-master": "1.12.x-dev" } }, "autoload": { @@ -607,8 +772,7 @@ { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", - "homepage": "http://seld.be", - "role": "Developer" + "homepage": "http://seld.be" } ], "description": "Sends your logs to files, sockets, inboxes, databases and various web services", @@ -618,23 +782,24 @@ "logging", "psr-3" ], - "time": "2014-06-04 16:30:04" + "time": "2014-12-29 21:29:35" }, { "name": "nikic/php-parser", - "version": "v0.9.4", + "version": "v0.9.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "1e5e280ae88a27effa2ae4aa2bd088494ed8594f" + "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1e5e280ae88a27effa2ae4aa2bd088494ed8594f", - "reference": "1e5e280ae88a27effa2ae4aa2bd088494ed8594f", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ef70767475434bdb3615b43c327e2cae17ef12eb", + "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb", "shasum": "" }, "require": { + "ext-tokenizer": "*", "php": ">=5.2" }, "type": "library", @@ -662,29 +827,29 @@ "parser", "php" ], - "time": "2013-08-25 17:11:40" + "time": "2014-07-23 18:24:17" }, { "name": "pdepend/pdepend", - "version": "2.0.0", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/pdepend/pdepend.git", - "reference": "b74f2bb68e86104cd97dfb8d74209692c9b465ce" + "reference": "1b0acf162da4f30237987e61e177a57f78e3d87e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/b74f2bb68e86104cd97dfb8d74209692c9b465ce", - "reference": "b74f2bb68e86104cd97dfb8d74209692c9b465ce", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/1b0acf162da4f30237987e61e177a57f78e3d87e", + "reference": "1b0acf162da4f30237987e61e177a57f78e3d87e", "shasum": "" }, "require": { - "symfony/config": "@stable", - "symfony/dependency-injection": "@stable", - "symfony/filesystem": "@stable" + "symfony/config": ">=2.4", + "symfony/dependency-injection": ">=2.4", + "symfony/filesystem": ">=2.4" }, "require-dev": { - "phpunit/phpunit": "3.*@stable", + "phpunit/phpunit": "4.*@stable", "squizlabs/php_codesniffer": "@stable" }, "bin": [ @@ -701,7 +866,7 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2014-05-21 09:48:10" + "time": "2014-12-04 12:38:39" }, { "name": "phenx/php-font-lib", @@ -771,9 +936,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -832,16 +997,16 @@ }, { "name": "phpdocumentor/graphviz", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/GraphViz.git", - "reference": "13595130b9bc185109f40f1b70f0b231f490f5fc" + "reference": "aa243118c8a055fc853c02802e8503c5435862f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/GraphViz/zipball/13595130b9bc185109f40f1b70f0b231f490f5fc", - "reference": "13595130b9bc185109f40f1b70f0b231f490f5fc", + "url": "https://api.github.com/repos/phpDocumentor/GraphViz/zipball/aa243118c8a055fc853c02802e8503c5435862f7", + "reference": "aa243118c8a055fc853c02802e8503c5435862f7", "shasum": "" }, "require": { @@ -869,28 +1034,28 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2014-02-26 17:45:01" + "time": "2014-07-19 06:52:59" }, { "name": "phpdocumentor/phpdocumentor", - "version": "v2.5.0", + "version": "v2.8.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/phpDocumentor2.git", - "reference": "bf9fa40f6d00412410025b2e16eb16c315eb0216" + "reference": "5920dd42a5a92e4486f342ba8ded979db149ceb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/phpDocumentor2/zipball/bf9fa40f6d00412410025b2e16eb16c315eb0216", - "reference": "bf9fa40f6d00412410025b2e16eb16c315eb0216", + "url": "https://api.github.com/repos/phpDocumentor/phpDocumentor2/zipball/5920dd42a5a92e4486f342ba8ded979db149ceb2", + "reference": "5920dd42a5a92e4486f342ba8ded979db149ceb2", "shasum": "" }, "require": { "cilex/cilex": "~1.0", "dompdf/dompdf": "~0.6", - "erusev/parsedown": "~0.7", + "erusev/parsedown": "~1.0", + "herrera-io/phar-update": "1.0.3", "jms/serializer": "~0.12", - "knplabs/knp-menu": "~1.1", "monolog/monolog": "~1.6", "php": ">=5.3.3", "phpdocumentor/fileset": "~1.0", @@ -913,20 +1078,20 @@ "symfony/stopwatch": "~2.3", "symfony/validator": "~2.2", "twig/twig": "~1.3", - "zendframework/zend-cache": "2.1.*", - "zendframework/zend-config": "2.1.*", - "zendframework/zend-filter": "2.1.*", - "zendframework/zend-i18n": "2.1.*", - "zendframework/zend-serializer": "2.1.*", - "zendframework/zend-servicemanager": "2.1.*", - "zendframework/zend-stdlib": "2.1.*", + "zendframework/zend-cache": "~2.1", + "zendframework/zend-config": "~2.1", + "zendframework/zend-filter": "~2.1", + "zendframework/zend-i18n": "~2.1", + "zendframework/zend-serializer": "~2.1", + "zendframework/zend-servicemanager": "~2.1", + "zendframework/zend-stdlib": "~2.1", "zetacomponents/document": ">=1.3.1" }, "require-dev": { "behat/behat": "~2.4", "mikey179/vfsstream": "~1.2", - "mockery/mockery": ">=0.8.0", - "phpunit/phpunit": "~3.7", + "mockery/mockery": "~0.9@dev", + "phpunit/phpunit": "~4.0", "squizlabs/php_codesniffer": "~1.4", "symfony/expression-language": "~2.4" }, @@ -941,7 +1106,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-develop": "2.5-dev" + "dev-develop": "2.9-dev" } }, "autoload": { @@ -949,6 +1114,9 @@ "phpDocumentor": [ "src/", "tests/unit/" + ], + "Cilex\\Provider": [ + "src/" ] } }, @@ -965,34 +1133,39 @@ "documentation", "phpdoc" ], - "time": "2014-05-17 12:25:35" + "time": "2014-11-11 14:08:43" }, { "name": "phpdocumentor/reflection", - "version": "1.0.5", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/phpDocumentor/Reflection.git", - "reference": "df82db631acd60739c8796b3c6d5e4da970808f3" + "reference": "fc40c3f604ac2287eb5c314174d5109b2c699372" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/Reflection/zipball/df82db631acd60739c8796b3c6d5e4da970808f3", - "reference": "df82db631acd60739c8796b3c6d5e4da970808f3", + "url": "https://api.github.com/repos/phpDocumentor/Reflection/zipball/fc40c3f604ac2287eb5c314174d5109b2c699372", + "reference": "fc40c3f604ac2287eb5c314174d5109b2c699372", "shasum": "" }, "require": { - "nikic/php-parser": "0.9.4", + "nikic/php-parser": "~0.9.4", "php": ">=5.3.3", - "phpdocumentor/reflection-docblock": "2.*", + "phpdocumentor/reflection-docblock": "~2.0", "psr/log": "~1.0" }, "require-dev": { "behat/behat": "~2.4", - "mockery/mockery": ">=0.7.0", - "phpunit/phpunit": "~3.7" + "mockery/mockery": "~0.8", + "phpunit/phpunit": "~4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-0": { "phpDocumentor": [ @@ -1014,20 +1187,20 @@ "reflection", "static analysis" ], - "time": "2014-03-28 11:20:22" + "time": "2014-11-14 11:43:04" }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "0bca477a34baea39add016af90046f002a175619" + "reference": "38743b677965c48a637097b2746a281264ae2347" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/0bca477a34baea39add016af90046f002a175619", - "reference": "0bca477a34baea39add016af90046f002a175619", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/38743b677965c48a637097b2746a281264ae2347", + "reference": "38743b677965c48a637097b2746a281264ae2347", "shasum": "" }, "require": { @@ -1063,24 +1236,23 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2014-03-28 09:21:30" + "time": "2014-08-09 10:27:07" }, { "name": "phpdocumentor/template-abstract", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/template.abstract.git", - "reference": "43fa2db351d7a150803397721e778f9dd8a20b47" + "reference": "df1d11cf11cf5da433789e2be07f4d2d6e51aaca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.abstract/zipball/43fa2db351d7a150803397721e778f9dd8a20b47", - "reference": "43fa2db351d7a150803397721e778f9dd8a20b47", + "url": "https://api.github.com/repos/phpDocumentor/template.abstract/zipball/df1d11cf11cf5da433789e2be07f4d2d6e51aaca", + "reference": "df1d11cf11cf5da433789e2be07f4d2d6e51aaca", "shasum": "" }, "require": { - "ext-xsl": "*", "phpdocumentor/unified-asset-installer": "~1.1" }, "type": "phpdocumentor-template", @@ -1095,24 +1267,23 @@ "phpdoc", "template" ], - "time": "2013-08-02 06:11:13" + "time": "2014-06-04 19:32:56" }, { "name": "phpdocumentor/template-checkstyle", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/template.checkstyle.git", - "reference": "22a45684e737c8c3ec3f1a12edb7743b7a82ac8b" + "reference": "cfa86d19327b0d762332787ff2dda0d55226a2e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.checkstyle/zipball/22a45684e737c8c3ec3f1a12edb7743b7a82ac8b", - "reference": "22a45684e737c8c3ec3f1a12edb7743b7a82ac8b", + "url": "https://api.github.com/repos/phpDocumentor/template.checkstyle/zipball/cfa86d19327b0d762332787ff2dda0d55226a2e2", + "reference": "cfa86d19327b0d762332787ff2dda0d55226a2e2", "shasum": "" }, "require": { - "ext-xsl": "*", "phpdocumentor/unified-asset-installer": "~1.1" }, "type": "phpdocumentor-template", @@ -1127,20 +1298,20 @@ "phpdoc", "template" ], - "time": "2013-08-01 19:43:19" + "time": "2014-08-17 19:32:38" }, { "name": "phpdocumentor/template-clean", - "version": "1.0.4", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/phpDocumentor/template.clean.git", - "reference": "78f2048c5ecd62f0b79dbac093687d78a66d1806" + "reference": "6fc0f7f6c55c1f94ac5b1c6fccde7aac77755e45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.clean/zipball/78f2048c5ecd62f0b79dbac093687d78a66d1806", - "reference": "78f2048c5ecd62f0b79dbac093687d78a66d1806", + "url": "https://api.github.com/repos/phpDocumentor/template.clean/zipball/6fc0f7f6c55c1f94ac5b1c6fccde7aac77755e45", + "reference": "6fc0f7f6c55c1f94ac5b1c6fccde7aac77755e45", "shasum": "" }, "require": { @@ -1159,24 +1330,23 @@ "responsive", "template" ], - "time": "2014-03-29 08:22:15" + "time": "2014-08-15 21:45:34" }, { "name": "phpdocumentor/template-new-black", - "version": "1.3.1", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/template.new_black.git", - "reference": "be38beba2b2674be292f32f88efe8a60c658a139" + "reference": "d98f84633b94b279582735aecd91015c1e191d98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.new_black/zipball/be38beba2b2674be292f32f88efe8a60c658a139", - "reference": "be38beba2b2674be292f32f88efe8a60c658a139", + "url": "https://api.github.com/repos/phpDocumentor/template.new_black/zipball/d98f84633b94b279582735aecd91015c1e191d98", + "reference": "d98f84633b94b279582735aecd91015c1e191d98", "shasum": "" }, "require": { - "ext-xsl": "*", "phpdocumentor/template-abstract": "1.*", "phpdocumentor/unified-asset-installer": "~1.1" }, @@ -1192,24 +1362,23 @@ "phpdoc", "template" ], - "time": "2013-08-02 06:16:30" + "time": "2014-06-27 17:00:31" }, { "name": "phpdocumentor/template-old-ocean", - "version": "1.3.1", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/template.old_ocean.git", - "reference": "3a0e2bcced4045a694d53b4607aad04e99d78489" + "reference": "2fdb786038351c0ec88633d4e2aa103e4bbb8655" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.old_ocean/zipball/3a0e2bcced4045a694d53b4607aad04e99d78489", - "reference": "3a0e2bcced4045a694d53b4607aad04e99d78489", + "url": "https://api.github.com/repos/phpDocumentor/template.old_ocean/zipball/2fdb786038351c0ec88633d4e2aa103e4bbb8655", + "reference": "2fdb786038351c0ec88633d4e2aa103e4bbb8655", "shasum": "" }, "require": { - "ext-xsl": "*", "phpdocumentor/unified-asset-installer": "~1.1" }, "type": "phpdocumentor-template", @@ -1224,24 +1393,23 @@ "phpdoc", "template" ], - "time": "2013-08-02 06:21:07" + "time": "2014-06-27 16:59:35" }, { "name": "phpdocumentor/template-responsive", - "version": "1.3.3", + "version": "1.3.5", "source": { "type": "git", "url": "https://github.com/phpDocumentor/template.responsive.git", - "reference": "26f895a2ed3148e1686ae4d802f65a3ef04c04e1" + "reference": "949e742f350f70fc8ec7c945b3cf0070a4e1825e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.responsive/zipball/26f895a2ed3148e1686ae4d802f65a3ef04c04e1", - "reference": "26f895a2ed3148e1686ae4d802f65a3ef04c04e1", + "url": "https://api.github.com/repos/phpDocumentor/template.responsive/zipball/949e742f350f70fc8ec7c945b3cf0070a4e1825e", + "reference": "949e742f350f70fc8ec7c945b3cf0070a4e1825e", "shasum": "" }, "require": { - "ext-xsl": "*", "phpdocumentor/unified-asset-installer": "~1.1" }, "type": "phpdocumentor-template", @@ -1256,20 +1424,20 @@ "phpdoc", "template" ], - "time": "2014-03-29 08:55:54" + "time": "2014-08-05 20:47:53" }, { "name": "phpdocumentor/template-responsive-twig", - "version": "1.2.3", + "version": "1.2.5", "source": { "type": "git", "url": "https://github.com/phpDocumentor/template.responsive-twig.git", - "reference": "cd6d82be6a4626d865fd01d40aad170cea08db0a" + "reference": "493e204be607583efd2d75f1728cd5210e23cf96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.responsive-twig/zipball/cd6d82be6a4626d865fd01d40aad170cea08db0a", - "reference": "cd6d82be6a4626d865fd01d40aad170cea08db0a", + "url": "https://api.github.com/repos/phpDocumentor/template.responsive-twig/zipball/493e204be607583efd2d75f1728cd5210e23cf96", + "reference": "493e204be607583efd2d75f1728cd5210e23cf96", "shasum": "" }, "require": { @@ -1287,7 +1455,7 @@ "phpdoc", "template" ], - "time": "2014-03-30 21:02:00" + "time": "2014-07-30 20:00:37" }, { "name": "phpdocumentor/template-xml", @@ -1405,24 +1573,24 @@ }, { "name": "phploc/phploc", - "version": "2.0.5", + "version": "2.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phploc.git", - "reference": "d177c22e2a08e448f7bdfa762045f7bd086834d7" + "reference": "322ad07c112d5c6832abed4269d648cacff5959b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phploc/zipball/d177c22e2a08e448f7bdfa762045f7bd086834d7", - "reference": "d177c22e2a08e448f7bdfa762045f7bd086834d7", + "url": "https://api.github.com/repos/sebastianbergmann/phploc/zipball/322ad07c112d5c6832abed4269d648cacff5959b", + "reference": "322ad07c112d5c6832abed4269d648cacff5959b", "shasum": "" }, "require": { "php": ">=5.3.3", - "sebastian/finder-facade": ">=1.1.0", - "sebastian/git": ">=1.0.0", - "sebastian/version": ">=1.0.3", - "symfony/console": ">=2.2.0" + "sebastian/finder-facade": "~1.1", + "sebastian/git": "~1.0", + "sebastian/version": "~1.0", + "symfony/console": "~2.2" }, "bin": [ "phploc" @@ -1451,28 +1619,28 @@ ], "description": "A tool for quickly measuring the size of a PHP project.", "homepage": "https://github.com/sebastianbergmann/phploc", - "time": "2014-04-27 06:47:27" + "time": "2014-06-25 08:11:02" }, { "name": "phpmd/phpmd", - "version": "2.0.0", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/phpmd/phpmd.git", - "reference": "68ced5452910d3555a38720bd87f5f2356c5a003" + "reference": "1a485d9db869137af5e9678bd844568c92998b25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/68ced5452910d3555a38720bd87f5f2356c5a003", - "reference": "68ced5452910d3555a38720bd87f5f2356c5a003", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/1a485d9db869137af5e9678bd844568c92998b25", + "reference": "1a485d9db869137af5e9678bd844568c92998b25", "shasum": "" }, "require": { "pdepend/pdepend": "2.0.*", "php": ">=5.3.0", - "symfony/config": "@stable", - "symfony/dependency-injection": "@stable", - "symfony/filesystem": "@stable" + "symfony/config": "2.5.*", + "symfony/dependency-injection": "2.5.*", + "symfony/filesystem": "2.5.*" }, "bin": [ "src/bin/phpmd" @@ -1480,20 +1648,15 @@ "type": "library", "autoload": { "psr-0": { - "PHPMD\\": "src/main/php", - "PDepend\\": "vendor/pdepend/pdepend/src/main/php/" + "PHPMD\\": "src/main/php" } }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "../../pdepend/pdepend/src/main/php", - "src/main/php" - ], "license": [ "BSD-3-Clause" ], "description": "Official version of PHPMD handled with Composer.", - "time": "2014-05-21 12:45:23" + "time": "2014-09-25 15:56:22" }, { "name": "phpoption/phpoption", @@ -1529,9 +1692,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -1546,23 +1709,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "1.2.17", + "version": "1.2.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6ef2bf3a1c47eca07ea95f0d8a902a6340390b34" + "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6ef2bf3a1c47eca07ea95f0d8a902a6340390b34", - "reference": "6ef2bf3a1c47eca07ea95f0d8a902a6340390b34", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", + "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", "shasum": "" }, "require": { "php": ">=5.3.3", "phpunit/php-file-iterator": ">=1.3.0@stable", "phpunit/php-text-template": ">=1.2.0@stable", - "phpunit/php-token-stream": ">=1.1.3@stable" + "phpunit/php-token-stream": ">=1.1.3,<1.3.0" }, "require-dev": { "phpunit/phpunit": "3.7.*@dev" @@ -1603,7 +1766,7 @@ "testing", "xunit" ], - "time": "2014-03-28 10:53:45" + "time": "2014-09-02 10:13:14" }, { "name": "phpunit/php-file-iterator", @@ -1790,16 +1953,16 @@ }, { "name": "phpunit/phpunit", - "version": "3.7.37", + "version": "3.7.38", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ae6cefd7cc84586a5ef27e04bae11ee940ec63dc" + "reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ae6cefd7cc84586a5ef27e04bae11ee940ec63dc", - "reference": "ae6cefd7cc84586a5ef27e04bae11ee940ec63dc", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/38709dc22d519a3d1be46849868aa2ddf822bcf6", + "reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6", "shasum": "" }, "require": { @@ -1859,7 +2022,7 @@ "testing", "xunit" ], - "time": "2014-04-30 12:24:19" + "time": "2014-10-17 09:04:17" }, { "name": "phpunit/phpunit-mock-objects", @@ -1915,12 +2078,12 @@ "version": "v1.1.1", "source": { "type": "git", - "url": "https://github.com/fabpot/Pimple.git", + "url": "https://github.com/silexphp/Pimple.git", "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d", "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d", "shasum": "" }, @@ -1945,9 +2108,7 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", @@ -2037,16 +2198,16 @@ }, { "name": "sebastian/git", - "version": "2.0.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/git.git", - "reference": "572c35353fefcc8607d6fef0e362a9f3a5e84d96" + "reference": "a99fbc102e982c1404041ef3e4d431562b29bcba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/git/zipball/572c35353fefcc8607d6fef0e362a9f3a5e84d96", - "reference": "572c35353fefcc8607d6fef0e362a9f3a5e84d96", + "url": "https://api.github.com/repos/sebastianbergmann/git/zipball/a99fbc102e982c1404041ef3e4d431562b29bcba", + "reference": "a99fbc102e982c1404041ef3e4d431562b29bcba", "shasum": "" }, "require": { @@ -2055,7 +2216,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -2079,7 +2240,7 @@ "keywords": [ "git" ], - "time": "2014-06-14 07:12:53" + "time": "2013-08-04 09:35:29" }, { "name": "sebastian/phpcpd", @@ -2134,16 +2295,16 @@ }, { "name": "sebastian/version", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43" + "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b", + "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b", "shasum": "" }, "type": "library", @@ -2165,20 +2326,66 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2014-03-07 15:35:33" + "time": "2014-12-15 14:25:24" + }, + { + "name": "seld/jsonlint", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/863ae85c6d3ef60ca49cb12bd051c4a0648c40c4", + "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "time": "2015-01-04 21:18:15" }, { "name": "squizlabs/php_codesniffer", - "version": "1.5.3", + "version": "1.5.6", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "396178ada8499ec492363587f037125bf7b07fcc" + "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/396178ada8499ec492363587f037125bf7b07fcc", - "reference": "396178ada8499ec492363587f037125bf7b07fcc", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6f3e42d311b882b25b4d409d23a289f4d3b803d5", + "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5", "shasum": "" }, "require": { @@ -2240,21 +2447,21 @@ "phpcs", "standards" ], - "time": "2014-05-01 03:07:07" + "time": "2014-12-04 22:32:15" }, { "name": "symfony/config", - "version": "v2.5.0", + "version": "v2.5.8", "target-dir": "Symfony/Component/Config", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "9c8caadb38ecc69ac35ab31af4d1996944b5a09f" + "reference": "92f0b4c625b8c42d394b53f879d2795d84bb8c4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/9c8caadb38ecc69ac35ab31af4d1996944b5a09f", - "reference": "9c8caadb38ecc69ac35ab31af4d1996944b5a09f", + "url": "https://api.github.com/repos/symfony/Config/zipball/92f0b4c625b8c42d394b53f879d2795d84bb8c4f", + "reference": "92f0b4c625b8c42d394b53f879d2795d84bb8c4f", "shasum": "" }, "require": { @@ -2277,34 +2484,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2014-04-22 08:11:23" + "time": "2014-12-02 20:15:53" }, { "name": "symfony/console", - "version": "v2.5.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "ef4ca73b0b3a10cbac653d3ca482d0cdd4502b2c" + "reference": "ef825fd9f809d275926547c9e57cbf14968793e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/ef4ca73b0b3a10cbac653d3ca482d0cdd4502b2c", - "reference": "ef4ca73b0b3a10cbac653d3ca482d0cdd4502b2c", + "url": "https://api.github.com/repos/symfony/Console/zipball/ef825fd9f809d275926547c9e57cbf14968793e8", + "reference": "ef825fd9f809d275926547c9e57cbf14968793e8", "shasum": "" }, "require": { @@ -2312,16 +2517,18 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1" + "symfony/event-dispatcher": "~2.1", + "symfony/process": "~2.1" }, "suggest": { "psr/log": "For using the console logger", - "symfony/event-dispatcher": "" + "symfony/event-dispatcher": "", + "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2334,34 +2541,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2014-05-22 08:54:24" + "time": "2014-12-02 20:19:20" }, { "name": "symfony/dependency-injection", - "version": "v2.5.0", + "version": "v2.5.8", "target-dir": "Symfony/Component/DependencyInjection", "source": { "type": "git", "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "5dfb4c2b74c4976efe1efa783370da656a2dd742" + "reference": "b4afda3c24867a17f93237ac1fcce917cc9d7695" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/5dfb4c2b74c4976efe1efa783370da656a2dd742", - "reference": "5dfb4c2b74c4976efe1efa783370da656a2dd742", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/b4afda3c24867a17f93237ac1fcce917cc9d7695", + "reference": "b4afda3c24867a17f93237ac1fcce917cc9d7695", "shasum": "" }, "require": { @@ -2393,34 +2598,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony DependencyInjection Component", "homepage": "http://symfony.com", - "time": "2014-05-12 09:28:39" + "time": "2014-12-02 21:48:32" }, { "name": "symfony/event-dispatcher", - "version": "v2.5.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8" + "reference": "720fe9bca893df7ad1b4546649473b5afddf0216" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8", - "reference": "cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/720fe9bca893df7ad1b4546649473b5afddf0216", + "reference": "720fe9bca893df7ad1b4546649473b5afddf0216", "shasum": "" }, "require": { @@ -2429,7 +2632,8 @@ "require-dev": { "psr/log": "~1.0", "symfony/config": "~2.0", - "symfony/dependency-injection": "~2.0", + "symfony/dependency-injection": "~2.6", + "symfony/expression-language": "~2.6", "symfony/stopwatch": "~2.2" }, "suggest": { @@ -2439,7 +2643,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2452,34 +2656,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", - "time": "2014-04-29 10:13:57" + "time": "2014-12-02 20:19:20" }, { "name": "symfony/filesystem", - "version": "v2.5.0", + "version": "v2.5.8", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "98e831eac836a0a5911626ce82684155f21d0e4d" + "reference": "e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/98e831eac836a0a5911626ce82684155f21d0e4d", - "reference": "98e831eac836a0a5911626ce82684155f21d0e4d", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42", + "reference": "e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42", "shasum": "" }, "require": { @@ -2501,34 +2703,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2014-04-16 10:36:21" + "time": "2014-12-02 20:15:53" }, { "name": "symfony/finder", - "version": "v2.5.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "307aad2c541bbdf43183043645e186ef2cd6b973" + "reference": "0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/307aad2c541bbdf43183043645e186ef2cd6b973", - "reference": "307aad2c541bbdf43183043645e186ef2cd6b973", + "url": "https://api.github.com/repos/symfony/Finder/zipball/0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721", + "reference": "0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721", "shasum": "" }, "require": { @@ -2537,7 +2737,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2550,34 +2750,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Finder Component", "homepage": "http://symfony.com", - "time": "2014-05-22 13:47:45" + "time": "2014-12-02 20:19:20" }, { "name": "symfony/process", - "version": "v2.5.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Process", "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "5d7d78e23894544740219e006320678cfa4cd45b" + "reference": "bf0c9bd625f13b0b0bbe39919225cf145dfb935a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/5d7d78e23894544740219e006320678cfa4cd45b", - "reference": "5d7d78e23894544740219e006320678cfa4cd45b", + "url": "https://api.github.com/repos/symfony/Process/zipball/bf0c9bd625f13b0b0bbe39919225cf145dfb935a", + "reference": "bf0c9bd625f13b0b0bbe39919225cf145dfb935a", "shasum": "" }, "require": { @@ -2586,7 +2784,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2599,34 +2797,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Process Component", "homepage": "http://symfony.com", - "time": "2014-05-23 09:02:52" + "time": "2014-12-02 20:19:20" }, { "name": "symfony/stopwatch", - "version": "v2.5.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Stopwatch", "source": { "type": "git", "url": "https://github.com/symfony/Stopwatch.git", - "reference": "724d73604ebe6c1c9bdf36533b556123bd9075a1" + "reference": "261abd360cfb6ac65ea93ffd82073e2011d034fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/724d73604ebe6c1c9bdf36533b556123bd9075a1", - "reference": "724d73604ebe6c1c9bdf36533b556123bd9075a1", + "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/261abd360cfb6ac65ea93ffd82073e2011d034fc", + "reference": "261abd360cfb6ac65ea93ffd82073e2011d034fc", "shasum": "" }, "require": { @@ -2635,7 +2831,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2648,51 +2844,52 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Stopwatch Component", "homepage": "http://symfony.com", - "time": "2014-04-18 20:40:13" + "time": "2014-12-02 20:19:20" }, { "name": "symfony/translation", - "version": "v2.5.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Translation", "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "5f23265dcf8927a84be832608069c9edca3cf5f4" + "reference": "5b8bf84a43317021849813f556f26dc35968156b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/5f23265dcf8927a84be832608069c9edca3cf5f4", - "reference": "5f23265dcf8927a84be832608069c9edca3cf5f4", + "url": "https://api.github.com/repos/symfony/Translation/zipball/5b8bf84a43317021849813f556f26dc35968156b", + "reference": "5b8bf84a43317021849813f556f26dc35968156b", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { + "psr/log": "~1.0", "symfony/config": "~2.0", + "symfony/intl": "~2.3", "symfony/yaml": "~2.2" }, "suggest": { + "psr/log": "To use logging capability in translator", "symfony/config": "", "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2705,34 +2902,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Translation Component", "homepage": "http://symfony.com", - "time": "2014-05-22 13:47:45" + "time": "2014-12-02 20:19:20" }, { "name": "symfony/validator", - "version": "v2.5.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Validator", "source": { "type": "git", "url": "https://github.com/symfony/Validator.git", - "reference": "62f6f7735fbd3897b9347ae60fda4a40d0122640" + "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/62f6f7735fbd3897b9347ae60fda4a40d0122640", - "reference": "62f6f7735fbd3897b9347ae60fda4a40d0122640", + "url": "https://api.github.com/repos/symfony/Validator/zipball/4583e0321f1bcdad14d93e265eaca1001035b5c4", + "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4", "shasum": "" }, "require": { @@ -2764,7 +2959,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2777,34 +2972,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Validator Component", "homepage": "http://symfony.com", - "time": "2014-05-31 02:02:56" + "time": "2014-12-02 20:19:20" }, { "name": "symfony/yaml", - "version": "v2.5.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "b4b09c68ec2f2727574544ef0173684281a5033c" + "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/b4b09c68ec2f2727574544ef0173684281a5033c", - "reference": "b4b09c68ec2f2727574544ef0173684281a5033c", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/3346fc090a3eb6b53d408db2903b241af51dcb20", + "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20", "shasum": "" }, "require": { @@ -2813,7 +3006,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -2826,33 +3019,31 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-05-16 14:25:18" + "time": "2014-12-02 20:19:20" }, { "name": "theseer/fdomdocument", - "version": "1.5.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/theseer/fDOMDocument.git", - "reference": "137aa3b13bef05b4e301899cbabdaf7d501847d2" + "reference": "d08cf070350f884c63fc9078d27893c2ab6c7cef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/137aa3b13bef05b4e301899cbabdaf7d501847d2", - "reference": "137aa3b13bef05b4e301899cbabdaf7d501847d2", + "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/d08cf070350f884c63fc9078d27893c2ab6c7cef", + "reference": "d08cf070350f884c63fc9078d27893c2ab6c7cef", "shasum": "" }, "require": { @@ -2879,20 +3070,20 @@ ], "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2014-02-19 00:20:43" + "time": "2014-09-13 10:57:19" }, { "name": "twig/twig", - "version": "v1.15.1", + "version": "v1.16.3", "source": { "type": "git", - "url": "https://github.com/fabpot/Twig.git", - "reference": "1fb5784662f438d7d96a541e305e28b812e2eeed" + "url": "https://github.com/twigphp/Twig.git", + "reference": "6dc11a1e8ecfc30e2c68aaeb218148409d8e68af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig/zipball/1fb5784662f438d7d96a541e305e28b812e2eeed", - "reference": "1fb5784662f438d7d96a541e305e28b812e2eeed", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/6dc11a1e8ecfc30e2c68aaeb218148409d8e68af", + "reference": "6dc11a1e8ecfc30e2c68aaeb218148409d8e68af", "shasum": "" }, "require": { @@ -2901,7 +3092,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.16-dev" } }, "autoload": { @@ -2927,7 +3118,7 @@ }, { "name": "Twig Team", - "homepage": "https://github.com/fabpot/Twig/graphs/contributors", + "homepage": "http://twig.sensiolabs.org/contributors", "role": "Contributors" } ], @@ -2936,31 +3127,32 @@ "keywords": [ "templating" ], - "time": "2014-02-13 10:19:29" + "time": "2014-12-25 19:58:19" }, { "name": "zendframework/zend-cache", - "version": "2.1.6", + "version": "2.3.3", "target-dir": "Zend/Cache", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendCache.git", - "reference": "560355160f06cdc3ef549a7eef843af3bead7e39" + "reference": "1966038a1568ebeaeeeaa78ce27bc7b340e30747" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendCache/zipball/560355160f06cdc3ef549a7eef843af3bead7e39", - "reference": "560355160f06cdc3ef549a7eef843af3bead7e39", + "url": "https://api.github.com/repos/zendframework/Component_ZendCache/zipball/1966038a1568ebeaeeeaa78ce27bc7b340e30747", + "reference": "1966038a1568ebeaeeeaa78ce27bc7b340e30747", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.23", "zendframework/zend-eventmanager": "self.version", "zendframework/zend-servicemanager": "self.version", "zendframework/zend-stdlib": "self.version" }, "require-dev": { - "zendframework/zend-serializer": "self.version" + "zendframework/zend-serializer": "self.version", + "zendframework/zend-session": "self.version" }, "suggest": { "ext-apc": "APC >= 3.1.6 to use the APC storage adapter", @@ -2973,8 +3165,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" + "dev-master": "2.3-dev", + "dev-develop": "2.4-dev" } }, "autoload": { @@ -2987,40 +3179,49 @@ "BSD-3-Clause" ], "description": "provides a generic way to cache any data", + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "cache", "zf2" ], - "time": "2014-03-03 23:00:17" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-config", - "version": "2.1.6", + "version": "2.3.3", "target-dir": "Zend/Config", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendConfig.git", - "reference": "a31c3980cf7ec88418a931e9cf4ba21079f47a08" + "reference": "a9ad512e1482461a5b500ee3fcf2d06ec9c7c7e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendConfig/zipball/a31c3980cf7ec88418a931e9cf4ba21079f47a08", - "reference": "a31c3980cf7ec88418a931e9cf4ba21079f47a08", + "url": "https://api.github.com/repos/zendframework/Component_ZendConfig/zipball/a9ad512e1482461a5b500ee3fcf2d06ec9c7c7e8", + "reference": "a9ad512e1482461a5b500ee3fcf2d06ec9c7c7e8", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.23", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "zendframework/zend-filter": "self.version", + "zendframework/zend-i18n": "self.version", + "zendframework/zend-json": "self.version", + "zendframework/zend-servicemanager": "self.version" + }, "suggest": { + "zendframework/zend-filter": "Zend\\Filter component", + "zendframework/zend-i18n": "Zend\\I18n component", "zendframework/zend-json": "Zend\\Json to use the Json reader or writer classes", "zendframework/zend-servicemanager": "Zend\\ServiceManager for use with the Config Factory to retrieve reader and writer instances" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" + "dev-master": "2.3-dev", + "dev-develop": "2.4-dev" } }, "autoload": { @@ -3033,36 +3234,37 @@ "BSD-3-Clause" ], "description": "provides a nested object property based user interface for accessing this configuration data within application code", + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "config", "zf2" ], - "time": "2014-01-02 18:00:10" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-eventmanager", - "version": "2.1.6", + "version": "2.3.3", "target-dir": "Zend/EventManager", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendEventManager.git", - "reference": "89368704bb37303fba64c3ddd6bce0506aa7187c" + "reference": "4110fe64b10616b9bb71429a206d8e9e6d99e3ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendEventManager/zipball/89368704bb37303fba64c3ddd6bce0506aa7187c", - "reference": "89368704bb37303fba64c3ddd6bce0506aa7187c", + "url": "https://api.github.com/repos/zendframework/Component_ZendEventManager/zipball/4110fe64b10616b9bb71429a206d8e9e6d99e3ba", + "reference": "4110fe64b10616b9bb71429a206d8e9e6d99e3ba", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.23", "zendframework/zend-stdlib": "self.version" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" + "dev-master": "2.3-dev", + "dev-develop": "2.4-dev" } }, "autoload": { @@ -3074,45 +3276,48 @@ "license": [ "BSD-3-Clause" ], + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "eventmanager", "zf2" ], - "time": "2014-01-04 13:00:14" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-filter", - "version": "2.1.6", + "version": "2.3.3", "target-dir": "Zend/Filter", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendFilter.git", - "reference": "8ceece474b29d079e86976dbd3efffe6064b3d72" + "reference": "98b8c2abfdc9009e4c0157e78c9f22bf2cebb693" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendFilter/zipball/8ceece474b29d079e86976dbd3efffe6064b3d72", - "reference": "8ceece474b29d079e86976dbd3efffe6064b3d72", + "url": "https://api.github.com/repos/zendframework/Component_ZendFilter/zipball/98b8c2abfdc9009e4c0157e78c9f22bf2cebb693", + "reference": "98b8c2abfdc9009e4c0157e78c9f22bf2cebb693", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.23", "zendframework/zend-stdlib": "self.version" }, "require-dev": { - "zendframework/zend-crypt": "self.version" + "zendframework/zend-crypt": "self.version", + "zendframework/zend-servicemanager": "self.version", + "zendframework/zend-uri": "self.version" }, "suggest": { "zendframework/zend-crypt": "Zend\\Crypt component", "zendframework/zend-i18n": "Zend\\I18n component", - "zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter", - "zendframework/zend-validator": "Zend\\Validator component" + "zendframework/zend-servicemanager": "Zend\\ServiceManager component", + "zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" + "dev-master": "2.3-dev", + "dev-develop": "2.4-dev" } }, "autoload": { @@ -3125,44 +3330,57 @@ "BSD-3-Clause" ], "description": "provides a set of commonly needed data filters", + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "filter", "zf2" ], - "time": "2014-03-03 21:00:06" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-i18n", - "version": "2.1.6", + "version": "2.3.3", "target-dir": "Zend/I18n", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendI18n.git", - "reference": "10f56e0869761d62699782e4dd04eb77262cc353" + "reference": "7939bd8eaa573f10fe33a799714199ed7c1fad5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendI18n/zipball/10f56e0869761d62699782e4dd04eb77262cc353", - "reference": "10f56e0869761d62699782e4dd04eb77262cc353", + "url": "https://api.github.com/repos/zendframework/Component_ZendI18n/zipball/7939bd8eaa573f10fe33a799714199ed7c1fad5c", + "reference": "7939bd8eaa573f10fe33a799714199ed7c1fad5c", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.23", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "zendframework/zend-cache": "self.version", + "zendframework/zend-config": "self.version", + "zendframework/zend-eventmanager": "self.version", + "zendframework/zend-filter": "self.version", + "zendframework/zend-servicemanager": "self.version", + "zendframework/zend-validator": "self.version", + "zendframework/zend-view": "self.version" + }, "suggest": { "ext-intl": "Required for most features of Zend\\I18n; included in default builds of PHP", + "zendframework/zend-cache": "Zend\\Cache component", + "zendframework/zend-config": "Zend\\Config component", "zendframework/zend-eventmanager": "You should install this package to use the events in the translator", "zendframework/zend-filter": "You should install this package to use the provided filters", "zendframework/zend-resources": "Translation resources", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component", "zendframework/zend-validator": "You should install this package to use the provided validators", "zendframework/zend-view": "You should install this package to use the provided view helpers" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" + "dev-master": "2.3-dev", + "dev-develop": "2.4-dev" } }, "autoload": { @@ -3174,39 +3392,45 @@ "license": [ "BSD-3-Clause" ], + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "i18n", "zf2" ], - "time": "2014-01-04 13:00:19" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-json", - "version": "2.1.6", + "version": "2.3.3", "target-dir": "Zend/Json", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendJson.git", - "reference": "dd8a8239a7c08c7449a6ea219da3e2369bd90d92" + "reference": "4093e5a0a166a5d02532bac6e5671a7b21d203b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendJson/zipball/dd8a8239a7c08c7449a6ea219da3e2369bd90d92", - "reference": "dd8a8239a7c08c7449a6ea219da3e2369bd90d92", + "url": "https://api.github.com/repos/zendframework/Component_ZendJson/zipball/4093e5a0a166a5d02532bac6e5671a7b21d203b5", + "reference": "4093e5a0a166a5d02532bac6e5671a7b21d203b5", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.23", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "zendframework/zend-http": "self.version", + "zendframework/zend-server": "self.version" + }, "suggest": { + "zendframework/zend-http": "Zend\\Http component", "zendframework/zend-server": "Zend\\Server component" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" + "dev-master": "2.3-dev", + "dev-develop": "2.4-dev" } }, "autoload": { @@ -3219,29 +3443,30 @@ "BSD-3-Clause" ], "description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP", + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "json", "zf2" ], - "time": "2014-03-06 18:00:05" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-math", - "version": "2.1.6", + "version": "2.3.3", "target-dir": "Zend/Math", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendMath.git", - "reference": "b982ee2edafd4075b22372596ab2e2fdd0f6424e" + "reference": "a197ee44ade44a289f0f250c2aedb321b3618573" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendMath/zipball/b982ee2edafd4075b22372596ab2e2fdd0f6424e", - "reference": "b982ee2edafd4075b22372596ab2e2fdd0f6424e", + "url": "https://api.github.com/repos/zendframework/Component_ZendMath/zipball/a197ee44ade44a289f0f250c2aedb321b3618573", + "reference": "a197ee44ade44a289f0f250c2aedb321b3618573", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.23" }, "suggest": { "ext-bcmath": "If using the bcmath functionality", @@ -3252,8 +3477,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" + "dev-master": "2.3-dev", + "dev-develop": "2.4-dev" } }, "autoload": { @@ -3265,41 +3490,45 @@ "license": [ "BSD-3-Clause" ], + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "math", "zf2" ], - "time": "2014-03-05 18:00:06" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-serializer", - "version": "2.1.6", + "version": "2.3.3", "target-dir": "Zend/Serializer", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendSerializer.git", - "reference": "d76b931d3ffa842a496c9fa319bbe285b5ddfade" + "reference": "34ee4925e7e256bfa80c4c3dcc8e764d02a51edd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendSerializer/zipball/d76b931d3ffa842a496c9fa319bbe285b5ddfade", - "reference": "d76b931d3ffa842a496c9fa319bbe285b5ddfade", + "url": "https://api.github.com/repos/zendframework/Component_ZendSerializer/zipball/34ee4925e7e256bfa80c4c3dcc8e764d02a51edd", + "reference": "34ee4925e7e256bfa80c4c3dcc8e764d02a51edd", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.23", "zendframework/zend-json": "self.version", "zendframework/zend-math": "self.version", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "zendframework/zend-servicemanager": "self.version" + }, "suggest": { "zendframework/zend-servicemanager": "To support plugin manager support" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" + "dev-master": "2.3-dev", + "dev-develop": "2.4-dev" } }, "autoload": { @@ -3312,29 +3541,33 @@ "BSD-3-Clause" ], "description": "provides an adapter based interface to simply generate storable representation of PHP types by different facilities, and recover", + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "serializer", "zf2" ], - "time": "2014-01-02 18:00:26" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-servicemanager", - "version": "2.1.6", + "version": "2.3.3", "target-dir": "Zend/ServiceManager", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendServiceManager.git", - "reference": "de182a20dfdcf978c49570514103c7477ef16e4f" + "reference": "559403e4fd10db2516641f20f129a568d7e6a993" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendServiceManager/zipball/de182a20dfdcf978c49570514103c7477ef16e4f", - "reference": "de182a20dfdcf978c49570514103c7477ef16e4f", + "url": "https://api.github.com/repos/zendframework/Component_ZendServiceManager/zipball/559403e4fd10db2516641f20f129a568d7e6a993", + "reference": "559403e4fd10db2516641f20f129a568d7e6a993", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.23" + }, + "require-dev": { + "zendframework/zend-di": "self.version" }, "suggest": { "zendframework/zend-di": "Zend\\Di component" @@ -3342,8 +3575,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" + "dev-master": "2.3-dev", + "dev-develop": "2.4-dev" } }, "autoload": { @@ -3355,39 +3588,46 @@ "license": [ "BSD-3-Clause" ], + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "servicemanager", "zf2" ], - "time": "2014-03-03 21:00:04" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-stdlib", - "version": "2.1.6", + "version": "2.3.3", "target-dir": "Zend/Stdlib", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendStdlib.git", - "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5" + "reference": "fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/e646729f2274f4552b6a92e38d8e458efe08ebc5", - "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5", + "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33", + "reference": "fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.23" + }, + "require-dev": { + "zendframework/zend-eventmanager": "self.version", + "zendframework/zend-serializer": "self.version", + "zendframework/zend-servicemanager": "self.version" }, "suggest": { "zendframework/zend-eventmanager": "To support aggregate hydrator usage", + "zendframework/zend-serializer": "Zend\\Serializer component", "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" + "dev-master": "2.3-dev", + "dev-develop": "2.4-dev" } }, "autoload": { @@ -3399,26 +3639,30 @@ "license": [ "BSD-3-Clause" ], + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "stdlib", "zf2" ], - "time": "2014-01-04 13:00:28" + "time": "2014-09-16 22:58:11" }, { "name": "zetacomponents/base", - "version": "1.8", + "version": "1.9", "source": { "type": "git", "url": "https://github.com/zetacomponents/Base.git", - "reference": "52ca69c1de55f3fa4f595779e5bc831da7ee176c" + "reference": "f20df24e8de3e48b6b69b2503f917e457281e687" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zetacomponents/Base/zipball/52ca69c1de55f3fa4f595779e5bc831da7ee176c", - "reference": "52ca69c1de55f3fa4f595779e5bc831da7ee176c", + "url": "https://api.github.com/repos/zetacomponents/Base/zipball/f20df24e8de3e48b6b69b2503f917e457281e687", + "reference": "f20df24e8de3e48b6b69b2503f917e457281e687", "shasum": "" }, + "require-dev": { + "zetacomponents/unit-test": "*" + }, "type": "library", "autoload": { "classmap": [ @@ -3427,7 +3671,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "apache2" + "Apache-2.0" ], "authors": [ { @@ -3463,7 +3707,7 @@ ], "description": "The Base package provides the basic infrastructure that all packages rely on. Therefore every component relies on this package.", "homepage": "https://github.com/zetacomponents", - "time": "2009-12-21 12:14:16" + "time": "2014-09-19 03:28:34" }, { "name": "zetacomponents/document", @@ -3517,19 +3761,15 @@ "time": "2013-12-19 11:40:00" } ], - "aliases": [ - - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": [ - - ], + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, "platform": { "php": ">=5.3.0", "ext-xml": "*", "ext-zip": "*" }, - "platform-dev": [ - - ] + "platform-dev": [] } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 090d58f47..52a1307a8 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -1288,17 +1288,9 @@ public function writeNote(Note $pNote = null) $objWriter->writeElement('p:cNvGrpSpPr', null); // p:nvPr - $objWriter->startElement('p:nvPr'); - - // p:ph - $objWriter->startElement('p:ph'); - $objWriter->writeAttribute('type', 'body'); - $objWriter->endElement(); - - // ## p:nvPr - $objWriter->endElement(); - - // ## p:cNvGrpSpPr + $objWriter->writeElement('p:nvPr', null); + + // ## p:nvGrpSpPr $objWriter->endElement(); // p:grpSpPr @@ -1337,24 +1329,73 @@ public function writeNote(Note $pNote = null) // ## p:grpSpPr $objWriter->endElement(); + // p:sp + $objWriter->startElement('p:sp'); + + // p:nvSpPr + $objWriter->startElement('p:nvSpPr'); + + $objWriter->startElement('p:cNvPr'); + $objWriter->writeAttribute('id', '1'); + $objWriter->writeAttribute('name', 'Notes Placeholder'); + $objWriter->endElement(); + + // p:cNvSpPr + $objWriter->startElement('p:cNvSpPr'); + + //a:spLocks + $objWriter->startElement('a:spLocks'); + $objWriter->writeAttribute('noGrp', '1'); + $objWriter->endElement(); + + // ## p:cNvSpPr + $objWriter->endElement(); + + // p:nvPr + $objWriter->startElement('p:nvPr'); + + $objWriter->startElement('p:ph'); + $objWriter->writeAttribute('type', 'body'); + $objWriter->writeAttribute('idx', '1'); + $objWriter->endElement(); + + // ## p:nvPr + $objWriter->endElement(); + + // ## p:nvSpPr + $objWriter->endElement(); + + $objWriter->writeElement('p:spPr', null); + + // p:txBody + $objWriter->startElement('p:txBody'); + + $objWriter->writeElement('a:bodyPr', null); + $objWriter->writeElement('a:lstStyle', null); + // Loop shapes - $shapeId = 0; $shapes = $pNote->getShapeCollection(); foreach ($shapes as $shape) { - // Increment $shapeId - ++$shapeId; - // Check type if ($shape instanceof RichText) { - $this->writeShapeText($objWriter, $shape, $shapeId); + $paragraphs = $shape->getParagraphs(); + $this->writeParagraphs($objWriter, $paragraphs); } } + // ## p:txBody + $objWriter->endElement(); + + // ## p:sp + $objWriter->endElement(); + + // ## p:spTree $objWriter->endElement(); + // ## p:cSld $objWriter->endElement(); - // > p:notes + // ## p:notes $objWriter->endElement(); // Return From 336f1495dd18e89f64bc4a67cd6c5148dbcdd350 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 7 Jan 2015 12:54:00 +0100 Subject: [PATCH 036/115] #63 : Added support for notes slide (ODPresentation & PowerPoint2007) --- composer.json | 2 +- composer.lock | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 6e5a73677..3122f98eb 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "phpmd/phpmd": "2.*", "sebastian/phpcpd": "2.*", "phploc/phploc": "2.*", - "squizlabs/php_codesniffer": "1.*" + "squizlabs/php_codesniffer": "2.*" }, "suggest": { "ext-gd2": "Required to add images" diff --git a/composer.lock b/composer.lock index ccffe0321..57ef09478 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "62ddcf9c34f2ad80fcef2409104808b0", + "hash": "56906b8cf5414a4ddc2432792f9f4d92", "packages": [], "packages-dev": [ { @@ -2376,27 +2376,25 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "1.5.6", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5" + "reference": "d2a1d4c58fd2bb09ba376d0d19e67c0ab649e401" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6f3e42d311b882b25b4d409d23a289f4d3b803d5", - "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d2a1d4c58fd2bb09ba376d0d19e67c0ab649e401", + "reference": "d2a1d4c58fd2bb09ba376d0d19e67c0ab649e401", "shasum": "" }, "require": { "ext-tokenizer": "*", "php": ">=5.1.2" }, - "suggest": { - "phpunit/php-timer": "dev-master" - }, "bin": [ - "scripts/phpcs" + "scripts/phpcs", + "scripts/phpcbf" ], "type": "library", "extra": { @@ -2410,12 +2408,12 @@ "CodeSniffer/CLI.php", "CodeSniffer/Exception.php", "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", "CodeSniffer/Report.php", "CodeSniffer/Reporting.php", "CodeSniffer/Sniff.php", "CodeSniffer/Tokens.php", "CodeSniffer/Reports/", - "CodeSniffer/CommentParser/", "CodeSniffer/Tokenizers/", "CodeSniffer/DocGenerators/", "CodeSniffer/Standards/AbstractPatternSniff.php", @@ -2447,7 +2445,7 @@ "phpcs", "standards" ], - "time": "2014-12-04 22:32:15" + "time": "2014-12-18 02:37:51" }, { "name": "symfony/config", From 5e5bdebc8571daf25eb757687f69125b4fa02567 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 7 Jan 2015 12:56:53 +0100 Subject: [PATCH 037/115] #63 : Added support for notes slide (ODPresentation & PowerPoint2007) --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ffcb8a349..7155b93d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: php php: - 5.3 - - 5.3.3 - 5.4 - 5.5 - 5.6 From e7a522251d548c82eb824eabfbf1b79765524e8b Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 7 Jan 2015 13:07:59 +0100 Subject: [PATCH 038/115] #63 : Added support for notes slide (ODPresentation & PowerPoint2007) (PHPCS Fixes) --- src/PhpPowerpoint/Reader/PowerPoint97.php | 2 +- src/PhpPowerpoint/Slide.php | 2 +- src/PhpPowerpoint/Slide/Note.php | 8 ++++---- src/PhpPowerpoint/Writer/ODPresentation/Content.php | 1 - src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php | 1 - src/PhpPowerpoint/Writer/Serialized.php | 10 +++++----- tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php | 2 +- tests/PhpPowerpoint/Tests/Reader/SerializedTest.php | 2 +- tests/PhpPowerpoint/Tests/Writer/SerializedTest.php | 2 +- 9 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index b43db3071..6cc38e5c7 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -681,7 +681,7 @@ private function loadUserEditAtom() } /** - * PersistDirectoryAtom + * PersistDirectoryAtom * @link http://msdn.microsoft.com/en-us/library/dd952680(v=office.12).aspx * @throws \Exception */ diff --git a/src/PhpPowerpoint/Slide.php b/src/PhpPowerpoint/Slide.php index 5cc978677..027432c4e 100644 --- a/src/PhpPowerpoint/Slide.php +++ b/src/PhpPowerpoint/Slide.php @@ -428,7 +428,7 @@ public function getNote() * @param \PhpOffice\PhpPowerpoint\Slide\Note $note * @return \PhpOffice\PhpPowerpoint\Slide */ - public function setNote (Note $note = null) + public function setNote(Note $note = null) { $this->slideNote = (is_null($note) ? new Note() : $note); $this->slideNote->setParent($this); diff --git a/src/PhpPowerpoint/Slide/Note.php b/src/PhpPowerpoint/Slide/Note.php index e22dba2f0..66252928d 100644 --- a/src/PhpPowerpoint/Slide/Note.php +++ b/src/PhpPowerpoint/Slide/Note.php @@ -166,7 +166,7 @@ public function setParent(Slide $parent) * * @return int */ - public function getOffsetX () + public function getOffsetX() { if ($this->offsetX === null) { $offsets = GeometryCalculator::calculateOffsets($this); @@ -181,7 +181,7 @@ public function getOffsetX () * * @return int */ - public function getOffsetY () + public function getOffsetY() { if ($this->offsetY === null) { $offsets = GeometryCalculator::calculateOffsets($this); @@ -196,7 +196,7 @@ public function getOffsetY () * * @return int */ - public function getExtentX () + public function getExtentX() { if ($this->extentX === null) { $extents = GeometryCalculator::calculateExtents($this); @@ -211,7 +211,7 @@ public function getExtentX () * * @return int */ - public function getExtentY () + public function getExtentY() { if ($this->extentY === null) { $extents = GeometryCalculator::calculateExtents($this); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index e0ed41c73..eda89e0eb 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -511,7 +511,6 @@ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape) } /** - * * @param XMLWriter $objWriter * @param Line $shape */ diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php index 4c94445be..2e2a72a52 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php @@ -410,7 +410,6 @@ public function writeSlideRelationships(SlideElement $pSlide) } if ($iterator->current() instanceof Group) { - $iterator2 = $pSlide->getShapeCollection()->getIterator(); while ($iterator2->valid()) { // Hyperlink on shape diff --git a/src/PhpPowerpoint/Writer/Serialized.php b/src/PhpPowerpoint/Writer/Serialized.php index 3847fe3be..59c115512 100644 --- a/src/PhpPowerpoint/Writer/Serialized.php +++ b/src/PhpPowerpoint/Writer/Serialized.php @@ -38,7 +38,7 @@ class Serialized implements WriterInterface * * @param \PhpOffice\PhpPowerpoint\PhpPowerpoint $pPHPPowerPoint */ - public function __construct (PhpPowerpoint $pPHPPowerPoint = null) + public function __construct(PhpPowerpoint $pPHPPowerPoint = null) { // Assign PHPPowerPoint $this->setPHPPowerPoint($pPHPPowerPoint); @@ -50,7 +50,7 @@ public function __construct (PhpPowerpoint $pPHPPowerPoint = null) * @param string $pFilename * @throws \Exception */ - public function save ($pFilename) + public function save($pFilename) { if (empty($pFilename)) { throw new \Exception("Filename is empty."); @@ -95,7 +95,7 @@ public function save ($pFilename) * @return PHPPowerPoint * @throws \Exception */ - public function getPHPPowerPoint () + public function getPHPPowerPoint() { if (!is_null($this->presentation)) { return $this->presentation; @@ -111,7 +111,7 @@ public function getPHPPowerPoint () * @throws \Exception * @return \PhpOffice\PhpPowerpoint\Writer\Serialized */ - public function setPHPPowerPoint (PhpPowerpoint $pPHPPowerPoint = null) + public function setPHPPowerPoint(PhpPowerpoint $pPHPPowerPoint = null) { $this->presentation = $pPHPPowerPoint; @@ -126,7 +126,7 @@ public function setPHPPowerPoint (PhpPowerpoint $pPHPPowerPoint = null) * @return string XML Output * @throws \Exception */ - private function writeSerialized (PhpPowerpoint $pPHPPowerPoint = null, $pFilename = '') + private function writeSerialized(PhpPowerpoint $pPHPPowerPoint = null, $pFilename = '') { // Clone $pPHPPowerPoint $pPHPPowerPoint = clone $pPHPPowerPoint; diff --git a/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php b/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php index 86d3d13ab..19b090e4e 100644 --- a/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php +++ b/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php @@ -61,7 +61,7 @@ public function testLoadFileNotExists() /** * @expectedException \Exception - * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPowerpoint\Reader\Serialized: + * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPowerpoint\Reader\Serialized: */ public function testLoadFileBadFormat() { diff --git a/tests/PhpPowerpoint/Tests/Reader/SerializedTest.php b/tests/PhpPowerpoint/Tests/Reader/SerializedTest.php index d11e4b08e..ae218b2c4 100644 --- a/tests/PhpPowerpoint/Tests/Reader/SerializedTest.php +++ b/tests/PhpPowerpoint/Tests/Reader/SerializedTest.php @@ -49,7 +49,7 @@ public function testLoadFileNotExists() /** * @expectedException \Exception - * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPowerpoint\Reader\Serialized: + * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPowerpoint\Reader\Serialized: */ public function testLoadFileBadFormat() { diff --git a/tests/PhpPowerpoint/Tests/Writer/SerializedTest.php b/tests/PhpPowerpoint/Tests/Writer/SerializedTest.php index 80fbee62a..233c086ae 100644 --- a/tests/PhpPowerpoint/Tests/Writer/SerializedTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/SerializedTest.php @@ -78,7 +78,7 @@ public function testSave() /** * @expectedException \Exception - * @expectedExceptionMessage Could not open + * @expectedExceptionMessage Could not open */ public function testSaveNotExistingDir() { From 1fb4a43a249d1a0fec082a13b606a8c7e908a67e Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 13 Jan 2015 12:38:23 +0100 Subject: [PATCH 039/115] #60 : Improved Powerpoint97 Reader with some fixes --- src/PhpPowerpoint/Reader/PowerPoint97.php | 28 +++++-- src/PhpPowerpoint/Shared/OLERead.php | 76 +++++++++---------- .../Tests/Reader/PowerPoint97Test.php | 2 +- 3 files changed, 59 insertions(+), 47 deletions(-) diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index 6cc38e5c7..9e3225def 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -395,7 +395,7 @@ public function load($pFilename) // Unserialize... First make sure the file supports it! if (!$this->fileSupportsUnserializePHPPowerPoint($pFilename)) { - throw new \Exception("Invalid file format for PhpOffice\PhpPowerpoint\Reader\Serialized: " . $pFilename . "."); + throw new \Exception("Invalid file format for PhpOffice\PhpPowerpoint\Reader\PowerPoint97: " . $pFilename . "."); } return $this->loadFile($pFilename); @@ -752,16 +752,15 @@ private function readRTSlide($pos) // *** slideShowSlideInfoAtom (24 bytes) $pos += 24; - // perSlideHFContainer (variable) + // perSlideHFContainer (variable) : optional // perSlideHFContainer > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - if ($rHeader['recVer'] != 0xF || $rHeader['recInstance'] != 0x000 || $rHeader['recType'] != self::RT_HEADERSFOOTERS) { - throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > perSlideHFContainer > RT_HeadersFooters).'); + if ($rHeader['recVer'] == 0xF && $rHeader['recInstance'] == 0x000 && $rHeader['recType'] == self::RT_HEADERSFOOTERS) { + $pos += 8; + $pos += $rHeader['recLen']; } - $pos += $rHeader['recLen']; - // *** rtSlideSyncInfo12 (variable) + // *** rtSlideSyncInfo12 (variable) : optional // *** drawing (variable) // drawing > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); @@ -1125,8 +1124,21 @@ private function readRTSlide($pos) // Shape Boolean Properties //@link : http://msdn.microsoft.com/en-us/library/dd951345(v=office.12).aspx break; + case 0x0380: + // Group Shape Property Set : wzName + //@link : http://msdn.microsoft.com/en-us/library/dd950681(v=office.12).aspx + if ($opt['fComplex'] == 1) { + $pos += $opt['op']; + $rHeader['recLen'] -= $opt['op']; + $shapePrimaryOptions['recLen'] -= $opt['op']; + } + break; + case 0x03BF: + // Group Shape Property Set : Group Shape Boolean Properties + //@link : http://msdn.microsoft.com/en-us/library/dd949807(v=office.12).aspx + break; default: - throw new \Exception('Feature not implemented (l.'.__LINE__.' : '.dechex($opt['opid'].')')); + throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($opt['opid']).')'); } } $pos += $shapePrimaryOptions['recLen']; diff --git a/src/PhpPowerpoint/Shared/OLERead.php b/src/PhpPowerpoint/Shared/OLERead.php index 58108d4f2..1dfff74fa 100644 --- a/src/PhpPowerpoint/Shared/OLERead.php +++ b/src/PhpPowerpoint/Shared/OLERead.php @@ -261,44 +261,44 @@ private function readPropertySets() $size = self::getInt4d($data, self::SIZE_POS); $name = str_replace("\x00", "", substr($data, 0, $nameSize)); - - - $this->props[] = array ( - 'name' => $name, - 'type' => $type, - 'startBlock' => $startBlock, - 'size' => $size); - - // tmp helper to simplify checks - $upName = strtoupper($name); - - switch ($upName){ - case 'ROOT ENTRY': - case 'R': - $this->rootentry = count($this->props) - 1; - break; - case chr(1).'COMPOBJ': - break; - case chr(1).'OLE': - break; - case chr(5).'SUMMARYINFORMATION': - $this->summaryInformation = count($this->props) - 1; - break; - case chr(5).'DOCUMENTSUMMARYINFORMATION': - $this->docSummaryInfos = count($this->props) - 1; - break; - case 'CURRENT USER': - $this->currentUser = count($this->props) - 1; - break; - case 'PICTURES': - $this->pictures = count($this->props) - 1; - break; - case 'POWERPOINT DOCUMENT': - $this->powerpointDocument = count($this->props) - 1; - break; - default: - throw new \Exception('OLE Block Not defined: $upName : '.$upName. ' - $name : "'.$name.'"'); - break; + if($size > 0){ + $this->props[] = array ( + 'name' => $name, + 'type' => $type, + 'startBlock' => $startBlock, + 'size' => $size); + + // tmp helper to simplify checks + $upName = strtoupper($name); + + switch ($upName){ + case 'ROOT ENTRY': + case 'R': + $this->rootentry = count($this->props) - 1; + break; + case chr(1).'COMPOBJ': + break; + case chr(1).'OLE': + break; + case chr(5).'SUMMARYINFORMATION': + $this->summaryInformation = count($this->props) - 1; + break; + case chr(5).'DOCUMENTSUMMARYINFORMATION': + $this->docSummaryInfos = count($this->props) - 1; + break; + case 'CURRENT USER': + $this->currentUser = count($this->props) - 1; + break; + case 'PICTURES': + $this->pictures = count($this->props) - 1; + break; + case 'POWERPOINT DOCUMENT': + $this->powerpointDocument = count($this->props) - 1; + break; + default: + throw new \Exception('OLE Block Not defined: $upName : '.$upName. ' - $name : "'.$name.'"'); + break; + } } $offset += self::PROPERTY_STORAGE_BLOCK_SIZE; diff --git a/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php b/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php index 19b090e4e..6edb548f8 100644 --- a/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php +++ b/tests/PhpPowerpoint/Tests/Reader/PowerPoint97Test.php @@ -61,7 +61,7 @@ public function testLoadFileNotExists() /** * @expectedException \Exception - * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPowerpoint\Reader\Serialized: + * @expectedExceptionMessage Invalid file format for PhpOffice\PhpPowerpoint\Reader\PowerPoint97: */ public function testLoadFileBadFormat() { From 83a34a17c349ea01d6344261e4af76bcd517afe2 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Thu, 15 Jan 2015 12:54:06 +0100 Subject: [PATCH 040/115] #49 : Added support for hyperlink on RichText Shape(PowerPoint2007) --- src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php | 5 +++++ .../Tests/Writer/PowerPoint2007/SlideTest.php | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 52a1307a8..c235c48f6 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -470,6 +470,11 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) $objWriter->writeAttribute('id', $shapeId); $objWriter->writeAttribute('name', ''); + // Hyperlink + if ($shape->hasHyperlink()) { + $this->writeHyperlink($objWriter, $shape); + } + $objWriter->endElement(); // p:cNvSpPr diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index 617a90909..5a0fc4340 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -506,6 +506,19 @@ public function testRichTextBreak() $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); } + public function testRichTextHyperlink() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oRichText = $oSlide->createRichTextShape(); + $oRichText->getHyperLink()->setUrl('http://www.google.fr'); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:sp//a:hlinkClick'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + } + public function testRichTextUpright() { $phpPowerPoint = new PhpPowerpoint(); From 61649bf3b1feb0ced70eb8b1080a3b3eb0c51707 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Thu, 15 Jan 2015 12:59:51 +0100 Subject: [PATCH 041/115] #49 : Added support for hyperlink on RichText Shape(PowerPoint2007) --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93fe2d48e..7786550ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Added support for calculating the offset and extent on a Slide. - @Pr0phet GH-68 - Added support for Horizontal bar chart - @rdoepke @Progi1984 GH-58 - Added support for hyperlink on picture (ODPresentation & PowerPoint2007) - @Progi1984 GH-49 +- Added support for hyperlink on richtext (PowerPoint2007) - @JewrassicPark GH-49 - Added support for notes slide (ODPresentation & PowerPoint2007) - @Progi1984 @JewrassicPark GH-63 - Added option for explosion in Pie3D Chart (ODPresentation & PowerPoint2007) - @Progi1984 GH-76 From 78e934b651a5a11161bea9c67e56e5d2d7382d64 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Thu, 15 Jan 2015 13:00:10 +0100 Subject: [PATCH 042/115] #60 : Improved Powerpoint97 Reader with some fixes (PHP CS Fixes) --- src/PhpPowerpoint/Reader/PowerPoint97.php | 4 ++-- src/PhpPowerpoint/Shared/OLERead.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index 9e3225def..46c632daf 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -752,7 +752,7 @@ private function readRTSlide($pos) // *** slideShowSlideInfoAtom (24 bytes) $pos += 24; - // perSlideHFContainer (variable) : optional + // perSlideHFContainer (variable) : optional // perSlideHFContainer > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); if ($rHeader['recVer'] == 0xF && $rHeader['recInstance'] == 0x000 && $rHeader['recType'] == self::RT_HEADERSFOOTERS) { @@ -760,7 +760,7 @@ private function readRTSlide($pos) $pos += $rHeader['recLen']; } - // *** rtSlideSyncInfo12 (variable) : optional + // *** rtSlideSyncInfo12 (variable) : optional // *** drawing (variable) // drawing > rh $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); diff --git a/src/PhpPowerpoint/Shared/OLERead.php b/src/PhpPowerpoint/Shared/OLERead.php index 1dfff74fa..7a7480200 100644 --- a/src/PhpPowerpoint/Shared/OLERead.php +++ b/src/PhpPowerpoint/Shared/OLERead.php @@ -261,7 +261,7 @@ private function readPropertySets() $size = self::getInt4d($data, self::SIZE_POS); $name = str_replace("\x00", "", substr($data, 0, $nameSize)); - if($size > 0){ + if ($size > 0) { $this->props[] = array ( 'name' => $name, 'type' => $type, From db1b18f1a3740b05eb7b89317cf3086207aaecb9 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 27 Jan 2015 13:08:54 +0100 Subject: [PATCH 043/115] Added the PowerPoint Viewer in docs/references.rst --- docs/references.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/references.rst b/docs/references.rst index d4fff575f..081954b39 100644 --- a/docs/references.rst +++ b/docs/references.rst @@ -20,6 +20,7 @@ ISO : `__ MSDN : +- `PowerPoint Viewer `__ - `DocumentFormat.OpenXml.Presentation Namespace on MSDN `__ - `Open XML SDK 2.5 with Validator `__ From 353ea5ea711bc4cc7d7fe0323bb9a9deafea8d70 Mon Sep 17 00:00:00 2001 From: Kenny Liau Date: Sun, 8 Mar 2015 15:11:53 -0400 Subject: [PATCH 044/115] FIXED: Refactor findLayoutIndex to findLayoutId where it assumes the slideLayout order was sorted. IMPROVED: unit tests --- .../PowerPoint2007/AbstractLayoutPack.php | 11 ++- .../LayoutPack/TemplateBased.php | 7 +- .../Writer/PowerPoint2007/Rels.php | 4 +- .../LayoutPack/TemplateBasedTest.php | 74 ++++++++++++++++++ tests/resources/files/Sample_00_01.pptx | Bin 0 -> 70569 bytes 5 files changed, 85 insertions(+), 11 deletions(-) create mode 100644 tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php create mode 100644 tests/resources/files/Sample_00_01.pptx diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/AbstractLayoutPack.php b/src/PhpPowerpoint/Writer/PowerPoint2007/AbstractLayoutPack.php index 0e78dfebb..abfd57ad8 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/AbstractLayoutPack.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/AbstractLayoutPack.php @@ -78,6 +78,7 @@ abstract class AbstractLayoutPack * Array of slide layouts. * * These are all an array consisting of: + * - id (int) * - masterid (int) * - name (string) * - body (string) @@ -186,21 +187,19 @@ public function findLayout($name = '', $masterId = 1) } /** - * Find specific slide layout index. + * Find specific slide layout id. * * @param string $name * @param int $masterId * @return int * @throws \Exception */ - public function findLayoutIndex($name = '', $masterId = 1) + public function findLayoutId($name = '', $masterId = 1) { - $index = 0; - foreach ($this->layouts as $layout) { + foreach ($this->layouts as $layoutId => $layout) { if ($layout['name'] == $name && $layout['masterid'] == $masterId) { - return $index; + return $layoutId; } - ++$index; } throw new \Exception("Could not find slide layout $name in current layout pack."); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/TemplateBased.php b/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/TemplateBased.php index bf370c220..e22d880a6 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/TemplateBased.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/LayoutPack/TemplateBased.php @@ -97,9 +97,10 @@ public function __construct($fileName = '') // Found slide layout! $layoutId = str_replace('slideLayout', '', basename($masterRel["Target"], '.xml')); $layout = array( - 'masterid' => $slideMasterId, - 'name' => '-unknown-', - 'body' => $package->getFromName($this->absoluteZipPath(dirname($rel["Target"]) . "/" . dirname($presRel["Target"]) . "/" . dirname($masterRel["Target"]) . "/" . basename($masterRel["Target"]))) + 'id' => $layoutId, + 'masterid' => $slideMasterId, + 'name' => '-unknown-', + 'body' => $package->getFromName($this->absoluteZipPath(dirname($rel["Target"]) . "/" . dirname($presRel["Target"]) . "/" . dirname($masterRel["Target"]) . "/" . basename($masterRel["Target"]))) ); if (utf8_encode(utf8_decode($layout['body'])) == $layout['body']) { $layoutXml = simplexml_load_string($layout['body']); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php index 2e2a72a52..d6f74517a 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php @@ -283,9 +283,9 @@ public function writeSlideRelationships(SlideElement $pSlide) $parentWriter = $this->getParentWriter(); if ($parentWriter instanceof PowerPoint2007) { $layoutPack = $parentWriter->getLayoutPack(); - $layoutIndex = $layoutPack->findlayoutIndex($pSlide->getSlideLayout(), $pSlide->getSlideMasterId()); + $layoutId = $layoutPack->findlayoutId($pSlide->getSlideLayout(), $pSlide->getSlideMasterId()); - $this->writeRelationship($objWriter, $relId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout', '../slideLayouts/slideLayout' . ($layoutIndex + 1) . '.xml'); + $this->writeRelationship($objWriter, $relId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout', '../slideLayouts/slideLayout' . $layoutId . '.xml'); } // Write drawing relationships? diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php new file mode 100644 index 000000000..95303848b --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php @@ -0,0 +1,74 @@ +getLayouts(); + + foreach ($layouts as $layoutId => $layout) { + $foundLayout = $templateBased->findLayout($layout['name']); + $this->assertEquals($layout, $foundLayout); + } + } + + /** + * @expectedException \Exception + */ + public function testFindLayoutException() + { + $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_00_01.pptx'; + $templateBased = new TemplateBased($file); + $name = 'Invalid'; + $templateBased->findLayout($name); + } + + public function testFindLayoutId() + { + $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_00_01.pptx'; + $templateBased = new TemplateBased($file); + $layouts = $templateBased->getLayouts(); + + foreach ($layouts as $layoutId => $layout) { + $foundLayoutId = $templateBased->findLayoutId($layout['name']); + $this->assertEquals($layout['id'], $foundLayoutId); + } + } + + /** + * @expectedException \Exception + */ + public function testFindLayoutIdException() + { + $file = PHPPOWERPOINT_TESTS_BASE_DIR . '/resources/files/Sample_00_01.pptx'; + $templateBased = new TemplateBased($file); + $name = 'Invalid'; + $templateBased->findLayoutId($name); + } +} \ No newline at end of file diff --git a/tests/resources/files/Sample_00_01.pptx b/tests/resources/files/Sample_00_01.pptx new file mode 100644 index 0000000000000000000000000000000000000000..604b76a94d47ceffb1f50dc70faaad997ac5667b GIT binary patch literal 70569 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 Lo$QrX~}xZit-5-!t8%s7*9L}y=5 zF>B1;uVBm;X#g;=Py&-i7jibougcg<1)!vlx=WPfy5|Nt-Zr93z&NL07us&kEc8qn zcZ{UfA1s8N?9WAa;V3uJGS!9QGO}{35BsAVb=}|qeM9%HMzrVdSy_1&#QENGmG=RO3U8uJZvb z_!`SvrBQri@&b{y5^}cVtw|;B={&+oW?_ImQy1J^mclVy^>fXa0gs7*_(*5hxsWxeT1mHAg z(yyVx-WG?L(x2Kv;SR}qdrfOt&}>CtArjf^?42xV>DVTwJ&$gW0L~sUk90Gi{Zmjy zHL@mFnh?D?iyk6#=;4gj21;!IRqhSnPCXWJNP$R&EQ%6%hxR!!`C5qvfNAWl+grnW zboV#3GCWYa4(zP5cq2;S6lVX_j(^t8F9L|ex$;*^RbFCklrm&0&eYKlj5|42Gm2`k z#3yg|Jm*8Jp*yCubw$(^pPw{^{pu|g3G)zn_(4AT9rPe8lIq}&lq#jrj~Oqrmtf;j z6`}`3rG^_%!HBV+eJhY?3y|dGsXdU?p&BF?JTgkC6xjgzx6w#D*~gS~A591aDc-1L83lE9el^7r zP(2QFKYC(5IQHp>>5(~7B&{vZAi1{6N2;26fz$012af#CZfY0@CH9KA3}lVwJk&%i zW_9!~LHt>!bSOxB$&ggcdU+ZdC8)(IRrcH7SEKzFxas|3Wqt5Ejai>$drvBI`ObRi zJ8P=1`RHZeD+@k_{11W&`i`BzR&XYFn!0i3Z8NV}*azZ|SKC$!UCS5^x_F}Rat|-c z`R?Fb&;74mOblJLfi=8~3Hfi#y8f|B|EKP<+dALVwquo5$qhfm`|du%>YB<)B@Yti;C`QmS`K>-`Wya@S67AmLbhNp`G$3Ud>1WMsY11Kt!%7F)vTIi zKHWSkqV}>dmf|ksE1sXA00i%W$Q2tN%JkZzk4_y2HO8envV&sL=S>!Ac8Z`4Ey;TZ z_PxI9>3})A0kW~oX)KlUsx=}0F_AaWSgqQgE<-I0tjz*-!S|D| zhfFzC+frj~J?iddXJW1;v&t^_Q5D~*XnH;wsk|BM{JDz3(TbH&FRss!<)BmD+VmBj zMT$=oHGXlAk#9WA@rmMM@3|-MaL1?bU$1@rXDf8@e<2vtELr`Qu~NbMenx+CR?v31f=4^jUYyKN&)?j^4tZIh7LBeaoimc; zDj)iT;oj!SP5CjNBkAn3$WJ6$+${JbHt+Xk9Ia>h_0OR$nbt$e`WM-IPEKq6 zMiyDK_Cw+}&XPQ*`BnH-t_x~dU&|ZfX3~8ZS5}x@zI-_yiG3=YX1Xw5AtXhabIkc9 z>y01puxOEHGvm>8NBrQ$j*&m=@AD!#FMmS*vBG5dUEN7hyqAADRnta$SV~Y)T{`=P z*_%B-bntg?tps7Q(HNQ)KUln7{ZV z>RpHG_qW_l_r9_colW)}U#G3yg3^1ZuH5-P#J2f}kpEm-^TPAbk_k;{*l=+nzn0|4 z>81L0|EnW0qK+I?Y_W}VW-3RC%kG9*+H%2oIUyn^IG* z)b)|C>dd>@dWRZh?YqnP!{u7VBA}h|#pC)jcdG+Z<0GcGc2+F9ZXuI3Y;r0Z+Adc- zoeBH0)=^2GGQ={^2N=MkEbSiyZ#ia~hp0DVo_1Fqw^}S`p0f z4QlmtR`@7kNVg+-(I*=<2rDpk(L1dVbDr4MKvLf@HW)FuK48kN0eRM&b`4#wWB;^Z;lnLhZ?Qh222+Fz;k=ua;L>M_rZHZjzPVMv z5k}fgr}39Ve_*rdAUf54`MH2PHBIS>M8Tza&u=f zbf0Riy%mC(mW42J;833%kySB|RFw)x^*t61DvFTIVxeof8nmMKZBYak$@9E==>@Pb`fn%1D8-2bU>_^9`oTp|JEQJx_`?v1nu|yp0_(% zA74c4tiB(A7g?3;^-bKcYwq@r}{^!4jl5sgK$0z_m+q1uS@AR;-bhKpuw&(iGX?L{ zcDfU)(x!&_1P0J6e(h>SGMh=cdB;}?E2PJ<u6KGzm7u zmmz-L!^|-V$r#r7Rw8t5CQ24A=3C3&;!vW56vi?G2q5V;&6Ez^6K8R-}f*cR*`s#~D@m(ToF0~<_hHa-y9NnD)1Mml!UL7E@BLJ9Qrge%_j zfRj4L*k(<5Kl?ZDtTB?()8PxU9kE+Je#~7Wi=Xr9B<(Zf4;U~kBx2%_P{tZj=}=^w*lRvw@to!|`ga?vX3&kk6&ZxkXzw!e}1Cz}5_ zd*3?C-tKp|PU?HNzB``(OFkh`#P=4qGmfj1&h3h6?HaIN;w*NzQIarrJlY=kd(&Oq zXy&BD|KVg*JYXC3n-Fx1o*p7P9utcw5T#}%A9g-d3t=~ap}6<<87WSE&W9-=`Kvb>WJgx3yPH3 z=U;M8M5RP{L~^Gfo*yDYl*M#*5M=E$eP57HB&DdrpDH>w1nNVPt5sz1)>9q~7+ zNC_Z8*M9rHA4X$}6UTod1DRrUi_+9#yyer09{tg&73R4Vp@p}b$q~;-OIzSP@&@64 zCL|EEIa2&!(IKl@;q%U?m)nj%eV#RqTwbHAxl?&b)O?8#Fg}ueXI9&thTA^8j4^(R zhx#%5>CsK907R^fd?~-me1b*tJS7_1bIJfwyT|$J5F2gFJ2so`l|6Cbcr50AY(z9= zAY#xjbfMU|5zss;EAw#Y==La#8VI!&c7`1+l4TivixnE6b-Lrq=+S=hf98!h6X zQvFo;;?uy%)SaiDF`Ge=*JZ!25JG1ry@@p|HOp7UtXTxf@fzL!aWz+}hcuza-}OcI zs%xzal!2&ZrkWV9OE|Pw*URNGhMB%Ce1?GGx`Nr~vKc2jFW<9Fk#3OyOa^quej!C3_ z$RzrnPyU*VGDUql^bPs=()?l`;b}CjS)vT8O%H<^i8So3=HW{j`qm~60dXc^QkdER&x53GffgLmHvN{U>d#p_`c~<7CFwWO}=>c!{orXawq$>-j4y-zK@4XXCh5 zEnn;{wFP2UCp2DNknliQFkKwW>YkNAT&>%AaPst!dp9FjzIB?^}U`M$1&E2l5_-NgN1WVX(v5K%5#j;=dNkre4U=Og*zyDj1-Fki` z-i{~uPTcfjBjqP#WJx#Dv z?_Q+e5e<%*wB~Rf3+|Vu&WEm(BY7eWPC-7rV9rE5&5D-Cfy8lBw4r=`=*lzaUjA}0 znDZas9zB1LSn**10J?ntae(}D^|yh6^Wq@>AFIEi%bcDKvCmPPKRr><==O3Q>nBo- zj`d+yyh;vj-@N^lhx|I1{fhqz;R-W*=;$5uVDiVOitc9kQ5i#!qmiu-@1Hq+dhj5Z zpQ+0sG0nm{=;Q9MzwJ?N(Pz4;`Gt8eKjcJQW4>t$R@jU5pax;?DLI^+HK*z-u@y;`u>*S6<+v&cAPI( z$Gl2>xgxRcxf}CUQFI2#So7^g9Wvxe49|<>I!5vrW+!~Z))Eo?Nzc1`n2x!EXbdZ7 zO)1}@G2$1t7o7)PLlfXDdmP~_dn({7d(Pl1d&KWA7U3&fMOY_fZSS;O z&!wA;%tr)N+V2r(+(UY1q-c|R7eR8>uftw>yjqdHFA3?<{_<*PIG1phE@91H#tMOl zz5`{Mi{v~$t#FIol++MNi}Z@SJ|mpMS6@&6HK5XVz07>$OKy3xs08ZpdtUXZQ_nqD z?~=Wz=Ny|1>6&$*;RXwhm6co%=*nQlc#P< z!sdoV(&{tCtu>}Tb}mp^#Uby7(zm&H1p8Jdm%_vGj!m@WbC@n_W3k-ouaj6Dm1UHp zww&JAOds{q>Mv$(+KuJDaX$%VlvsAf{m+>ZifPF>ub zsEm*!$+;dQF~9hAP!)8!`rCmL?qIxg0i%j;L5?wSC5|^i=c)(4tvClf?4eIu)rrH7SRzX!{ZaK|kXMlN%aE_c?}qQ}Z-?r? zo3GitYQ!2mbFtl`2}|Mn5%7SuM4-R=sgsQB9GYlHU0pQj789ExdRcL|Ll9s>5>V-g zY_hkh`o)J}`Rm>LO9II=`t9f1t)yZyex7~bXVna!{`~&Lri|e30!WE<^pWP|=Dhh` zlC~VQQ%Kp4S?g(M#cD?7!%un&f?(#VbWxqS4J&z8oZ6x^sf)M8WFC9|41|^@5OKVR zuBA9IcQnFpE>YA~yUuhxRHPb&5;3U?6jhJJr7Y={?raAYfhVKXDVnKS7&8eUk#~Lg z!{V4V!6oh;GnYu=Whu|yg^*%??}{1EX>>)DHXR$i>bCfR7hWE|5SeIJgz<{?$(OT+ z+#Pg>DINR_oOf79XsGl0PQ%V7xPTjsDke=gw}u#zzQSEI)8*utmJ}QuvpGlGrm^{8 z5Q49^TB(t%uIyD!&cyyYSu4i;(S#-|eo?yLhaxMs!$il#VcdJowx7xg5@ZNqT^|@I9fMK55DP%$qTmBRJUxFj zmO0u%jj(Z=RBEyjM$ZY!iqI|zk0Ld#WhPwIi;8aj{@pqQM)@|QLeD9us}Xz!dw(7Z z{^sQs4<1TY@*sIlo7$J5V`sM(O3`|s-x2^g;A zg^!uIX$zUYW_09=b)A?Ia?O3xV_FmaLGk?Mepq1lmcw$!NQP?lzS8xK{pAfKQ-Ee? z@LK+?wD;?DaKj7iuZ_rXm$I~vpY;LX5=VXZmJ!->GttU<70$eK%@m%SXr4Bt{g8x= z=Mc;_UXma3Wr;1<3b!%P=3ZME1tgcQyJD!31D+F*$b~OS@%Ga%buQ*21ph4Aq;*fi zn+;*`@wtil!To+UwQ`OBMcNZR0fMs1dtO%8K8H2xSDj4)^`b$pC_j5?gJj*MHa?P> zB3^Wn5|q3^JiLlg=Ij8YqWiS09@GbS64)oH8xU0_zY3JSHSx4mFsN&Kt}dcyo}BQO zCpbV*OLSu z_7^f9CnmSzTgD-MK3b-@T@vH%>&eB0FYt@Gv{3t-NrveG$qe~JpU_KlglQ9gJRb;Q z$7vk@8gr5UJ3(PtjXuHW8+JsIuGhrWIP338MjB>s82$ua9jo*M5-sFasD#)-|{+h)8ZA7;!%;YZL3e8;^Zdan- z$zP|1qgycg%OSChP{B6h_sG!)-yi9Z$wWBJYZv@={tV&bTNzmI(>B#{(O z{tfk$d%{=SV#+ztNq+sFZONzjy|?T}DwEoxZ{`>woPar(b*e>;*e+|%f$F7;tVYSG zDL=1}2>xl~{n%)>?H|(57e_MJnsDBbrUEtAYUN9hrmVP2x0Lj?q8jH*$Axj?oyG|9 zCnrzv%^3y4R#8OpIRjew?k%D+IK|-LUF?7ZUj!-Eb+)w%h4sRR3#{vB)+*}puZ3<# zGtXPV1D$Ev3ES1WW0pqsIqZY7Tz$fm z!f7<2hKs0b?Jr1RVnnODr|KKojQ!W|mmxYaY5X+-b7Qjxv%a4qGWXm_x z!7VCGs^*7#HOhedjwiqSzDBVQ4|=08Y7%6VK3ar_-R42D-}~?{@0suy%Rd4QAdb

E-pF3OhwWxRf=r&Y8>r)FIqJ@ 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 Wg9h3R1OyH62Lc+lH8kLVApQ>=o@=oH literal 0 HcmV?d00001 From 6e8dd34906a99261c18d95f3478a73291e30f55b Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Thu, 21 May 2015 12:59:10 +0200 Subject: [PATCH 045/115] Support for Gitter.im --- .travis.yml | 8 ++++++++ README.md | 1 + 2 files changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7155b93d7..4edfef35d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,3 +46,11 @@ after_script: ## Scrutinizer - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + +notifications: + webhooks: + urls: + - https://webhooks.gitter.im/e/0dbc70ac93ba40880eef + on_success: change # options: [always|never|change] default: always + on_failure: always # options: [always|never|change] default: always + on_start: false # default: false \ No newline at end of file diff --git a/README.md b/README.md index 27359b299..fac6a8d19 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![Code Coverage](https://scrutinizer-ci.com/g/PHPOffice/PHPPowerPoint/badges/coverage.png?s=742a98745725c562955440edc8d2c39d7ff5ae25)](https://scrutinizer-ci.com/g/PHPOffice/PHPPowerPoint/) [![Total Downloads](https://poser.pugx.org/phpoffice/phppowerpoint/downloads.png)](https://packagist.org/packages/phpoffice/phppowerpoint) [![License](https://poser.pugx.org/phpoffice/phppowerpoint/license.png)](https://packagist.org/packages/phpoffice/phppowerpoint) +[![Join the chat at https://gitter.im/PHPOffice/PHPPowerPoint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/PHPOffice/PHPPowerPoint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) PHPPowerPoint is a library written in pure PHP that provides a set of classes to write to different presentation file formats, i.e. Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML) or OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF). From 5db9b8f2cd8526e2c311121bc81e2cef342e6bd5 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 22 May 2015 13:17:27 +0200 Subject: [PATCH 046/115] FIXED: Refactor findLayoutIndex to findLayoutId where it assumes the slideLayout order was sorted. --- CHANGELOG.md | 2 +- .../Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7786550ce..58dc639fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,8 @@ - PowerPoint2007 Writer : Fill don't work for RichTextShapes - @Progi1984 GH-61 - PowerPoint2007 Writer : Border don't work for RichTextShapes - @Progi1984 GH-61 - PowerPoint2007 Writer : Hyperlink in table doesn't work - @Progi1984 GH-70 -- ODPresentation Writer : Hyperlink in table doesn't work - @Progi1984 GH-70 - PowerPoint2007 Writer : AutoFitNormal works with options (fontScale & lineSpacingReduction) - @Progi1984 @desigennaro GH-71 +- Refactor findLayoutIndex to findLayoutId where it assumes the slideLayout order was sorted. IMPROVED: unit tests - @kenliau GH-95 ### Miscellaneous diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php index 95303848b..d632d3e46 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/LayoutPack/TemplateBasedTest.php @@ -32,7 +32,7 @@ public function testFindLayout() $templateBased = new TemplateBased($file); $layouts = $templateBased->getLayouts(); - foreach ($layouts as $layoutId => $layout) { + foreach ($layouts as $layout) { $foundLayout = $templateBased->findLayout($layout['name']); $this->assertEquals($layout, $foundLayout); } @@ -55,7 +55,7 @@ public function testFindLayoutId() $templateBased = new TemplateBased($file); $layouts = $templateBased->getLayouts(); - foreach ($layouts as $layoutId => $layout) { + foreach ($layouts as $layout) { $foundLayoutId = $templateBased->findLayoutId($layout['name']); $this->assertEquals($layout['id'], $foundLayoutId); } @@ -71,4 +71,4 @@ public function testFindLayoutIdException() $name = 'Invalid'; $templateBased->findLayoutId($name); } -} \ No newline at end of file +} From 3d80595b56945cec0018e910e52fb33dc7d6dbf2 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 27 May 2015 10:49:12 +0200 Subject: [PATCH 047/115] Support for Gitter.im --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fac6a8d19..f3092d010 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Code Coverage](https://scrutinizer-ci.com/g/PHPOffice/PHPPowerPoint/badges/coverage.png?s=742a98745725c562955440edc8d2c39d7ff5ae25)](https://scrutinizer-ci.com/g/PHPOffice/PHPPowerPoint/) [![Total Downloads](https://poser.pugx.org/phpoffice/phppowerpoint/downloads.png)](https://packagist.org/packages/phpoffice/phppowerpoint) [![License](https://poser.pugx.org/phpoffice/phppowerpoint/license.png)](https://packagist.org/packages/phpoffice/phppowerpoint) -[![Join the chat at https://gitter.im/PHPOffice/PHPPowerPoint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/PHPOffice/PHPPowerPoint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Join the chat at https://gitter.im/PHPOffice/PHPPowerPoint](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/PHPPowerPoint) PHPPowerPoint is a library written in pure PHP that provides a set of classes to write to different presentation file formats, i.e. Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML) or OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF). From e08f7081f6c18b12501be018e8acdae851ba1e46 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 3 Jun 2015 13:00:00 +0200 Subject: [PATCH 048/115] ODPresentation Writer : Title in Legend in chart doesn't displayed - @Progi1984 GH-79 --- CHANGELOG.md | 1 + .../Writer/ODPresentation/Content.php | 4 +-- .../Writer/ODPresentation/ObjectsChart.php | 17 +++++++++++- .../Writer/ODPresentation/ChartsTest.php | 27 +++++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58dc639fa..681cdab00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 +- ODPresentation Writer : Title in Legend in chart doesn't displayed - @Progi1984 GH-79 - PowerPoint2007 Writer : Fill don't work for RichTextShapes - @Progi1984 GH-61 - PowerPoint2007 Writer : Border don't work for RichTextShapes - @Progi1984 GH-61 - PowerPoint2007 Writer : Hyperlink in table doesn't work - @Progi1984 GH-70 diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index eda89e0eb..c777c33eb 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -328,7 +328,7 @@ public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape) $objWriter->writeElement('text:p'); $objWriter->endElement(); - if ($shape->getHyperlink()) { + if ($shape->hasHyperlink()) { // office:event-listeners $objWriter->startElement('office:event-listeners'); // presentation:event-listener @@ -574,7 +574,7 @@ public function writeShapeTable(XMLWriter $objWriter, Table $shape) if ($shapeRichText instanceof Run) { $objWriter->writeAttribute('text:style-name', 'T_' . $shapeRichText->getFont()->getHashCode()); } - if ($shapeRichText->hasHyperlink() == true && $shapeRichText->getHyperlink()->getUrl() != '') { + if ($shapeRichText->hasHyperlink()) { // text:a $objWriter->startElement('text:a'); $objWriter->writeAttribute('xlink:href', $shapeRichText->getHyperlink()->getUrl()); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index 9f1013ccb..23fd034dc 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -623,6 +623,19 @@ private function writeTable() $this->xmlContent->endElement(); // > table:table-header-columns $this->xmlContent->endElement(); + + // table:table-columns + $this->xmlContent->startElement('table:table-columns'); + // table:table-column + $this->xmlContent->startElement('table:table-column'); + if (!empty($this->arrayData)) { + $rowFirst = reset($this->arrayData); + $this->xmlContent->writeAttribute('table:number-columns-repeated', count($rowFirst) - 1); + } + // > table:table-column + $this->xmlContent->endElement(); + // > table:table-columns + $this->xmlContent->endElement(); // table:table-header-rows $this->xmlContent->startElement('table:table-header-rows'); @@ -633,7 +646,9 @@ private function writeTable() foreach ($rowFirst as $key => $cell) { // table:table-cell $this->xmlContent->startElement('table:table-cell'); - $this->xmlContent->writeAttribute('office:value', 'string'); + if (isset($this->arrayTitle[$key - 1])) { + $this->xmlContent->writeAttribute('office:value-type', 'string'); + } // text:p $this->xmlContent->startElement('text:p'); if (isset($this->arrayTitle[$key - 1])) { diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php index a1095c91e..ff0ec05fb 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php @@ -205,4 +205,31 @@ public function testChartScatter() $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); $this->assertEquals('chart:scatter', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml')); } + + public function testLegend() + { + $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2)); + $oSeries->setShowSeriesName(true); + + $oLine = new Line(); + $oLine->addSeries($oSeries); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oChart = $oSlide->createChartShape(); + $oChart->getPlotArea()->setType($oLine); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:body/office:chart/chart:chart/chart:legend'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $element = '/office:document-content/office:body/office:chart/chart:chart/table:table/table:table-header-rows'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $element = '/office:document-content/office:body/office:chart/chart:chart/table:table/table:table-header-rows/table:table-row'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $element = '/office:document-content/office:body/office:chart/chart:chart/table:table/table:table-header-rows/table:table-row/table:table-cell'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $element = '/office:document-content/office:body/office:chart/chart:chart/table:table/table:table-header-rows/table:table-row/table:table-cell[@office:value-type=\'string\']'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + } } From 4454bd6e9ada5beb78f3415ca5af76c415c6210a Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 5 Jun 2015 13:57:11 +0200 Subject: [PATCH 049/115] ADDED : Support of PHP7 in tests --- .travis.yml | 2 + composer.lock | 232 ++++++++++++++++++++++++++++---------------------- 2 files changed, 134 insertions(+), 100 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4edfef35d..62310d2c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,12 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 - hhvm matrix: allow_failures: + - php: 7.0 - php: hhvm env: diff --git a/composer.lock b/composer.lock index 57ef09478..37ef2789a 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "56906b8cf5414a4ddc2432792f9f4d92", + "hash": "666f88d20d2d8c86a544b50b8b598154", "packages": [], "packages-dev": [ { @@ -586,9 +586,9 @@ ], "authors": [ { - "name": "Johannes Schmitt", + "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", + "homepage": "http://jmsyst.com", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -936,9 +936,9 @@ ], "authors": [ { - "name": "Johannes Schmitt", + "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", + "homepage": "http://jmsyst.com", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -1692,9 +1692,9 @@ ], "authors": [ { - "name": "Johannes Schmitt", + "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", + "homepage": "http://jmsyst.com", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -2108,7 +2108,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" } ], "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", @@ -3130,25 +3132,28 @@ { "name": "zendframework/zend-cache", "version": "2.3.3", - "target-dir": "Zend/Cache", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendCache.git", - "reference": "1966038a1568ebeaeeeaa78ce27bc7b340e30747" + "url": "https://github.com/zendframework/zend-cache.git", + "reference": "5d82386d837365943251b39466fef40325876709" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendCache/zipball/1966038a1568ebeaeeeaa78ce27bc7b340e30747", - "reference": "1966038a1568ebeaeeeaa78ce27bc7b340e30747", + "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/5d82386d837365943251b39466fef40325876709", + "reference": "5d82386d837365943251b39466fef40325876709", "shasum": "" }, "require": { "php": ">=5.3.23", "zendframework/zend-eventmanager": "self.version", + "zendframework/zend-serializer": "self.version", "zendframework/zend-servicemanager": "self.version", "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-serializer": "self.version", "zendframework/zend-session": "self.version" }, @@ -3156,7 +3161,9 @@ "ext-apc": "APC >= 3.1.6 to use the APC storage adapter", "ext-dba": "DBA, to use the DBA storage adapter", "ext-memcached": "Memcached >= 1.0.0 to use the Memcached storage adapter", + "ext-mongo": "Mongo, to use MongoDb storage adapter", "ext-wincache": "WinCache, to use the WinCache storage adapter", + "mongofill/mongofill": "Alternative to ext-mongo - a pure PHP implementation designed as a drop in replacement", "zendframework/zend-serializer": "Zend\\Serializer component", "zendframework/zend-session": "Zend\\Session component" }, @@ -3168,8 +3175,8 @@ } }, "autoload": { - "psr-0": { - "Zend\\Cache\\": "" + "psr-4": { + "Zend\\Cache\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -3177,26 +3184,25 @@ "BSD-3-Clause" ], "description": "provides a generic way to cache any data", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-cache", "keywords": [ "cache", "zf2" ], - "time": "2014-09-16 22:58:11" + "time": "2014-08-11 15:50:41" }, { "name": "zendframework/zend-config", "version": "2.3.3", - "target-dir": "Zend/Config", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendConfig.git", - "reference": "a9ad512e1482461a5b500ee3fcf2d06ec9c7c7e8" + "url": "https://github.com/zendframework/zend-config.git", + "reference": "f233ad11bd5ae224675e0a9b1d3ec3ec1ff896e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendConfig/zipball/a9ad512e1482461a5b500ee3fcf2d06ec9c7c7e8", - "reference": "a9ad512e1482461a5b500ee3fcf2d06ec9c7c7e8", + "url": "https://api.github.com/repos/zendframework/zend-config/zipball/f233ad11bd5ae224675e0a9b1d3ec3ec1ff896e5", + "reference": "f233ad11bd5ae224675e0a9b1d3ec3ec1ff896e5", "shasum": "" }, "require": { @@ -3204,6 +3210,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-filter": "self.version", "zendframework/zend-i18n": "self.version", "zendframework/zend-json": "self.version", @@ -3223,8 +3232,8 @@ } }, "autoload": { - "psr-0": { - "Zend\\Config\\": "" + "psr-4": { + "Zend\\Config\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -3232,32 +3241,36 @@ "BSD-3-Clause" ], "description": "provides a nested object property based user interface for accessing this configuration data within application code", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-config", "keywords": [ "config", "zf2" ], - "time": "2014-09-16 22:58:11" + "time": "2014-08-11 15:50:41" }, { "name": "zendframework/zend-eventmanager", "version": "2.3.3", - "target-dir": "Zend/EventManager", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendEventManager.git", - "reference": "4110fe64b10616b9bb71429a206d8e9e6d99e3ba" + "url": "https://github.com/zendframework/zend-eventmanager.git", + "reference": "b01ea3d2e026463f6d3fd9f95935974a282d97f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendEventManager/zipball/4110fe64b10616b9bb71429a206d8e9e6d99e3ba", - "reference": "4110fe64b10616b9bb71429a206d8e9e6d99e3ba", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/b01ea3d2e026463f6d3fd9f95935974a282d97f1", + "reference": "b01ea3d2e026463f6d3fd9f95935974a282d97f1", "shasum": "" }, "require": { "php": ">=5.3.23", "zendframework/zend-stdlib": "self.version" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "type": "library", "extra": { "branch-alias": { @@ -3266,34 +3279,33 @@ } }, "autoload": { - "psr-0": { - "Zend\\EventManager\\": "" + "psr-4": { + "Zend\\EventManager\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-event-manager", "keywords": [ "eventmanager", "zf2" ], - "time": "2014-09-16 22:58:11" + "time": "2014-08-11 15:50:41" }, { "name": "zendframework/zend-filter", "version": "2.3.3", - "target-dir": "Zend/Filter", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendFilter.git", - "reference": "98b8c2abfdc9009e4c0157e78c9f22bf2cebb693" + "url": "https://github.com/zendframework/zend-filter.git", + "reference": "e3564e5e08a7c3564efb550d4de459d8273735ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendFilter/zipball/98b8c2abfdc9009e4c0157e78c9f22bf2cebb693", - "reference": "98b8c2abfdc9009e4c0157e78c9f22bf2cebb693", + "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/e3564e5e08a7c3564efb550d4de459d8273735ec", + "reference": "e3564e5e08a7c3564efb550d4de459d8273735ec", "shasum": "" }, "require": { @@ -3301,6 +3313,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-crypt": "self.version", "zendframework/zend-servicemanager": "self.version", "zendframework/zend-uri": "self.version" @@ -3319,8 +3334,8 @@ } }, "autoload": { - "psr-0": { - "Zend\\Filter\\": "" + "psr-4": { + "Zend\\Filter\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -3328,26 +3343,25 @@ "BSD-3-Clause" ], "description": "provides a set of commonly needed data filters", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-filter", "keywords": [ "filter", "zf2" ], - "time": "2014-09-16 22:58:11" + "time": "2014-08-11 15:50:41" }, { "name": "zendframework/zend-i18n", "version": "2.3.3", - "target-dir": "Zend/I18n", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendI18n.git", - "reference": "7939bd8eaa573f10fe33a799714199ed7c1fad5c" + "url": "https://github.com/zendframework/zend-i18n.git", + "reference": "fad436afd26eee19d3d6a5d20ba93236e4964336" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendI18n/zipball/7939bd8eaa573f10fe33a799714199ed7c1fad5c", - "reference": "7939bd8eaa573f10fe33a799714199ed7c1fad5c", + "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/fad436afd26eee19d3d6a5d20ba93236e4964336", + "reference": "fad436afd26eee19d3d6a5d20ba93236e4964336", "shasum": "" }, "require": { @@ -3355,6 +3369,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-cache": "self.version", "zendframework/zend-config": "self.version", "zendframework/zend-eventmanager": "self.version", @@ -3382,34 +3399,33 @@ } }, "autoload": { - "psr-0": { - "Zend\\I18n\\": "" + "psr-4": { + "Zend\\I18n\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-i18n", "keywords": [ "i18n", "zf2" ], - "time": "2014-09-16 22:58:11" + "time": "2014-08-11 15:50:41" }, { "name": "zendframework/zend-json", "version": "2.3.3", - "target-dir": "Zend/Json", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendJson.git", - "reference": "4093e5a0a166a5d02532bac6e5671a7b21d203b5" + "url": "https://github.com/zendframework/zend-json.git", + "reference": "6da7732a991f9cd2230b12a287db0e0a6005af05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendJson/zipball/4093e5a0a166a5d02532bac6e5671a7b21d203b5", - "reference": "4093e5a0a166a5d02532bac6e5671a7b21d203b5", + "url": "https://api.github.com/repos/zendframework/zend-json/zipball/6da7732a991f9cd2230b12a287db0e0a6005af05", + "reference": "6da7732a991f9cd2230b12a287db0e0a6005af05", "shasum": "" }, "require": { @@ -3417,12 +3433,16 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-http": "self.version", "zendframework/zend-server": "self.version" }, "suggest": { "zendframework/zend-http": "Zend\\Http component", - "zendframework/zend-server": "Zend\\Server component" + "zendframework/zend-server": "Zend\\Server component", + "zendframework/zendxml": "To support Zend\\Json\\Json::fromXml() usage" }, "type": "library", "extra": { @@ -3432,8 +3452,8 @@ } }, "autoload": { - "psr-0": { - "Zend\\Json\\": "" + "psr-4": { + "Zend\\Json\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -3441,31 +3461,35 @@ "BSD-3-Clause" ], "description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-json", "keywords": [ "json", "zf2" ], - "time": "2014-09-16 22:58:11" + "time": "2014-08-11 15:50:41" }, { "name": "zendframework/zend-math", "version": "2.3.3", - "target-dir": "Zend/Math", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendMath.git", - "reference": "a197ee44ade44a289f0f250c2aedb321b3618573" + "url": "https://github.com/zendframework/zend-math.git", + "reference": "ddedb7eec27f039c09513274258cd3717c12a152" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendMath/zipball/a197ee44ade44a289f0f250c2aedb321b3618573", - "reference": "a197ee44ade44a289f0f250c2aedb321b3618573", + "url": "https://api.github.com/repos/zendframework/zend-math/zipball/ddedb7eec27f039c09513274258cd3717c12a152", + "reference": "ddedb7eec27f039c09513274258cd3717c12a152", "shasum": "" }, "require": { "php": ">=5.3.23" }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, "suggest": { "ext-bcmath": "If using the bcmath functionality", "ext-gmp": "If using the gmp functionality", @@ -3480,34 +3504,33 @@ } }, "autoload": { - "psr-0": { - "Zend\\Math\\": "" + "psr-4": { + "Zend\\Math\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-math", "keywords": [ "math", "zf2" ], - "time": "2014-09-16 22:58:11" + "time": "2014-08-11 15:50:41" }, { "name": "zendframework/zend-serializer", "version": "2.3.3", - "target-dir": "Zend/Serializer", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendSerializer.git", - "reference": "34ee4925e7e256bfa80c4c3dcc8e764d02a51edd" + "url": "https://github.com/zendframework/zend-serializer.git", + "reference": "f3757acc7a288af62d4719139c50330516a41e5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendSerializer/zipball/34ee4925e7e256bfa80c4c3dcc8e764d02a51edd", - "reference": "34ee4925e7e256bfa80c4c3dcc8e764d02a51edd", + "url": "https://api.github.com/repos/zendframework/zend-serializer/zipball/f3757acc7a288af62d4719139c50330516a41e5e", + "reference": "f3757acc7a288af62d4719139c50330516a41e5e", "shasum": "" }, "require": { @@ -3517,6 +3540,9 @@ "zendframework/zend-stdlib": "self.version" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-servicemanager": "self.version" }, "suggest": { @@ -3530,8 +3556,8 @@ } }, "autoload": { - "psr-0": { - "Zend\\Serializer\\": "" + "psr-4": { + "Zend\\Serializer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -3539,32 +3565,34 @@ "BSD-3-Clause" ], "description": "provides an adapter based interface to simply generate storable representation of PHP types by different facilities, and recover", - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-serializer", "keywords": [ "serializer", "zf2" ], - "time": "2014-09-16 22:58:11" + "time": "2014-08-11 15:50:41" }, { "name": "zendframework/zend-servicemanager", "version": "2.3.3", - "target-dir": "Zend/ServiceManager", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendServiceManager.git", - "reference": "559403e4fd10db2516641f20f129a568d7e6a993" + "url": "https://github.com/zendframework/zend-servicemanager.git", + "reference": "23f7c9b129a26d855d6734e4dc58f5bfa63c8f36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendServiceManager/zipball/559403e4fd10db2516641f20f129a568d7e6a993", - "reference": "559403e4fd10db2516641f20f129a568d7e6a993", + "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/23f7c9b129a26d855d6734e4dc58f5bfa63c8f36", + "reference": "23f7c9b129a26d855d6734e4dc58f5bfa63c8f36", "shasum": "" }, "require": { "php": ">=5.3.23" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-di": "self.version" }, "suggest": { @@ -3578,46 +3606,50 @@ } }, "autoload": { - "psr-0": { - "Zend\\ServiceManager\\": "" + "psr-4": { + "Zend\\ServiceManager\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-service-manager", "keywords": [ "servicemanager", "zf2" ], - "time": "2014-09-16 22:58:11" + "time": "2014-08-11 15:50:41" }, { "name": "zendframework/zend-stdlib", "version": "2.3.3", - "target-dir": "Zend/Stdlib", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendStdlib.git", - "reference": "fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33" + "url": "https://github.com/zendframework/zend-stdlib.git", + "reference": "f78c86701b33caddae091623708860dea0c2715f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33", - "reference": "fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/f78c86701b33caddae091623708860dea0c2715f", + "reference": "f78c86701b33caddae091623708860dea0c2715f", "shasum": "" }, "require": { "php": ">=5.3.23" }, "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", "zendframework/zend-eventmanager": "self.version", + "zendframework/zend-filter": "self.version", "zendframework/zend-serializer": "self.version", "zendframework/zend-servicemanager": "self.version" }, "suggest": { "zendframework/zend-eventmanager": "To support aggregate hydrator usage", + "zendframework/zend-filter": "To support naming strategy hydrator usage", "zendframework/zend-serializer": "Zend\\Serializer component", "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" }, @@ -3629,20 +3661,20 @@ } }, "autoload": { - "psr-0": { - "Zend\\Stdlib\\": "" + "psr-4": { + "Zend\\Stdlib\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zf2", + "homepage": "https://github.com/zendframework/zend-stdlib", "keywords": [ "stdlib", "zf2" ], - "time": "2014-09-16 22:58:11" + "time": "2014-08-11 15:50:41" }, { "name": "zetacomponents/base", From d7a5331bc9681e349425648489a32f293901cbe7 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 8 Jun 2015 13:45:31 +0200 Subject: [PATCH 050/115] ODPresentation Writer : Segments in Pie3D Chart are now in clockwise order, as in PowerPoint2007 Writer - @Progi1984 GH-79 --- CHANGELOG.md | 3 ++- .../Writer/ODPresentation/ObjectsChart.php | 14 +++++++++++--- .../Tests/Writer/ODPresentation/ChartsTest.php | 8 ++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 681cdab00..ae78b47cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,12 +12,13 @@ ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 -- ODPresentation Writer : Title in Legend in chart doesn't displayed - @Progi1984 GH-79 - PowerPoint2007 Writer : Fill don't work for RichTextShapes - @Progi1984 GH-61 - PowerPoint2007 Writer : Border don't work for RichTextShapes - @Progi1984 GH-61 - PowerPoint2007 Writer : Hyperlink in table doesn't work - @Progi1984 GH-70 - PowerPoint2007 Writer : AutoFitNormal works with options (fontScale & lineSpacingReduction) - @Progi1984 @desigennaro GH-71 - Refactor findLayoutIndex to findLayoutId where it assumes the slideLayout order was sorted. IMPROVED: unit tests - @kenliau GH-95 +- ODPresentation Writer : Title in Legend in chart doesn't displayed - @Progi1984 GH-79 +- ODPresentation Writer : Segments in Pie3D Chart are now in clockwise order, as in PowerPoint2007 Writer - @Progi1984 GH-79 ### Miscellaneous diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index 23fd034dc..35ea8ff3f 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -159,7 +159,7 @@ private function writeContentPart(Chart $chart) $this->writeChartStyle($chart); // Axis - $this->writeAxisStyle(); + $this->writeAxisStyle($chart); // Series $this->numSeries = 0; @@ -267,8 +267,10 @@ private function writeAxis(Chart $chart) } } - private function writeAxisStyle() + private function writeAxisStyle(Chart $chart) { + $chartType = $chart->getPlotArea()->getType(); + // AxisX // style:style $this->xmlContent->startElement('style:style'); @@ -277,6 +279,9 @@ private function writeAxisStyle() // style:chart-properties $this->xmlContent->startElement('style:chart-properties'); $this->xmlContent->writeAttribute('chart:display-label', 'true'); + if ($chartType instanceof Pie3D) { + $this->xmlContent->writeAttribute('chart:reverse-direction', 'true'); + } // > style:chart-properties $this->xmlContent->endElement(); // > style:style @@ -290,6 +295,9 @@ private function writeAxisStyle() // style:chart-properties $this->xmlContent->startElement('style:chart-properties'); $this->xmlContent->writeAttribute('chart:display-label', 'true'); + if ($chartType instanceof Pie3D) { + $this->xmlContent->writeAttribute('chart:reverse-direction', 'true'); + } // > style:chart-properties $this->xmlContent->endElement(); // > style:style @@ -555,7 +563,7 @@ private function writeSeriesStyle(Chart $chart, Chart\Series $series) // style:chart-properties $this->xmlContent->startElement('style:chart-properties'); $this->xmlContent->writeAttribute('chart:data-label-number', 'value'); - $this->xmlContent->writeAttribute('chart:label-position', 'right'); + $this->xmlContent->writeAttribute('chart:label-position', 'center'); if ($chartType instanceof Pie3D) { $this->xmlContent->writeAttribute('chart:pie-offset', $chartType->getExplosion()); } diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php index ff0ec05fb..85a96e2a8 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php @@ -161,6 +161,14 @@ public function testChartPie3D() $element = '/office:document-content/office:body/office:chart/chart:chart/chart:plot-area/chart:series/chart:data-point'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisX\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:reverse-direction', 'Object 1/content.xml')); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisY\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:reverse-direction', 'Object 1/content.xml')); } public function testChartPie3DExplosion() From d452897ecd1531195af285a9ab109987a4e89e26 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 9 Jun 2015 14:00:58 +0200 Subject: [PATCH 051/115] ODPresentation Writer : Axis in Line Chart have not tick marks displayed, as in PowerPoint2007 Writer - @Progi1984 GH-79 --- CHANGELOG.md | 1 + .../Writer/ODPresentation/ObjectsChart.php | 20 +++++++++++++++++++ .../Writer/ODPresentation/ChartsTest.php | 16 +++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae78b47cd..5540c7e42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - Refactor findLayoutIndex to findLayoutId where it assumes the slideLayout order was sorted. IMPROVED: unit tests - @kenliau GH-95 - ODPresentation Writer : Title in Legend in chart doesn't displayed - @Progi1984 GH-79 - ODPresentation Writer : Segments in Pie3D Chart are now in clockwise order, as in PowerPoint2007 Writer - @Progi1984 GH-79 +- ODPresentation Writer : Axis in Line Chart have not tick marks displayed, as in PowerPoint2007 Writer - @Progi1984 GH-79 ### Miscellaneous diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index 35ea8ff3f..edbbec76a 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -267,6 +267,10 @@ private function writeAxis(Chart $chart) } } + /** + * @param Chart $chart + * @todo Set function in \PhpPowerpoint\Shape\Chart\Axis for defining width and color of the axis + */ private function writeAxisStyle(Chart $chart) { $chartType = $chart->getPlotArea()->getType(); @@ -279,11 +283,19 @@ private function writeAxisStyle(Chart $chart) // style:chart-properties $this->xmlContent->startElement('style:chart-properties'); $this->xmlContent->writeAttribute('chart:display-label', 'true'); + $this->xmlContent->writeAttribute('chart:tick-marks-major-inner', 'false'); + $this->xmlContent->writeAttribute('chart:tick-marks-major-outer', 'false'); if ($chartType instanceof Pie3D) { $this->xmlContent->writeAttribute('chart:reverse-direction', 'true'); } // > style:chart-properties $this->xmlContent->endElement(); + // style:graphic-properties + $this->xmlContent->startElement('style:graphic-properties'); + $this->xmlContent->writeAttribute('svg:stroke-width', '0.026cm'); + $this->xmlContent->writeAttribute('svg:stroke-color', '#878787'); + // > style:graphic-properties + $this->xmlContent->endElement(); // > style:style $this->xmlContent->endElement(); @@ -295,11 +307,19 @@ private function writeAxisStyle(Chart $chart) // style:chart-properties $this->xmlContent->startElement('style:chart-properties'); $this->xmlContent->writeAttribute('chart:display-label', 'true'); + $this->xmlContent->writeAttribute('chart:tick-marks-major-inner', 'false'); + $this->xmlContent->writeAttribute('chart:tick-marks-major-outer', 'false'); if ($chartType instanceof Pie3D) { $this->xmlContent->writeAttribute('chart:reverse-direction', 'true'); } // > style:chart-properties $this->xmlContent->endElement(); + // style:graphic-properties + $this->xmlContent->startElement('style:graphic-properties'); + $this->xmlContent->writeAttribute('svg:stroke-width', '0.026cm'); + $this->xmlContent->writeAttribute('svg:stroke-color', '#878787'); + // > style:graphic-properties + $this->xmlContent->endElement(); // > style:style $this->xmlContent->endElement(); } diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php index 85a96e2a8..50fd7eaf1 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php @@ -135,6 +135,22 @@ public function testChartLine() $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); $this->assertEquals('chart:line', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml')); + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisX\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('false', $pres->getElementAttribute($element, 'chart:tick-marks-major-inner', 'Object 1/content.xml')); + $this->assertEquals('false', $pres->getElementAttribute($element, 'chart:tick-marks-major-outer', 'Object 1/content.xml')); + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisX\']/style:graphic-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('0.026cm', $pres->getElementAttribute($element, 'svg:stroke-width', 'Object 1/content.xml')); + $this->assertEquals('#878787', $pres->getElementAttribute($element, 'svg:stroke-color', 'Object 1/content.xml')); + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisY\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('false', $pres->getElementAttribute($element, 'chart:tick-marks-major-inner', 'Object 1/content.xml')); + $this->assertEquals('false', $pres->getElementAttribute($element, 'chart:tick-marks-major-outer', 'Object 1/content.xml')); + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisY\']/style:graphic-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('0.026cm', $pres->getElementAttribute($element, 'svg:stroke-width', 'Object 1/content.xml')); + $this->assertEquals('#878787', $pres->getElementAttribute($element, 'svg:stroke-color', 'Object 1/content.xml')); } public function testChartPie3D() From ae19e01c32ed70b2a3e8ea5d868518722538cdd2 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 9 Jun 2015 14:01:36 +0200 Subject: [PATCH 052/115] ODPresentation Writer : Support for fill in RichText - @Progi1984 GH-79 --- CHANGELOG.md | 1 + .../Writer/ODPresentation/Content.php | 9 +++ .../Writer/ODPresentation/Styles.php | 52 ++++++++++++---- .../Writer/ODPresentation/StylesTest.php | 60 ++++++++++++++----- 4 files changed, 96 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5540c7e42..5e6d437d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Added support for hyperlink on richtext (PowerPoint2007) - @JewrassicPark GH-49 - Added support for notes slide (ODPresentation & PowerPoint2007) - @Progi1984 @JewrassicPark GH-63 - Added option for explosion in Pie3D Chart (ODPresentation & PowerPoint2007) - @Progi1984 GH-76 +- ODPresentation Writer : Support for fill in RichText - @Progi1984 GH-79 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index c777c33eb..df6a73399 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -729,6 +729,15 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) $objWriter->writeAttribute('draw:auto-grow-width', var_export($shape->hasAutoShrinkHorizontal(), true)); } switch ($shape->getFill()->getFillType()){ + case Fill::FILL_GRADIENT_LINEAR: + case Fill::FILL_GRADIENT_PATH: + $objWriter->writeAttribute('draw:fill', 'gradient'); + $objWriter->writeAttribute('draw:fill-gradient-name', 'gradient_'.$shape->getFill()->getHashCode()); + break; + case Fill::FILL_SOLID: + $objWriter->writeAttribute('draw:fill', 'solid'); + $objWriter->writeAttribute('draw:fill-color', '#'.$shape->getFill()->getStartColor()->getRGB()); + break; case Fill::FILL_NONE: default: $objWriter->writeAttribute('draw:fill', 'none'); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php b/src/PhpPowerpoint/Writer/ODPresentation/Styles.php index d991d619b..5e80f5c15 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Styles.php @@ -24,6 +24,7 @@ use PhpOffice\PhpPowerpoint\Shared\String; use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Style\Fill; +use PhpOffice\PhpPowerpoint\Shape\RichText; /** * \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Styles @@ -111,6 +112,8 @@ public function writePart(PHPPowerPoint $pPHPPowerPoint) $this->writeTableStyle($objWriter, $shape); } elseif ($shape instanceof Group) { $this->writeGroupStyle($objWriter, $shape); + } elseif ($shape instanceof RichText) { + $this->writeRichTextStyle($objWriter, $shape); } } } @@ -164,6 +167,21 @@ public function writePart(PHPPowerPoint $pPHPPowerPoint) return $objWriter->getData(); } + /** + * Write the default style information for a RichText shape + * + * @param XMLWriter $objWriter + * @param RichText $shape + */ + public function writeRichTextStyle(XMLWriter $objWriter, RichText $shape) + { + if ($shape->getFill()->getFillType() == Fill::FILL_GRADIENT_LINEAR || $shape->getFill()->getFillType() == Fill::FILL_GRADIENT_PATH) { + if (!in_array($shape->getFill()->getHashCode(), $this->arrayGradient)) { + $this->writeGradientFill($objWriter, $shape->getFill()); + } + } + } + /** * Write the default style information for a Table shape * @@ -176,18 +194,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) foreach ($row->getCells() as $cell) { if ($cell->getFill()->getFillType() == Fill::FILL_GRADIENT_LINEAR) { if (!in_array($cell->getFill()->getHashCode(), $this->arrayGradient)) { - $objWriter->startElement('draw:gradient'); - $objWriter->writeAttribute('draw:name', 'gradient_'.$cell->getFill()->getHashCode()); - $objWriter->writeAttribute('draw:display-name', 'gradient_'.$cell->getFill()->getHashCode()); - $objWriter->writeAttribute('draw:style', 'linear'); - $objWriter->writeAttribute('draw:start-intensity', '100%'); - $objWriter->writeAttribute('draw:end-intensity', '100%'); - $objWriter->writeAttribute('draw:start-color', '#'.$cell->getFill()->getStartColor()->getRGB()); - $objWriter->writeAttribute('draw:end-color', '#'.$cell->getFill()->getEndColor()->getRGB()); - $objWriter->writeAttribute('draw:border', '0%'); - $objWriter->writeAttribute('draw:angle', $cell->getFill()->getRotation() - 90); - $objWriter->endElement(); - $this->arrayGradient[] = $cell->getFill()->getHashCode(); + $this->writeGradientFill($objWriter, $cell->getFill()); } } } @@ -211,4 +218,25 @@ public function writeGroupStyle(XMLWriter $objWriter, Group $group) } } } + + /** + * Write the gradient style + * @param XMLWriter $objWriter + * @param Fill $oFill + */ + protected function writeGradientFill(XMLWriter $objWriter, Fill $oFill) + { + $objWriter->startElement('draw:gradient'); + $objWriter->writeAttribute('draw:name', 'gradient_'.$oFill->getHashCode()); + $objWriter->writeAttribute('draw:display-name', 'gradient_'.$oFill->getHashCode()); + $objWriter->writeAttribute('draw:style', 'linear'); + $objWriter->writeAttribute('draw:start-intensity', '100%'); + $objWriter->writeAttribute('draw:end-intensity', '100%'); + $objWriter->writeAttribute('draw:start-color', '#'.$oFill->getStartColor()->getRGB()); + $objWriter->writeAttribute('draw:end-color', '#'.$oFill->getEndColor()->getRGB()); + $objWriter->writeAttribute('draw:border', '0%'); + $objWriter->writeAttribute('draw:angle', $oFill->getRotation() - 90); + $objWriter->endElement(); + $this->arrayGradient[] = $oFill->getHashCode(); + } } diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php index 1eeda5220..551eb8866 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php @@ -39,20 +39,6 @@ public function tearDown() TestHelperDOCX::clear(); } - public function testGradient() - { - $phpPowerPoint = new PhpPowerpoint(); - $oSlide = $phpPowerPoint->getActiveSlide(); - $oShape = $oSlide->createTableShape(); - $oRow = $oShape->createRow(); - $oCell = $oRow->getCell(); - $oCell->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR)->setStartColor(new Color('FFFF7700'))->setEndColor(new Color('FFFFFFFF')); - - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); - $element = "/office:document-styles/office:styles/draw:gradient"; - $this->assertEquals('gradient_'.$oCell->getFill()->getHashCode(), $pres->getElementAttribute($element, 'draw:name', 'styles.xml')); - } - public function testDocumentLayout() { $element = "/office:document-styles/office:automatic-styles/style:page-layout/style:page-layout-properties"; @@ -89,4 +75,50 @@ public function testCustomDocumentLayout() $this->assertTrue($pres->elementExists($element, 'styles.xml')); $this->assertEquals('sPL0', $pres->getElementAttribute($element, 'style:page-layout-name', 'styles.xml')); } + + public function testFillGradientLinearRichText() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createRichTextShape(); + $oShape->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR)->setStartColor(new Color('FFFF7700'))->setEndColor(new Color('FFFFFFFF')); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $element = '/office:document-styles/office:styles/draw:gradient'; + $this->assertEquals('gradient_'.$oShape->getFill()->getHashCode(), $pres->getElementAttribute($element, 'draw:name', 'styles.xml')); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertEquals('gradient', $pres->getElementAttribute($element, 'draw:fill', 'content.xml')); + $this->assertEquals('gradient_'.$oShape->getFill()->getHashCode(), $pres->getElementAttribute($element, 'draw:fill-gradient-name', 'content.xml')); + } + + public function testFillSolidRichText() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createRichTextShape(); + $oShape->getFill()->setFillType(Fill::FILL_SOLID)->setRotation(90)->setStartColor(new Color('FF4672A8'))->setEndColor(new Color('FF4672A8')); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertEquals('solid', $pres->getElementAttribute($element, 'draw:fill', 'content.xml')); + $this->assertEquals('#'.$oShape->getFill()->getStartColor()->getRGB(), $pres->getElementAttribute($element, 'draw:fill-color', 'content.xml')); + $this->assertEquals('#'.$oShape->getFill()->getEndColor()->getRGB(), $pres->getElementAttribute($element, 'draw:fill-color', 'content.xml')); + } + + public function testGradientTable() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createTableShape(); + $oRow = $oShape->createRow(); + $oCell = $oRow->getCell(); + $oCell->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR)->setStartColor(new Color('FFFF7700'))->setEndColor(new Color('FFFFFFFF')); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $element = "/office:document-styles/office:styles/draw:gradient"; + $this->assertEquals('gradient_'.$oCell->getFill()->getHashCode(), $pres->getElementAttribute($element, 'draw:name', 'styles.xml')); + } } From b4c247e9832e61383f55ac1241c7a4c1439164f7 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 10 Jun 2015 13:59:33 +0200 Subject: [PATCH 053/115] ODPresentation Writer : Support for border style in RichText - @Progi1984 GH-79 --- CHANGELOG.md | 1 + src/PhpPowerpoint/Shared/Drawing.php | 15 ++++ .../Writer/ODPresentation/Content.php | 33 ++++++-- .../Writer/ODPresentation/Styles.php | 78 +++++++++++++++++++ .../Tests/Shared/DrawingTest.php | 10 +++ .../Writer/ODPresentation/ContentTest.php | 40 ++++++++++ .../Writer/ODPresentation/StylesTest.php | 55 +++++++++++++ 7 files changed, 227 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e6d437d9..0156ff263 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Added support for notes slide (ODPresentation & PowerPoint2007) - @Progi1984 @JewrassicPark GH-63 - Added option for explosion in Pie3D Chart (ODPresentation & PowerPoint2007) - @Progi1984 GH-76 - ODPresentation Writer : Support for fill in RichText - @Progi1984 GH-79 +- ODPresentation Writer : Support for border style in RichText - @Progi1984 GH-79 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/src/PhpPowerpoint/Shared/Drawing.php b/src/PhpPowerpoint/Shared/Drawing.php index 636be8012..685b0d462 100644 --- a/src/PhpPowerpoint/Shared/Drawing.php +++ b/src/PhpPowerpoint/Shared/Drawing.php @@ -61,6 +61,21 @@ public static function pixelsToPoints($pValue = 0) return $pValue * 0.67777777; } + /** + * Convert points width to centimeters + * + * @param int $pValue Value in points + * @return int Value in centimeters + */ + public static function pointsToCentimeters($pValue = 0) + { + if ($pValue != 0) { + return ((($pValue * 1.333333333) / self::DPI_96) * 2.54); + } else { + return 0; + } + } + /** * Convert points width to pixels * diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index df6a73399..2eea2240a 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -728,6 +728,7 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) if (is_bool($shape->hasAutoShrinkHorizontal())) { $objWriter->writeAttribute('draw:auto-grow-width', var_export($shape->hasAutoShrinkHorizontal(), true)); } + // Fill switch ($shape->getFill()->getFillType()){ case Fill::FILL_GRADIENT_LINEAR: case Fill::FILL_GRADIENT_PATH: @@ -744,11 +745,33 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) $objWriter->writeAttribute('draw:fill-color', '#'.$shape->getFill()->getStartColor()->getRGB()); break; } - switch ($shape->getBorder()->getLineStyle()){ - case Border::LINE_NONE: - default: - $objWriter->writeAttribute('draw:stroke', 'none'); - $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); + // Border + if($shape->getBorder()->getLineStyle() == Border::LINE_NONE){ + $objWriter->writeAttribute('draw:stroke', 'none'); + } else { + $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); + $objWriter->writeAttribute('svg:stroke-width', number_format(SharedDrawing::pointsToCentimeters($shape->getBorder()->getLineWidth()), 3, '.', '').'cm'); + switch ($shape->getBorder()->getDashStyle()){ + case Border::DASH_SOLID: + $objWriter->writeAttribute('draw:stroke', 'solid'); + break; + case Border::DASH_DASH: + case Border::DASH_DASHDOT: + case Border::DASH_DOT: + case Border::DASH_LARGEDASH: + case Border::DASH_LARGEDASHDOT: + case Border::DASH_LARGEDASHDOTDOT: + case Border::DASH_SYSDASH: + case Border::DASH_SYSDASHDOT: + case Border::DASH_SYSDASHDOTDOT: + case Border::DASH_SYSDOT: + $objWriter->writeAttribute('draw:stroke', 'dash'); + $objWriter->writeAttribute('draw:stroke-dash', 'strokeDash_'.$shape->getBorder()->getDashStyle()); + break; + default: + $objWriter->writeAttribute('draw:stroke', 'none'); + break; + } } $objWriter->writeAttribute('fo:wrap-option', 'wrap'); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php b/src/PhpPowerpoint/Writer/ODPresentation/Styles.php index 5e80f5c15..ed4cd5595 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Styles.php @@ -25,6 +25,7 @@ use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Style\Fill; use PhpOffice\PhpPowerpoint\Shape\RichText; +use PhpOffice\PhpPowerpoint\Style\Border; /** * \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Styles @@ -37,6 +38,12 @@ class Styles extends AbstractPart * @var array */ private $arrayGradient = array(); + /** + * Stores font styles draw:stroke-dash nodes + * + * @var array + */ + private $arrayStrokeDash = array(); /** * Write Meta file to XML format @@ -180,6 +187,77 @@ public function writeRichTextStyle(XMLWriter $objWriter, RichText $shape) $this->writeGradientFill($objWriter, $shape->getFill()); } } + if ($shape->getBorder()->getDashStyle() != Border::DASH_SOLID) { + if (!in_array($shape->getBorder()->getDashStyle(), $this->arrayStrokeDash)) { + $objWriter->startElement('draw:stroke-dash'); + $objWriter->writeAttribute('draw:name', 'strokeDash_'.$shape->getBorder()->getDashStyle()); + $objWriter->writeAttribute('draw:style', 'rect'); + switch ($shape->getBorder()->getDashStyle()){ + case Border::DASH_DASH: + $objWriter->writeAttribute('draw:distance', '0.105cm'); + $objWriter->writeAttribute('draw:dots2', '1'); + $objWriter->writeAttribute('draw:dots2-length', '0.14cm'); + break; + case Border::DASH_DASHDOT: + $objWriter->writeAttribute('draw:distance', '0.105cm'); + $objWriter->writeAttribute('draw:dots1', '1'); + $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); + $objWriter->writeAttribute('draw:dots2', '1'); + $objWriter->writeAttribute('draw:dots2-length', '0.14cm'); + break; + case Border::DASH_DOT: + $objWriter->writeAttribute('draw:distance', '0.105cm'); + $objWriter->writeAttribute('draw:dots1', '1'); + $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); + break; + case Border::DASH_LARGEDASH: + $objWriter->writeAttribute('draw:distance', '0.105cm'); + $objWriter->writeAttribute('draw:dots2', '1'); + $objWriter->writeAttribute('draw:dots2-length', '0.28cm'); + break; + case Border::DASH_LARGEDASHDOT: + $objWriter->writeAttribute('draw:distance', '0.105cm'); + $objWriter->writeAttribute('draw:dots1', '1'); + $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); + $objWriter->writeAttribute('draw:dots2', '1'); + $objWriter->writeAttribute('draw:dots2-length', '0.28cm'); + break; + case Border::DASH_LARGEDASHDOTDOT: + $objWriter->writeAttribute('draw:distance', '0.105cm'); + $objWriter->writeAttribute('draw:dots1', '2'); + $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); + $objWriter->writeAttribute('draw:dots2', '1'); + $objWriter->writeAttribute('draw:dots2-length', '0.28cm'); + break; + case Border::DASH_SYSDASH: + $objWriter->writeAttribute('draw:distance', '0.035cm'); + $objWriter->writeAttribute('draw:dots2', '1'); + $objWriter->writeAttribute('draw:dots2-length', '0.105cm'); + break; + case Border::DASH_SYSDASHDOT: + $objWriter->writeAttribute('draw:distance', '0.035cm'); + $objWriter->writeAttribute('draw:dots1', '1'); + $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); + $objWriter->writeAttribute('draw:dots2', '1'); + $objWriter->writeAttribute('draw:dots2-length', '0.105cm'); + break; + case Border::DASH_SYSDASHDOTDOT: + $objWriter->writeAttribute('draw:distance', '0.035cm'); + $objWriter->writeAttribute('draw:dots1', '2'); + $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); + $objWriter->writeAttribute('draw:dots2', '1'); + $objWriter->writeAttribute('draw:dots2-length', '0.105cm'); + break; + case Border::DASH_SYSDOT: + $objWriter->writeAttribute('draw:distance', '0.035cm'); + $objWriter->writeAttribute('draw:dots1', '1'); + $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); + break; + } + $objWriter->endElement(); + $this->arrayStrokeDash[] = $shape->getBorder()->getDashStyle(); + } + } } /** diff --git a/tests/PhpPowerpoint/Tests/Shared/DrawingTest.php b/tests/PhpPowerpoint/Tests/Shared/DrawingTest.php index 4f7ef947f..bb2f99029 100644 --- a/tests/PhpPowerpoint/Tests/Shared/DrawingTest.php +++ b/tests/PhpPowerpoint/Tests/Shared/DrawingTest.php @@ -37,7 +37,17 @@ public function testPixelsCentimeters() $this->assertEquals(0, Drawing::centimetersToPixels()); $this->assertEquals($value / 2.54 * Drawing::DPI_96, Drawing::centimetersToPixels($value)); } + + /** + */ + public function testPointsCentimeters() + { + $value = rand(1, 100); + $this->assertEquals(0, Drawing::pointsToCentimeters()); + $this->assertEquals($value * 1.333333333 / Drawing::DPI_96 * 2.54, Drawing::pointsToCentimeters($value)); + } + /** */ public function testPixelsEMU() diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index 2653522df..9ec14f18b 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -20,9 +20,12 @@ use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\RichText\Run; use PhpOffice\PhpPowerpoint\Style\Alignment; +use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Bullet; +use PhpOffice\PhpPowerpoint\Style\Color; use PhpOffice\PhpPowerpoint\Writer\ODPresentation; use PhpOffice\PhpPowerpoint\Tests\TestHelperDOCX; +use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; /** * Test class for PhpOffice\PhpPowerpoint\Writer\ODPresentation\Manifest @@ -197,6 +200,43 @@ public function testRichtextAutoShrink() $this->assertEquals('false', $pres->getElementAttribute($element, 'draw:auto-grow-height', 'content.xml')); $this->assertEquals('true', $pres->getElementAttribute($element, 'draw:auto-grow-width', 'content.xml')); } + + public function testRichtextBorder() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oRichText1 = $oSlide->createRichTextShape(); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties'; + + $oRichText1->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_SOLID)->setLineStyle(Border::LINE_NONE); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertFalse($pres->attributeElementExists($element, 'svg:stroke-color', 'content.xml')); + $this->assertFalse($pres->attributeElementExists($element, 'svg:stroke-width', 'content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'draw:stroke', 'content.xml')); + $this->assertEquals('none', $pres->getElementAttribute($element, 'draw:stroke', 'content.xml')); + + $oRichText1->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_SOLID)->setLineStyle(Border::LINE_SINGLE); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'svg:stroke-color', 'content.xml')); + $this->assertEquals('#'.$oRichText1->getBorder()->getColor()->getRGB(), $pres->getElementAttribute($element, 'svg:stroke-color', 'content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'svg:stroke-width', 'content.xml')); + $this->assertStringEndsWith('cm', $pres->getElementAttribute($element, 'svg:stroke-width', 'content.xml')); + $this->assertStringStartsWith((string) number_format(SharedDrawing::pointsToCentimeters($oRichText1->getBorder()->getLineWidth()), 3, '.', ''), $pres->getElementAttribute($element, 'svg:stroke-width', 'content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'draw:stroke', 'content.xml')); + $this->assertEquals('solid', $pres->getElementAttribute($element, 'draw:stroke', 'content.xml')); + $this->assertFalse($pres->attributeElementExists($element, 'draw:stroke-dash', 'content.xml')); + + $oRichText1->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_DASH); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties'; + $this->assertEquals('dash', $pres->getElementAttribute($element, 'draw:stroke', 'content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'draw:stroke-dash', 'content.xml')); + $this->assertStringStartsWith('strokeDash_', $pres->getElementAttribute($element, 'draw:stroke-dash', 'content.xml')); + $this->assertStringEndsWith($oRichText1->getBorder()->getDashStyle(), $pres->getElementAttribute($element, 'draw:stroke-dash', 'content.xml')); + } public function testStyleAlignment() { diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php index 551eb8866..9649a2755 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php @@ -19,6 +19,7 @@ use PhpOffice\PhpPowerpoint\DocumentLayout; use PhpOffice\PhpPowerpoint\PhpPowerpoint; +use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Color; use PhpOffice\PhpPowerpoint\Style\Fill; use PhpOffice\PhpPowerpoint\Writer\ODPresentation; @@ -121,4 +122,58 @@ public function testGradientTable() $element = "/office:document-styles/office:styles/draw:gradient"; $this->assertEquals('gradient_'.$oCell->getFill()->getHashCode(), $pres->getElementAttribute($element, 'draw:name', 'styles.xml')); } + + public function testStrokeDash() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oRichText1 = $oSlide->createRichTextShape(); + $oRichText1->getBorder()->setColor(new Color('FF4672A8'))->setLineStyle(Border::LINE_SINGLE); + $arrayDashStyle = array( + Border::DASH_DASH, + Border::DASH_DASHDOT, + Border::DASH_DOT, + Border::DASH_LARGEDASH, + Border::DASH_LARGEDASHDOT, + Border::DASH_LARGEDASHDOTDOT, + Border::DASH_SYSDASH, + Border::DASH_SYSDASHDOT, + Border::DASH_SYSDASHDOTDOT, + Border::DASH_SYSDOT, + ); + + foreach ($arrayDashStyle as $style){ + $oRichText1->getBorder()->setDashStyle($style); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $element = '/office:document-styles/office:styles/draw:stroke-dash[@draw:name=\'strokeDash_'.$style.'\']'; + $this->assertTrue($pres->elementExists($element, 'styles.xml')); + $this->assertEquals('rect', $pres->getElementAttribute($element, 'draw:style', 'styles.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'draw:distance', 'styles.xml')); + + switch($style){ + case Border::DASH_DOT: + case Border::DASH_SYSDOT: + $this->assertTrue($pres->attributeElementExists($element, 'draw:dots1', 'styles.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'draw:dots1-length', 'styles.xml')); + break; + case Border::DASH_DASH: + case Border::DASH_LARGEDASH: + case Border::DASH_SYSDASH: + $this->assertTrue($pres->attributeElementExists($element, 'draw:dots2', 'styles.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'draw:dots2-length', 'styles.xml')); + break; + case Border::DASH_DASHDOT: + case Border::DASH_LARGEDASHDOT: + case Border::DASH_LARGEDASHDOTDOT: + case Border::DASH_SYSDASHDOT: + case Border::DASH_SYSDASHDOTDOT: + $this->assertTrue($pres->attributeElementExists($element, 'draw:dots1', 'styles.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'draw:dots1-length', 'styles.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'draw:dots2', 'styles.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'draw:dots2-length', 'styles.xml')); + break; + } + } + } } From fa9656ee0b8298afacce7febb954719009f6ff35 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 10 Jun 2015 17:19:57 +0200 Subject: [PATCH 054/115] Fixes for PHP-MD --- src/PhpPowerpoint/Writer/ODPresentation/Content.php | 2 +- tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index 2eea2240a..55329ca45 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -746,7 +746,7 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) break; } // Border - if($shape->getBorder()->getLineStyle() == Border::LINE_NONE){ + if ($shape->getBorder()->getLineStyle() == Border::LINE_NONE) { $objWriter->writeAttribute('draw:stroke', 'none'); } else { $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php index 9649a2755..da0492a94 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php @@ -142,7 +142,7 @@ public function testStrokeDash() Border::DASH_SYSDOT, ); - foreach ($arrayDashStyle as $style){ + foreach ($arrayDashStyle as $style) { $oRichText1->getBorder()->setDashStyle($style); $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); From 398b1e1398b25535f9c3a8b3dccbf2d371d9c2d4 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 12 Jun 2015 14:09:43 +0200 Subject: [PATCH 055/115] ODPresentation Writer : Support for Area Chart - @Progi1984 GH-82 --- CHANGELOG.md | 1 + src/PhpPowerpoint/Shape/Chart/Series.php | 12 +++ .../Shape/Chart/Type/AbstractType.php | 2 +- src/PhpPowerpoint/Shape/Chart/Type/Area.php | 40 ++++++++++ .../Writer/ODPresentation/ObjectsChart.php | 34 +++++---- .../Tests/Shape/Chart/SeriesTest.php | 10 +++ .../Tests/Shape/Chart/Type/AreaTest.php | 65 ++++++++++++++++ .../Writer/ODPresentation/ChartAreaTest.php | 76 +++++++++++++++++++ 8 files changed, 225 insertions(+), 15 deletions(-) create mode 100644 src/PhpPowerpoint/Shape/Chart/Type/Area.php create mode 100644 tests/PhpPowerpoint/Tests/Shape/Chart/Type/AreaTest.php create mode 100644 tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartAreaTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 0156ff263..f1ecc990f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Added option for explosion in Pie3D Chart (ODPresentation & PowerPoint2007) - @Progi1984 GH-76 - ODPresentation Writer : Support for fill in RichText - @Progi1984 GH-79 - ODPresentation Writer : Support for border style in RichText - @Progi1984 GH-79 +- ODPresentation Writer : Support for Area Chart - @Progi1984 GH-79 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/src/PhpPowerpoint/Shape/Chart/Series.php b/src/PhpPowerpoint/Shape/Chart/Series.php index 5268608d1..b9c2fdfb8 100644 --- a/src/PhpPowerpoint/Shape/Chart/Series.php +++ b/src/PhpPowerpoint/Shape/Chart/Series.php @@ -170,6 +170,18 @@ public function getFill() return $this->fill; } + /** + * Set Fill + * + * @param \PhpOffice\PhpPowerpoint\Style\Fill $value + * @return Series + */ + public function setFill(Fill $fill = null) + { + $this->fill = $fill; + return $this; + } + /** * Get DataPointFill * diff --git a/src/PhpPowerpoint/Shape/Chart/Type/AbstractType.php b/src/PhpPowerpoint/Shape/Chart/Type/AbstractType.php index ee6f988cf..20cdfbc78 100644 --- a/src/PhpPowerpoint/Shape/Chart/Type/AbstractType.php +++ b/src/PhpPowerpoint/Shape/Chart/Type/AbstractType.php @@ -115,7 +115,7 @@ public function addSeries(Series $value) /** * Get Data * - * @return array + * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Series[] */ public function getData() { diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Area.php b/src/PhpPowerpoint/Shape/Chart/Type/Area.php new file mode 100644 index 000000000..94766af05 --- /dev/null +++ b/src/PhpPowerpoint/Shape/Chart/Type/Area.php @@ -0,0 +1,40 @@ +getData() as $series) { + $hash .= $series->getHashCode(); + } + return md5($hash . __CLASS__); + } +} diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index edbbec76a..f3ce806f1 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -19,6 +19,7 @@ use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\Chart; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; @@ -87,7 +88,7 @@ public function writePart(Chart $chart) private function writeContentPart(Chart $chart) { $chartType = $chart->getPlotArea()->getType(); - if (!($chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Pie3D|| $chartType instanceof Scatter)) { + if (!($chartType instanceof Area || $chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Pie3D || $chartType instanceof Scatter)) { throw new \Exception('The chart type provided could not be rendered.'); } @@ -198,7 +199,9 @@ private function writeContentPart(Chart $chart) $this->xmlContent->writeAttribute('xlink:href', '.'); $this->xmlContent->writeAttribute('xlink:type', 'simple'); $this->xmlContent->writeAttribute('chart:style-name', 'styleChart'); - if ($chartType instanceof Bar3D) { + if ($chartType instanceof Area) { + $this->xmlContent->writeAttribute('chart:class', 'chart:area'); + } elseif ($chartType instanceof Bar3D) { $this->xmlContent->writeAttribute('chart:class', 'chart:bar'); } elseif ($chartType instanceof Line) { $this->xmlContent->writeAttribute('chart:class', 'chart:line'); @@ -425,13 +428,13 @@ private function writePlotArea(Chart $chart) if ($chartType instanceof Bar3D || $chartType instanceof Pie3D) { // dr3d:light $arrayLight = array( - array('#808080', '(0 0 1)', 'false', 'true'), - array('#666666', '(0.2 0.4 1)', 'true', 'false'), - array('#808080', '(0 0 1)', 'false', 'false'), - array('#808080', '(0 0 1)', 'false', 'false'), - array('#808080', '(0 0 1)', 'false', 'false'), - array('#808080', '(0 0 1)', 'false', 'false'), - array('#808080', '(0 0 1)', 'false', 'false'), + array('#808080', '(0 0 1)', 'false', 'true'), + array('#666666', '(0.2 0.4 1)', 'true', 'false'), + array('#808080', '(0 0 1)', 'false', 'false'), + array('#808080', '(0 0 1)', 'false', 'false'), + array('#808080', '(0 0 1)', 'false', 'false'), + array('#808080', '(0 0 1)', 'false', 'false'), + array('#808080', '(0 0 1)', 'false', 'false'), ); foreach ($arrayLight as $light) { $this->xmlContent->startElement('dr3d:light'); @@ -510,7 +513,9 @@ private function writeSeries(Chart $chart, Chart\Series $series) $this->xmlContent->startElement('chart:series'); $this->xmlContent->writeAttribute('chart:values-cell-range-address', 'table-local.$'.$this->rangeCol.'$2:.$'.$this->rangeCol.'$'.($numRange+1)); $this->xmlContent->writeAttribute('chart:label-cell-address', 'table-local.$'.$this->rangeCol.'$1'); - if ($chartType instanceof Bar3D) { + if ($chartType instanceof Area) { + $this->xmlContent->writeAttribute('chart:class', 'chart:area'); + } elseif ($chartType instanceof Bar3D) { $this->xmlContent->writeAttribute('chart:class', 'chart:bar'); } elseif ($chartType instanceof Line) { $this->xmlContent->writeAttribute('chart:class', 'chart:line'); @@ -520,7 +525,7 @@ private function writeSeries(Chart $chart, Chart\Series $series) $this->xmlContent->writeAttribute('chart:class', 'chart:scatter'); } $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries'.$this->numSeries); - if ($chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Scatter) { + if ($chartType instanceof Area || $chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Scatter) { $dataPointFills = $series->getDataPointFills(); if (empty($dataPointFills)) { $incRepeat = $numRange; @@ -599,12 +604,13 @@ private function writeSeriesStyle(Chart $chart, Chart\Series $series) //@todo : Permit edit the color and width of a line $this->xmlContent->writeAttribute('svg:stroke-width', '0.079cm'); $this->xmlContent->writeAttribute('svg:stroke-color', '#4a7ebb'); - $this->xmlContent->writeAttribute('draw:fill-color', '#4a7ebb'); } else { $this->xmlContent->writeAttribute('draw:stroke', 'none'); - $this->xmlContent->writeAttribute('draw:fill', $series->getFill()->getFillType()); - $this->xmlContent->writeAttribute('draw:fill-color', '#'.$series->getFill()->getStartColor()->getRGB()); + if (!($chartType instanceof Area)) { + $this->xmlContent->writeAttribute('draw:fill', $series->getFill()->getFillType()); + } } + $this->xmlContent->writeAttribute('draw:fill-color', '#'.$series->getFill()->getStartColor()->getRGB()); // > style:graphic-properties $this->xmlContent->endElement(); // style:text-properties diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php index 0e548cf62..b7acdfa09 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php @@ -51,6 +51,16 @@ public function testDataPointFills() $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getDataPointFill(0)); } + public function testFill() + { + $object = new Series(); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setFill()); + $this->assertNull($object->getFill()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setFill(new Fill())); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->getFill()); + } + public function testFont() { $object = new Series(); diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/AreaTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/AreaTest.php new file mode 100644 index 000000000..db338b273 --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/AreaTest.php @@ -0,0 +1,65 @@ +assertInternalType('array', $object->getData()); + $this->assertEmpty($object->getData()); + + $array = array( + new Series(), + new Series(), + ); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Area', $object->setData()); + $this->assertEmpty($object->getData()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Area', $object->setData($array)); + $this->assertCount(count($array), $object->getData()); + } + + public function testSeries() + { + $object = new Area(); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Area', $object->addSeries(new Series())); + $this->assertCount(1, $object->getData()); + } + + public function testHashCode() + { + $oSeries = new Series(); + + $object = new Area(); + $object->addSeries($oSeries); + + $this->assertEquals(md5($oSeries->getHashCode().get_class($object)), $object->getHashCode()); + } +} diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartAreaTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartAreaTest.php new file mode 100644 index 000000000..d8609e489 --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartAreaTest.php @@ -0,0 +1,76 @@ + 1, 'Feb' => 5, 'Mar' => 2)); + $oSeries->getFill()->setStartColor(new Color('FF93A9CE')); + + $oArea = new Area(); + $oArea->addSeries($oSeries); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oChart = $oSlide->createChartShape(); + $oChart->getPlotArea()->setType($oArea); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:body/office:chart/chart:chart'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('chart:area', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml')); + + $element = '/office:document-content/office:body/office:chart/chart:chart/chart:plot-area/chart:series'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('chart:area', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml')); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleSeries0\']/style:graphic-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertFalse($pres->attributeElementExists($element, 'draw:fill', 'Object 1/content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'draw:fill-color', 'Object 1/content.xml')); + $this->assertEquals('#93A9CE', $pres->getElementAttribute($element, 'draw:fill-color', 'Object 1/content.xml')); + } +} From 8f5d6ba9f056d91a4c1f6e4cdbeeb05b79e5e62f Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 12 Jun 2015 17:01:06 +0200 Subject: [PATCH 056/115] ODPresentation Writer : Support for Area Chart - @Progi1984 GH-82 --- CHANGELOG.md | 2 +- src/PhpPowerpoint/Shape/Chart/Series.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1ecc990f..2ea6f9037 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ - Added option for explosion in Pie3D Chart (ODPresentation & PowerPoint2007) - @Progi1984 GH-76 - ODPresentation Writer : Support for fill in RichText - @Progi1984 GH-79 - ODPresentation Writer : Support for border style in RichText - @Progi1984 GH-79 -- ODPresentation Writer : Support for Area Chart - @Progi1984 GH-79 +- ODPresentation Writer : Support for Area Chart - @Progi1984 GH-82 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/src/PhpPowerpoint/Shape/Chart/Series.php b/src/PhpPowerpoint/Shape/Chart/Series.php index b9c2fdfb8..dfb062a86 100644 --- a/src/PhpPowerpoint/Shape/Chart/Series.php +++ b/src/PhpPowerpoint/Shape/Chart/Series.php @@ -178,7 +178,7 @@ public function getFill() */ public function setFill(Fill $fill = null) { - $this->fill = $fill; + $this->fill = $fill; return $this; } From 921c405e35bb1e16a6c8d7e2353de782806b56f7 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 12 Jun 2015 17:02:05 +0200 Subject: [PATCH 057/115] Improve Samples - GH78 --- ...erialized.php => Sample_02_Serialized.php} | 0 ..._InMemoryImage.php => Sample_03_Image.php} | 23 +- ...ample_06_Table.php => Sample_04_Table.php} | 11 +- samples/Sample_05_Chart.php | 282 ++++++++++++++++++ ...hart_Line.php => Sample_05_Chart_Line.php} | 73 +++-- ....php => Sample_05_Chart_with_PHPExcel.php} | 0 ...{Sample_09_Fill.php => Sample_06_Fill.php} | 30 +- ...ple_10_Border.php => Sample_07_Border.php} | 0 samples/Sample_07_Chart.php | 206 ------------- ...ample_11_Group.php => Sample_08_Group.php} | 0 ..._SlideNote.php => Sample_09_SlideNote.php} | 0 ...ntation.php => Sample_X2_Presentation.php} | 0 ..._Templated.php => Sample_X5_Templated.php} | 0 13 files changed, 360 insertions(+), 265 deletions(-) rename samples/{Sample_03_Serialized.php => Sample_02_Serialized.php} (100%) rename samples/{Sample_04_InMemoryImage.php => Sample_03_Image.php} (67%) rename samples/{Sample_06_Table.php => Sample_04_Table.php} (91%) create mode 100644 samples/Sample_05_Chart.php rename samples/{Sample_07_Chart_Line.php => Sample_05_Chart_Line.php} (53%) rename samples/{Sample_08_Chart_with_PHPExcel.php => Sample_05_Chart_with_PHPExcel.php} (100%) rename samples/{Sample_09_Fill.php => Sample_06_Fill.php} (70%) rename samples/{Sample_10_Border.php => Sample_07_Border.php} (100%) delete mode 100644 samples/Sample_07_Chart.php rename samples/{Sample_11_Group.php => Sample_08_Group.php} (100%) rename samples/{Sample_12_SlideNote.php => Sample_09_SlideNote.php} (100%) rename samples/{Sample_02_Presentation.php => Sample_X2_Presentation.php} (100%) rename samples/{Sample_05_Templated.php => Sample_X5_Templated.php} (100%) diff --git a/samples/Sample_03_Serialized.php b/samples/Sample_02_Serialized.php similarity index 100% rename from samples/Sample_03_Serialized.php rename to samples/Sample_02_Serialized.php diff --git a/samples/Sample_04_InMemoryImage.php b/samples/Sample_03_Image.php similarity index 67% rename from samples/Sample_04_InMemoryImage.php rename to samples/Sample_03_Image.php index 3195b2be8..0b00ed0fc 100644 --- a/samples/Sample_04_InMemoryImage.php +++ b/samples/Sample_03_Image.php @@ -3,22 +3,13 @@ include_once 'Sample_Header.php'; use PhpOffice\PhpPowerpoint\PhpPowerpoint; +use PhpOffice\PhpPowerpoint\Shape\Drawing; use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing; // Create new PHPPowerPoint object echo date('H:i:s') . ' Create new PHPPowerPoint object'.EOL; $objPHPPowerPoint = new PhpPowerpoint(); -// Set properties -echo date('H:i:s') . ' Set properties'.EOL; -$objPHPPowerPoint->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') - ->setTitle('Sample 04 Title') - ->setSubject('Sample 04 Subject') - ->setDescription('Sample 04 Description') - ->setKeywords('office 2007 openxml libreoffice odt php') - ->setCategory('Sample Category'); - // Create slide echo date('H:i:s') . ' Create slide'.EOL; $currentSlide = $objPHPPowerPoint->getActiveSlide(); @@ -29,7 +20,7 @@ $textColor = imagecolorallocate($gdImage, 255, 255, 255); imagestring($gdImage, 1, 5, 5, 'Created with PHPPowerPoint', $textColor); -// Add a drawing to the worksheet +// Add a generated drawing to the slide echo date('H:i:s') . ' Add a drawing to the worksheet'.EOL; $shape = new MemoryDrawing(); $shape->setName('Sample image') @@ -42,6 +33,16 @@ ->setOffsetY(10); $currentSlide->addShape($shape); +// Add a file drawing (GIF) to the slide +$shape = new Drawing(); +$shape->setName('PHPPowerPoint logo') + ->setDescription('PHPPowerPoint logo') + ->setPath('./resources/phppowerpoint_logo.gif') + ->setHeight(36) + ->setOffsetX(10) + ->setOffsetY(100); +$currentSlide->addShape($shape); + // Save file echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); if (!CLI) { diff --git a/samples/Sample_06_Table.php b/samples/Sample_04_Table.php similarity index 91% rename from samples/Sample_06_Table.php rename to samples/Sample_04_Table.php index 9d3b8c84e..cfbda02b2 100644 --- a/samples/Sample_06_Table.php +++ b/samples/Sample_04_Table.php @@ -46,8 +46,7 @@ ->setEndColor(new Color('FFFFFFFF')); $cell = $row->nextCell(); $cell->setColSpan(3); -$cell->createTextRun('Title row')->getFont()->setBold(true) - ->setSize(16); +$cell->createTextRun('Title row')->getFont()->setBold(true)->setSize(16); $cell->getBorders()->getBottom()->setLineWidth(4) ->setLineStyle(Border::LINE_SINGLE) ->setDashStyle(Border::DASH_DASH); @@ -58,7 +57,7 @@ $row->setHeight(20); $row->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR) ->setRotation(90) - ->setStartColor(new Color( 'FFE06B20' )) + ->setStartColor(new Color('FFE06B20')) ->setEndColor(new Color('FFFFFFFF')); $row->nextCell()->createTextRun('R1C1')->getFont()->setBold(true); $row->nextCell()->createTextRun('R1C2')->getFont()->setBold(true); @@ -74,7 +73,7 @@ echo date('H:i:s') . ' Add row'.EOL; $row = $shape->createRow(); $row->getFill()->setFillType(Fill::FILL_SOLID) - ->setStartColor(new Color( 'FFE06B20' )) + ->setStartColor(new Color('FFE06B20')) ->setEndColor(new Color('FFE06B20')); $row->nextCell()->createTextRun('R2C1'); $row->nextCell()->createTextRun('R2C2'); @@ -84,7 +83,7 @@ echo date('H:i:s') . ' Add row'.EOL; $row = $shape->createRow(); $row->getFill()->setFillType(Fill::FILL_SOLID) - ->setStartColor(new Color( 'FFE06B20' )) + ->setStartColor(new Color('FFE06B20')) ->setEndColor(new Color('FFE06B20')); $row->nextCell()->createTextRun('R3C1'); $row->nextCell()->createTextRun('R3C2'); @@ -94,7 +93,7 @@ echo date('H:i:s') . ' Add row'.EOL; $row = $shape->createRow(); $row->getFill()->setFillType(Fill::FILL_SOLID) - ->setStartColor(new Color( 'FFE06B20' )) + ->setStartColor(new Color('FFE06B20')) ->setEndColor(new Color('FFE06B20')); $textRun = $row->nextCell()->createTextRun('Link'); $textRun->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); diff --git a/samples/Sample_05_Chart.php b/samples/Sample_05_Chart.php new file mode 100644 index 000000000..713fb7111 --- /dev/null +++ b/samples/Sample_05_Chart.php @@ -0,0 +1,282 @@ + 12, + 'Tuesday' => 15, + 'Wednesday' => 13, + 'Thursday' => 17, + 'Friday' => 14, + 'Saturday' => 9, + 'Sunday' => 7 + ); + + // Create templated slide + echo EOL . date('H:i:s') . ' Create templated slide' . EOL; + $currentSlide = createTemplatedSlide($objPHPPowerPoint); + + // Create a line chart (that should be inserted in a shape) + echo date('H:i:s') . ' Create a area chart (that should be inserted in a chart shape)' . EOL; + $areaChart = new Area(); + $series = new Series('Downloads', $seriesData); + $series->setShowSeriesName(true); + $series->setShowValue(true); + $series->getFill()->setStartColor(new Color('FF93A9CE')); + $areaChart->addSeries($series); + + // Create a shape (chart) + echo date('H:i:s') . ' Create a shape (chart)' . EOL; + $shape = $currentSlide->createChartShape(); + $shape->setName('PHPPowerPoint Daily Downloads')->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); + $shape->setShadow($oShadow); + $shape->setFill($oFill); + $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); + $shape->getTitle()->getFont()->setItalic(true); + $shape->getPlotArea()->setType($areaChart); + $shape->getView3D()->setRotationX(30); + $shape->getView3D()->setPerspective(30); + $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getLegend()->getFont()->setItalic(true); +} + +function fnSlide_Bar3D(PhpPowerpoint $objPHPPowerPoint) { + global $oFill; + global $oShadow; + + // Create templated slide + echo EOL.date('H:i:s') . ' Create templated slide'.EOL; + $currentSlide = createTemplatedSlide($objPHPPowerPoint); + + // Generate sample data for first chart + echo date('H:i:s') . ' Generate sample data for first chart'.EOL; + $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293); + $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379); + + // Create a bar chart (that should be inserted in a shape) + echo date('H:i:s') . ' Create a bar chart (that should be inserted in a chart shape)'.EOL; + $bar3DChart = new Bar3D(); + $series1 = new Series('2009', $series1Data); + $series1->setShowSeriesName(true); + $series1->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4F81BD')); + $series1->getFont()->getColor()->setRGB('00FF00'); + $series1->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20')); + $series2 = new Series('2010', $series2Data); + $series2->setShowSeriesName(true); + $series2->getFont()->getColor()->setRGB('FF0000'); + $series2->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFC0504D')); + $bar3DChart->addSeries($series1); + $bar3DChart->addSeries($series2); + + // Create a shape (chart) + echo date('H:i:s') . ' Create a shape (chart)'.EOL; + $shape = $currentSlide->createChartShape(); + $shape->setName('PHPPowerPoint Monthly Downloads') + ->setResizeProportional(false) + ->setHeight(550) + ->setWidth(700) + ->setOffsetX(120) + ->setOffsetY(80); + $shape->setShadow($oShadow); + $shape->setFill($oFill); + $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); + $shape->getTitle()->getFont()->setItalic(true); + $shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); + $shape->getPlotArea()->getAxisX()->setTitle('Month'); + $shape->getPlotArea()->getAxisY()->setTitle('Downloads'); + $shape->getPlotArea()->setType($bar3DChart); + $shape->getView3D()->setRightAngleAxes(true); + $shape->getView3D()->setRotationX(20); + $shape->getView3D()->setRotationY(20); + $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getLegend()->getFont()->setItalic(true); +} + +function fnSlide_Bar3DHorizontal(PhpPowerpoint $objPHPPowerPoint) { + global $oFill; + global $oShadow; + + // Create a bar chart (that should be inserted in a shape) + echo date('H:i:s') . ' Create a horizontal bar chart (that should be inserted in a chart shape) '.EOL; + $bar3DChartHorz = $objPHPPowerPoint->getSlide(1)->getShapeCollection()->offsetGet(1)->getPlotArea()->getType(); + //$bar3DChartHorz->setBarDirection(Bar3D::DIRECTION_HORIZONTAL); + + // Create templated slide + echo EOL.date('H:i:s') . ' Create templated slide'.EOL; + $currentSlide = createTemplatedSlide($objPHPPowerPoint); + + // Create a shape (chart) + echo date('H:i:s') . ' Create a shape (chart)'.EOL; + $shape = $currentSlide->createChartShape(); + $shape->setName('PHPPowerPoint Monthly Downloads') + ->setResizeProportional(false) + ->setHeight(550) + ->setWidth(700) + ->setOffsetX(120) + ->setOffsetY(80); + $shape->setShadow($oShadow); + $shape->setFill($oFill); + $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); + $shape->getTitle()->getFont()->setItalic(true); + $shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); + $shape->getPlotArea()->getAxisX()->setTitle('Month'); + $shape->getPlotArea()->getAxisY()->setTitle('Downloads'); + $shape->getPlotArea()->setType($bar3DChartHorz); + $shape->getView3D()->setRightAngleAxes(true); + $shape->getView3D()->setRotationX(20); + $shape->getView3D()->setRotationY(20); + $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getLegend()->getFont()->setItalic(true); +} + +function fnSlide_Pie3D(PhpPowerpoint $objPHPPowerPoint) { + global $oFill; + global $oShadow; + + // Create templated slide + echo EOL.date('H:i:s') . ' Create templated slide'.EOL; + $currentSlide = createTemplatedSlide($objPHPPowerPoint); + + // Generate sample data for second chart + echo date('H:i:s') . ' Generate sample data for second chart'.EOL; + $seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7); + + // Create a pie chart (that should be inserted in a shape) + echo date('H:i:s') . ' Create a pie chart (that should be inserted in a chart shape)'.EOL; + $pie3DChart = new Pie3D(); + $pie3DChart->setExplosion(20); + $series = new Series('Downloads', $seriesData); + $series->setShowSeriesName(true); + $series->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8')); + $series->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744')); + $series->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F')); + $series->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF725990')); + $series->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4299B0')); + $series->getDataPointFill(5)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFDC853E')); + $series->getDataPointFill(6)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF93A9CE')); + $pie3DChart->addSeries($series); + + // Create a shape (chart) + echo date('H:i:s') . ' Create a shape (chart)'.EOL; + $shape = $currentSlide->createChartShape(); + $shape->setName('PHPPowerPoint Daily Downloads') + ->setResizeProportional(false) + ->setHeight(550) + ->setWidth(700) + ->setOffsetX(120) + ->setOffsetY(80); + $shape->setShadow($oShadow); + $shape->setFill($oFill); + $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); + $shape->getTitle()->getFont()->setItalic(true); + $shape->getPlotArea()->setType($pie3DChart); + $shape->getView3D()->setRotationX(30); + $shape->getView3D()->setPerspective(30); + $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getLegend()->getFont()->setItalic(true); +} + +function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { + global $oFill; + global $oShadow; + + // Create templated slide + echo EOL.date('H:i:s') . ' Create templated slide'.EOL; + $currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function + + // Generate sample data for fourth chart + echo date('H:i:s') . ' Generate sample data for fourth chart'.EOL; + $seriesData = array('Monday' => 0.1, 'Tuesday' => 0.33333, 'Wednesday' => 0.4444, 'Thursday' => 0.5, 'Friday' => 0.4666, 'Saturday' => 0.3666, 'Sunday' => 0.1666); + + // Create a scatter chart (that should be inserted in a shape) + echo date('H:i:s') . ' Create a scatter chart (that should be inserted in a chart shape)'.EOL; + $lineChart = new Scatter(); + $series = new Series('Downloads', $seriesData); + $series->setShowSeriesName(true); + $lineChart->addSeries($series); + + // Create a shape (chart) + echo date('H:i:s') . ' Create a shape (chart)'.EOL; + $shape = $currentSlide->createChartShape(); + $shape->setName('PHPPowerPoint Daily Download Distribution') + ->setResizeProportional(false) + ->setHeight(550) + ->setWidth(700) + ->setOffsetX(120) + ->setOffsetY(80); + $shape->setShadow($oShadow); + $shape->setFill($oFill); + $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); + $shape->getTitle()->getFont()->setItalic(true); + $shape->getPlotArea()->setType($lineChart); + $shape->getView3D()->setRotationX(30); + $shape->getView3D()->setPerspective(30); + $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getLegend()->getFont()->setItalic(true); +} + +// Create new PHPPowerPoint object +echo date('H:i:s') . ' Create new PHPPowerPoint object'.EOL; +$objPHPPowerPoint = new PhpPowerpoint(); + +// Set properties +echo date('H:i:s') . ' Set properties'.EOL; +$objPHPPowerPoint->getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPowerPoint Team') + ->setTitle('Sample 07 Title') + ->setSubject('Sample 07 Subject') + ->setDescription('Sample 07 Description') + ->setKeywords('office 2007 openxml libreoffice odt php') + ->setCategory('Sample Category'); + +// Remove first slide +echo date('H:i:s') . ' Remove first slide'.EOL; +$objPHPPowerPoint->removeSlideByIndex(0); + +// Set Style +$oFill = new Fill(); +$oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20')); + +$oShadow = new Shadow(); +$oShadow->setVisible(true)->setDirection(45)->setDistance(10); + +fnSlide_Area($objPHPPowerPoint); + +fnSlide_Bar3D($objPHPPowerPoint); + +fnSlide_Bar3DHorizontal($objPHPPowerPoint); + +fnSlide_Pie3D($objPHPPowerPoint); + +fnSlide_Scatter($objPHPPowerPoint); + +// Save file +echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/samples/Sample_07_Chart_Line.php b/samples/Sample_05_Chart_Line.php similarity index 53% rename from samples/Sample_07_Chart_Line.php rename to samples/Sample_05_Chart_Line.php index 534b1e815..66eae16ae 100644 --- a/samples/Sample_07_Chart_Line.php +++ b/samples/Sample_05_Chart_Line.php @@ -15,21 +15,15 @@ use PhpOffice\PhpPowerpoint\Style\Shadow; // Create new PHPPowerPoint object -echo date('H:i:s') . ' Create new PHPPowerPoint object'.EOL; +echo date('H:i:s') . ' Create new PHPPowerPoint object' . EOL; $objPHPPowerPoint = new PhpPowerpoint(); // Set properties -echo date('H:i:s') . ' Set properties'.EOL; -$objPHPPowerPoint->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') - ->setTitle('Sample 07 Title') - ->setSubject('Sample 07 Subject') - ->setDescription('Sample 07 Description') - ->setKeywords('office 2007 openxml libreoffice odt php') - ->setCategory('Sample Category'); +echo date('H:i:s') . ' Set properties' . EOL; +$objPHPPowerPoint->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPowerPoint Team')->setTitle('Sample 07 Title')->setSubject('Sample 07 Subject')->setDescription('Sample 07 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category'); // Remove first slide -echo date('H:i:s') . ' Remove first slide'.EOL; +echo date('H:i:s') . ' Remove first slide' . EOL; $objPHPPowerPoint->removeSlideByIndex(0); // Set Style @@ -40,15 +34,23 @@ $oShadow->setVisible(true)->setDirection(45)->setDistance(10); // Generate sample data for chart -echo date('H:i:s') . ' Generate sample data for chart'.EOL; -$seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7); +echo date('H:i:s') . ' Generate sample data for chart' . EOL; +$seriesData = array( + 'Monday' => 12, + 'Tuesday' => 15, + 'Wednesday' => 13, + 'Thursday' => 17, + 'Friday' => 14, + 'Saturday' => 9, + 'Sunday' => 7 +); // Create templated slide -echo EOL.date('H:i:s') . ' Create templated slide'.EOL; +echo EOL . date('H:i:s') . ' Create templated slide' . EOL; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // Create a line chart (that should be inserted in a shape) -echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)'.EOL; +echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)' . EOL; $lineChart = new Line(); $series = new Series('Downloads', $seriesData); $series->setShowSeriesName(true); @@ -56,14 +58,9 @@ $lineChart->addSeries($series); // Create a shape (chart) -echo date('H:i:s') . ' Create a shape (chart)'.EOL; +echo date('H:i:s') . ' Create a shape (chart)' . EOL; $shape = $currentSlide->createChartShape(); -$shape->setName('PHPPowerPoint Daily Downloads') - ->setResizeProportional(false) - ->setHeight(550) - ->setWidth(700) - ->setOffsetX(120) - ->setOffsetY(80); +$shape->setName('PHPPowerPoint Daily Downloads')->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $shape->setShadow($oShadow); $shape->setFill($oFill); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); @@ -76,16 +73,16 @@ $shape->getLegend()->getFont()->setItalic(true); // Create templated slide -echo EOL.date('H:i:s') . ' Create templated slide'.EOL; +echo EOL . date('H:i:s') . ' Create templated slide' . EOL; $currentSlide = createTemplatedSlide($objPHPPowerPoint); // Create a line chart (that should be inserted in a shape) -echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)'.EOL; +echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)' . EOL; $lineChart1 = clone $lineChart; // Create a shape (chart) -echo date('H:i:s') . ' Create a shape (chart)'.EOL; -echo date('H:i:s') . ' Differences with previous : Values on right axis and Legend hidden'.EOL; +echo date('H:i:s') . ' Create a shape (chart)' . EOL; +echo date('H:i:s') . ' Differences with previous : Values on right axis and Legend hidden' . EOL; $shape1 = clone $shape; $shape1->getLegend()->setVisible(false); $shape1->setName('PHPPowerPoint Weekly Downloads'); @@ -94,9 +91,31 @@ $shape1->getPlotArea()->getAxisY()->setFormatCode('#,##0'); $currentSlide->addShape($shape1); +// Create templated slide +echo EOL . date('H:i:s') . ' Create templated slide' . EOL; +$currentSlide = createTemplatedSlide($objPHPPowerPoint); + +// Create a line chart (that should be inserted in a shape) +echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)' . EOL; +$lineChart2 = clone $lineChart; +$series2 = $lineChart2->getData(); +$series2[0]->getFill()->setFillType(Fill::FILL_SOLID); +$lineChart2->setData($series2); + +// Create a shape (chart) +echo date('H:i:s') . ' Create a shape (chart)' . EOL; +echo date('H:i:s') . ' Differences with previous : Values on right axis and Legend hidden' . EOL; +$shape2 = clone $shape; +$shape2->getLegend()->setVisible(false); +$shape2->setName('PHPPowerPoint Weekly Downloads'); +$shape2->getTitle()->setText('PHPPowerPoint Weekly Downloads'); +$shape2->getPlotArea()->setType($lineChart2); +$shape2->getPlotArea()->getAxisY()->setFormatCode('#,##0'); +$currentSlide->addShape($shape2); + // Save file -echo EOL.write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +echo EOL . write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); if (!CLI) { - include_once 'Sample_Footer.php'; + include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_08_Chart_with_PHPExcel.php b/samples/Sample_05_Chart_with_PHPExcel.php similarity index 100% rename from samples/Sample_08_Chart_with_PHPExcel.php rename to samples/Sample_05_Chart_with_PHPExcel.php diff --git a/samples/Sample_09_Fill.php b/samples/Sample_06_Fill.php similarity index 70% rename from samples/Sample_09_Fill.php rename to samples/Sample_06_Fill.php index d1427dd5c..f4322e209 100644 --- a/samples/Sample_09_Fill.php +++ b/samples/Sample_06_Fill.php @@ -38,25 +38,25 @@ $shape->setOffsetX(320); } if($inc == 1 || $inc == 2){ - $shape->setOffsetY(10); + $shape->setOffsetY(10); } else { - $shape->setOffsetY(220); + $shape->setOffsetY(220); } $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); switch ($inc) { - case 1 : - $shape->getFill()->setFillType(Fill::FILL_NONE); - break; - case 2 : - $shape->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR)->setRotation(90)->setStartColor(new Color( 'FF4672A8' ))->setEndColor(new Color( 'FF000000' )); - break; - case 3 : - $shape->getFill()->setFillType(Fill::FILL_GRADIENT_PATH)->setRotation(90)->setStartColor(new Color( 'FF4672A8' ))->setEndColor(new Color( 'FF000000' )); - break; - case 4 : - $shape->getFill()->setFillType(Fill::FILL_SOLID)->setRotation(90)->setStartColor(new Color( 'FF4672A8' ))->setEndColor(new Color( 'FF4672A8' )); - break; + case 1 : + $shape->getFill()->setFillType(Fill::FILL_NONE); + break; + case 2 : + $shape->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR)->setRotation(90)->setStartColor(new Color( 'FF4672A8' ))->setEndColor(new Color( 'FF000000' )); + break; + case 3 : + $shape->getFill()->setFillType(Fill::FILL_GRADIENT_PATH)->setRotation(90)->setStartColor(new Color( 'FF4672A8' ))->setEndColor(new Color( 'FF000000' )); + break; + case 4 : + $shape->getFill()->setFillType(Fill::FILL_SOLID)->setRotation(90)->setStartColor(new Color( 'FF4672A8' ))->setEndColor(new Color( 'FF4672A8' )); + break; } $textRun = $shape->createTextRun('Use PHPPowerPoint!'); @@ -68,5 +68,5 @@ // Save file echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); if (!CLI) { - include_once 'Sample_Footer.php'; + include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_10_Border.php b/samples/Sample_07_Border.php similarity index 100% rename from samples/Sample_10_Border.php rename to samples/Sample_07_Border.php diff --git a/samples/Sample_07_Chart.php b/samples/Sample_07_Chart.php deleted file mode 100644 index 0b904f8a1..000000000 --- a/samples/Sample_07_Chart.php +++ /dev/null @@ -1,206 +0,0 @@ -getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPPowerPoint Team') - ->setTitle('Sample 07 Title') - ->setSubject('Sample 07 Subject') - ->setDescription('Sample 07 Description') - ->setKeywords('office 2007 openxml libreoffice odt php') - ->setCategory('Sample Category'); - -// Remove first slide -echo date('H:i:s') . ' Remove first slide'.EOL; -$objPHPPowerPoint->removeSlideByIndex(0); - -// Set Style -$oFill = new Fill(); -$oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20')); - -$oShadow = new Shadow(); -$oShadow->setVisible(true)->setDirection(45)->setDistance(10); - -// Create templated slide -echo EOL.date('H:i:s') . ' Create templated slide'.EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); - -// Generate sample data for first chart -echo date('H:i:s') . ' Generate sample data for first chart'.EOL; -$series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293); -$series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379); - -// Create a bar chart (that should be inserted in a shape) -echo date('H:i:s') . ' Create a bar chart (that should be inserted in a chart shape)'.EOL; -$bar3DChart = new Bar3D(); -$series1 = new Series('2009', $series1Data); -$series1->setShowSeriesName(true); -$series1->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4F81BD')); -$series1->getFont()->getColor()->setRGB('00FF00'); -$series1->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20')); -$series2 = new Series('2010', $series2Data); -$series2->setShowSeriesName(true); -$series2->getFont()->getColor()->setRGB('FF0000'); -$series2->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFC0504D')); -$bar3DChart->addSeries($series1); -$bar3DChart->addSeries($series2); - -// Create a shape (chart) -echo date('H:i:s') . ' Create a shape (chart)'.EOL; -$shape = $currentSlide->createChartShape(); -$shape->setName('PHPPowerPoint Monthly Downloads') - ->setResizeProportional(false) - ->setHeight(550) - ->setWidth(700) - ->setOffsetX(120) - ->setOffsetY(80); -$shape->setShadow($oShadow); -$shape->setFill($oFill); -$shape->getBorder()->setLineStyle(Border::LINE_SINGLE); -$shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); -$shape->getTitle()->getFont()->setItalic(true); -$shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); -$shape->getPlotArea()->getAxisX()->setTitle('Month'); -$shape->getPlotArea()->getAxisY()->setTitle('Downloads'); -$shape->getPlotArea()->setType($bar3DChart); -$shape->getView3D()->setRightAngleAxes(true); -$shape->getView3D()->setRotationX(20); -$shape->getView3D()->setRotationY(20); -$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); -$shape->getLegend()->getFont()->setItalic(true); - - -// Create templated slide -echo EOL.date('H:i:s') . ' Create templated slide'.EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); - -// Create a bar chart (that should be inserted in a shape) -echo date('H:i:s') . ' Create a horizontal bar chart (that should be inserted in a chart shape) '.EOL; -$bar3DChartHorz = clone $bar3DChart; -$bar3DChartHorz->setBarDirection(Bar3D::DIRECTION_HORIZONTAL); - -// Create a shape (chart) -echo date('H:i:s') . ' Create a shape (chart)'.EOL; -$shape = $currentSlide->createChartShape(); -$shape->setName('PHPPowerPoint Monthly Downloads') - ->setResizeProportional(false) - ->setHeight(550) - ->setWidth(700) - ->setOffsetX(120) - ->setOffsetY(80); -$shape->setShadow($oShadow); -$shape->setFill($oFill); -$shape->getBorder()->setLineStyle(Border::LINE_SINGLE); -$shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); -$shape->getTitle()->getFont()->setItalic(true); -$shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); -$shape->getPlotArea()->getAxisX()->setTitle('Month'); -$shape->getPlotArea()->getAxisY()->setTitle('Downloads'); -$shape->getPlotArea()->setType($bar3DChartHorz); -$shape->getView3D()->setRightAngleAxes(true); -$shape->getView3D()->setRotationX(20); -$shape->getView3D()->setRotationY(20); -$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); -$shape->getLegend()->getFont()->setItalic(true); - -// Create templated slide -echo EOL.date('H:i:s') . ' Create templated slide'.EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); - -// Generate sample data for second chart -echo date('H:i:s') . ' Generate sample data for second chart'.EOL; -$seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7); - -// Create a pie chart (that should be inserted in a shape) -echo date('H:i:s') . ' Create a pie chart (that should be inserted in a chart shape)'.EOL; -$pie3DChart = new Pie3D(); -$pie3DChart->setExplosion(20); -$series = new Series('Downloads', $seriesData); -$series->setShowSeriesName(true); -$series->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8')); -$series->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744')); -$series->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F')); -$series->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF725990')); -$series->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4299B0')); -$series->getDataPointFill(5)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFDC853E')); -$series->getDataPointFill(6)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF93A9CE')); -$pie3DChart->addSeries($series); - -// Create a shape (chart) -echo date('H:i:s') . ' Create a shape (chart)'.EOL; -$shape = $currentSlide->createChartShape(); -$shape->setName('PHPPowerPoint Daily Downloads') - ->setResizeProportional(false) - ->setHeight(550) - ->setWidth(700) - ->setOffsetX(120) - ->setOffsetY(80); -$shape->setShadow($oShadow); -$shape->setFill($oFill); -$shape->getBorder()->setLineStyle(Border::LINE_SINGLE); -$shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); -$shape->getTitle()->getFont()->setItalic(true); -$shape->getPlotArea()->setType($pie3DChart); -$shape->getView3D()->setRotationX(30); -$shape->getView3D()->setPerspective(30); -$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); -$shape->getLegend()->getFont()->setItalic(true); - -// Create templated slide -echo EOL.date('H:i:s') . ' Create templated slide'.EOL; -$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function - -// Generate sample data for fourth chart -echo date('H:i:s') . ' Generate sample data for fourth chart'.EOL; -$seriesData = array('Monday' => 0.1, 'Tuesday' => 0.33333, 'Wednesday' => 0.4444, 'Thursday' => 0.5, 'Friday' => 0.4666, 'Saturday' => 0.3666, 'Sunday' => 0.1666); - -// Create a scatter chart (that should be inserted in a shape) -echo date('H:i:s') . ' Create a scatter chart (that should be inserted in a chart shape)'.EOL; -$lineChart = new Scatter(); -$series = new Series('Downloads', $seriesData); -$series->setShowSeriesName(true); -$lineChart->addSeries($series); - -// Create a shape (chart) -echo date('H:i:s') . ' Create a shape (chart)'.EOL; -$shape = $currentSlide->createChartShape(); -$shape->setName('PHPPowerPoint Daily Download Distribution') - ->setResizeProportional(false) - ->setHeight(550) - ->setWidth(700) - ->setOffsetX(120) - ->setOffsetY(80); -$shape->setShadow($oShadow); -$shape->setFill($oFill); -$shape->getBorder()->setLineStyle(Border::LINE_SINGLE); -$shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); -$shape->getTitle()->getFont()->setItalic(true); -$shape->getPlotArea()->setType($lineChart); -$shape->getView3D()->setRotationX(30); -$shape->getView3D()->setPerspective(30); -$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); -$shape->getLegend()->getFont()->setItalic(true); - -// Save file -echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); -if (!CLI) { - include_once 'Sample_Footer.php'; -} diff --git a/samples/Sample_11_Group.php b/samples/Sample_08_Group.php similarity index 100% rename from samples/Sample_11_Group.php rename to samples/Sample_08_Group.php diff --git a/samples/Sample_12_SlideNote.php b/samples/Sample_09_SlideNote.php similarity index 100% rename from samples/Sample_12_SlideNote.php rename to samples/Sample_09_SlideNote.php diff --git a/samples/Sample_02_Presentation.php b/samples/Sample_X2_Presentation.php similarity index 100% rename from samples/Sample_02_Presentation.php rename to samples/Sample_X2_Presentation.php diff --git a/samples/Sample_05_Templated.php b/samples/Sample_X5_Templated.php similarity index 100% rename from samples/Sample_05_Templated.php rename to samples/Sample_X5_Templated.php From be4de546d028c337b68feffbbc164d486193e0f8 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 12 Jun 2015 19:59:19 +0200 Subject: [PATCH 058/115] PowerPoint2007 Writer : Support for Area Chart - @Progi1984 GH-82 --- .gitignore | 1 + CHANGELOG.md | 1 + samples/.gitignore | 4 - samples/Sample_Header.php | 2 +- .../Writer/PowerPoint2007/Chart.php | 180 +++++++++++++++++- .../Writer/PowerPoint2007/ChartAreaTest.php | 77 ++++++++ 6 files changed, 259 insertions(+), 6 deletions(-) delete mode 100644 samples/.gitignore create mode 100644 tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php diff --git a/.gitignore b/.gitignore index c6b3da4e8..4f302c6ba 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ vendor /samples/#47 /samples/#70 /samples/#71 +/samples/Github_*.* diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ea6f9037..747c808f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - ODPresentation Writer : Support for fill in RichText - @Progi1984 GH-79 - ODPresentation Writer : Support for border style in RichText - @Progi1984 GH-79 - ODPresentation Writer : Support for Area Chart - @Progi1984 GH-82 +- PowerPoint2007 Writer : Support for Area Chart - @Progi1984 GH-82 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/samples/.gitignore b/samples/.gitignore deleted file mode 100644 index 9ca351d81..000000000 --- a/samples/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ - -*.odp -*.pptx -*.phppt \ No newline at end of file diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index 4871f6c87..6c2530dd0 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -44,7 +44,7 @@ /** * Write documents * - * @param \PhpOffice\PhpWord\PhpWord $phpWord + * @param \PhpOffice\PhpPowerPoint\PhpPowerPoint $phpPowerPoint * @param string $filename * @param array $writers */ diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 5b295d574..6c7046de2 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -21,6 +21,7 @@ use PhpOffice\PhpPowerpoint\Shape\Chart\Legend; use PhpOffice\PhpPowerpoint\Shape\Chart\PlotArea; use PhpOffice\PhpPowerpoint\Shape\Chart\Title; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; @@ -498,7 +499,9 @@ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeC // Write chart $chartType = $subject->getType(); - if ($chartType instanceof Bar3D) { + if ($chartType instanceof Area) { + $this->writeTypeArea($objWriter, $chartType, $chart->hasIncludedSpreadsheet()); + } elseif ($chartType instanceof Bar3D) { $this->writeTypeBar3D($objWriter, $chartType, $chart->hasIncludedSpreadsheet()); } elseif ($chartType instanceof Pie3D) { $this->writeTypePie3D($objWriter, $chartType, $chart->hasIncludedSpreadsheet()); @@ -893,6 +896,181 @@ protected function writeLayout(XMLWriter $objWriter, $subject) $objWriter->endElement(); } + /** + * Write Type Line + * + * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area $subject + * @param boolean $includeSheet + * @throws \Exception + */ + protected function writeTypeArea(XMLWriter $objWriter, Area $subject, $includeSheet = false) + { + // c:lineChart + $objWriter->startElement('c:areaChart'); + + // c:grouping + $objWriter->startElement('c:grouping'); + $objWriter->writeAttribute('val', 'standard'); + $objWriter->endElement(); + + // Write series + $seriesIndex = 0; + foreach ($subject->getData() as $series) { + // c:ser + $objWriter->startElement('c:ser'); + + // c:idx + $objWriter->startElement('c:idx'); + $objWriter->writeAttribute('val', $seriesIndex); + $objWriter->endElement(); + + // c:order + $objWriter->startElement('c:order'); + $objWriter->writeAttribute('val', $seriesIndex); + $objWriter->endElement(); + + // c:tx + $objWriter->startElement('c:tx'); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); + $this->writeSingleValueOrReference($objWriter, $includeSheet, $series->getTitle(), $coords); + $objWriter->endElement(); + + // c:dLbls + $objWriter->startElement('c:dLbls'); + + // c:txPr + $objWriter->startElement('c:txPr'); + + // a:bodyPr + $objWriter->writeElement('a:bodyPr', null); + + // a:lstStyle + $objWriter->writeElement('a:lstStyle', null); + + // a:p + $objWriter->startElement('a:p'); + + // a:pPr + $objWriter->startElement('a:pPr'); + + // a:defRPr + $objWriter->startElement('a:defRPr'); + + $objWriter->writeAttribute('b', ($series->getFont()->isBold() ? 'true' : 'false')); + $objWriter->writeAttribute('i', ($series->getFont()->isItalic() ? 'true' : 'false')); + $objWriter->writeAttribute('strike', ($series->getFont()->isStrikethrough() ? 'sngStrike' : 'noStrike')); + $objWriter->writeAttribute('sz', ($series->getFont()->getSize() * 100)); + $objWriter->writeAttribute('u', $series->getFont()->getUnderline()); + + if ($series->getFont()->isSuperScript() || $series->getFont()->isSubScript()) { + if ($series->getFont()->isSuperScript()) { + $objWriter->writeAttribute('baseline', '30000'); + } elseif ($series->getFont()->isSubScript()) { + $objWriter->writeAttribute('baseline', '-25000'); + } + } + + // Font - a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', $series->getFont()->getColor()->getRGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Font - a:latin + $objWriter->startElement('a:latin'); + $objWriter->writeAttribute('typeface', $series->getFont()->getName()); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:endParaRPr + $objWriter->startElement('a:endParaRPr'); + $objWriter->writeAttribute('lang', 'en-US'); + $objWriter->writeAttribute('dirty', '0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // c:showVal + $this->writeElementWithValAttribute($objWriter, 'c:showVal', $series->hasShowValue() ? '1' : '0'); + + // c:showCatName + $this->writeElementWithValAttribute($objWriter, 'c:showCatName', $series->hasShowCategoryName() ? '1' : '0'); + + // c:showSerName + $this->writeElementWithValAttribute($objWriter, 'c:showSerName', $series->hasShowSeriesName() ? '1' : '0'); + + // c:showPercent + $this->writeElementWithValAttribute($objWriter, 'c:showPercent', $series->hasShowPercentage() ? '1' : '0'); + + // c:showLeaderLines + $this->writeElementWithValAttribute($objWriter, 'c:showLeaderLines', $series->hasShowLeaderLines() ? '1' : '0'); + + $objWriter->endElement(); + + if ($series->getFill()->getFillType() != Fill::FILL_NONE) { + // c:spPr + $objWriter->startElement('c:spPr'); + // Write fill + $this->writeFill($objWriter, $series->getFill()); + // ## c:spPr + $objWriter->endElement(); + } + + // Write X axis data + $axisXData = array_keys($series->getValues()); + + // c:cat + $objWriter->startElement('c:cat'); + $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisXData, 'Sheet1!$A$2:$A$' . (1 + count($axisXData))); + $objWriter->endElement(); + + // Write Y axis data + $axisYData = array_values($series->getValues()); + + // c:val + $objWriter->startElement('c:val'); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); + $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisYData, $coords); + $objWriter->endElement(); + + $objWriter->endElement(); + + ++$seriesIndex; + } + + // c:marker + $objWriter->startElement('c:marker'); + $objWriter->writeAttribute('val', '1'); + $objWriter->endElement(); + + // c:smooth + $objWriter->startElement('c:smooth'); + $objWriter->writeAttribute('val', '0'); + $objWriter->endElement(); + + // c:axId + $objWriter->startElement('c:axId'); + $objWriter->writeAttribute('val', '52743552'); + $objWriter->endElement(); + + // c:axId + $objWriter->startElement('c:axId'); + $objWriter->writeAttribute('val', '52749440'); + $objWriter->endElement(); + + $objWriter->endElement(); + } + /** * Write Type Bar3D * diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php new file mode 100644 index 000000000..b20f4c1b9 --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php @@ -0,0 +1,77 @@ + 1, + 'B' => 2, + 'C' => 4, + 'D' => 3, + 'E' => 2, + ); + + $oPHPPowerPoint = new PhpPowerpoint(); + $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oShape = $oSlide->createChartShape(); + $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); + $oArea = new Area(); + $oSeries = new Series('Downloads', $seriesData); + $oSeries->getFill()->setStartColor(new Color('FFAABBCC')); + $oArea->addSeries($oSeries); + $oShape->getPlotArea()->setType($oArea); + + $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); + $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:dPt/c:spPr'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:tx/c:v'; + $this->assertEquals($oSeries->getTitle(), $oXMLDoc->getElement($element, 'ppt/charts/'.$oShape->getIndexedFilename())->nodeValue); + } +} From 9800da55e6c60e0218111e5c9742f8b48da9c4b8 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 12 Jun 2015 20:21:12 +0200 Subject: [PATCH 059/115] PowerPoint2007 Writer : Support for Area Chart - @Progi1984 GH-82 --- .../PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php index b20f4c1b9..4496e4320 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php @@ -69,7 +69,7 @@ public function testTypeArea() $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); - $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:dPt/c:spPr'; + $element = '/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:tx/c:v'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:tx/c:v'; $this->assertEquals($oSeries->getTitle(), $oXMLDoc->getElement($element, 'ppt/charts/'.$oShape->getIndexedFilename())->nodeValue); From 2b38819fadf3ec0213a8df00a5c1afd82dd855b5 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 12 Jun 2015 21:06:12 +0200 Subject: [PATCH 060/115] PowerPoint2007 Writer : Support for Area Chart - @Progi1984 GH-82 --- .../Tests/Writer/PowerPoint2007/ChartAreaTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php index 4496e4320..afb6edb59 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartAreaTest.php @@ -69,9 +69,5 @@ public function testTypeArea() $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); - $element = '/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:tx/c:v'; - $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); - $element = '/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:tx/c:v'; - $this->assertEquals($oSeries->getTitle(), $oXMLDoc->getElement($element, 'ppt/charts/'.$oShape->getIndexedFilename())->nodeValue); } } From cba4ff5bbbbf3f67212d47131f1fa86a4dd0b580 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 12 Jun 2015 22:23:38 +0200 Subject: [PATCH 061/115] ODPresentation & PowerPoint2007 Writer : Support for Bar Chart - @Progi1984 GH-82 --- composer.lock | 865 +++++++++--------- samples/Sample_05_Chart.php | 112 ++- src/PhpPowerpoint/Shape/Chart/Type/Bar.php | 73 ++ .../Writer/ODPresentation/ObjectsChart.php | 17 +- .../Writer/PowerPoint2007/Chart.php | 210 +++++ .../Tests/Shape/Chart/Type/BarTest.php | 75 ++ .../Writer/ODPresentation/ChartBarTest.php | 104 +++ .../Writer/ODPresentation/ChartsTest.php | 8 + .../Writer/PowerPoint2007/ChartBarTest.php | 81 ++ 9 files changed, 1119 insertions(+), 426 deletions(-) create mode 100644 src/PhpPowerpoint/Shape/Chart/Type/Bar.php create mode 100644 tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php create mode 100644 tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartBarTest.php create mode 100644 tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartBarTest.php diff --git a/composer.lock b/composer.lock index 37ef2789a..a02ddf9c6 100644 --- a/composer.lock +++ b/composer.lock @@ -127,16 +127,16 @@ }, { "name": "doctrine/annotations", - "version": "v1.2.3", + "version": "v1.2.4", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "eeda578cbe24a170331a1cfdf78be723412df7a4" + "reference": "b5202eb9e83f8db52e0e58867e0a46e63be8332e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/eeda578cbe24a170331a1cfdf78be723412df7a4", - "reference": "eeda578cbe24a170331a1cfdf78be723412df7a4", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/b5202eb9e83f8db52e0e58867e0a46e63be8332e", + "reference": "b5202eb9e83f8db52e0e58867e0a46e63be8332e", "shasum": "" }, "require": { @@ -191,7 +191,7 @@ "docblock", "parser" ], - "time": "2014-12-20 20:49:38" + "time": "2014-12-23 22:40:37" }, { "name": "doctrine/lexer", @@ -290,16 +290,16 @@ }, { "name": "erusev/parsedown", - "version": "1.1.4", + "version": "1.5.3", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "495e7ac73bb5fde6b857b88ff2bb1b5e79a4263a" + "reference": "b9e5228e92e5f5c17d7774cfb2de8e5e8362de1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/495e7ac73bb5fde6b857b88ff2bb1b5e79a4263a", - "reference": "495e7ac73bb5fde6b857b88ff2bb1b5e79a4263a", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/b9e5228e92e5f5c17d7774cfb2de8e5e8362de1a", + "reference": "b9e5228e92e5f5c17d7774cfb2de8e5e8362de1a", "shasum": "" }, "type": "library", @@ -325,7 +325,7 @@ "markdown", "parser" ], - "time": "2014-11-29 02:29:14" + "time": "2015-04-29 20:22:24" }, { "name": "herrera-io/json", @@ -586,9 +586,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -605,16 +605,16 @@ }, { "name": "justinrainbow/json-schema", - "version": "1.3.7", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "87b54b460febed69726c781ab67462084e97a105" + "reference": "2465fe486c864e30badaa4d005ebdf89dbc503f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/87b54b460febed69726c781ab67462084e97a105", - "reference": "87b54b460febed69726c781ab67462084e97a105", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2465fe486c864e30badaa4d005ebdf89dbc503f3", + "reference": "2465fe486c864e30badaa4d005ebdf89dbc503f3", "shasum": "" }, "require": { @@ -667,7 +667,7 @@ "json", "schema" ], - "time": "2014-08-25 02:48:14" + "time": "2015-03-27 16:41:39" }, { "name": "kherge/version", @@ -714,16 +714,16 @@ }, { "name": "monolog/monolog", - "version": "1.12.0", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f" + "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1fbe8c2641f2b163addf49cc5e18f144bec6b19f", - "reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c31a2c4e8db5da8b46c74cf275d7f109c0f249ac", + "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac", "shasum": "" }, "require": { @@ -740,6 +740,7 @@ "phpunit/phpunit": "~4.0", "raven/raven": "~0.5", "ruflin/elastica": "0.90.*", + "swiftmailer/swiftmailer": "~5.3", "videlalvaro/php-amqplib": "~2.4" }, "suggest": { @@ -756,7 +757,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12.x-dev" + "dev-master": "1.13.x-dev" } }, "autoload": { @@ -782,7 +783,7 @@ "logging", "psr-3" ], - "time": "2014-12-29 21:29:35" + "time": "2015-03-09 09:58:04" }, { "name": "nikic/php-parser", @@ -831,16 +832,16 @@ }, { "name": "pdepend/pdepend", - "version": "2.0.4", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/pdepend/pdepend.git", - "reference": "1b0acf162da4f30237987e61e177a57f78e3d87e" + "reference": "f58902a774449f73f1a1d9cd1a07aeac8fbee367" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/1b0acf162da4f30237987e61e177a57f78e3d87e", - "reference": "1b0acf162da4f30237987e61e177a57f78e3d87e", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/f58902a774449f73f1a1d9cd1a07aeac8fbee367", + "reference": "f58902a774449f73f1a1d9cd1a07aeac8fbee367", "shasum": "" }, "require": { @@ -866,7 +867,7 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2014-12-04 12:38:39" + "time": "2015-05-21 18:09:06" }, { "name": "phenx/php-font-lib", @@ -936,9 +937,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -1038,16 +1039,16 @@ }, { "name": "phpdocumentor/phpdocumentor", - "version": "v2.8.1", + "version": "v2.8.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/phpDocumentor2.git", - "reference": "5920dd42a5a92e4486f342ba8ded979db149ceb2" + "reference": "1c6a3bd696de9153a0d8596e2fc26cf866ac9c2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/phpDocumentor2/zipball/5920dd42a5a92e4486f342ba8ded979db149ceb2", - "reference": "5920dd42a5a92e4486f342ba8ded979db149ceb2", + "url": "https://api.github.com/repos/phpDocumentor/phpDocumentor2/zipball/1c6a3bd696de9153a0d8596e2fc26cf866ac9c2d", + "reference": "1c6a3bd696de9153a0d8596e2fc26cf866ac9c2d", "shasum": "" }, "require": { @@ -1088,7 +1089,7 @@ "zetacomponents/document": ">=1.3.1" }, "require-dev": { - "behat/behat": "~2.4", + "behat/behat": "~3.0", "mikey179/vfsstream": "~1.2", "mockery/mockery": "~0.9@dev", "phpunit/phpunit": "~4.0", @@ -1133,7 +1134,7 @@ "documentation", "phpdoc" ], - "time": "2014-11-11 14:08:43" + "time": "2015-02-22 17:09:31" }, { "name": "phpdocumentor/reflection", @@ -1191,27 +1192,27 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "38743b677965c48a637097b2746a281264ae2347" + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/38743b677965c48a637097b2746a281264ae2347", - "reference": "38743b677965c48a637097b2746a281264ae2347", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "3.7.*@stable" + "phpunit/phpunit": "~4.0" }, "suggest": { - "dflydev/markdown": "1.0.*", - "erusev/parsedown": "~0.7" + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" }, "type": "library", "extra": { @@ -1236,7 +1237,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2014-08-09 10:27:07" + "time": "2015-02-03 12:10:50" }, { "name": "phpdocumentor/template-abstract", @@ -1267,6 +1268,7 @@ "phpdoc", "template" ], + "abandoned": true, "time": "2014-06-04 19:32:56" }, { @@ -1424,6 +1426,7 @@ "phpdoc", "template" ], + "abandoned": true, "time": "2014-08-05 20:47:53" }, { @@ -1573,24 +1576,27 @@ }, { "name": "phploc/phploc", - "version": "2.0.6", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phploc.git", - "reference": "322ad07c112d5c6832abed4269d648cacff5959b" + "reference": "ab893cbe5c4b63760b1560b370fedc001eb5717f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phploc/zipball/322ad07c112d5c6832abed4269d648cacff5959b", - "reference": "322ad07c112d5c6832abed4269d648cacff5959b", + "url": "https://api.github.com/repos/sebastianbergmann/phploc/zipball/ab893cbe5c4b63760b1560b370fedc001eb5717f", + "reference": "ab893cbe5c4b63760b1560b370fedc001eb5717f", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/finder-facade": "~1.1", - "sebastian/git": "~1.0", - "sebastian/version": "~1.0", - "symfony/console": "~2.2" + "sebastian/git": "~2.0", + "sebastian/version": "~1.0.3", + "symfony/console": "~2.5" + }, + "require-dev": { + "phpunit/phpunit": "~4" }, "bin": [ "phploc" @@ -1598,7 +1604,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -1619,33 +1625,37 @@ ], "description": "A tool for quickly measuring the size of a PHP project.", "homepage": "https://github.com/sebastianbergmann/phploc", - "time": "2014-06-25 08:11:02" + "time": "2015-06-04 13:18:14" }, { "name": "phpmd/phpmd", - "version": "2.1.3", + "version": "2.2.3", "source": { "type": "git", "url": "https://github.com/phpmd/phpmd.git", - "reference": "1a485d9db869137af5e9678bd844568c92998b25" + "reference": "5eeb5a4d39c8304910b33ae49f8813905346cc35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/1a485d9db869137af5e9678bd844568c92998b25", - "reference": "1a485d9db869137af5e9678bd844568c92998b25", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/5eeb5a4d39c8304910b33ae49f8813905346cc35", + "reference": "5eeb5a4d39c8304910b33ae49f8813905346cc35", "shasum": "" }, "require": { - "pdepend/pdepend": "2.0.*", + "pdepend/pdepend": "~2.0", "php": ">=5.3.0", - "symfony/config": "2.5.*", - "symfony/dependency-injection": "2.5.*", - "symfony/filesystem": "2.5.*" + "symfony/config": ">=2.4", + "symfony/dependency-injection": ">=2.4", + "symfony/filesystem": ">=2.4" + }, + "require-dev": { + "phpunit/phpunit": "*", + "squizlabs/php_codesniffer": "*" }, "bin": [ "src/bin/phpmd" ], - "type": "library", + "type": "project", "autoload": { "psr-0": { "PHPMD\\": "src/main/php" @@ -1655,8 +1665,29 @@ "license": [ "BSD-3-Clause" ], - "description": "Official version of PHPMD handled with Composer.", - "time": "2014-09-25 15:56:22" + "authors": [ + { + "name": "Manuel Pichler", + "email": "github@manuel-pichler.de", + "homepage": "https://github.com/manuelpichler", + "role": "Project founder" + }, + { + "name": "Other contributors", + "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", + "role": "Contributors" + } + ], + "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", + "homepage": "http://phpmd.org/", + "keywords": [ + "mess detection", + "mess detector", + "pdepend", + "phpmd", + "pmd" + ], + "time": "2015-05-27 18:16:57" }, { "name": "phpoption/phpoption", @@ -1692,9 +1723,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -1770,31 +1801,33 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.3.4", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", + "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, "autoload": { "classmap": [ - "File/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -1811,7 +1844,7 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2015-04-02 05:19:05" }, { "name": "phpunit/php-text-template", @@ -2108,9 +2141,7 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", @@ -2161,21 +2192,21 @@ }, { "name": "sebastian/finder-facade", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/finder-facade.git", - "reference": "1e396fda3449fce9df032749fa4fa2619e0347e0" + "reference": "a520dcc3dd39160eea480daa3426f4fd419a327b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/1e396fda3449fce9df032749fa4fa2619e0347e0", - "reference": "1e396fda3449fce9df032749fa4fa2619e0347e0", + "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/a520dcc3dd39160eea480daa3426f4fd419a327b", + "reference": "a520dcc3dd39160eea480daa3426f4fd419a327b", "shasum": "" }, "require": { - "symfony/finder": ">=2.2.0", - "theseer/fdomdocument": ">=1.3.1" + "symfony/finder": "~2.3", + "theseer/fdomdocument": "~1.3" }, "type": "library", "autoload": { @@ -2196,20 +2227,20 @@ ], "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2013-05-28 06:10:03" + "time": "2015-06-04 08:11:58" }, { "name": "sebastian/git", - "version": "1.2.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/git.git", - "reference": "a99fbc102e982c1404041ef3e4d431562b29bcba" + "reference": "2d5c139d0eedcb9e67e0e9ca08023be6e9b7b47b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/git/zipball/a99fbc102e982c1404041ef3e4d431562b29bcba", - "reference": "a99fbc102e982c1404041ef3e4d431562b29bcba", + "url": "https://api.github.com/repos/sebastianbergmann/git/zipball/2d5c139d0eedcb9e67e0e9ca08023be6e9b7b47b", + "reference": "2d5c139d0eedcb9e67e0e9ca08023be6e9b7b47b", "shasum": "" }, "require": { @@ -2218,7 +2249,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2233,8 +2264,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], "description": "Simple wrapper for Git", @@ -2242,28 +2272,28 @@ "keywords": [ "git" ], - "time": "2013-08-04 09:35:29" + "time": "2015-04-06 16:23:43" }, { "name": "sebastian/phpcpd", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpcpd.git", - "reference": "a9462153f2dd90466a010179901d31fbff598365" + "reference": "d3ad100fdf15805495f6ff19f473f4314c99390c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpcpd/zipball/a9462153f2dd90466a010179901d31fbff598365", - "reference": "a9462153f2dd90466a010179901d31fbff598365", + "url": "https://api.github.com/repos/sebastianbergmann/phpcpd/zipball/d3ad100fdf15805495f6ff19f473f4314c99390c", + "reference": "d3ad100fdf15805495f6ff19f473f4314c99390c", "shasum": "" }, "require": { "php": ">=5.3.3", - "phpunit/php-timer": ">=1.0.4", - "sebastian/finder-facade": ">=1.1.0", - "sebastian/version": ">=1.0.3", - "symfony/console": ">=2.2.0", + "phpunit/php-timer": "~1.0", + "sebastian/finder-facade": "~1.1", + "sebastian/version": "~1.0", + "symfony/console": "~2.2", "theseer/fdomdocument": "~1.4" }, "bin": [ @@ -2293,20 +2323,20 @@ ], "description": "Copy/Paste Detector (CPD) for PHP code.", "homepage": "https://github.com/sebastianbergmann/phpcpd", - "time": "2014-03-31 09:25:30" + "time": "2015-03-26 14:47:38" }, { "name": "sebastian/version", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b" + "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b", - "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", + "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", "shasum": "" }, "type": "library", @@ -2328,7 +2358,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2014-12-15 14:25:24" + "time": "2015-02-24 06:35:25" }, { "name": "seld/jsonlint", @@ -2378,20 +2408,21 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.1.0", + "version": "2.3.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "d2a1d4c58fd2bb09ba376d0d19e67c0ab649e401" + "reference": "e96d8579fbed0c95ecf2a0501ec4f307a4aa6404" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d2a1d4c58fd2bb09ba376d0d19e67c0ab649e401", - "reference": "d2a1d4c58fd2bb09ba376d0d19e67c0ab649e401", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e96d8579fbed0c95ecf2a0501ec4f307a4aa6404", + "reference": "e96d8579fbed0c95ecf2a0501ec4f307a4aa6404", "shasum": "" }, "require": { "ext-tokenizer": "*", + "ext-xmlwriter": "*", "php": ">=5.1.2" }, "bin": [ @@ -2401,7 +2432,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-phpcs-fixer": "2.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -2441,41 +2472,43 @@ "role": "lead" } ], - "description": "PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", "homepage": "http://www.squizlabs.com/php-codesniffer", "keywords": [ "phpcs", "standards" ], - "time": "2014-12-18 02:37:51" + "time": "2015-04-28 23:28:20" }, { "name": "symfony/config", - "version": "v2.5.8", - "target-dir": "Symfony/Component/Config", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "92f0b4c625b8c42d394b53f879d2795d84bb8c4f" + "reference": "58ded81f1f582a87c528ef3dae9a859f78b5f374" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/92f0b4c625b8c42d394b53f879d2795d84bb8c4f", - "reference": "92f0b4c625b8c42d394b53f879d2795d84bb8c4f", + "url": "https://api.github.com/repos/symfony/Config/zipball/58ded81f1f582a87c528ef3dae9a859f78b5f374", + "reference": "58ded81f1f582a87c528ef3dae9a859f78b5f374", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.9", "symfony/filesystem": "~2.3" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Config\\": "" } }, @@ -2484,40 +2517,40 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Config Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:15:53" + "homepage": "https://symfony.com", + "time": "2015-06-11 14:06:56" }, { "name": "symfony/console", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Console", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "ef825fd9f809d275926547c9e57cbf14968793e8" + "reference": "564398bc1f33faf92fc2ec86859983d30eb81806" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/ef825fd9f809d275926547c9e57cbf14968793e8", - "reference": "ef825fd9f809d275926547c9e57cbf14968793e8", + "url": "https://api.github.com/repos/symfony/Console/zipball/564398bc1f33faf92fc2ec86859983d30eb81806", + "reference": "564398bc1f33faf92fc2ec86859983d30eb81806", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.1", + "symfony/phpunit-bridge": "~2.7", "symfony/process": "~2.1" }, "suggest": { @@ -2528,11 +2561,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Console\\": "" } }, @@ -2541,41 +2574,44 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "homepage": "https://symfony.com", + "time": "2015-06-10 15:30:22" }, { "name": "symfony/dependency-injection", - "version": "v2.5.8", - "target-dir": "Symfony/Component/DependencyInjection", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "b4afda3c24867a17f93237ac1fcce917cc9d7695" + "reference": "1a409e52a38ec891de0a7a61a191d1c62080b69d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/b4afda3c24867a17f93237ac1fcce917cc9d7695", - "reference": "b4afda3c24867a17f93237ac1fcce917cc9d7695", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/1a409e52a38ec891de0a7a61a191d1c62080b69d", + "reference": "1a409e52a38ec891de0a7a61a191d1c62080b69d", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "conflict": { + "symfony/expression-language": "<2.6" }, "require-dev": { "symfony/config": "~2.2", - "symfony/expression-language": "~2.4", - "symfony/yaml": "~2.0" + "symfony/expression-language": "~2.6", + "symfony/phpunit-bridge": "~2.7", + "symfony/yaml": "~2.1" }, "suggest": { "symfony/config": "", @@ -2585,11 +2621,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\DependencyInjection\\": "" } }, @@ -2598,43 +2634,43 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony DependencyInjection Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 21:48:32" + "homepage": "https://symfony.com", + "time": "2015-06-11 19:13:11" }, { "name": "symfony/event-dispatcher", - "version": "v2.6.1", - "target-dir": "Symfony/Component/EventDispatcher", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "720fe9bca893df7ad1b4546649473b5afddf0216" + "reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/720fe9bca893df7ad1b4546649473b5afddf0216", - "reference": "720fe9bca893df7ad1b4546649473b5afddf0216", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/be3c5ff8d503c46768aeb78ce6333051aa6f26d9", + "reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.0", + "symfony/config": "~2.0,>=2.0.5", "symfony/dependency-injection": "~2.6", "symfony/expression-language": "~2.6", - "symfony/stopwatch": "~2.2" + "symfony/phpunit-bridge": "~2.7", + "symfony/stopwatch": "~2.3" }, "suggest": { "symfony/dependency-injection": "", @@ -2643,11 +2679,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" } }, @@ -2656,45 +2692,47 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "homepage": "https://symfony.com", + "time": "2015-06-08 09:37:21" }, { "name": "symfony/filesystem", - "version": "v2.5.8", - "target-dir": "Symfony/Component/Filesystem", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42" + "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42", - "reference": "e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a0d43eb3e17d4f4c6990289805a488a0482a07f3", + "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Filesystem\\": "" } }, @@ -2703,45 +2741,47 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Filesystem Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:15:53" + "homepage": "https://symfony.com", + "time": "2015-06-08 09:37:21" }, { "name": "symfony/finder", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Finder", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721" + "reference": "c13a40d638aeede1e8400f8c956c7f9246c05f75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721", - "reference": "0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721", + "url": "https://api.github.com/repos/symfony/Finder/zipball/c13a40d638aeede1e8400f8c956c7f9246c05f75", + "reference": "c13a40d638aeede1e8400f8c956c7f9246c05f75", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Finder\\": "" } }, @@ -2750,45 +2790,47 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "homepage": "https://symfony.com", + "time": "2015-06-04 20:11:48" }, { "name": "symfony/process", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Process", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "bf0c9bd625f13b0b0bbe39919225cf145dfb935a" + "reference": "552d8efdc80980cbcca50b28d626ac8e36e3cdd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/bf0c9bd625f13b0b0bbe39919225cf145dfb935a", - "reference": "bf0c9bd625f13b0b0bbe39919225cf145dfb935a", + "url": "https://api.github.com/repos/symfony/Process/zipball/552d8efdc80980cbcca50b28d626ac8e36e3cdd1", + "reference": "552d8efdc80980cbcca50b28d626ac8e36e3cdd1", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Process\\": "" } }, @@ -2797,45 +2839,47 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Process Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "homepage": "https://symfony.com", + "time": "2015-06-08 09:37:21" }, { "name": "symfony/stopwatch", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Stopwatch", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Stopwatch.git", - "reference": "261abd360cfb6ac65ea93ffd82073e2011d034fc" + "reference": "c653f1985f6c2b7dbffd04d48b9c0a96aaef814b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/261abd360cfb6ac65ea93ffd82073e2011d034fc", - "reference": "261abd360cfb6ac65ea93ffd82073e2011d034fc", + "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/c653f1985f6c2b7dbffd04d48b9c0a96aaef814b", + "reference": "c653f1985f6c2b7dbffd04d48b9c0a96aaef814b", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Stopwatch\\": "" } }, @@ -2844,41 +2888,44 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Stopwatch Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "homepage": "https://symfony.com", + "time": "2015-06-04 20:11:48" }, { "name": "symfony/translation", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Translation", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "5b8bf84a43317021849813f556f26dc35968156b" + "reference": "8349a2b0d11bd0311df9e8914408080912983a0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/5b8bf84a43317021849813f556f26dc35968156b", - "reference": "5b8bf84a43317021849813f556f26dc35968156b", + "url": "https://api.github.com/repos/symfony/Translation/zipball/8349a2b0d11bd0311df9e8914408080912983a0b", + "reference": "8349a2b0d11bd0311df9e8914408080912983a0b", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "conflict": { + "symfony/config": "<2.7" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.0", + "symfony/config": "~2.7", "symfony/intl": "~2.3", + "symfony/phpunit-bridge": "~2.7", "symfony/yaml": "~2.2" }, "suggest": { @@ -2889,11 +2936,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Translation\\": "" } }, @@ -2902,48 +2949,48 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Translation Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "homepage": "https://symfony.com", + "time": "2015-06-11 17:26:34" }, { "name": "symfony/validator", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Validator", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Validator.git", - "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4" + "reference": "3c58b1ef26ab2114f8f84d1808937b9b76bad8f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/4583e0321f1bcdad14d93e265eaca1001035b5c4", - "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4", + "url": "https://api.github.com/repos/symfony/Validator/zipball/3c58b1ef26ab2114f8f84d1808937b9b76bad8f5", + "reference": "3c58b1ef26ab2114f8f84d1808937b9b76bad8f5", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/translation": "~2.0" + "php": ">=5.3.9", + "symfony/translation": "~2.4" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0", - "egulias/email-validator": "~1.0", + "egulias/email-validator": "~1.2,>=1.2.1", "symfony/config": "~2.2", "symfony/expression-language": "~2.4", "symfony/http-foundation": "~2.1", "symfony/intl": "~2.3", - "symfony/property-access": "~2.2", - "symfony/yaml": "~2.0" + "symfony/phpunit-bridge": "~2.7", + "symfony/property-access": "~2.3", + "symfony/yaml": "~2.0,>=2.0.5" }, "suggest": { "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", @@ -2959,11 +3006,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Validator\\": "" } }, @@ -2972,45 +3019,47 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Validator Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "homepage": "https://symfony.com", + "time": "2015-06-08 09:37:21" }, { "name": "symfony/yaml", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Yaml", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20" + "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/3346fc090a3eb6b53d408db2903b241af51dcb20", - "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/9808e75c609a14f6db02f70fccf4ca4aab53c160", + "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Yaml\\": "" } }, @@ -3019,31 +3068,31 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "homepage": "https://symfony.com", + "time": "2015-06-10 15:30:22" }, { "name": "theseer/fdomdocument", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/theseer/fDOMDocument.git", - "reference": "d08cf070350f884c63fc9078d27893c2ab6c7cef" + "reference": "d9ad139d6c2e8edf5e313ffbe37ff13344cf0684" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/d08cf070350f884c63fc9078d27893c2ab6c7cef", - "reference": "d08cf070350f884c63fc9078d27893c2ab6c7cef", + "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/d9ad139d6c2e8edf5e313ffbe37ff13344cf0684", + "reference": "d9ad139d6c2e8edf5e313ffbe37ff13344cf0684", "shasum": "" }, "require": { @@ -3070,29 +3119,29 @@ ], "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2014-09-13 10:57:19" + "time": "2015-05-27 22:58:02" }, { "name": "twig/twig", - "version": "v1.16.3", + "version": "v1.18.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "6dc11a1e8ecfc30e2c68aaeb218148409d8e68af" + "reference": "e8e6575abf6102af53ec283f7f14b89e304fa602" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/6dc11a1e8ecfc30e2c68aaeb218148409d8e68af", - "reference": "6dc11a1e8ecfc30e2c68aaeb218148409d8e68af", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/e8e6575abf6102af53ec283f7f14b89e304fa602", + "reference": "e8e6575abf6102af53ec283f7f14b89e304fa602", "shasum": "" }, "require": { - "php": ">=5.2.4" + "php": ">=5.2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.16-dev" + "dev-master": "1.18-dev" } }, "autoload": { @@ -3127,35 +3176,33 @@ "keywords": [ "templating" ], - "time": "2014-12-25 19:58:19" + "time": "2015-06-06 23:31:24" }, { "name": "zendframework/zend-cache", - "version": "2.3.3", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-cache.git", - "reference": "5d82386d837365943251b39466fef40325876709" + "reference": "5999e5a03f7dcf82abbbe67eea74da641f959684" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/5d82386d837365943251b39466fef40325876709", - "reference": "5d82386d837365943251b39466fef40325876709", + "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/5999e5a03f7dcf82abbbe67eea74da641f959684", + "reference": "5999e5a03f7dcf82abbbe67eea74da641f959684", "shasum": "" }, "require": { "php": ">=5.3.23", - "zendframework/zend-eventmanager": "self.version", - "zendframework/zend-serializer": "self.version", - "zendframework/zend-servicemanager": "self.version", - "zendframework/zend-stdlib": "self.version" + "zendframework/zend-eventmanager": "~2.5", + "zendframework/zend-serializer": "~2.5", + "zendframework/zend-servicemanager": "~2.5", + "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "dev-master", - "zendframework/zend-serializer": "self.version", - "zendframework/zend-session": "self.version" + "zendframework/zend-session": "~2.5" }, "suggest": { "ext-apc": "APC >= 3.1.6 to use the APC storage adapter", @@ -3170,8 +3217,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev", - "dev-develop": "2.4-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3189,34 +3236,34 @@ "cache", "zf2" ], - "time": "2014-08-11 15:50:41" + "time": "2015-06-03 15:31:59" }, { "name": "zendframework/zend-config", - "version": "2.3.3", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-config.git", - "reference": "f233ad11bd5ae224675e0a9b1d3ec3ec1ff896e5" + "reference": "ec49b1df1bdd9772df09dc2f612fbfc279bf4c27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-config/zipball/f233ad11bd5ae224675e0a9b1d3ec3ec1ff896e5", - "reference": "f233ad11bd5ae224675e0a9b1d3ec3ec1ff896e5", + "url": "https://api.github.com/repos/zendframework/zend-config/zipball/ec49b1df1bdd9772df09dc2f612fbfc279bf4c27", + "reference": "ec49b1df1bdd9772df09dc2f612fbfc279bf4c27", "shasum": "" }, "require": { "php": ">=5.3.23", - "zendframework/zend-stdlib": "self.version" + "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "dev-master", - "zendframework/zend-filter": "self.version", - "zendframework/zend-i18n": "self.version", - "zendframework/zend-json": "self.version", - "zendframework/zend-servicemanager": "self.version" + "zendframework/zend-filter": "~2.5", + "zendframework/zend-i18n": "~2.5", + "zendframework/zend-json": "~2.5", + "zendframework/zend-mvc": "~2.5", + "zendframework/zend-servicemanager": "~2.5" }, "suggest": { "zendframework/zend-filter": "Zend\\Filter component", @@ -3227,8 +3274,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev", - "dev-develop": "2.4-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3246,36 +3293,35 @@ "config", "zf2" ], - "time": "2014-08-11 15:50:41" + "time": "2015-06-03 15:32:00" }, { "name": "zendframework/zend-eventmanager", - "version": "2.3.3", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "b01ea3d2e026463f6d3fd9f95935974a282d97f1" + "reference": "d94a16039144936f107f906896349900fd634443" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/b01ea3d2e026463f6d3fd9f95935974a282d97f1", - "reference": "b01ea3d2e026463f6d3fd9f95935974a282d97f1", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/d94a16039144936f107f906896349900fd634443", + "reference": "d94a16039144936f107f906896349900fd634443", "shasum": "" }, "require": { "php": ">=5.3.23", - "zendframework/zend-stdlib": "self.version" + "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "dev-master" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev", - "dev-develop": "2.4-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3287,38 +3333,40 @@ "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zend-event-manager", + "homepage": "https://github.com/zendframework/zend-eventmanager", "keywords": [ "eventmanager", "zf2" ], - "time": "2014-08-11 15:50:41" + "time": "2015-06-03 15:32:01" }, { "name": "zendframework/zend-filter", - "version": "2.3.3", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-filter.git", - "reference": "e3564e5e08a7c3564efb550d4de459d8273735ec" + "reference": "93e6990a198e6cdd811064083acac4693f4b29ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/e3564e5e08a7c3564efb550d4de459d8273735ec", - "reference": "e3564e5e08a7c3564efb550d4de459d8273735ec", + "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/93e6990a198e6cdd811064083acac4693f4b29ae", + "reference": "93e6990a198e6cdd811064083acac4693f4b29ae", "shasum": "" }, "require": { "php": ">=5.3.23", - "zendframework/zend-stdlib": "self.version" + "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "dev-master", - "zendframework/zend-crypt": "self.version", - "zendframework/zend-servicemanager": "self.version", - "zendframework/zend-uri": "self.version" + "zendframework/zend-config": "~2.5", + "zendframework/zend-crypt": "~2.5", + "zendframework/zend-i18n": "~2.5", + "zendframework/zend-loader": "~2.5", + "zendframework/zend-servicemanager": "~2.5", + "zendframework/zend-uri": "~2.5" }, "suggest": { "zendframework/zend-crypt": "Zend\\Crypt component", @@ -3329,8 +3377,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev", - "dev-develop": "2.4-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3348,37 +3396,36 @@ "filter", "zf2" ], - "time": "2014-08-11 15:50:41" + "time": "2015-06-03 15:32:01" }, { "name": "zendframework/zend-i18n", - "version": "2.3.3", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-i18n.git", - "reference": "fad436afd26eee19d3d6a5d20ba93236e4964336" + "reference": "509271eb7947e4aabebfc376104179cffea42696" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/fad436afd26eee19d3d6a5d20ba93236e4964336", - "reference": "fad436afd26eee19d3d6a5d20ba93236e4964336", + "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/509271eb7947e4aabebfc376104179cffea42696", + "reference": "509271eb7947e4aabebfc376104179cffea42696", "shasum": "" }, "require": { "php": ">=5.3.23", - "zendframework/zend-stdlib": "self.version" + "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "dev-master", - "zendframework/zend-cache": "self.version", - "zendframework/zend-config": "self.version", - "zendframework/zend-eventmanager": "self.version", - "zendframework/zend-filter": "self.version", - "zendframework/zend-servicemanager": "self.version", - "zendframework/zend-validator": "self.version", - "zendframework/zend-view": "self.version" + "zendframework/zend-cache": "~2.5", + "zendframework/zend-config": "~2.5", + "zendframework/zend-eventmanager": "~2.5", + "zendframework/zend-filter": "~2.5", + "zendframework/zend-servicemanager": "~2.5", + "zendframework/zend-validator": "~2.5", + "zendframework/zend-view": "~2.5" }, "suggest": { "ext-intl": "Required for most features of Zend\\I18n; included in default builds of PHP", @@ -3394,8 +3441,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev", - "dev-develop": "2.4-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3412,32 +3459,32 @@ "i18n", "zf2" ], - "time": "2014-08-11 15:50:41" + "time": "2015-06-03 15:32:01" }, { "name": "zendframework/zend-json", - "version": "2.3.3", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-json.git", - "reference": "6da7732a991f9cd2230b12a287db0e0a6005af05" + "reference": "c74eaf17d2dd37dc1e964be8dfde05706a821ebc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-json/zipball/6da7732a991f9cd2230b12a287db0e0a6005af05", - "reference": "6da7732a991f9cd2230b12a287db0e0a6005af05", + "url": "https://api.github.com/repos/zendframework/zend-json/zipball/c74eaf17d2dd37dc1e964be8dfde05706a821ebc", + "reference": "c74eaf17d2dd37dc1e964be8dfde05706a821ebc", "shasum": "" }, "require": { "php": ">=5.3.23", - "zendframework/zend-stdlib": "self.version" + "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "dev-master", - "zendframework/zend-http": "self.version", - "zendframework/zend-server": "self.version" + "zendframework/zend-http": "~2.5", + "zendframework/zend-server": "~2.5", + "zendframework/zendxml": "~1.0" }, "suggest": { "zendframework/zend-http": "Zend\\Http component", @@ -3447,8 +3494,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev", - "dev-develop": "2.4-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3466,20 +3513,20 @@ "json", "zf2" ], - "time": "2014-08-11 15:50:41" + "time": "2015-06-03 15:32:01" }, { "name": "zendframework/zend-math", - "version": "2.3.3", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-math.git", - "reference": "ddedb7eec27f039c09513274258cd3717c12a152" + "reference": "9f02a1ac4d3374d3332c80f9215deec9c71558fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-math/zipball/ddedb7eec27f039c09513274258cd3717c12a152", - "reference": "ddedb7eec27f039c09513274258cd3717c12a152", + "url": "https://api.github.com/repos/zendframework/zend-math/zipball/9f02a1ac4d3374d3332c80f9215deec9c71558fc", + "reference": "9f02a1ac4d3374d3332c80f9215deec9c71558fc", "shasum": "" }, "require": { @@ -3487,8 +3534,9 @@ }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", + "ircmaxell/random-lib": "~1.1", "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "dev-master" + "zendframework/zend-servicemanager": "~2.5" }, "suggest": { "ext-bcmath": "If using the bcmath functionality", @@ -3499,8 +3547,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev", - "dev-develop": "2.4-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3517,33 +3565,32 @@ "math", "zf2" ], - "time": "2014-08-11 15:50:41" + "time": "2015-06-03 15:32:02" }, { "name": "zendframework/zend-serializer", - "version": "2.3.3", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-serializer.git", - "reference": "f3757acc7a288af62d4719139c50330516a41e5e" + "reference": "b7208eb17dc4a4fb3a660b85e6c4af035eeed40c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-serializer/zipball/f3757acc7a288af62d4719139c50330516a41e5e", - "reference": "f3757acc7a288af62d4719139c50330516a41e5e", + "url": "https://api.github.com/repos/zendframework/zend-serializer/zipball/b7208eb17dc4a4fb3a660b85e6c4af035eeed40c", + "reference": "b7208eb17dc4a4fb3a660b85e6c4af035eeed40c", "shasum": "" }, "require": { "php": ">=5.3.23", - "zendframework/zend-json": "self.version", - "zendframework/zend-math": "self.version", - "zendframework/zend-stdlib": "self.version" + "zendframework/zend-json": "~2.5", + "zendframework/zend-math": "~2.5", + "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "dev-master", - "zendframework/zend-servicemanager": "self.version" + "zendframework/zend-servicemanager": "~2.5" }, "suggest": { "zendframework/zend-servicemanager": "To support plugin manager support" @@ -3551,8 +3598,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev", - "dev-develop": "2.4-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3570,20 +3617,20 @@ "serializer", "zf2" ], - "time": "2014-08-11 15:50:41" + "time": "2015-06-03 15:32:02" }, { "name": "zendframework/zend-servicemanager", - "version": "2.3.3", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-servicemanager.git", - "reference": "23f7c9b129a26d855d6734e4dc58f5bfa63c8f36" + "reference": "3b22c403e351d92526c642cba0bd810bc22e1c56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/23f7c9b129a26d855d6734e4dc58f5bfa63c8f36", - "reference": "23f7c9b129a26d855d6734e4dc58f5bfa63c8f36", + "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/3b22c403e351d92526c642cba0bd810bc22e1c56", + "reference": "3b22c403e351d92526c642cba0bd810bc22e1c56", "shasum": "" }, "require": { @@ -3592,17 +3639,18 @@ "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "dev-master", - "zendframework/zend-di": "self.version" + "zendframework/zend-di": "~2.5", + "zendframework/zend-mvc": "~2.5" }, "suggest": { + "ocramius/proxy-manager": "ProxyManager 0.5.* to handle lazy initialization of services", "zendframework/zend-di": "Zend\\Di component" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev", - "dev-develop": "2.4-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3614,25 +3662,25 @@ "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zend-service-manager", + "homepage": "https://github.com/zendframework/zend-servicemanager", "keywords": [ "servicemanager", "zf2" ], - "time": "2014-08-11 15:50:41" + "time": "2015-06-03 15:32:02" }, { "name": "zendframework/zend-stdlib", - "version": "2.3.3", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "f78c86701b33caddae091623708860dea0c2715f" + "reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/f78c86701b33caddae091623708860dea0c2715f", - "reference": "f78c86701b33caddae091623708860dea0c2715f", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cc8e90a60dd5d44b9730b77d07b97550091da1ae", + "reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae", "shasum": "" }, "require": { @@ -3641,11 +3689,12 @@ "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "dev-master", - "zendframework/zend-eventmanager": "self.version", - "zendframework/zend-filter": "self.version", - "zendframework/zend-serializer": "self.version", - "zendframework/zend-servicemanager": "self.version" + "zendframework/zend-config": "~2.5", + "zendframework/zend-eventmanager": "~2.5", + "zendframework/zend-filter": "~2.5", + "zendframework/zend-inputfilter": "~2.5", + "zendframework/zend-serializer": "~2.5", + "zendframework/zend-servicemanager": "~2.5" }, "suggest": { "zendframework/zend-eventmanager": "To support aggregate hydrator usage", @@ -3656,8 +3705,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev", - "dev-develop": "2.4-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3674,7 +3723,7 @@ "stdlib", "zf2" ], - "time": "2014-08-11 15:50:41" + "time": "2015-06-03 15:32:03" }, { "name": "zetacomponents/base", diff --git a/samples/Sample_05_Chart.php b/samples/Sample_05_Chart.php index 713fb7111..5f2c5bd17 100644 --- a/samples/Sample_05_Chart.php +++ b/samples/Sample_05_Chart.php @@ -4,6 +4,7 @@ use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; @@ -61,19 +62,104 @@ function fnSlide_Area(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic(true); } +function fnSlide_Bar(PhpPowerpoint $objPHPPowerPoint) { + global $oFill; + global $oShadow; + + // Create templated slide + echo EOL.date('H:i:s') . ' Create templated slide'.EOL; + $currentSlide = createTemplatedSlide($objPHPPowerPoint); + + // Generate sample data for first chart + echo date('H:i:s') . ' Generate sample data for first chart'.EOL; + $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293); + $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379); + + // Create a bar chart (that should be inserted in a shape) + echo date('H:i:s') . ' Create a bar chart (that should be inserted in a chart shape)'.EOL; + $barChart = new Bar(); + $series1 = new Series('2009', $series1Data); + $series1->setShowSeriesName(true); + $series1->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4F81BD')); + $series1->getFont()->getColor()->setRGB('00FF00'); + $series1->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20')); + $series2 = new Series('2010', $series2Data); + $series2->setShowSeriesName(true); + $series2->getFont()->getColor()->setRGB('FF0000'); + $series2->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFC0504D')); + $barChart->addSeries($series1); + $barChart->addSeries($series2); + + // Create a shape (chart) + echo date('H:i:s') . ' Create a shape (chart)'.EOL; + $shape = $currentSlide->createChartShape(); + $shape->setName('PHPPowerPoint Monthly Downloads') + ->setResizeProportional(false) + ->setHeight(550) + ->setWidth(700) + ->setOffsetX(120) + ->setOffsetY(80); + $shape->setShadow($oShadow); + $shape->setFill($oFill); + $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); + $shape->getTitle()->getFont()->setItalic(true); + $shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); + $shape->getPlotArea()->getAxisX()->setTitle('Month'); + $shape->getPlotArea()->getAxisY()->setTitle('Downloads'); + $shape->getPlotArea()->setType($barChart); + $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getLegend()->getFont()->setItalic(true); +} + +function fnSlide_BarHorizontal(PhpPowerpoint $objPHPPowerPoint) { + global $oFill; + global $oShadow; + + // Create a bar chart (that should be inserted in a shape) + echo date('H:i:s') . ' Create a horizontal bar chart (that should be inserted in a chart shape) '.EOL; + $barChartHorz = clone $objPHPPowerPoint->getSlide(1)->getShapeCollection()->offsetGet(1)->getPlotArea()->getType(); + $barChartHorz->setBarDirection(Bar3D::DIRECTION_HORIZONTAL); + + // Create templated slide + echo EOL.date('H:i:s') . ' Create templated slide'.EOL; + $currentSlide = createTemplatedSlide($objPHPPowerPoint); + + // Create a shape (chart) + echo date('H:i:s') . ' Create a shape (chart)'.EOL; + $shape = $currentSlide->createChartShape(); + $shape->setName('PHPPowerPoint Monthly Downloads') + ->setResizeProportional(false) + ->setHeight(550) + ->setWidth(700) + ->setOffsetX(120) + ->setOffsetY(80); + $shape->setShadow($oShadow); + $shape->setFill($oFill); + $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getTitle()->setText('PHPPowerPoint Monthly Downloads'); + $shape->getTitle()->getFont()->setItalic(true); + $shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); + $shape->getPlotArea()->getAxisX()->setTitle('Month'); + $shape->getPlotArea()->getAxisY()->setTitle('Downloads'); + $shape->getPlotArea()->setType($barChartHorz); + $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getLegend()->getFont()->setItalic(true); +} + function fnSlide_Bar3D(PhpPowerpoint $objPHPPowerPoint) { global $oFill; global $oShadow; - + // Create templated slide echo EOL.date('H:i:s') . ' Create templated slide'.EOL; $currentSlide = createTemplatedSlide($objPHPPowerPoint); - + // Generate sample data for first chart echo date('H:i:s') . ' Generate sample data for first chart'.EOL; $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293); $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379); - + // Create a bar chart (that should be inserted in a shape) echo date('H:i:s') . ' Create a bar chart (that should be inserted in a chart shape)'.EOL; $bar3DChart = new Bar3D(); @@ -88,16 +174,16 @@ function fnSlide_Bar3D(PhpPowerpoint $objPHPPowerPoint) { $series2->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFC0504D')); $bar3DChart->addSeries($series1); $bar3DChart->addSeries($series2); - + // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)'.EOL; $shape = $currentSlide->createChartShape(); $shape->setName('PHPPowerPoint Monthly Downloads') - ->setResizeProportional(false) - ->setHeight(550) - ->setWidth(700) - ->setOffsetX(120) - ->setOffsetY(80); + ->setResizeProportional(false) + ->setHeight(550) + ->setWidth(700) + ->setOffsetX(120) + ->setOffsetY(80); $shape->setShadow($oShadow); $shape->setFill($oFill); $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); @@ -120,8 +206,8 @@ function fnSlide_Bar3DHorizontal(PhpPowerpoint $objPHPPowerPoint) { // Create a bar chart (that should be inserted in a shape) echo date('H:i:s') . ' Create a horizontal bar chart (that should be inserted in a chart shape) '.EOL; - $bar3DChartHorz = $objPHPPowerPoint->getSlide(1)->getShapeCollection()->offsetGet(1)->getPlotArea()->getType(); - //$bar3DChartHorz->setBarDirection(Bar3D::DIRECTION_HORIZONTAL); + $bar3DChartHorz = clone $objPHPPowerPoint->getSlide(3)->getShapeCollection()->offsetGet(1)->getPlotArea()->getType(); + $bar3DChartHorz->setBarDirection(Bar3D::DIRECTION_HORIZONTAL); // Create templated slide echo EOL.date('H:i:s') . ' Create templated slide'.EOL; @@ -267,6 +353,10 @@ function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { fnSlide_Area($objPHPPowerPoint); +fnSlide_Bar($objPHPPowerPoint); + +fnSlide_BarHorizontal($objPHPPowerPoint); + fnSlide_Bar3D($objPHPPowerPoint); fnSlide_Bar3DHorizontal($objPHPPowerPoint); diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Bar.php b/src/PhpPowerpoint/Shape/Chart/Type/Bar.php new file mode 100644 index 000000000..e3aa47367 --- /dev/null +++ b/src/PhpPowerpoint/Shape/Chart/Type/Bar.php @@ -0,0 +1,73 @@ +barDirection = $value; + return $this; + } + + /** + * Get orientation + * + * @return string + */ + public function getBarDirection() + { + return $this->barDirection; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() + { + $hash = ''; + foreach ($this->getData() as $series) { + $hash .= $series->getHashCode(); + } + return md5($hash . __CLASS__); + } +} diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index f3ce806f1..3003fa45e 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -20,6 +20,7 @@ use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\Chart; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; @@ -88,7 +89,7 @@ public function writePart(Chart $chart) private function writeContentPart(Chart $chart) { $chartType = $chart->getPlotArea()->getType(); - if (!($chartType instanceof Area || $chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Pie3D || $chartType instanceof Scatter)) { + if (!($chartType instanceof Area || $chartType instanceof Bar || $chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Pie3D || $chartType instanceof Scatter)) { throw new \Exception('The chart type provided could not be rendered.'); } @@ -201,7 +202,7 @@ private function writeContentPart(Chart $chart) $this->xmlContent->writeAttribute('chart:style-name', 'styleChart'); if ($chartType instanceof Area) { $this->xmlContent->writeAttribute('chart:class', 'chart:area'); - } elseif ($chartType instanceof Bar3D) { + } elseif ($chartType instanceof Bar || $chartType instanceof Bar3D) { $this->xmlContent->writeAttribute('chart:class', 'chart:bar'); } elseif ($chartType instanceof Line) { $this->xmlContent->writeAttribute('chart:class', 'chart:line'); @@ -483,14 +484,16 @@ private function writePlotAreaStyle(Chart $chart) if ($chartType instanceof Bar3D) { $this->xmlContent->writeAttribute('chart:three-dimensional', 'true'); $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true'); + } elseif ($chartType instanceof Pie3D) { + $this->xmlContent->writeAttribute('chart:three-dimensional', 'true'); + $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true'); + } + if ($chartType instanceof Bar || $chartType instanceof Bar3D) { if ($chartType->getBarDirection() == Bar3D::DIRECTION_HORIZONTAL) { $this->xmlContent->writeAttribute('chart:vertical', 'true'); } else { $this->xmlContent->writeAttribute('chart:vertical', 'false'); } - } elseif ($chartType instanceof Pie3D) { - $this->xmlContent->writeAttribute('chart:three-dimensional', 'true'); - $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true'); } $this->xmlContent->writeAttribute('chart:data-label-number', 'value'); // > style:text-properties @@ -515,7 +518,7 @@ private function writeSeries(Chart $chart, Chart\Series $series) $this->xmlContent->writeAttribute('chart:label-cell-address', 'table-local.$'.$this->rangeCol.'$1'); if ($chartType instanceof Area) { $this->xmlContent->writeAttribute('chart:class', 'chart:area'); - } elseif ($chartType instanceof Bar3D) { + } elseif ($chartType instanceof Bar || $chartType instanceof Bar3D) { $this->xmlContent->writeAttribute('chart:class', 'chart:bar'); } elseif ($chartType instanceof Line) { $this->xmlContent->writeAttribute('chart:class', 'chart:line'); @@ -525,7 +528,7 @@ private function writeSeries(Chart $chart, Chart\Series $series) $this->xmlContent->writeAttribute('chart:class', 'chart:scatter'); } $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries'.$this->numSeries); - if ($chartType instanceof Area || $chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Scatter) { + if ($chartType instanceof Area || $chartType instanceof Bar || $chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Scatter) { $dataPointFills = $series->getDataPointFills(); if (empty($dataPointFills)) { $incRepeat = $numRange; diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 6c7046de2..96e9d2b41 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -22,6 +22,7 @@ use PhpOffice\PhpPowerpoint\Shape\Chart\PlotArea; use PhpOffice\PhpPowerpoint\Shape\Chart\Title; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; @@ -501,6 +502,8 @@ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeC $chartType = $subject->getType(); if ($chartType instanceof Area) { $this->writeTypeArea($objWriter, $chartType, $chart->hasIncludedSpreadsheet()); + } elseif ($chartType instanceof Bar) { + $this->writeTypeBar($objWriter, $chartType, $chart->hasIncludedSpreadsheet()); } elseif ($chartType instanceof Bar3D) { $this->writeTypeBar3D($objWriter, $chartType, $chart->hasIncludedSpreadsheet()); } elseif ($chartType instanceof Pie3D) { @@ -1071,6 +1074,213 @@ protected function writeTypeArea(XMLWriter $objWriter, Area $subject, $includeSh $objWriter->endElement(); } + + /** + * Write Type Bar3D + * + * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar $subject + * @param boolean $includeSheet + * @throws \Exception + */ + protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, $includeSheet = false) + { + // c:bar3DChart + $objWriter->startElement('c:barChart'); + + // c:barDir + $objWriter->startElement('c:barDir'); + $objWriter->writeAttribute('val', $subject->getBarDirection()); + $objWriter->endElement(); + + // c:grouping + $objWriter->startElement('c:grouping'); + $objWriter->writeAttribute('val', 'clustered'); + $objWriter->endElement(); + + // Write series + $seriesIndex = 0; + foreach ($subject->getData() as $series) { + // c:ser + $objWriter->startElement('c:ser'); + + // c:idx + $objWriter->startElement('c:idx'); + $objWriter->writeAttribute('val', $seriesIndex); + $objWriter->endElement(); + + // c:order + $objWriter->startElement('c:order'); + $objWriter->writeAttribute('val', $seriesIndex); + $objWriter->endElement(); + + // c:tx + $objWriter->startElement('c:tx'); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); + $this->writeSingleValueOrReference($objWriter, $includeSheet, $series->getTitle(), $coords); + $objWriter->endElement(); + + // Fills for points? + $dataPointFills = $series->getDataPointFills(); + foreach ($dataPointFills as $key => $value) { + // c:dPt + $objWriter->startElement('c:dPt'); + + // c:idx + $this->writeElementWithValAttribute($objWriter, 'c:idx', $key); + + if ($value->getFillType() != Fill::FILL_NONE) { + // c:spPr + $objWriter->startElement('c:spPr'); + // Write fill + $this->writeFill($objWriter, $value); + // ## c:spPr + $objWriter->endElement(); + } + + // ## c:dPt + $objWriter->endElement(); + } + + // c:dLbls + $objWriter->startElement('c:dLbls'); + + // c:txPr + $objWriter->startElement('c:txPr'); + + // a:bodyPr + $objWriter->writeElement('a:bodyPr', null); + + // a:lstStyle + $objWriter->writeElement('a:lstStyle', null); + + // a:p + $objWriter->startElement('a:p'); + + // a:pPr + $objWriter->startElement('a:pPr'); + + // a:defRPr + $objWriter->startElement('a:defRPr'); + + $objWriter->writeAttribute('b', ($series->getFont()->isBold() ? 'true' : 'false')); + $objWriter->writeAttribute('i', ($series->getFont()->isItalic() ? 'true' : 'false')); + $objWriter->writeAttribute('strike', ($series->getFont()->isStrikethrough() ? 'sngStrike' : 'noStrike')); + $objWriter->writeAttribute('sz', ($series->getFont()->getSize() * 100)); + $objWriter->writeAttribute('u', $series->getFont()->getUnderline()); + + if ($series->getFont()->isSuperScript() || $series->getFont()->isSubScript()) { + if ($series->getFont()->isSuperScript()) { + $objWriter->writeAttribute('baseline', '30000'); + } elseif ($series->getFont()->isSubScript()) { + $objWriter->writeAttribute('baseline', '-25000'); + } + } + + // Font - a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', $series->getFont()->getColor()->getRGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Font - a:latin + $objWriter->startElement('a:latin'); + $objWriter->writeAttribute('typeface', $series->getFont()->getName()); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:endParaRPr + $objWriter->startElement('a:endParaRPr'); + $objWriter->writeAttribute('lang', 'en-US'); + $objWriter->writeAttribute('dirty', '0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // c:showVal + $this->writeElementWithValAttribute($objWriter, 'c:showVal', $series->hasShowValue() ? '1' : '0'); + + // c:showCatName + $this->writeElementWithValAttribute($objWriter, 'c:showCatName', $series->hasShowCategoryName() ? '1' : '0'); + + // c:showSerName + $this->writeElementWithValAttribute($objWriter, 'c:showSerName', $series->hasShowSeriesName() ? '1' : '0'); + + // c:showPercent + $this->writeElementWithValAttribute($objWriter, 'c:showPercent', $series->hasShowPercentage() ? '1' : '0'); + + // c:showLeaderLines + $this->writeElementWithValAttribute($objWriter, 'c:showLeaderLines', $series->hasShowLeaderLines() ? '1' : '0'); + + $objWriter->endElement(); + +// // c:spPr +// $objWriter->startElement('c:spPr'); + +// // Write fill +// $this->writeFill($objWriter, $series->getFill()); + +// $objWriter->endElement(); + + // Write X axis data + $axisXData = array_keys($series->getValues()); + + // c:cat + $objWriter->startElement('c:cat'); + $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisXData, 'Sheet1!$A$2:$A$' . (1 + count($axisXData))); + $objWriter->endElement(); + + // Write Y axis data + $axisYData = array_values($series->getValues()); + + // c:val + $objWriter->startElement('c:val'); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); + $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisYData, $coords); + $objWriter->endElement(); + + $objWriter->endElement(); + + ++$seriesIndex; + } + + // c:gapWidth + $objWriter->startElement('c:gapWidth'); + $objWriter->writeAttribute('val', '75'); + $objWriter->endElement(); + + // c:shape + $objWriter->startElement('c:shape'); + $objWriter->writeAttribute('val', 'box'); + $objWriter->endElement(); + + // c:axId + $objWriter->startElement('c:axId'); + $objWriter->writeAttribute('val', '52743552'); + $objWriter->endElement(); + + // c:axId + $objWriter->startElement('c:axId'); + $objWriter->writeAttribute('val', '52749440'); + $objWriter->endElement(); + + // c:axId + $objWriter->startElement('c:axId'); + $objWriter->writeAttribute('val', '0'); + $objWriter->endElement(); + + $objWriter->endElement(); + } + /** * Write Type Bar3D * diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php new file mode 100644 index 000000000..852dd2560 --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php @@ -0,0 +1,75 @@ +assertInternalType('array', $object->getData()); + $this->assertEmpty($object->getData()); + + $array = array( + new Series(), + new Series(), + ); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setData()); + $this->assertEmpty($object->getData()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setData($array)); + $this->assertCount(count($array), $object->getData()); + } + + public function testSeries() + { + $object = new Bar(); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->addSeries(new Series())); + $this->assertCount(1, $object->getData()); + } + + public function testBarDirection() + { + $object = new Bar(); + $this->assertEquals(Bar::DIRECTION_VERTICAL, $object->getBarDirection()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarDirection(Bar::DIRECTION_HORIZONTAL)); + $this->assertEquals(Bar::DIRECTION_HORIZONTAL, $object->getBarDirection()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarDirection(Bar::DIRECTION_VERTICAL)); + $this->assertEquals(Bar::DIRECTION_VERTICAL, $object->getBarDirection()); + } + + public function testHashCode() + { + $oSeries = new Series(); + + $object = new Bar(); + $object->addSeries($oSeries); + + $this->assertEquals(md5($oSeries->getHashCode().get_class($object)), $object->getHashCode()); + } +} diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartBarTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartBarTest.php new file mode 100644 index 000000000..43cec308e --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartBarTest.php @@ -0,0 +1,104 @@ + 1, 'Feb' => 5, 'Mar' => 2)); + $oSeries->setShowSeriesName(true); + $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8')); + $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744')); + $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F')); + + $oBar = new Bar(); + $oBar->addSeries($oSeries); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oChart = $oSlide->createChartShape(); + $oChart->getPlotArea()->setType($oBar); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:body/office:chart/chart:chart'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('chart:bar', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml')); + + $element = '/office:document-content/office:body/office:chart/chart:chart/chart:plot-area/chart:series/chart:data-point'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePlotArea\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('false', $pres->getElementAttribute($element, 'chart:vertical', 'Object 1/content.xml')); + $this->assertFalse($pres->attributeElementExists($element, 'chart:three-dimensional', 'Object 1/content.xml')); + $this->assertFalse($pres->attributeElementExists($element, 'chart:right-angled-axes', 'Object 1/content.xml')); + } + + public function testChartBarHorizontal() + { + $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2)); + $oSeries->setShowSeriesName(true); + $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8')); + $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744')); + $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F')); + + $oBar = new Bar(); + $oBar->setBarDirection(Bar::DIRECTION_HORIZONTAL); + $oBar->addSeries($oSeries); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oChart = $oSlide->createChartShape(); + $oChart->getPlotArea()->setType($oBar); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:body/office:chart/chart:chart'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('chart:bar', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml')); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePlotArea\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:vertical', 'Object 1/content.xml')); + $this->assertFalse($pres->attributeElementExists($element, 'chart:three-dimensional', 'Object 1/content.xml')); + $this->assertFalse($pres->attributeElementExists($element, 'chart:right-angled-axes', 'Object 1/content.xml')); + } +} diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php index 50fd7eaf1..5d10ebca3 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php @@ -87,6 +87,10 @@ public function testChartBar3D() $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePlotArea\']/style:chart-properties'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); $this->assertEquals('false', $pres->getElementAttribute($element, 'chart:vertical', 'Object 1/content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'chart:three-dimensional', 'Object 1/content.xml')); + $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:three-dimensional', 'Object 1/content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'chart:right-angled-axes', 'Object 1/content.xml')); + $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:right-angled-axes', 'Object 1/content.xml')); } public function testChartBar3DHorizontal() @@ -115,6 +119,10 @@ public function testChartBar3DHorizontal() $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePlotArea\']/style:chart-properties'; $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:vertical', 'Object 1/content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'chart:three-dimensional', 'Object 1/content.xml')); + $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:three-dimensional', 'Object 1/content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'chart:right-angled-axes', 'Object 1/content.xml')); + $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:right-angled-axes', 'Object 1/content.xml')); } public function testChartLine() diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartBarTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartBarTest.php new file mode 100644 index 000000000..6d7d06e93 --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartBarTest.php @@ -0,0 +1,81 @@ + 1, + 'B' => 2, + 'C' => 4, + 'D' => 3, + 'E' => 2, + ); + + $oPHPPowerPoint = new PhpPowerpoint(); + $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oShape = $oSlide->createChartShape(); + $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); + $oBar = new Bar(); + $oSeries = new Series('Downloads', $seriesData); + $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_BLUE)); + $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKBLUE)); + $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKGREEN)); + $oSeries->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKRED)); + $oSeries->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKYELLOW)); + $oBar->addSeries($oSeries); + $oShape->getPlotArea()->setType($oBar); + + $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); + $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dPt/c:spPr'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $element = '/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:tx/c:v'; + $this->assertEquals($oSeries->getTitle(), $oXMLDoc->getElement($element, 'ppt/charts/'.$oShape->getIndexedFilename())->nodeValue); + } +} From e88280340b5102d15424797a5514e6951676e04f Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 12 Jun 2015 22:48:01 +0200 Subject: [PATCH 062/115] ODPresentation & PowerPoint2007 Writer : Support for Bar Chart - @Progi1984 GH-82 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 747c808f2..c530b4e96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ - ODPresentation Writer : Support for border style in RichText - @Progi1984 GH-79 - ODPresentation Writer : Support for Area Chart - @Progi1984 GH-82 - PowerPoint2007 Writer : Support for Area Chart - @Progi1984 GH-82 +- ODPresentation Writer : Support for Bar Chart - @Progi1984 GH-82 +- PowerPoint2007 Writer : Support for Bar Chart - @Progi1984 GH-82 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 From b15ca9756d989f4ec8b568b6edee987760c063bb Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 12 Jun 2015 23:50:33 +0200 Subject: [PATCH 063/115] Added units in DocumentLayout - @Progi1984 GH-87 --- CHANGELOG.md | 1 + src/PhpPowerpoint/DocumentLayout.php | 97 ++++++++++++++++++- .../Tests/DocumentLayoutTest.php | 57 ++++++++++- 3 files changed, 147 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c530b4e96..8e598c5ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - PowerPoint2007 Writer : Support for Area Chart - @Progi1984 GH-82 - ODPresentation Writer : Support for Bar Chart - @Progi1984 GH-82 - PowerPoint2007 Writer : Support for Bar Chart - @Progi1984 GH-82 +- Added units in DocumentLayout - @Progi1984 GH-87 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/src/PhpPowerpoint/DocumentLayout.php b/src/PhpPowerpoint/DocumentLayout.php index a28b077cb..88d6b0a82 100644 --- a/src/PhpPowerpoint/DocumentLayout.php +++ b/src/PhpPowerpoint/DocumentLayout.php @@ -16,6 +16,7 @@ */ namespace PhpOffice\PhpPowerpoint; +use PhpOffice\PhpPowerpoint\Shared\Drawing; /** * \PhpOffice\PhpPowerpoint\DocumentLayout @@ -35,6 +36,12 @@ class DocumentLayout const LAYOUT_LETTER = 'letter'; const LAYOUT_OVERHEAD = 'overhead'; + const UNIT_EMU = 'emu'; + const UNIT_CENTIMETER = 'cm'; + const UNIT_INCH = 'in'; + const UNIT_MILLIMETER = 'mm'; + const UNIT_PIXEL = 'px'; + const UNIT_POINT = 'pt'; /** * Dimension types @@ -144,9 +151,9 @@ public function setDocumentLayout($pValue = self::LAYOUT_SCREEN_4X3, $isLandscap * * @return integer */ - public function getCX() + public function getCX($unit = self::UNIT_EMU) { - return $this->dimensionX; + return $this->convertUnit($this->dimensionX, self::UNIT_EMU, $unit); } /** @@ -154,15 +161,93 @@ public function getCX() * * @return integer */ - public function getCY() + public function getCY($unit = self::UNIT_EMU) { - return $this->dimensionY; + return $this->convertUnit($this->dimensionY, self::UNIT_EMU, $unit); + } + + /** + * Get Document Layout cx + * + * @return integer + */ + public function setCX($value, $unit = self::UNIT_EMU) + { + $this->layout = self::LAYOUT_CUSTOM; + $this->dimensionX = $this->convertUnit($value, $unit, self::UNIT_EMU); + return $this; + } + + /** + * Get Document Layout cy + * + * @return integer + */ + public function setCY($value, $unit = self::UNIT_EMU) + { + $this->layout = self::LAYOUT_CUSTOM; + $this->dimensionY = $this->convertUnit($value, $unit, self::UNIT_EMU); + return $this; + } + + /** + * Convert EMUs to differents units + * @param $value + * @param string $unit + */ + protected function convertUnit($value, $fromUnit, $toUnit) + { + // Convert from $fromUnit to EMU + switch($fromUnit){ + case self::UNIT_MILLIMETER: + $value *= 36000; + break; + case self::UNIT_CENTIMETER: + $value *= 360000; + break; + case self::UNIT_INCH: + $value *= 914400; + break; + case self::UNIT_PIXEL: + $value = Drawing::pixelsToEmu($value); + break; + case self::UNIT_POINT: + $value *= 12700; + break; + case self::UNIT_EMU: + default: + // no changes + } + + // Convert from EMU to $toUnit + switch($toUnit){ + case self::UNIT_MILLIMETER: + $value /= 36000; + break; + case self::UNIT_CENTIMETER: + $value /= 360000; + break; + case self::UNIT_INCH: + $value /= 914400; + break; + case self::UNIT_PIXEL: + $value = Drawing::emuToPixels($value); + break; + case self::UNIT_POINT: + $value /= 12700; + break; + case self::UNIT_EMU: + default: + // no changes + } + return $value; } /** * Get Document Layout in millimeters * * @return integer + * @deprecated 0.4.0 getCX(DocumentLayout::UNIT_MILLIMETER) */ public function getLayoutXmilli() { @@ -173,6 +258,7 @@ public function getLayoutXmilli() * Get Document Layout in millimeters * * @return integer + * @deprecated 0.4.0 getCY(DocumentLayout::UNIT_MILLIMETER) */ public function getLayoutYmilli() { @@ -184,6 +270,7 @@ public function getLayoutYmilli() * * @param integer $pValue Layout width * @return \PhpOffice\PhpPowerpoint\DocumentLayout + * @deprecated 0.4.0 setCY($pValue, DocumentLayout::UNIT_MILLIMETER) */ public function setLayoutXmilli($pValue) { @@ -192,11 +279,13 @@ public function setLayoutXmilli($pValue) return $this; } + /** * Set Document Layout in millimeters * * @param integer $pValue Layout height * @return \PhpOffice\PhpPowerpoint\DocumentLayout + * @deprecated 0.4.0 setCY($pValue, DocumentLayout::UNIT_MILLIMETER) */ public function setLayoutYmilli($pValue) { diff --git a/tests/PhpPowerpoint/Tests/DocumentLayoutTest.php b/tests/PhpPowerpoint/Tests/DocumentLayoutTest.php index 4be7b85a4..b36b2c4bd 100644 --- a/tests/PhpPowerpoint/Tests/DocumentLayoutTest.php +++ b/tests/PhpPowerpoint/Tests/DocumentLayoutTest.php @@ -47,11 +47,60 @@ public function testSetCustomLayout() { $object = new DocumentLayout(); $object->setDocumentLayout(array('cx' => 6858000, 'cy' => 9144000), false); - $object->setLayoutXmilli(6858000 / 36000); - $object->setLayoutYmilli(9144000 / 36000); - - $this->assertEquals('', $object->getDocumentLayout()); + $this->assertEquals(DocumentLayout::LAYOUT_CUSTOM, $object->getDocumentLayout()); + $this->assertEquals(9144000, $object->getCX()); + $this->assertEquals(6858000, $object->getCY()); + $object->setDocumentLayout(array('cx' => 6858000, 'cy' => 9144000), true); + $this->assertEquals(DocumentLayout::LAYOUT_CUSTOM, $object->getDocumentLayout()); $this->assertEquals(6858000, $object->getCX()); $this->assertEquals(9144000, $object->getCY()); } + + public function testCX() + { + $value = rand(1, 100000); + $object = new DocumentLayout(); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCX($value)); + $this->assertEquals($value, $object->getCX()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_CENTIMETER)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_CENTIMETER)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_EMU)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_EMU)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_INCH)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_INCH)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_MILLIMETER)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_MILLIMETER)); + $this->assertEquals($value, $object->getLayoutXmilli()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_POINT)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_POINT)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_PIXEL)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_PIXEL)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setLayoutXmilli($value)); + $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_MILLIMETER)); + $this->assertEquals($value, $object->getLayoutXmilli()); + } + + public function testCY() + { + $value = rand(1, 100000); + $object = new DocumentLayout(); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCY($value)); + $this->assertEquals($value, $object->getCY()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_CENTIMETER)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_CENTIMETER)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_EMU)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_EMU)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_INCH)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_INCH)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_MILLIMETER)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_MILLIMETER)); + $this->assertEquals($value, $object->getLayoutYmilli()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_POINT)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_POINT)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_PIXEL)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_PIXEL)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\DocumentLayout', $object->setLayoutYmilli($value)); + $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_MILLIMETER)); + $this->assertEquals($value, $object->getLayoutYmilli()); + } } From ba7dd0fba9c38a8e6ad00be92cecf2b0d4c67720 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 12 Jun 2015 23:59:09 +0200 Subject: [PATCH 064/115] Added units in DocumentLayout - @Progi1984 GH-87 --- src/PhpPowerpoint/DocumentLayout.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PhpPowerpoint/DocumentLayout.php b/src/PhpPowerpoint/DocumentLayout.php index 88d6b0a82..a2c285d19 100644 --- a/src/PhpPowerpoint/DocumentLayout.php +++ b/src/PhpPowerpoint/DocumentLayout.php @@ -16,6 +16,7 @@ */ namespace PhpOffice\PhpPowerpoint; + use PhpOffice\PhpPowerpoint\Shared\Drawing; /** From 937f7f333c3da8a9b796f3ac61ecdbedf6d15e11 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Thu, 18 Jun 2015 22:54:31 +0200 Subject: [PATCH 065/115] Added support for transitions between slides --- CHANGELOG.md | 1 + README.md | 1 + composer.lock | 391 +----------------- samples/Sample_10_Transition.php | 71 ++++ src/PhpPowerpoint/Slide.php | 37 +- src/PhpPowerpoint/Slide/Transition.php | 167 ++++++++ .../Writer/ODPresentation/Content.php | 201 ++++++++- .../Writer/PowerPoint2007/Slide.php | 257 +++++++++++- .../Tests/Slide/TransitionTest.php | 93 +++++ tests/PhpPowerpoint/Tests/SlideTest.php | 14 + .../Writer/ODPresentation/ContentTest.php | 202 +++++++++ .../Tests/Writer/PowerPoint2007/SlideTest.php | 206 ++++++++- 12 files changed, 1258 insertions(+), 383 deletions(-) create mode 100644 samples/Sample_10_Transition.php create mode 100644 src/PhpPowerpoint/Slide/Transition.php create mode 100644 tests/PhpPowerpoint/Tests/Slide/TransitionTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e598c5ef..952142262 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - ODPresentation Writer : Support for Bar Chart - @Progi1984 GH-82 - PowerPoint2007 Writer : Support for Bar Chart - @Progi1984 GH-82 - Added units in DocumentLayout - @Progi1984 GH-87 +- Added support for transitions between slides - @Progi1984 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 diff --git a/README.md b/README.md index f3092d010..dd3ffe4d1 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Read more about PHPPowerPoint: - Supports hyperlinks and rich-text strings - Add images with different styles (positioning, rotation, shadow) - Set printing options (header, footer, page margins, paper size, orientation) +- Set transitions between slides - Output to different file formats: PowerPoint 2007 (.pptx), OpenDocument Presentation (.odp), Serialized Presentation) - ... and lots of other things! diff --git a/composer.lock b/composer.lock index a02ddf9c6..b85d47334 100644 --- a/composer.lock +++ b/composer.lock @@ -127,16 +127,16 @@ }, { "name": "doctrine/annotations", - "version": "v1.2.4", + "version": "v1.2.6", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "b5202eb9e83f8db52e0e58867e0a46e63be8332e" + "reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/b5202eb9e83f8db52e0e58867e0a46e63be8332e", - "reference": "b5202eb9e83f8db52e0e58867e0a46e63be8332e", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f4a91702ca3cd2e568c3736aa031ed00c3752af4", + "reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4", "shasum": "" }, "require": { @@ -191,7 +191,7 @@ "docblock", "parser" ], - "time": "2014-12-23 22:40:37" + "time": "2015-06-17 12:21:22" }, { "name": "doctrine/lexer", @@ -605,20 +605,20 @@ }, { "name": "justinrainbow/json-schema", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "2465fe486c864e30badaa4d005ebdf89dbc503f3" + "reference": "7dfe4f1db8a62be3dd35710efce663537d515653" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2465fe486c864e30badaa4d005ebdf89dbc503f3", - "reference": "2465fe486c864e30badaa4d005ebdf89dbc503f3", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/7dfe4f1db8a62be3dd35710efce663537d515653", + "reference": "7dfe4f1db8a62be3dd35710efce663537d515653", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=5.3.2" }, "require-dev": { "json-schema/json-schema-test-suite": "1.1.0", @@ -667,7 +667,7 @@ "json", "schema" ], - "time": "2015-03-27 16:41:39" + "time": "2015-06-14 20:01:28" }, { "name": "kherge/version", @@ -1039,16 +1039,16 @@ }, { "name": "phpdocumentor/phpdocumentor", - "version": "v2.8.2", + "version": "v2.8.3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/phpDocumentor2.git", - "reference": "1c6a3bd696de9153a0d8596e2fc26cf866ac9c2d" + "reference": "0dd03c67db51771e312176d36194846d9006f28f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/phpDocumentor2/zipball/1c6a3bd696de9153a0d8596e2fc26cf866ac9c2d", - "reference": "1c6a3bd696de9153a0d8596e2fc26cf866ac9c2d", + "url": "https://api.github.com/repos/phpDocumentor/phpDocumentor2/zipball/0dd03c67db51771e312176d36194846d9006f28f", + "reference": "0dd03c67db51771e312176d36194846d9006f28f", "shasum": "" }, "require": { @@ -1063,15 +1063,6 @@ "phpdocumentor/graphviz": "~1.0", "phpdocumentor/reflection": "~1.0", "phpdocumentor/reflection-docblock": "~2.0", - "phpdocumentor/template-abstract": "~1.2", - "phpdocumentor/template-checkstyle": "~1.2", - "phpdocumentor/template-clean": "~1.0", - "phpdocumentor/template-new-black": "~1.3", - "phpdocumentor/template-old-ocean": "~1.3", - "phpdocumentor/template-responsive": "~1.3", - "phpdocumentor/template-responsive-twig": "~1.2", - "phpdocumentor/template-xml": "~1.0", - "phpdocumentor/template-zend": "~1.3", "symfony/config": "~2.3", "symfony/console": "~2.3", "symfony/event-dispatcher": "~2.1", @@ -1134,7 +1125,7 @@ "documentation", "phpdoc" ], - "time": "2015-02-22 17:09:31" + "time": "2015-06-15 19:08:33" }, { "name": "phpdocumentor/reflection", @@ -1239,341 +1230,6 @@ ], "time": "2015-02-03 12:10:50" }, - { - "name": "phpdocumentor/template-abstract", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/template.abstract.git", - "reference": "df1d11cf11cf5da433789e2be07f4d2d6e51aaca" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.abstract/zipball/df1d11cf11cf5da433789e2be07f4d2d6e51aaca", - "reference": "df1d11cf11cf5da433789e2be07f4d2d6e51aaca", - "shasum": "" - }, - "require": { - "phpdocumentor/unified-asset-installer": "~1.1" - }, - "type": "phpdocumentor-template", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Simple bright template for phpDocumentor", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "documentation", - "phpdoc", - "template" - ], - "abandoned": true, - "time": "2014-06-04 19:32:56" - }, - { - "name": "phpdocumentor/template-checkstyle", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/template.checkstyle.git", - "reference": "cfa86d19327b0d762332787ff2dda0d55226a2e2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.checkstyle/zipball/cfa86d19327b0d762332787ff2dda0d55226a2e2", - "reference": "cfa86d19327b0d762332787ff2dda0d55226a2e2", - "shasum": "" - }, - "require": { - "phpdocumentor/unified-asset-installer": "~1.1" - }, - "type": "phpdocumentor-template", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Checkstyle XML output template for phpDocumentor2", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "documentation", - "phpdoc", - "template" - ], - "time": "2014-08-17 19:32:38" - }, - { - "name": "phpdocumentor/template-clean", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/template.clean.git", - "reference": "6fc0f7f6c55c1f94ac5b1c6fccde7aac77755e45" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.clean/zipball/6fc0f7f6c55c1f94ac5b1c6fccde7aac77755e45", - "reference": "6fc0f7f6c55c1f94ac5b1c6fccde7aac77755e45", - "shasum": "" - }, - "require": { - "phpdocumentor/unified-asset-installer": "~1.1" - }, - "type": "phpdocumentor-template", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A clean, responsive modern template for phpDocumentor for Twig aimed at usability", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "documentation", - "phpdoc", - "responsive", - "template" - ], - "time": "2014-08-15 21:45:34" - }, - { - "name": "phpdocumentor/template-new-black", - "version": "1.3.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/template.new_black.git", - "reference": "d98f84633b94b279582735aecd91015c1e191d98" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.new_black/zipball/d98f84633b94b279582735aecd91015c1e191d98", - "reference": "d98f84633b94b279582735aecd91015c1e191d98", - "shasum": "" - }, - "require": { - "phpdocumentor/template-abstract": "1.*", - "phpdocumentor/unified-asset-installer": "~1.1" - }, - "type": "phpdocumentor-template", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Web 2.0 template with dark sidebar for phpDocumentor", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "documentation", - "phpdoc", - "template" - ], - "time": "2014-06-27 17:00:31" - }, - { - "name": "phpdocumentor/template-old-ocean", - "version": "1.3.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/template.old_ocean.git", - "reference": "2fdb786038351c0ec88633d4e2aa103e4bbb8655" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.old_ocean/zipball/2fdb786038351c0ec88633d4e2aa103e4bbb8655", - "reference": "2fdb786038351c0ec88633d4e2aa103e4bbb8655", - "shasum": "" - }, - "require": { - "phpdocumentor/unified-asset-installer": "~1.1" - }, - "type": "phpdocumentor-template", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Blue template with high contrast for the foreground", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "documentation", - "phpdoc", - "template" - ], - "time": "2014-06-27 16:59:35" - }, - { - "name": "phpdocumentor/template-responsive", - "version": "1.3.5", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/template.responsive.git", - "reference": "949e742f350f70fc8ec7c945b3cf0070a4e1825e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.responsive/zipball/949e742f350f70fc8ec7c945b3cf0070a4e1825e", - "reference": "949e742f350f70fc8ec7c945b3cf0070a4e1825e", - "shasum": "" - }, - "require": { - "phpdocumentor/unified-asset-installer": "~1.1" - }, - "type": "phpdocumentor-template", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Responsive modern template for phpDocumentor", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "documentation", - "phpdoc", - "template" - ], - "abandoned": true, - "time": "2014-08-05 20:47:53" - }, - { - "name": "phpdocumentor/template-responsive-twig", - "version": "1.2.5", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/template.responsive-twig.git", - "reference": "493e204be607583efd2d75f1728cd5210e23cf96" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.responsive-twig/zipball/493e204be607583efd2d75f1728cd5210e23cf96", - "reference": "493e204be607583efd2d75f1728cd5210e23cf96", - "shasum": "" - }, - "require": { - "phpdocumentor/unified-asset-installer": "~1.1" - }, - "type": "phpdocumentor-template", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Responsive modern template for phpDocumentor for Twig", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "documentation", - "phpdoc", - "template" - ], - "time": "2014-07-30 20:00:37" - }, - { - "name": "phpdocumentor/template-xml", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/mvriel/template.xml.git", - "reference": "a372713be8ee99b16497e2580592e474ff51190c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mvriel/template.xml/zipball/a372713be8ee99b16497e2580592e474ff51190c", - "reference": "a372713be8ee99b16497e2580592e474ff51190c", - "shasum": "" - }, - "require": { - "phpdocumentor/unified-asset-installer": "~1.1" - }, - "type": "phpdocumentor-template", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Generates an XML representation of the project's structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "documentation", - "phpdoc", - "template" - ], - "time": "2013-08-01 20:23:32" - }, - { - "name": "phpdocumentor/template-zend", - "version": "1.3.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/template.zend.git", - "reference": "75913288bfd73d3bf4c1b1179c3963f3431e7a9d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/template.zend/zipball/75913288bfd73d3bf4c1b1179c3963f3431e7a9d", - "reference": "75913288bfd73d3bf4c1b1179c3963f3431e7a9d", - "shasum": "" - }, - "require": { - "ext-xsl": "*", - "phpdocumentor/template-abstract": "1.*", - "phpdocumentor/unified-asset-installer": "~1.1" - }, - "type": "phpdocumentor-template", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Official Zend Framework Template for phpDocumentor2", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "ZendFramework", - "documentation", - "phpdoc", - "template", - "zend", - "zf" - ], - "time": "2013-12-05 08:51:57" - }, - { - "name": "phpdocumentor/unified-asset-installer", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/UnifiedAssetInstaller.git", - "reference": "241fb036268cd9da7d76da3db66e3eda66259c52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/UnifiedAssetInstaller/zipball/241fb036268cd9da7d76da3db66e3eda66259c52", - "reference": "241fb036268cd9da7d76da3db66e3eda66259c52", - "shasum": "" - }, - "require": { - "composer-plugin-api": "1.0.0" - }, - "require-dev": { - "composer/composer": "~1.0@dev", - "phpunit/phpunit": "~3.7" - }, - "type": "composer-installer", - "extra": { - "class": "\\phpDocumentor\\Composer\\UnifiedAssetInstaller" - }, - "autoload": { - "psr-0": { - "phpDocumentor\\Composer": [ - "src/", - "test/unit/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Asset installer for phpDocumentor", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "assets", - "installer", - "plugins", - "templates" - ], - "time": "2013-09-09 06:13:02" - }, { "name": "phploc/phploc", "version": "2.1.3", @@ -1892,16 +1548,16 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.5", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d", + "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d", "shasum": "" }, "require": { @@ -1910,13 +1566,10 @@ "type": "library", "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -1932,7 +1585,7 @@ "keywords": [ "timer" ], - "time": "2013-08-02 07:42:54" + "time": "2015-06-13 07:35:30" }, { "name": "phpunit/php-token-stream", diff --git a/samples/Sample_10_Transition.php b/samples/Sample_10_Transition.php new file mode 100644 index 000000000..ed1106ef5 --- /dev/null +++ b/samples/Sample_10_Transition.php @@ -0,0 +1,71 @@ +getProperties()->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPowerPoint Team') + ->setTitle('Sample 10 Title') + ->setSubject('Sample 10 Subject') + ->setDescription('Sample 10 Description') + ->setKeywords('office 2007 openxml libreoffice odt php') + ->setCategory('Sample Category'); + +// Create slide +echo date('H:i:s') . ' Create slide'.EOL; +$slide0 = $objPHPPowerPoint->getActiveSlide(); + +// Create a shape (drawing) +echo date('H:i:s') . ' Create a shape (drawing)'.EOL; +$shapeDrawing = $slide0->createDrawingShape(); +$shapeDrawing->setName('PHPPowerPoint logo') + ->setDescription('PHPPowerPoint logo') + ->setPath('./resources/phppowerpoint_logo.gif') + ->setHeight(36) + ->setOffsetX(10) + ->setOffsetY(10); +$shapeDrawing->getShadow()->setVisible(true) + ->setDirection(45) + ->setDistance(10); +$shapeDrawing->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); + +// Create a shape (text) +echo date('H:i:s') . ' Create a shape (rich text)'.EOL; +$shapeRichText = $slide0->createRichTextShape() + ->setHeight(300) + ->setWidth(600) + ->setOffsetX(170) + ->setOffsetY(180); +$shapeRichText->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER ); +$textRun = $shapeRichText->createTextRun('Thank you for using PHPPowerPoint!'); +$textRun->getFont()->setBold(true) + ->setSize(60) + ->setColor( new Color( 'FFE06B20' ) ); + +$oTransition = new Transition(); +$oTransition->setManualTrigger(false); +$oTransition->setTimeTrigger(true, 4000); +$oTransition->setTransitionType(Transition::TRANSITION_SPLIT_IN_VERTICAL); +$slide0->setTransition($oTransition); + +// Create slide +echo date('H:i:s') . ' Create slide'.EOL; +$slide1 = $objPHPPowerPoint->createSlide(); +$slide1->addShape(clone $shapeDrawing); +$slide1->addShape(clone $shapeRichText); + +// Save file +echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/src/PhpPowerpoint/Slide.php b/src/PhpPowerpoint/Slide.php index 027432c4e..c1494b9e7 100644 --- a/src/PhpPowerpoint/Slide.php +++ b/src/PhpPowerpoint/Slide.php @@ -17,15 +17,14 @@ namespace PhpOffice\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\GeometryCalculator; use PhpOffice\PhpPowerpoint\Shape\Chart; use PhpOffice\PhpPowerpoint\Shape\Drawing; -use PhpOffice\PhpPowerpoint\Shape\Group; use PhpOffice\PhpPowerpoint\Shape\Line; use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\Shape\Table; use PhpOffice\PhpPowerpoint\Slide\Layout; use PhpOffice\PhpPowerpoint\Slide\Note; +use PhpOffice\PhpPowerpoint\Slide\Transition; /** * Slide class @@ -66,12 +65,17 @@ class Slide implements ComparableInterface, ShapeContainerInterface * @var integer */ private $slideMasterId = 1; - + /** * * @var \PhpOffice\PhpPowerpoint\Slide\Note */ private $slideNote; + /** + * + * @var \PhpOffice\PhpPowerpoint\Slide\Transition + */ + private $slideTransition; /** * Hash index @@ -410,7 +414,7 @@ public function getExtentY() } return $this->extentY; } - + /** * * @return \PhpOffice\PhpPowerpoint\Slide\Note @@ -422,7 +426,7 @@ public function getNote() } return $this->slideNote; } - + /** * * @param \PhpOffice\PhpPowerpoint\Slide\Note $note @@ -432,7 +436,28 @@ public function setNote(Note $note = null) { $this->slideNote = (is_null($note) ? new Note() : $note); $this->slideNote->setParent($this); - + + return $this; + } + + /** + * + * @return \PhpOffice\PhpPowerpoint\Slide\Transition + */ + public function getTransition() + { + return $this->slideTransition; + } + + /** + * + * @param \PhpOffice\PhpPowerpoint\Slide\Transition $transition + * @return \PhpOffice\PhpPowerpoint\Slide + */ + public function setTransition(Transition $transition = null) + { + $this->slideTransition = $transition; + return $this; } } diff --git a/src/PhpPowerpoint/Slide/Transition.php b/src/PhpPowerpoint/Slide/Transition.php new file mode 100644 index 000000000..2e43fe0e0 --- /dev/null +++ b/src/PhpPowerpoint/Slide/Transition.php @@ -0,0 +1,167 @@ +speed = $speed; + } else { + $this->speed = null; + } + + return $this; + } + + public function getSpeed() + { + return $this->speed; + } + + public function setManualTrigger($value = false) + { + if(is_bool($value)) { + $this->hasManualTrigger = $value; + } + return $this; + } + + public function hasManualTrigger() + { + return $this->hasManualTrigger; + } + + public function setTimeTrigger($value = false, $advanceTime = 1000) + { + if(is_bool($value)) { + $this->hasTimeTrigger = $value; + } + $this->advanceTimeTrigger = null; + if($this->hasTimeTrigger === true) { + $this->advanceTimeTrigger = (int) $advanceTime; + } + return $this; + } + + public function hasTimeTrigger() + { + return $this->hasTimeTrigger; + } + + public function getAdvanceTimeTrigger() + { + return $this->advanceTimeTrigger; + } + + public function setTransitionType($type = null) + { + $this->transitionType = $type; + return $this; + } + + public function getTransitionType() + { + return $this->transitionType; + } +} diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index 55329ca45..843174dbf 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -17,6 +17,7 @@ namespace PhpOffice\PhpPowerpoint\Writer\ODPresentation; +use PhpOffice\PhpPowerpoint\Slide; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; use PhpOffice\PhpPowerpoint\Shape\Chart; @@ -29,12 +30,11 @@ use PhpOffice\PhpPowerpoint\Shape\RichText\TextElement; use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\Shape\Table; -use PhpOffice\PhpPowerpoint\Shape\Table\Cell; -use PhpOffice\PhpPowerpoint\Shape\Table\Row; use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; use PhpOffice\PhpPowerpoint\Shared\String; use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Slide\Note; +use PhpOffice\PhpPowerpoint\Slide\Transition; use PhpOffice\PhpPowerpoint\Style\Alignment; use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Fill; @@ -127,7 +127,11 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) $objWriter->startElement('office:automatic-styles'); $this->shapeId = 0; + $incSlide = 0; foreach ($pPHPPowerPoint->getAllSlides() as $pSlide) { + // Slides + $this->writeStyleSlide($objWriter, $pSlide, $incSlide); + // Images $shapes = $pSlide->getShapeCollection(); foreach ($shapes as $shape) { @@ -151,6 +155,8 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) $this->writeGroupStyle($objWriter, $shape); } } + + $incSlide++; } // Style : Bullet if (!empty($this->arrStyleBullet)) { @@ -263,6 +269,7 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) $objWriter->startElement('draw:page'); $objWriter->writeAttribute('draw:name', 'page' . $i); $objWriter->writeAttribute('draw:master-page-name', 'Standard'); + $objWriter->writeAttribute('draw:style-name', 'stylePage' . $i); // Images $shapes = $pSlide->getShapeCollection(); foreach ($shapes as $shape) { @@ -1015,7 +1022,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) /** * Write the slide note * @param XMLWriter $objWriter - * @param PhpOffice\PhpPowerpoint\Note $note + * @param |PhpOffice\PhpPowerpoint\Slide\Note $note */ public function writeSlideNote(XMLWriter $objWriter, Note $note) { @@ -1035,4 +1042,192 @@ public function writeSlideNote(XMLWriter $objWriter, Note $note) $objWriter->endElement(); } } + + /** + * Write style of a slide + * @param XMLWriter $objWriter + * @param Slide $slide + * @param int $i + */ + public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $i) + { + // style:style + $objWriter->startElement('style:style'); + $objWriter->writeAttribute('style:family', 'drawing-page'); + $objWriter->writeAttribute('style:name', 'stylePage'.$i); + // style:style/style:drawing-page-properties + $objWriter->startElement('style:drawing-page-properties'); + if (!is_null($oTransition = $slide->getTransition())){ + $objWriter->writeAttribute('presentation:duration', 'PT'.number_format($oTransition->getAdvanceTimeTrigger() / 1000, 6, '.', '').'S'); + if ($oTransition->hasManualTrigger()) { + $objWriter->writeAttribute('presentation:transition-type', 'manual'); + } elseif ($oTransition->hasTimeTrigger()) { + $objWriter->writeAttribute('presentation:transition-type', 'automatic'); + } + switch($oTransition->getSpeed()) { + case Transition::SPEED_FAST; + $objWriter->writeAttribute('presentation:transition-speed', 'fast'); + break; + case Transition::SPEED_MEDIUM; + $objWriter->writeAttribute('presentation:transition-speed', 'medium'); + break; + case Transition::SPEED_SLOW; + $objWriter->writeAttribute('presentation:transition-speed', 'slow'); + break; + } + + /** + * http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-presentation_transition-style + */ + switch($oTransition->getTransitionType()) { + case Transition::TRANSITION_BLINDS_HORIZONTAL: + $objWriter->writeAttribute('presentation:transition-style', 'horizontal-stripes'); + break; + case Transition::TRANSITION_BLINDS_VERTICAL: + $objWriter->writeAttribute('presentation:transition-style', 'vertical-stripes'); + break; + case Transition::TRANSITION_CHECKER_HORIZONTAL: + $objWriter->writeAttribute('presentation:transition-style', 'horizontal-checkerboard'); + break; + case Transition::TRANSITION_CHECKER_VERTICAL: + $objWriter->writeAttribute('presentation:transition-style', 'vertical-checkerboard'); + break; + case Transition::TRANSITION_CIRCLE_HORIZONTAL: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_CIRCLE_VERTICAL: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_COMB_HORIZONTAL: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_COMB_VERTICAL: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_COVER_DOWN: + $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-bottom'); + break; + case Transition::TRANSITION_COVER_LEFT: + $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-left'); + break; + case Transition::TRANSITION_COVER_LEFT_DOWN: + $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerleft'); + break; + case Transition::TRANSITION_COVER_LEFT_UP: + $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperleft'); + break; + case Transition::TRANSITION_COVER_RIGHT: + $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-right'); + break; + case Transition::TRANSITION_COVER_RIGHT_DOWN: + $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerright'); + break; + case Transition::TRANSITION_COVER_RIGHT_UP: + $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperright'); + break; + case Transition::TRANSITION_COVER_UP: + $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-top'); + break; + case Transition::TRANSITION_CUT: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_DIAMOND: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_DISSOLVE: + $objWriter->writeAttribute('presentation:transition-style', 'dissolve'); + break; + case Transition::TRANSITION_FADE: + $objWriter->writeAttribute('presentation:transition-style', 'fade-from-center'); + break; + case Transition::TRANSITION_NEWSFLASH: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_PLUS: + $objWriter->writeAttribute('presentation:transition-style', 'close'); + break; + case Transition::TRANSITION_PULL_DOWN: + $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-bottom'); + break; + case Transition::TRANSITION_PULL_LEFT: + $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-left'); + break; + case Transition::TRANSITION_PULL_RIGHT: + $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-right'); + break; + case Transition::TRANSITION_PULL_UP: + $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-top'); + break; + case Transition::TRANSITION_PUSH_DOWN: + $objWriter->writeAttribute('presentation:transition-style', 'roll-from-bottom'); + break; + case Transition::TRANSITION_PUSH_LEFT: + $objWriter->writeAttribute('presentation:transition-style', 'roll-from-left'); + break; + case Transition::TRANSITION_PUSH_RIGHT: + $objWriter->writeAttribute('presentation:transition-style', 'roll-from-right'); + break; + case Transition::TRANSITION_PUSH_UP: + $objWriter->writeAttribute('presentation:transition-style', 'roll-from-top'); + break; + case Transition::TRANSITION_RANDOM: + $objWriter->writeAttribute('presentation:transition-style', 'random'); + break; + case Transition::TRANSITION_RANDOMBAR_HORIZONTAL: + $objWriter->writeAttribute('presentation:transition-style', 'horizontal-lines'); + break; + case Transition::TRANSITION_RANDOMBAR_VERTICAL: + $objWriter->writeAttribute('presentation:transition-style', 'vertical-lines'); + break; + case Transition::TRANSITION_SPLIT_IN_HORIZONTAL: + $objWriter->writeAttribute('presentation:transition-style', 'close-horizontal'); + break; + case Transition::TRANSITION_SPLIT_OUT_HORIZONTAL: + $objWriter->writeAttribute('presentation:transition-style', 'open-horizontal'); + break; + case Transition::TRANSITION_SPLIT_IN_VERTICAL: + $objWriter->writeAttribute('presentation:transition-style', 'close-vertical'); + break; + case Transition::TRANSITION_SPLIT_OUT_VERTICAL: + $objWriter->writeAttribute('presentation:transition-style', 'open-vertical'); + break; + case Transition::TRANSITION_STRIPS_LEFT_DOWN: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_STRIPS_LEFT_UP: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_STRIPS_RIGHT_DOWN: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_STRIPS_RIGHT_UP: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_WEDGE: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_WIPE_DOWN: + $objWriter->writeAttribute('presentation:transition-style', 'fade-from-bottom'); + break; + case Transition::TRANSITION_WIPE_LEFT: + $objWriter->writeAttribute('presentation:transition-style', 'fade-from-left'); + break; + case Transition::TRANSITION_WIPE_RIGHT: + $objWriter->writeAttribute('presentation:transition-style', 'fade-from-right'); + break; + case Transition::TRANSITION_WIPE_UP: + $objWriter->writeAttribute('presentation:transition-style', 'fade-from-top'); + break; + case Transition::TRANSITION_ZOOM_IN: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + case Transition::TRANSITION_ZOOM_OUT: + $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; + } + } + $objWriter->endElement(); + // > style:style + $objWriter->endElement(); + } } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index c235c48f6..a32989d0a 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -31,8 +31,8 @@ use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Slide as SlideElement; use PhpOffice\PhpPowerpoint\Slide\Note; +use PhpOffice\PhpPowerpoint\Slide\Transition; use PhpOffice\PhpPowerpoint\Style\Alignment; -use PhpOffice\PhpPowerpoint\Style\Borders; use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Bullet; use PhpOffice\PhpPowerpoint\Style\Fill; @@ -161,6 +161,10 @@ public function writeSlide(SlideElement $pSlide = null) $objWriter->endElement(); + if (!is_null($pSlide->getTransition())) { + $this->writeTransition($objWriter, $pSlide->getTransition()); + } + $objWriter->endElement(); // Return @@ -1406,4 +1410,255 @@ public function writeNote(Note $pNote = null) // Return return $objWriter->getData(); } + + /** + * Write Transition Slide + * @link http://officeopenxml.com/prSlide-transitions.php + * @param XMLWriter $objWriter + * @param Transition $transition + */ + public function writeTransition(XMLWriter $objWriter, Transition $transition) + { + $objWriter->startElement('p:transition'); + if(!is_null($transition->getSpeed())){ + $objWriter->writeAttribute('spd', $transition->getSpeed()); + } + $objWriter->writeAttribute('advClick', $transition->hasManualTrigger() ? '1' : '0'); + if($transition->hasTimeTrigger()) { + $objWriter->writeAttribute('advTm', $transition->getAdvanceTimeTrigger()); + } + + switch($transition->getTransitionType()) { + case Transition::TRANSITION_BLINDS_HORIZONTAL: + $objWriter->startElement('p:blinds'); + $objWriter->writeAttribute('dir', 'horz'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_BLINDS_VERTICAL: + $objWriter->startElement('p:blinds'); + $objWriter->writeAttribute('dir', 'vert'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_CHECKER_HORIZONTAL: + $objWriter->startElement('p:checker'); + $objWriter->writeAttribute('dir', 'horz'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_CHECKER_VERTICAL: + $objWriter->startElement('p:checker'); + $objWriter->writeAttribute('dir', 'vert'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_CIRCLE_HORIZONTAL: + $objWriter->startElement('p:circle'); + $objWriter->writeAttribute('dir', 'horz'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_CIRCLE_VERTICAL: + $objWriter->startElement('p:circle'); + $objWriter->writeAttribute('dir', 'vert'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_COMB_HORIZONTAL: + $objWriter->startElement('p:comb'); + $objWriter->writeAttribute('dir', 'horz'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_COMB_VERTICAL: + $objWriter->startElement('p:comb'); + $objWriter->writeAttribute('dir', 'vert'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_COVER_DOWN: + $objWriter->startElement('p:cover'); + $objWriter->writeAttribute('dir', 'd'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_COVER_LEFT: + $objWriter->startElement('p:cover'); + $objWriter->writeAttribute('dir', 'l'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_COVER_LEFT_DOWN: + $objWriter->startElement('p:cover'); + $objWriter->writeAttribute('dir', 'ld'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_COVER_LEFT_UP: + $objWriter->startElement('p:cover'); + $objWriter->writeAttribute('dir', 'lu'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_COVER_RIGHT: + $objWriter->startElement('p:cover'); + $objWriter->writeAttribute('dir', 'r'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_COVER_RIGHT_DOWN: + $objWriter->startElement('p:cover'); + $objWriter->writeAttribute('dir', 'rd'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_COVER_RIGHT_UP: + $objWriter->startElement('p:cover'); + $objWriter->writeAttribute('dir', 'ru'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_COVER_UP: + $objWriter->startElement('p:cover'); + $objWriter->writeAttribute('dir', 'u'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_CUT: + $objWriter->writeElement('p:cut'); + break; + case Transition::TRANSITION_DIAMOND: + $objWriter->writeElement('p:diamond'); + break; + case Transition::TRANSITION_DISSOLVE: + $objWriter->writeElement('p:dissolve'); + break; + case Transition::TRANSITION_FADE: + $objWriter->writeElement('p:fade'); + break; + case Transition::TRANSITION_NEWSFLASH: + $objWriter->writeElement('p:newsflash'); + break; + case Transition::TRANSITION_PLUS: + $objWriter->writeElement('p:plus'); + break; + case Transition::TRANSITION_PULL_DOWN: + $objWriter->startElement('p:pull'); + $objWriter->writeAttribute('dir', 'd'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_PULL_LEFT: + $objWriter->startElement('p:pull'); + $objWriter->writeAttribute('dir', 'l'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_PULL_RIGHT: + $objWriter->startElement('p:pull'); + $objWriter->writeAttribute('dir', 'r'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_PULL_UP: + $objWriter->startElement('p:pull'); + $objWriter->writeAttribute('dir', 'u'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_PUSH_DOWN: + $objWriter->startElement('p:push'); + $objWriter->writeAttribute('dir', 'd'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_PUSH_LEFT: + $objWriter->startElement('p:push'); + $objWriter->writeAttribute('dir', 'l'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_PUSH_RIGHT: + $objWriter->startElement('p:push'); + $objWriter->writeAttribute('dir', 'r'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_PUSH_UP: + $objWriter->startElement('p:push'); + $objWriter->writeAttribute('dir', 'u'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_RANDOM: + $objWriter->writeElement('p:random'); + break; + case Transition::TRANSITION_RANDOMBAR_HORIZONTAL: + $objWriter->startElement('p:randomBar'); + $objWriter->writeAttribute('dir', 'horz'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_RANDOMBAR_VERTICAL: + $objWriter->startElement('p:randomBar'); + $objWriter->writeAttribute('dir', 'vert'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_SPLIT_IN_HORIZONTAL: + $objWriter->startElement('p:split'); + $objWriter->writeAttribute('dir', 'in'); + $objWriter->writeAttribute('orient', 'horz'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_SPLIT_OUT_HORIZONTAL: + $objWriter->startElement('p:split'); + $objWriter->writeAttribute('dir', 'out'); + $objWriter->writeAttribute('orient', 'horz'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_SPLIT_IN_VERTICAL: + $objWriter->startElement('p:split'); + $objWriter->writeAttribute('dir', 'in'); + $objWriter->writeAttribute('orient', 'vert'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_SPLIT_OUT_VERTICAL: + $objWriter->startElement('p:split'); + $objWriter->writeAttribute('dir', 'out'); + $objWriter->writeAttribute('orient', 'vert'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_STRIPS_LEFT_DOWN: + $objWriter->startElement('p:strips'); + $objWriter->writeAttribute('dir', 'ld'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_STRIPS_LEFT_UP: + $objWriter->startElement('p:strips'); + $objWriter->writeAttribute('dir', 'lu'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_STRIPS_RIGHT_DOWN: + $objWriter->startElement('p:strips'); + $objWriter->writeAttribute('dir', 'rd'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_STRIPS_RIGHT_UP: + $objWriter->startElement('p:strips'); + $objWriter->writeAttribute('dir', 'ru'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_WEDGE: + $objWriter->writeElement('p:wedge'); + break; + case Transition::TRANSITION_WIPE_DOWN: + $objWriter->startElement('p:wipe'); + $objWriter->writeAttribute('dir', 'd'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_WIPE_LEFT: + $objWriter->startElement('p:wipe'); + $objWriter->writeAttribute('dir', 'l'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_WIPE_RIGHT: + $objWriter->startElement('p:wipe'); + $objWriter->writeAttribute('dir', 'r'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_WIPE_UP: + $objWriter->startElement('p:wipe'); + $objWriter->writeAttribute('dir', 'u'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_ZOOM_IN: + $objWriter->startElement('p:zoom'); + $objWriter->writeAttribute('dir', 'in'); + $objWriter->endElement(); + break; + case Transition::TRANSITION_ZOOM_OUT: + $objWriter->startElement('p:zoom'); + $objWriter->writeAttribute('dir', 'out'); + $objWriter->endElement(); + break; + } + + $objWriter->endElement(); + } } diff --git a/tests/PhpPowerpoint/Tests/Slide/TransitionTest.php b/tests/PhpPowerpoint/Tests/Slide/TransitionTest.php new file mode 100644 index 000000000..531aadc4a --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Slide/TransitionTest.php @@ -0,0 +1,93 @@ +assertNull($object->getSpeed()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setSpeed()); + $this->assertEquals(Transition::SPEED_MEDIUM, $object->getSpeed()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setSpeed(Transition::SPEED_FAST)); + $this->assertEquals(Transition::SPEED_FAST, $object->getSpeed()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setSpeed(rand(1, 1000))); + $this->assertNull($object->getSpeed()); + } + + public function testManualTrigger() + { + $object = new Transition(); + $this->assertFalse($object->hasManualTrigger()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setManualTrigger()); + $this->assertFalse($object->hasManualTrigger()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setManualTrigger(true)); + $this->assertTrue($object->hasManualTrigger()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setManualTrigger(null)); + $this->assertTrue($object->hasManualTrigger()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setManualTrigger(false)); + $this->assertFalse($object->hasManualTrigger()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setManualTrigger(null)); + $this->assertFalse($object->hasManualTrigger()); + } + + public function testTimeTrigger() + { + $object = new Transition(); + $this->assertFalse($object->hasTimeTrigger()); + $this->assertNull($object->getAdvanceTimeTrigger()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTimeTrigger()); + $this->assertFalse($object->hasTimeTrigger()); + $this->assertNull($object->getAdvanceTimeTrigger()); + $value = rand(1, 1000); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTimeTrigger(true, $value)); + $this->assertTrue($object->hasTimeTrigger()); + $this->assertEquals($value, $object->getAdvanceTimeTrigger()); + $value = rand(1, 1000); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTimeTrigger(null, $value)); + $this->assertTrue($object->hasTimeTrigger()); + $this->assertEquals($value, $object->getAdvanceTimeTrigger()); + $value = rand(1, 1000); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTimeTrigger(false, $value)); + $this->assertFalse($object->hasTimeTrigger()); + $this->assertNull($object->getAdvanceTimeTrigger()); + $value = rand(1, 1000); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTimeTrigger(null, $value)); + $this->assertFalse($object->hasTimeTrigger()); + $this->assertNull($object->getAdvanceTimeTrigger()); + } + + public function testTransitionType() + { + $object = new Transition(); + $this->assertNull($object->getTransitionType()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTransitionType()); + $this->assertNull($object->getTransitionType()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->setTransitionType(Transition::TRANSITION_RANDOM)); + $this->assertEquals(Transition::TRANSITION_RANDOM, $object->getTransitionType()); + + } +} diff --git a/tests/PhpPowerpoint/Tests/SlideTest.php b/tests/PhpPowerpoint/Tests/SlideTest.php index c670ec9e8..8cfcc8977 100644 --- a/tests/PhpPowerpoint/Tests/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/SlideTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpPowerpoint\Tests; use PhpOffice\PhpPowerpoint\Slide; +use PhpOffice\PhpPowerpoint\Slide\Transition; use PhpOffice\PhpPowerpoint\PhpPowerpoint; /** @@ -64,4 +65,17 @@ public function testGroup() $object = new Slide(); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->createGroup()); } + + public function testTransition() + { + $object = new Slide(); + $oTransition = new Transition(); + $this->assertNull($object->getTransition()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->setTransition()); + $this->assertNull($object->getTransition()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->setTransition($oTransition)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide\\Transition', $object->getTransition()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->setTransition(null)); + $this->assertNull($object->getTransition()); + } } diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index 9ec14f18b..dc5d2e288 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -19,6 +19,7 @@ use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\RichText\Run; +use PhpOffice\PhpPowerpoint\Slide\Transition; use PhpOffice\PhpPowerpoint\Style\Alignment; use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Bullet; @@ -383,4 +384,205 @@ public function testTableWithText() $this->assertTrue($pres->elementExists($element, 'content.xml')); $this->assertEquals('Test', $pres->getElement($element, 'content.xml')->nodeValue); } + + public function testTransition() + { + $value = rand(1000, 5000); + + $oTransition = new Transition(); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePage0\']/style:drawing-page-properties'; + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertFalse($pres->attributeElementExists($element, 'presentation:duration', 'content.xml')); + + $oTransition->setTimeTrigger(true, $value); + $oSlide->setTransition($oTransition); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'presentation:duration', 'content.xml')); + $this->assertStringStartsWith('PT', $pres->getElementAttribute($element, 'presentation:duration', 'content.xml')); + $this->assertStringEndsWith('S', $pres->getElementAttribute($element, 'presentation:duration', 'content.xml')); + $this->assertContains(number_format($value / 1000, 6, '.', ''), $pres->getElementAttribute($element, 'presentation:duration', 'content.xml')); + $this->assertContains('automatic', $pres->getElementAttribute($element, 'presentation:transition-type', 'content.xml')); + + $oTransition->setSpeed(Transition::SPEED_FAST); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $this->assertContains('fast', $pres->getElementAttribute($element, 'presentation:transition-speed', 'content.xml')); + + $oTransition->setSpeed(Transition::SPEED_MEDIUM); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $this->assertContains('medium', $pres->getElementAttribute($element, 'presentation:transition-speed', 'content.xml')); + + $oTransition->setSpeed(Transition::SPEED_SLOW); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $this->assertContains('slow', $pres->getElementAttribute($element, 'presentation:transition-speed', 'content.xml')); + + $rcTransition = new \ReflectionClass('PhpOffice\PhpPowerpoint\Slide\Transition'); + $arrayConstants = $rcTransition->getConstants(); + foreach ($arrayConstants as $key => $value) { + if(strpos($key, 'TRANSITION_') !== 0) { + continue; + } + + $oTransition->setTransitionType($rcTransition->getConstant($key)); + $oSlide->setTransition($oTransition); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + switch($key) { + case 'TRANSITION_BLINDS_HORIZONTAL': + $this->assertContains('horizontal-stripes', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_BLINDS_VERTICAL': + $this->assertContains('vertical-stripes', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_CHECKER_HORIZONTAL': + $this->assertContains('horizontal-checkerboard', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_CHECKER_VERTICAL': + $this->assertContains('vertical-checkerboard', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_CIRCLE_HORIZONTAL': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_CIRCLE_VERTICAL': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_COMB_HORIZONTAL': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_COMB_VERTICAL': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_COVER_DOWN': + $this->assertContains('uncover-to-bottom', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_COVER_LEFT': + $this->assertContains('uncover-to-left', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_COVER_LEFT_DOWN': + $this->assertContains('uncover-to-lowerleft', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_COVER_LEFT_UP': + $this->assertContains('uncover-to-upperleft', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_COVER_RIGHT': + $this->assertContains('uncover-to-right', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_COVER_RIGHT_DOWN': + $this->assertContains('uncover-to-lowerright', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_COVER_RIGHT_UP': + $this->assertContains('uncover-to-upperright', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_COVER_UP': + $this->assertContains('uncover-to-top', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_CUT': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_DIAMOND': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_DISSOLVE': + $this->assertContains('dissolve', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_FADE': + $this->assertContains('fade-from-center', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_NEWSFLASH': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_PLUS': + $this->assertContains('close', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_PULL_DOWN': + $this->assertContains('stretch-from-bottom', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_PULL_LEFT': + $this->assertContains('stretch-from-left', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_PULL_RIGHT': + $this->assertContains('stretch-from-right', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_PULL_UP': + $this->assertContains('stretch-from-top', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_PUSH_DOWN': + $this->assertContains('roll-from-bottom', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_PUSH_LEFT': + $this->assertContains('roll-from-left', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_PUSH_RIGHT': + $this->assertContains('roll-from-right', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_PUSH_UP': + $this->assertContains('roll-from-top', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_RANDOM': + $this->assertContains('random', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_RANDOMBAR_HORIZONTAL': + $this->assertContains('horizontal-lines', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_RANDOMBAR_VERTICAL': + $this->assertContains('vertical-lines', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_SPLIT_IN_HORIZONTAL': + $this->assertContains('close-horizontal', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_SPLIT_OUT_HORIZONTAL': + $this->assertContains('open-horizontal', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_SPLIT_IN_VERTICAL': + $this->assertContains('close-vertical', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_SPLIT_OUT_VERTICAL': + $this->assertContains('open-vertical', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_STRIPS_LEFT_DOWN': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_STRIPS_LEFT_UP': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_STRIPS_RIGHT_DOWN': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_STRIPS_RIGHT_UP': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_WEDGE': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_WIPE_DOWN': + $this->assertContains('fade-from-bottom', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_WIPE_LEFT': + $this->assertContains('fade-from-left', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_WIPE_RIGHT': + $this->assertContains('fade-from-right', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_WIPE_UP': + $this->assertContains('fade-from-top', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_ZOOM_IN': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + case 'TRANSITION_ZOOM_OUT': + $this->assertContains('none', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); + break; + } + } + + $oTransition->setManualTrigger(true); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $this->assertContains('manual', $pres->getElementAttribute($element, 'presentation:transition-type', 'content.xml')); + } } diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index 5a0fc4340..af72f67e5 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -17,18 +17,18 @@ namespace PhpOffice\PhpPowerpoint\Tests\Writer\PowerPoint2007; +use PhpOffice\PhpPowerpoint\Tests\TestHelperDOCX; use PhpOffice\PhpPowerpoint\PhpPowerpoint; +use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\Shared\Drawing; use PhpOffice\PhpPowerpoint\Style\Alignment; use PhpOffice\PhpPowerpoint\Style\Bullet; use PhpOffice\PhpPowerpoint\Style\Color; use PhpOffice\PhpPowerpoint\Style\Fill; -use PhpOffice\PhpPowerpoint\Tests\TestHelperDOCX; -use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; +use PhpOffice\PhpPowerpoint\Slide\Transition; use PhpOffice\PhpPowerpoint\Style\Border; -use PhpOffice\PhpPowerpoint\Shape\Hyperlink; +use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Slide; -use PhpOffice\PhpPowerpoint\Shape\RichText; /** * Test class for PowerPoint2007 @@ -698,4 +698,202 @@ public function testTableWithHyperlink() $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); $this->assertEquals('rId2', $pres->getElementAttribute($element, 'r:id', 'ppt/slides/slide1.xml')); } + + public function testTransition() + { + $value = rand(1000, 5000); + + $oTransition = new Transition(); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + + $element = '/p:sld/p:transition'; + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $this->assertFalse($pres->elementExists($element, 'ppt/slides/slide1.xml')); + + $oTransition->setTimeTrigger(true, $value); + $oSlide->setTransition($oTransition); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + $this->assertTrue($pres->attributeElementExists($element, 'advTm', 'ppt/slides/slide1.xml')); + $this->assertEquals($value, $pres->getElementAttribute($element, 'advTm', 'ppt/slides/slide1.xml')); + $this->assertContains('0', $pres->getElementAttribute($element, 'advClick', 'ppt/slides/slide1.xml')); + + $oTransition->setSpeed(Transition::SPEED_FAST); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $this->assertContains('fast', $pres->getElementAttribute($element, 'spd', 'ppt/slides/slide1.xml')); + + $oTransition->setSpeed(Transition::SPEED_MEDIUM); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $this->assertContains('med', $pres->getElementAttribute($element, 'spd', 'ppt/slides/slide1.xml')); + + $oTransition->setSpeed(Transition::SPEED_SLOW); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $this->assertContains('slow', $pres->getElementAttribute($element, 'spd', 'ppt/slides/slide1.xml')); + + $rcTransition = new \ReflectionClass('PhpOffice\PhpPowerpoint\Slide\Transition'); + $arrayConstants = $rcTransition->getConstants(); + foreach ($arrayConstants as $key => $value) { + if(strpos($key, 'TRANSITION_') !== 0) { + continue; + } + + $oTransition->setTransitionType($rcTransition->getConstant($key)); + $oSlide->setTransition($oTransition); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + switch($key) { + case 'TRANSITION_BLINDS_HORIZONTAL': + $this->assertTrue($pres->elementExists($element.'/p:blinds[@dir=\'horz\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_BLINDS_VERTICAL': + $this->assertTrue($pres->elementExists($element.'/p:blinds[@dir=\'vert\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_CHECKER_HORIZONTAL': + $this->assertTrue($pres->elementExists($element.'/p:checker[@dir=\'horz\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_CHECKER_VERTICAL': + $this->assertTrue($pres->elementExists($element.'/p:checker[@dir=\'vert\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_CIRCLE_HORIZONTAL': + $this->assertTrue($pres->elementExists($element.'/p:circle[@dir=\'horz\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_CIRCLE_VERTICAL': + $this->assertTrue($pres->elementExists($element.'/p:circle[@dir=\'vert\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_COMB_HORIZONTAL': + $this->assertTrue($pres->elementExists($element.'/p:comb[@dir=\'horz\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_COMB_VERTICAL': + $this->assertTrue($pres->elementExists($element.'/p:comb[@dir=\'vert\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_COVER_DOWN': + $this->assertTrue($pres->elementExists($element.'/p:cover[@dir=\'d\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_COVER_LEFT': + $this->assertTrue($pres->elementExists($element.'/p:cover[@dir=\'l\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_COVER_LEFT_DOWN': + $this->assertTrue($pres->elementExists($element.'/p:cover[@dir=\'ld\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_COVER_LEFT_UP': + $this->assertTrue($pres->elementExists($element.'/p:cover[@dir=\'lu\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_COVER_RIGHT': + $this->assertTrue($pres->elementExists($element.'/p:cover[@dir=\'r\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_COVER_RIGHT_DOWN': + $this->assertTrue($pres->elementExists($element.'/p:cover[@dir=\'rd\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_COVER_RIGHT_UP': + $this->assertTrue($pres->elementExists($element.'/p:cover[@dir=\'ru\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_COVER_UP': + $this->assertTrue($pres->elementExists($element.'/p:cover[@dir=\'u\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_CUT': + $this->assertTrue($pres->elementExists($element.'/p:cut', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_DIAMOND': + $this->assertTrue($pres->elementExists($element.'/p:diamond', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_DISSOLVE': + $this->assertTrue($pres->elementExists($element.'/p:dissolve', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_FADE': + $this->assertTrue($pres->elementExists($element.'/p:fade', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_NEWSFLASH': + $this->assertTrue($pres->elementExists($element.'/p:newsflash', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_PLUS': + $this->assertTrue($pres->elementExists($element.'/p:plus', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_PULL_DOWN': + $this->assertTrue($pres->elementExists($element.'/p:pull[@dir=\'d\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_PULL_LEFT': + $this->assertTrue($pres->elementExists($element.'/p:pull[@dir=\'l\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_PULL_RIGHT': + $this->assertTrue($pres->elementExists($element.'/p:pull[@dir=\'r\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_PULL_UP': + $this->assertTrue($pres->elementExists($element.'/p:pull[@dir=\'u\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_PUSH_DOWN': + $this->assertTrue($pres->elementExists($element.'/p:push[@dir=\'d\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_PUSH_LEFT': + $this->assertTrue($pres->elementExists($element.'/p:push[@dir=\'l\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_PUSH_RIGHT': + $this->assertTrue($pres->elementExists($element.'/p:push[@dir=\'r\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_PUSH_UP': + $this->assertTrue($pres->elementExists($element.'/p:push[@dir=\'u\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_RANDOM': + $this->assertTrue($pres->elementExists($element.'/p:random', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_RANDOMBAR_HORIZONTAL': + $this->assertTrue($pres->elementExists($element.'/p:randomBar[@dir=\'horz\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_RANDOMBAR_VERTICAL': + $this->assertTrue($pres->elementExists($element.'/p:randomBar[@dir=\'vert\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_SPLIT_IN_HORIZONTAL': + $this->assertTrue($pres->elementExists($element.'/p:split[@dir=\'in\'][@orient=\'horz\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_SPLIT_OUT_HORIZONTAL': + $this->assertTrue($pres->elementExists($element.'/p:split[@dir=\'out\'][@orient=\'horz\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_SPLIT_IN_VERTICAL': + $this->assertTrue($pres->elementExists($element.'/p:split[@dir=\'in\'][@orient=\'vert\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_SPLIT_OUT_VERTICAL': + $this->assertTrue($pres->elementExists($element.'/p:split[@dir=\'out\'][@orient=\'vert\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_STRIPS_LEFT_DOWN': + $this->assertTrue($pres->elementExists($element.'/p:strips[@dir=\'ld\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_STRIPS_LEFT_UP': + $this->assertTrue($pres->elementExists($element.'/p:strips[@dir=\'lu\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_STRIPS_RIGHT_DOWN': + $this->assertTrue($pres->elementExists($element.'/p:strips[@dir=\'rd\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_STRIPS_RIGHT_UP': + $this->assertTrue($pres->elementExists($element.'/p:strips[@dir=\'ru\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_WEDGE': + $this->assertTrue($pres->elementExists($element.'/p:wedge', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_WIPE_DOWN': + $this->assertTrue($pres->elementExists($element.'/p:wipe[@dir=\'d\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_WIPE_LEFT': + $this->assertTrue($pres->elementExists($element.'/p:wipe[@dir=\'l\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_WIPE_RIGHT': + $this->assertTrue($pres->elementExists($element.'/p:wipe[@dir=\'r\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_WIPE_UP': + $this->assertTrue($pres->elementExists($element.'/p:wipe[@dir=\'u\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_ZOOM_IN': + $this->assertTrue($pres->elementExists($element.'/p:zoom[@dir=\'in\']', 'ppt/slides/slide1.xml')); + break; + case 'TRANSITION_ZOOM_OUT': + $this->assertTrue($pres->elementExists($element.'/p:zoom[@dir=\'out\']', 'ppt/slides/slide1.xml')); + break; + } + } + + $oTransition->setManualTrigger(true); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + $this->assertContains('1', $pres->getElementAttribute($element, 'advClick', 'ppt/slides/slide1.xml')); + } } From 0b77e8f76007f3fbda333d9e8eef5143b51b4dea Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Thu, 18 Jun 2015 23:33:47 +0200 Subject: [PATCH 066/115] Added support for transitions between slides --- src/PhpPowerpoint/Slide.php | 2 + src/PhpPowerpoint/Slide/Transition.php | 8 +- .../Writer/ODPresentation/Content.php | 114 +++++++++--------- .../Writer/PowerPoint2007/Slide.php | 4 +- .../Writer/ODPresentation/ContentTest.php | 2 +- .../Tests/Writer/PowerPoint2007/SlideTest.php | 2 +- 6 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/PhpPowerpoint/Slide.php b/src/PhpPowerpoint/Slide.php index c1494b9e7..0536b9b75 100644 --- a/src/PhpPowerpoint/Slide.php +++ b/src/PhpPowerpoint/Slide.php @@ -17,8 +17,10 @@ namespace PhpOffice\PhpPowerpoint; +use PhpOffice\PhpPowerpoint\GeometryCalculator; use PhpOffice\PhpPowerpoint\Shape\Chart; use PhpOffice\PhpPowerpoint\Shape\Drawing; +use PhpOffice\PhpPowerpoint\Shape\Group; use PhpOffice\PhpPowerpoint\Shape\Line; use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\Shape\Table; diff --git a/src/PhpPowerpoint/Slide/Transition.php b/src/PhpPowerpoint/Slide/Transition.php index 2e43fe0e0..0900f47fa 100644 --- a/src/PhpPowerpoint/Slide/Transition.php +++ b/src/PhpPowerpoint/Slide/Transition.php @@ -105,7 +105,7 @@ class Transition public function setSpeed($speed = self::SPEED_MEDIUM) { - if(in_array($speed, array(self::SPEED_FAST, self::SPEED_MEDIUM, self::SPEED_SLOW))){ + if (in_array($speed, array(self::SPEED_FAST, self::SPEED_MEDIUM, self::SPEED_SLOW))) { $this->speed = $speed; } else { $this->speed = null; @@ -121,7 +121,7 @@ public function getSpeed() public function setManualTrigger($value = false) { - if(is_bool($value)) { + if (is_bool($value)) { $this->hasManualTrigger = $value; } return $this; @@ -134,11 +134,11 @@ public function hasManualTrigger() public function setTimeTrigger($value = false, $advanceTime = 1000) { - if(is_bool($value)) { + if (is_bool($value)) { $this->hasTimeTrigger = $value; } $this->advanceTimeTrigger = null; - if($this->hasTimeTrigger === true) { + if ($this->hasTimeTrigger === true) { $this->advanceTimeTrigger = (int) $advanceTime; } return $this; diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index 843174dbf..af6acbf21 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -33,8 +33,6 @@ use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; use PhpOffice\PhpPowerpoint\Shared\String; use PhpOffice\PhpPowerpoint\Shared\XMLWriter; -use PhpOffice\PhpPowerpoint\Slide\Note; -use PhpOffice\PhpPowerpoint\Slide\Transition; use PhpOffice\PhpPowerpoint\Style\Alignment; use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Fill; @@ -1024,7 +1022,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) * @param XMLWriter $objWriter * @param |PhpOffice\PhpPowerpoint\Slide\Note $note */ - public function writeSlideNote(XMLWriter $objWriter, Note $note) + public function writeSlideNote(XMLWriter $objWriter, Slide\Note $note) { $shapesNote = $note->getShapeCollection(); if (count($shapesNote) > 0) { @@ -1047,17 +1045,17 @@ public function writeSlideNote(XMLWriter $objWriter, Note $note) * Write style of a slide * @param XMLWriter $objWriter * @param Slide $slide - * @param int $i + * @param int $incPage */ - public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $i) + public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) { // style:style $objWriter->startElement('style:style'); $objWriter->writeAttribute('style:family', 'drawing-page'); - $objWriter->writeAttribute('style:name', 'stylePage'.$i); + $objWriter->writeAttribute('style:name', 'stylePage'.$incPage); // style:style/style:drawing-page-properties $objWriter->startElement('style:drawing-page-properties'); - if (!is_null($oTransition = $slide->getTransition())){ + if (!is_null($oTransition = $slide->getTransition())) { $objWriter->writeAttribute('presentation:duration', 'PT'.number_format($oTransition->getAdvanceTimeTrigger() / 1000, 6, '.', '').'S'); if ($oTransition->hasManualTrigger()) { $objWriter->writeAttribute('presentation:transition-type', 'manual'); @@ -1065,13 +1063,13 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $i) $objWriter->writeAttribute('presentation:transition-type', 'automatic'); } switch($oTransition->getSpeed()) { - case Transition::SPEED_FAST; + case Slide\Transition::SPEED_FAST: $objWriter->writeAttribute('presentation:transition-speed', 'fast'); break; - case Transition::SPEED_MEDIUM; + case Slide\Transition::SPEED_MEDIUM: $objWriter->writeAttribute('presentation:transition-speed', 'medium'); break; - case Transition::SPEED_SLOW; + case Slide\Transition::SPEED_SLOW: $objWriter->writeAttribute('presentation:transition-speed', 'slow'); break; } @@ -1080,148 +1078,148 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $i) * http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-presentation_transition-style */ switch($oTransition->getTransitionType()) { - case Transition::TRANSITION_BLINDS_HORIZONTAL: + case Slide\Transition::TRANSITION_BLINDS_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-stripes'); break; - case Transition::TRANSITION_BLINDS_VERTICAL: + case Slide\Transition::TRANSITION_BLINDS_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-stripes'); break; - case Transition::TRANSITION_CHECKER_HORIZONTAL: + case Slide\Transition::TRANSITION_CHECKER_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-checkerboard'); break; - case Transition::TRANSITION_CHECKER_VERTICAL: + case Slide\Transition::TRANSITION_CHECKER_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-checkerboard'); break; - case Transition::TRANSITION_CIRCLE_HORIZONTAL: + case Slide\Transition::TRANSITION_CIRCLE_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_CIRCLE_VERTICAL: + case Slide\Transition::TRANSITION_CIRCLE_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_COMB_HORIZONTAL: + case Slide\Transition::TRANSITION_COMB_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_COMB_VERTICAL: + case Slide\Transition::TRANSITION_COMB_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_COVER_DOWN: + case Slide\Transition::TRANSITION_COVER_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-bottom'); break; - case Transition::TRANSITION_COVER_LEFT: + case Slide\Transition::TRANSITION_COVER_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-left'); break; - case Transition::TRANSITION_COVER_LEFT_DOWN: + case Slide\Transition::TRANSITION_COVER_LEFT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerleft'); break; - case Transition::TRANSITION_COVER_LEFT_UP: + case Slide\Transition::TRANSITION_COVER_LEFT_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperleft'); break; - case Transition::TRANSITION_COVER_RIGHT: + case Slide\Transition::TRANSITION_COVER_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-right'); break; - case Transition::TRANSITION_COVER_RIGHT_DOWN: + case Slide\Transition::TRANSITION_COVER_RIGHT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerright'); break; - case Transition::TRANSITION_COVER_RIGHT_UP: + case Slide\Transition::TRANSITION_COVER_RIGHT_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperright'); break; - case Transition::TRANSITION_COVER_UP: + case Slide\Transition::TRANSITION_COVER_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-top'); break; - case Transition::TRANSITION_CUT: + case Slide\Transition::TRANSITION_CUT: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_DIAMOND: + case Slide\Transition::TRANSITION_DIAMOND: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_DISSOLVE: + case Slide\Transition::TRANSITION_DISSOLVE: $objWriter->writeAttribute('presentation:transition-style', 'dissolve'); break; - case Transition::TRANSITION_FADE: + case Slide\Transition::TRANSITION_FADE: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-center'); break; - case Transition::TRANSITION_NEWSFLASH: + case Slide\Transition::TRANSITION_NEWSFLASH: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_PLUS: + case Slide\Transition::TRANSITION_PLUS: $objWriter->writeAttribute('presentation:transition-style', 'close'); break; - case Transition::TRANSITION_PULL_DOWN: + case Slide\Transition::TRANSITION_PULL_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-bottom'); break; - case Transition::TRANSITION_PULL_LEFT: + case Slide\Transition::TRANSITION_PULL_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-left'); break; - case Transition::TRANSITION_PULL_RIGHT: + case Slide\Transition::TRANSITION_PULL_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-right'); break; - case Transition::TRANSITION_PULL_UP: + case Slide\Transition::TRANSITION_PULL_UP: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-top'); break; - case Transition::TRANSITION_PUSH_DOWN: + case Slide\Transition::TRANSITION_PUSH_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-bottom'); break; - case Transition::TRANSITION_PUSH_LEFT: + case Slide\Transition::TRANSITION_PUSH_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-left'); break; - case Transition::TRANSITION_PUSH_RIGHT: + case Slide\Transition::TRANSITION_PUSH_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-right'); break; - case Transition::TRANSITION_PUSH_UP: + case Slide\Transition::TRANSITION_PUSH_UP: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-top'); break; - case Transition::TRANSITION_RANDOM: + case Slide\Transition::TRANSITION_RANDOM: $objWriter->writeAttribute('presentation:transition-style', 'random'); break; - case Transition::TRANSITION_RANDOMBAR_HORIZONTAL: + case Slide\Transition::TRANSITION_RANDOMBAR_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-lines'); break; - case Transition::TRANSITION_RANDOMBAR_VERTICAL: + case Slide\Transition::TRANSITION_RANDOMBAR_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-lines'); break; - case Transition::TRANSITION_SPLIT_IN_HORIZONTAL: + case Slide\Transition::TRANSITION_SPLIT_IN_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'close-horizontal'); break; - case Transition::TRANSITION_SPLIT_OUT_HORIZONTAL: + case Slide\Transition::TRANSITION_SPLIT_OUT_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'open-horizontal'); break; - case Transition::TRANSITION_SPLIT_IN_VERTICAL: + case Slide\Transition::TRANSITION_SPLIT_IN_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'close-vertical'); break; - case Transition::TRANSITION_SPLIT_OUT_VERTICAL: + case Slide\Transition::TRANSITION_SPLIT_OUT_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'open-vertical'); break; - case Transition::TRANSITION_STRIPS_LEFT_DOWN: + case Slide\Transition::TRANSITION_STRIPS_LEFT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_STRIPS_LEFT_UP: + case Slide\Transition::TRANSITION_STRIPS_LEFT_UP: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_STRIPS_RIGHT_DOWN: + case Slide\Transition::TRANSITION_STRIPS_RIGHT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_STRIPS_RIGHT_UP: + case Slide\Transition::TRANSITION_STRIPS_RIGHT_UP: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_WEDGE: + case Slide\Transition::TRANSITION_WEDGE: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_WIPE_DOWN: + case Slide\Transition::TRANSITION_WIPE_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-bottom'); break; - case Transition::TRANSITION_WIPE_LEFT: + case Slide\Transition::TRANSITION_WIPE_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-left'); break; - case Transition::TRANSITION_WIPE_RIGHT: + case Slide\Transition::TRANSITION_WIPE_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-right'); break; - case Transition::TRANSITION_WIPE_UP: + case Slide\Transition::TRANSITION_WIPE_UP: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-top'); break; - case Transition::TRANSITION_ZOOM_IN: + case Slide\Transition::TRANSITION_ZOOM_IN: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Transition::TRANSITION_ZOOM_OUT: + case Slide\Transition::TRANSITION_ZOOM_OUT: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index a32989d0a..b4ad93c40 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -1420,11 +1420,11 @@ public function writeNote(Note $pNote = null) public function writeTransition(XMLWriter $objWriter, Transition $transition) { $objWriter->startElement('p:transition'); - if(!is_null($transition->getSpeed())){ + if (!is_null($transition->getSpeed())) { $objWriter->writeAttribute('spd', $transition->getSpeed()); } $objWriter->writeAttribute('advClick', $transition->hasManualTrigger() ? '1' : '0'); - if($transition->hasTimeTrigger()) { + if ($transition->hasTimeTrigger()) { $objWriter->writeAttribute('advTm', $transition->getAdvanceTimeTrigger()); } diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index dc5d2e288..59510ddec 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -426,7 +426,7 @@ public function testTransition() $rcTransition = new \ReflectionClass('PhpOffice\PhpPowerpoint\Slide\Transition'); $arrayConstants = $rcTransition->getConstants(); foreach ($arrayConstants as $key => $value) { - if(strpos($key, 'TRANSITION_') !== 0) { + if (strpos($key, 'TRANSITION_') !== 0) { continue; } diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index af72f67e5..829fb4ade 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -737,7 +737,7 @@ public function testTransition() $rcTransition = new \ReflectionClass('PhpOffice\PhpPowerpoint\Slide\Transition'); $arrayConstants = $rcTransition->getConstants(); foreach ($arrayConstants as $key => $value) { - if(strpos($key, 'TRANSITION_') !== 0) { + if (strpos($key, 'TRANSITION_') !== 0) { continue; } From 658916511174fa3b7fefefb4b724e9bd7169cde5 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Jun 2015 00:07:19 +0200 Subject: [PATCH 067/115] Added support for transitions between slides --- phpmd.xml.dist | 6 - .../Writer/ODPresentation/Content.php | 108 +++++++++--------- 2 files changed, 55 insertions(+), 59 deletions(-) diff --git a/phpmd.xml.dist b/phpmd.xml.dist index b39729659..87a53c279 100644 --- a/phpmd.xml.dist +++ b/phpmd.xml.dist @@ -9,12 +9,6 @@ - - - - - - diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index af6acbf21..48c30905b 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -33,6 +33,8 @@ use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; use PhpOffice\PhpPowerpoint\Shared\String; use PhpOffice\PhpPowerpoint\Shared\XMLWriter; +use PhpOffice\PhpPowerpoint\Slide\Note; +use PhpOffice\PhpPowerpoint\Slide\Transition; use PhpOffice\PhpPowerpoint\Style\Alignment; use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Fill; @@ -1022,7 +1024,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) * @param XMLWriter $objWriter * @param |PhpOffice\PhpPowerpoint\Slide\Note $note */ - public function writeSlideNote(XMLWriter $objWriter, Slide\Note $note) + public function writeSlideNote(XMLWriter $objWriter, Note $note) { $shapesNote = $note->getShapeCollection(); if (count($shapesNote) > 0) { @@ -1055,7 +1057,7 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) $objWriter->writeAttribute('style:name', 'stylePage'.$incPage); // style:style/style:drawing-page-properties $objWriter->startElement('style:drawing-page-properties'); - if (!is_null($oTransition = $slide->getTransition())) { + if (!is_null($oTransition = $slide->getTransition())){ $objWriter->writeAttribute('presentation:duration', 'PT'.number_format($oTransition->getAdvanceTimeTrigger() / 1000, 6, '.', '').'S'); if ($oTransition->hasManualTrigger()) { $objWriter->writeAttribute('presentation:transition-type', 'manual'); @@ -1063,13 +1065,13 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) $objWriter->writeAttribute('presentation:transition-type', 'automatic'); } switch($oTransition->getSpeed()) { - case Slide\Transition::SPEED_FAST: + case Transition::SPEED_FAST; $objWriter->writeAttribute('presentation:transition-speed', 'fast'); break; - case Slide\Transition::SPEED_MEDIUM: + case Transition::SPEED_MEDIUM; $objWriter->writeAttribute('presentation:transition-speed', 'medium'); break; - case Slide\Transition::SPEED_SLOW: + case Transition::SPEED_SLOW; $objWriter->writeAttribute('presentation:transition-speed', 'slow'); break; } @@ -1078,148 +1080,148 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) * http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-presentation_transition-style */ switch($oTransition->getTransitionType()) { - case Slide\Transition::TRANSITION_BLINDS_HORIZONTAL: + case Transition::TRANSITION_BLINDS_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-stripes'); break; - case Slide\Transition::TRANSITION_BLINDS_VERTICAL: + case Transition::TRANSITION_BLINDS_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-stripes'); break; - case Slide\Transition::TRANSITION_CHECKER_HORIZONTAL: + case Transition::TRANSITION_CHECKER_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-checkerboard'); break; - case Slide\Transition::TRANSITION_CHECKER_VERTICAL: + case Transition::TRANSITION_CHECKER_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-checkerboard'); break; - case Slide\Transition::TRANSITION_CIRCLE_HORIZONTAL: + case Transition::TRANSITION_CIRCLE_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_CIRCLE_VERTICAL: + case Transition::TRANSITION_CIRCLE_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_COMB_HORIZONTAL: + case Transition::TRANSITION_COMB_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_COMB_VERTICAL: + case Transition::TRANSITION_COMB_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_COVER_DOWN: + case Transition::TRANSITION_COVER_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-bottom'); break; - case Slide\Transition::TRANSITION_COVER_LEFT: + case Transition::TRANSITION_COVER_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-left'); break; - case Slide\Transition::TRANSITION_COVER_LEFT_DOWN: + case Transition::TRANSITION_COVER_LEFT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerleft'); break; - case Slide\Transition::TRANSITION_COVER_LEFT_UP: + case Transition::TRANSITION_COVER_LEFT_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperleft'); break; - case Slide\Transition::TRANSITION_COVER_RIGHT: + case Transition::TRANSITION_COVER_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-right'); break; - case Slide\Transition::TRANSITION_COVER_RIGHT_DOWN: + case Transition::TRANSITION_COVER_RIGHT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerright'); break; - case Slide\Transition::TRANSITION_COVER_RIGHT_UP: + case Transition::TRANSITION_COVER_RIGHT_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperright'); break; - case Slide\Transition::TRANSITION_COVER_UP: + case Transition::TRANSITION_COVER_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-top'); break; - case Slide\Transition::TRANSITION_CUT: + case Transition::TRANSITION_CUT: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_DIAMOND: + case Transition::TRANSITION_DIAMOND: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_DISSOLVE: + case Transition::TRANSITION_DISSOLVE: $objWriter->writeAttribute('presentation:transition-style', 'dissolve'); break; - case Slide\Transition::TRANSITION_FADE: + case Transition::TRANSITION_FADE: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-center'); break; - case Slide\Transition::TRANSITION_NEWSFLASH: + case Transition::TRANSITION_NEWSFLASH: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_PLUS: + case Transition::TRANSITION_PLUS: $objWriter->writeAttribute('presentation:transition-style', 'close'); break; - case Slide\Transition::TRANSITION_PULL_DOWN: + case Transition::TRANSITION_PULL_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-bottom'); break; - case Slide\Transition::TRANSITION_PULL_LEFT: + case Transition::TRANSITION_PULL_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-left'); break; - case Slide\Transition::TRANSITION_PULL_RIGHT: + case Transition::TRANSITION_PULL_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-right'); break; - case Slide\Transition::TRANSITION_PULL_UP: + case Transition::TRANSITION_PULL_UP: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-top'); break; - case Slide\Transition::TRANSITION_PUSH_DOWN: + case Transition::TRANSITION_PUSH_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-bottom'); break; - case Slide\Transition::TRANSITION_PUSH_LEFT: + case Transition::TRANSITION_PUSH_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-left'); break; - case Slide\Transition::TRANSITION_PUSH_RIGHT: + case Transition::TRANSITION_PUSH_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-right'); break; - case Slide\Transition::TRANSITION_PUSH_UP: + case Transition::TRANSITION_PUSH_UP: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-top'); break; - case Slide\Transition::TRANSITION_RANDOM: + case Transition::TRANSITION_RANDOM: $objWriter->writeAttribute('presentation:transition-style', 'random'); break; - case Slide\Transition::TRANSITION_RANDOMBAR_HORIZONTAL: + case Transition::TRANSITION_RANDOMBAR_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-lines'); break; - case Slide\Transition::TRANSITION_RANDOMBAR_VERTICAL: + case Transition::TRANSITION_RANDOMBAR_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-lines'); break; - case Slide\Transition::TRANSITION_SPLIT_IN_HORIZONTAL: + case Transition::TRANSITION_SPLIT_IN_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'close-horizontal'); break; - case Slide\Transition::TRANSITION_SPLIT_OUT_HORIZONTAL: + case Transition::TRANSITION_SPLIT_OUT_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'open-horizontal'); break; - case Slide\Transition::TRANSITION_SPLIT_IN_VERTICAL: + case Transition::TRANSITION_SPLIT_IN_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'close-vertical'); break; - case Slide\Transition::TRANSITION_SPLIT_OUT_VERTICAL: + case Transition::TRANSITION_SPLIT_OUT_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'open-vertical'); break; - case Slide\Transition::TRANSITION_STRIPS_LEFT_DOWN: + case Transition::TRANSITION_STRIPS_LEFT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_STRIPS_LEFT_UP: + case Transition::TRANSITION_STRIPS_LEFT_UP: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_STRIPS_RIGHT_DOWN: + case Transition::TRANSITION_STRIPS_RIGHT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_STRIPS_RIGHT_UP: + case Transition::TRANSITION_STRIPS_RIGHT_UP: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_WEDGE: + case Transition::TRANSITION_WEDGE: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_WIPE_DOWN: + case Transition::TRANSITION_WIPE_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-bottom'); break; - case Slide\Transition::TRANSITION_WIPE_LEFT: + case Transition::TRANSITION_WIPE_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-left'); break; - case Slide\Transition::TRANSITION_WIPE_RIGHT: + case Transition::TRANSITION_WIPE_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-right'); break; - case Slide\Transition::TRANSITION_WIPE_UP: + case Transition::TRANSITION_WIPE_UP: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-top'); break; - case Slide\Transition::TRANSITION_ZOOM_IN: + case Transition::TRANSITION_ZOOM_IN: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; - case Slide\Transition::TRANSITION_ZOOM_OUT: + case Transition::TRANSITION_ZOOM_OUT: $objWriter->writeAttribute('presentation:transition-style', 'none'); break; } From 686eef4f77e39537db9cc4c9920989d738d78212 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Jun 2015 00:23:04 +0200 Subject: [PATCH 068/115] Added support for transitions between slides --- src/PhpPowerpoint/Writer/ODPresentation/Content.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index 48c30905b..37397450a 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -1057,7 +1057,7 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) $objWriter->writeAttribute('style:name', 'stylePage'.$incPage); // style:style/style:drawing-page-properties $objWriter->startElement('style:drawing-page-properties'); - if (!is_null($oTransition = $slide->getTransition())){ + if (!is_null($oTransition = $slide->getTransition())) { $objWriter->writeAttribute('presentation:duration', 'PT'.number_format($oTransition->getAdvanceTimeTrigger() / 1000, 6, '.', '').'S'); if ($oTransition->hasManualTrigger()) { $objWriter->writeAttribute('presentation:transition-type', 'manual'); @@ -1065,13 +1065,13 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) $objWriter->writeAttribute('presentation:transition-type', 'automatic'); } switch($oTransition->getSpeed()) { - case Transition::SPEED_FAST; + case Transition::SPEED_FAST: $objWriter->writeAttribute('presentation:transition-speed', 'fast'); break; - case Transition::SPEED_MEDIUM; + case Transition::SPEED_MEDIUM: $objWriter->writeAttribute('presentation:transition-speed', 'medium'); break; - case Transition::SPEED_SLOW; + case Transition::SPEED_SLOW: $objWriter->writeAttribute('presentation:transition-speed', 'slow'); break; } From aec9de05f2fcff0f04c87466d286be6af0ee9663 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Jun 2015 13:12:14 +0200 Subject: [PATCH 069/115] FIXED : Some bugfixes found with @scrutinizer-ci --- src/PhpPowerpoint/DocumentLayout.php | 3 +- src/PhpPowerpoint/Reader/PowerPoint97.php | 10 ++-- src/PhpPowerpoint/Shape/Chart/PlotArea.php | 2 +- src/PhpPowerpoint/Shape/Chart/Series.php | 2 +- src/PhpPowerpoint/Shared/File.php | 3 +- src/PhpPowerpoint/Shared/OLERead.php | 52 +++++++++---------- src/PhpPowerpoint/Shared/XMLWriter.php | 11 ++-- src/PhpPowerpoint/Writer/ODPresentation.php | 40 ++++++++++---- .../Writer/ODPresentation/Content.php | 38 +++++++------- .../Writer/ODPresentation/Drawing.php | 8 ++- .../Writer/ODPresentation/ObjectsChart.php | 1 - src/PhpPowerpoint/Writer/PowerPoint2007.php | 8 +-- .../Writer/PowerPoint2007/Chart.php | 15 ++++-- .../Writer/PowerPoint2007/ContentTypes.php | 7 +-- .../Writer/PowerPoint2007/DocProps.php | 4 +- .../Writer/PowerPoint2007/Drawing.php | 4 +- .../Writer/PowerPoint2007/PptProps.php | 3 -- .../Writer/PowerPoint2007/Presentation.php | 4 +- .../Writer/PowerPoint2007/Rels.php | 16 +++--- .../Writer/PowerPoint2007/Slide.php | 11 ++-- 20 files changed, 140 insertions(+), 102 deletions(-) diff --git a/src/PhpPowerpoint/DocumentLayout.php b/src/PhpPowerpoint/DocumentLayout.php index a2c285d19..a32771b42 100644 --- a/src/PhpPowerpoint/DocumentLayout.php +++ b/src/PhpPowerpoint/DocumentLayout.php @@ -194,7 +194,8 @@ public function setCY($value, $unit = self::UNIT_EMU) /** * Convert EMUs to differents units * @param $value - * @param string $unit + * @param string $fromUnit + * @param string $toUnit */ protected function convertUnit($value, $fromUnit, $toUnit) { diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index 46c632daf..9ab626f44 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -494,7 +494,7 @@ private function loadPicturesStream() } else { $readSuccess = false; } - } while ($readSuccess == true); + } while ($readSuccess === true); } /** @@ -574,7 +574,7 @@ private function loadCurrentUserStream() $ansiUserName .= chr($char); $pos += 1; } - } while ($char != false); + } while ($char !== false); // relVersion $relVersion = self::getInt4d($this->streamCurrentUser, $pos); @@ -1816,7 +1816,7 @@ private function readRTSlide($pos) $shpSecondaryOptions2 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; $rHeader['recLen'] -= 8; - if ($bShpSecondaryOpt1 == true && $shpSecondaryOptions2['recVer'] == 0x3 && $shpSecondaryOptions2['recType'] == 0xF121) { + if ($bShpSecondaryOpt1 === true && $shpSecondaryOptions2['recVer'] == 0x3 && $shpSecondaryOptions2['recType'] == 0xF121) { } else { $pos -= 8; $rHeader['recLen'] += 8; @@ -1825,7 +1825,7 @@ private function readRTSlide($pos) $shpTertiaryOptions2 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; $rHeader['recLen'] -= 8; - if ($bShpTertiaryOptions1 == true && $shpTertiaryOptions2['recVer'] == 0x3 && $shpTertiaryOptions2['recType'] == 0xF122) { + if ($bShpTertiaryOptions1 === true && $shpTertiaryOptions2['recVer'] == 0x3 && $shpTertiaryOptions2['recType'] == 0xF122) { } else { $pos -= 8; $rHeader['recLen'] += 8; @@ -1926,7 +1926,7 @@ private function readRTSlide($pos) } // New paragraph $bCreateParagraph = false; - if (strpos($sText, "\r") != false) { + if (strpos($sText, "\r") !== false) { $bCreateParagraph = true; $sText = str_replace("\r", '', $sText); } diff --git a/src/PhpPowerpoint/Shape/Chart/PlotArea.php b/src/PhpPowerpoint/Shape/Chart/PlotArea.php index 6c2d0c9ef..4cd6838d1 100644 --- a/src/PhpPowerpoint/Shape/Chart/PlotArea.php +++ b/src/PhpPowerpoint/Shape/Chart/PlotArea.php @@ -27,7 +27,7 @@ class PlotArea implements ComparableInterface /** * Type * - * @var \PhpOffice\PhpPowerpoint\Shape\Chart\AbstractType + * @var \PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractType */ private $type; diff --git a/src/PhpPowerpoint/Shape/Chart/Series.php b/src/PhpPowerpoint/Shape/Chart/Series.php index dfb062a86..26503b4e0 100644 --- a/src/PhpPowerpoint/Shape/Chart/Series.php +++ b/src/PhpPowerpoint/Shape/Chart/Series.php @@ -173,7 +173,7 @@ public function getFill() /** * Set Fill * - * @param \PhpOffice\PhpPowerpoint\Style\Fill $value + * @param \PhpOffice\PhpPowerpoint\Style\Fill $fill * @return Series */ public function setFill(Fill $fill = null) diff --git a/src/PhpPowerpoint/Shared/File.php b/src/PhpPowerpoint/Shared/File.php index 86dde820d..95bb5017e 100644 --- a/src/PhpPowerpoint/Shared/File.php +++ b/src/PhpPowerpoint/Shared/File.php @@ -68,7 +68,8 @@ public static function realpath($pFilename) if ($returnValue == '' || is_null($returnValue)) { $pathArray = explode('/', $pFilename); while (in_array('..', $pathArray) && $pathArray[0] != '..') { - for ($i = 0; $i < count($pathArray); ++$i) { + $numPathArray = count($pathArray); + for ($i = 0; $i < $numPathArray; ++$i) { if ($pathArray[$i] == '..' && $i > 0) { unset($pathArray[$i]); unset($pathArray[$i - 1]); diff --git a/src/PhpPowerpoint/Shared/OLERead.php b/src/PhpPowerpoint/Shared/OLERead.php index 7a7480200..698e8890d 100644 --- a/src/PhpPowerpoint/Shared/OLERead.php +++ b/src/PhpPowerpoint/Shared/OLERead.php @@ -28,8 +28,9 @@ namespace PhpOffice\PhpPowerpoint\Shared; -defined('IDENTIFIER_OLE') || - define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); +if (!defined('IDENTIFIER_OLE')){ + define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); +} class OLERead { @@ -69,6 +70,8 @@ class OLERead public $powerpointDocument = null; public $currentUser = null; public $pictures = null; + public $rootEntry = null; + public $props = array(); /** * Read the file @@ -96,26 +99,26 @@ public function read($sFileName) $this->data = file_get_contents($sFileName); // Total number of sectors used for the SAT - $this->numBigBlockDepotBlocks = self::getInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); + $numBigBlockDepotBlocks = self::getInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); // SecID of the first sector of the directory stream - $this->rootStartBlock = self::getInt4d($this->data, self::ROOT_START_BLOCK_POS); + $rootStartBlock = self::getInt4d($this->data, self::ROOT_START_BLOCK_POS); // SecID of the first sector of the SSAT (or -2 if not extant) - $this->sbdStartBlock = self::getInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS); + $sbdStartBlock = self::getInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS); // SecID of the first sector of the MSAT (or -2 if no additional sectors are used) - $this->extensionBlock = self::getInt4d($this->data, self::EXTENSION_BLOCK_POS); + $extensionBlock = self::getInt4d($this->data, self::EXTENSION_BLOCK_POS); // Total number of sectors used by MSAT - $this->numExtensionBlocks = self::getInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS); + $numExtensionBlocks = self::getInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS); $bigBlockDepotBlocks = array(); $pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS; - $bbdBlocks = $this->numBigBlockDepotBlocks; + $bbdBlocks = $numBigBlockDepotBlocks; - if ($this->numExtensionBlocks != 0) { + if ($numExtensionBlocks != 0) { $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4; } @@ -124,9 +127,9 @@ public function read($sFileName) $pos += 4; } - for ($j = 0; $j < $this->numExtensionBlocks; ++$j) { - $pos = ($this->extensionBlock + 1) * self::BIG_BLOCK_SIZE; - $blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1); + for ($j = 0; $j < $numExtensionBlocks; ++$j) { + $pos = ($extensionBlock + 1) * self::BIG_BLOCK_SIZE; + $blocksToRead = min($numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1); for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) { $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); @@ -134,36 +137,34 @@ public function read($sFileName) } $bbdBlocks += $blocksToRead; - if ($bbdBlocks < $this->numBigBlockDepotBlocks) { - $this->extensionBlock = self::getInt4d($this->data, $pos); + if ($bbdBlocks < $numBigBlockDepotBlocks) { + $extensionBlock = self::getInt4d($this->data, $pos); } } - $pos = 0; - $this->bigBlockChain = ''; + $bigBlockChain = ''; $bbs = self::BIG_BLOCK_SIZE / 4; - for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) { + for ($i = 0; $i < $numBigBlockDepotBlocks; ++$i) { $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE; - $this->bigBlockChain .= substr($this->data, $pos, 4*$bbs); + $bigBlockChain .= substr($this->data, $pos, 4*$bbs); $pos += 4*$bbs; } - $pos = 0; - $sbdBlock = $this->sbdStartBlock; - $this->smallBlockChain = ''; + $sbdBlock = $sbdStartBlock; + $smallBlockChain = ''; while ($sbdBlock != -2) { $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE; - $this->smallBlockChain .= substr($this->data, $pos, 4*$bbs); + $smallBlockChain .= substr($this->data, $pos, 4*$bbs); $pos += 4*$bbs; - $sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock*4); + $sbdBlock = self::getInt4d($bigBlockChain, $sbdBlock*4); } // read the directory stream - $block = $this->rootStartBlock; - $this->entry = $this->readData($block); + $block = $rootStartBlock; + $entry = $this->readData($block); $this->readPropertySets(); } @@ -297,7 +298,6 @@ private function readPropertySets() break; default: throw new \Exception('OLE Block Not defined: $upName : '.$upName. ' - $name : "'.$name.'"'); - break; } } diff --git a/src/PhpPowerpoint/Shared/XMLWriter.php b/src/PhpPowerpoint/Shared/XMLWriter.php index 411cb3e0b..e63f7a4d9 100644 --- a/src/PhpPowerpoint/Shared/XMLWriter.php +++ b/src/PhpPowerpoint/Shared/XMLWriter.php @@ -90,7 +90,9 @@ public function __destruct() // Unlink temporary files if ($this->tempFileName != '') { - @unlink($this->tempFileName); + if (@unlink($this->tempFileName) === false) { + throw new \Exception('The file '.$this->tempFileName.' could not be deleted.'); + } } } @@ -103,10 +105,9 @@ public function __destruct() public function __call($function, $args) { try { - @call_user_func_array(array( - $this->xmlWriter, - $function - ), $args); + if (@call_user_func_array(array($this->xmlWriter, $function), $args) === false) { + throw new \Exception('The method '.$function.' doesn\'t exist.'); + } } catch (\Exception $ex) { // Do nothing! } diff --git a/src/PhpPowerpoint/Writer/ODPresentation.php b/src/PhpPowerpoint/Writer/ODPresentation.php index b70e3cc7a..7e443f075 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation.php +++ b/src/PhpPowerpoint/Writer/ODPresentation.php @@ -127,17 +127,33 @@ public function save($pFilename) } } + $writerPartObjectsChart = $this->getWriterPart('charts'); + if (!$writerPartObjectsChart instanceof ObjectsChart) { + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\ObjectsChart'); + } + $writerPartContent = $this->getWriterPart('content'); + if (!$writerPartContent instanceof Content) { + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Content'); + } $writerPartDrawing = $this->getWriterPart('Drawing'); if (!$writerPartDrawing instanceof Drawing) { throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Drawing'); } + $writerPartManifest = $this->getWriterPart('manifest'); + if (!$writerPartManifest instanceof Manifest) { + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Manifest'); + } + $writerPartMeta = $this->getWriterPart('meta'); + if (!$writerPartMeta instanceof Meta) { + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Meta'); + } $writerPartMimetype = $this->getWriterPart('mimetype'); if (!$writerPartMimetype instanceof Mimetype) { throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Mimetype'); } - $writerPartContent = $this->getWriterPart('content'); - if (!$writerPartContent instanceof Content) { - throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Content'); + $writerPartStyles = $this->getWriterPart('styles'); + if (!$writerPartStyles instanceof Styles) { + throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\Styles'); } // Create drawing dictionary @@ -161,17 +177,17 @@ public function save($pFilename) $objZip->addFromString('content.xml', $writerPartContent->writePart($this->presentation)); // Add meta.xml to ZIP file - $objZip->addFromString('meta.xml', $this->getWriterPart('meta')->writePart($this->presentation)); + $objZip->addFromString('meta.xml', $writerPartMeta->writePart($this->presentation)); // Add styles.xml to ZIP file - $objZip->addFromString('styles.xml', $this->getWriterPart('styles')->writePart($this->presentation)); + $objZip->addFromString('styles.xml', $writerPartStyles->writePart($this->presentation)); // Add META-INF/manifest.xml - $objZip->addFromString('META-INF/manifest.xml', $this->getWriterPart('manifest')->writePart()); + $objZip->addFromString('META-INF/manifest.xml', $writerPartManifest->writePart()); // Add charts foreach ($this->chartArray as $keyChart => $shapeChart) { - $arrayFile = $this->getWriterPart('charts')->writePart($shapeChart); + $arrayFile = $writerPartObjectsChart->writePart($shapeChart); foreach ($arrayFile as $file => $content) { if (!empty($content)) { $objZip->addFromString('Object '.$keyChart.'/' . $file, $content); @@ -230,7 +246,9 @@ public function save($pFilename) if (copy($pFilename, $originalFilename) === false) { throw new \Exception("Could not copy temporary zip file $pFilename to $originalFilename."); } - @unlink($pFilename); + if (@unlink($pFilename) === false) { + throw new \Exception('The file '.$pFilename.' could not be deleted.'); + } } } else { throw new \Exception("PHPPowerPoint object unassigned."); @@ -240,7 +258,7 @@ public function save($pFilename) /** * Get PHPPowerPoint object * - * @return PHPPowerPoint + * @return PhpPowerpoint * @throws \Exception */ public function getPHPPowerPoint() @@ -255,11 +273,11 @@ public function getPHPPowerPoint() /** * Get PHPPowerPoint object * - * @param PHPPowerPoint $pPHPPowerPoint PHPPowerPoint object + * @param PhpPowerpoint $pPHPPowerPoint PHPPowerPoint object * @throws \Exception * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 */ - public function setPHPPowerPoint(PHPPowerPoint $pPHPPowerPoint = null) + public function setPHPPowerPoint(PhpPowerpoint $pPHPPowerPoint = null) { $this->presentation = $pPHPPowerPoint; diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index 37397450a..d758868bd 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -292,7 +292,9 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) } } // Slide Note - $this->writeSlideNote($objWriter, $pSlide->getNote()); + if ($pSlide->getNote() instanceof Note) { + $this->writeSlideNote($objWriter, $pSlide->getNote()); + } $objWriter->endElement(); } @@ -376,12 +378,12 @@ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape) $paragraphs = $shape->getParagraphs(); $paragraphId = 0; $sCstShpLastBullet = ''; - $iCstShpLastBulletLvl = 0; + $iCstShpLastBulletLvl = 0; $bCstShpHasBullet = false; foreach ($paragraphs as $paragraph) { // Close the bullet list - if ($sCstShpLastBullet != 'bullet' && $bCstShpHasBullet == true) { + if ($sCstShpLastBullet != 'bullet' && $bCstShpHasBullet === true) { for ($iInc = $iCstShpLastBulletLvl; $iInc >= 0; $iInc--) { // text:list-item $objWriter->endElement(); @@ -409,7 +411,7 @@ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape) if ($richtext instanceof Run) { $objWriter->writeAttribute('text:style-name', 'T_' . $richtext->getFont()->getHashCode()); } - if ($richtext->hasHyperlink() == true && $richtext->getHyperlink()->getUrl() != '') { + if ($richtext->hasHyperlink() === true && $richtext->getHyperlink()->getUrl() != '') { // text:a $objWriter->startElement('text:a'); $objWriter->writeAttribute('xlink:href', $richtext->getHyperlink()->getUrl()); @@ -502,7 +504,7 @@ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape) } // Close the bullet list - if ($sCstShpLastBullet == 'bullet' && $bCstShpHasBullet == true) { + if ($sCstShpLastBullet == 'bullet' && $bCstShpHasBullet === true) { for ($iInc = $iCstShpLastBulletLvl; $iInc >= 0; $iInc--) { // text:list-item $objWriter->endElement(); @@ -581,7 +583,7 @@ public function writeShapeTable(XMLWriter $objWriter, Table $shape) if ($shapeRichText instanceof Run) { $objWriter->writeAttribute('text:style-name', 'T_' . $shapeRichText->getFont()->getHashCode()); } - if ($shapeRichText->hasHyperlink()) { + if ($shapeRichText instanceof TextElement && $shapeRichText->hasHyperlink()) { // text:a $objWriter->startElement('text:a'); $objWriter->writeAttribute('xlink:href', $shapeRichText->getHyperlink()->getUrl()); @@ -665,17 +667,17 @@ public function writeShapeGroup(XMLWriter $objWriter, Group $group) // Check type if ($shape instanceof RichText) { - $this->writeShapeTxt($objWriter, $shape, $this->shapeId); + $this->writeShapeTxt($objWriter, $shape); } elseif ($shape instanceof Table) { - $this->writeShapeTable($objWriter, $shape, $this->shapeId); + $this->writeShapeTable($objWriter, $shape); } elseif ($shape instanceof Line) { - $this->writeShapeLine($objWriter, $shape, $this->shapeId); + $this->writeShapeLine($objWriter, $shape); } elseif ($shape instanceof Chart) { - $this->writeShapeChart($objWriter, $shape, $this->shapeId); + $this->writeShapeChart($objWriter, $shape); } elseif ($shape instanceof AbstractDrawing) { - $this->writeShapePic($objWriter, $shape, $this->shapeId); + $this->writeShapePic($objWriter, $shape); } elseif ($shape instanceof Group) { - $this->writeShapeGroup($objWriter, $shape, $this->shapeId); + $this->writeShapeGroup($objWriter, $shape); } } @@ -697,19 +699,19 @@ public function writeGroupStyle(XMLWriter $objWriter, Group $group) // Check type if ($shape instanceof RichText) { - $this->writeTxtStyle($objWriter, $shape, $this->shapeId); + $this->writeTxtStyle($objWriter, $shape); } if ($shape instanceof AbstractDrawing) { - $this->writeDrawingStyle($objWriter, $shape, $this->shapeId); + $this->writeDrawingStyle($objWriter, $shape); } if ($shape instanceof Line) { - $this->writeLineStyle($objWriter, $shape, $this->shapeId); + $this->writeLineStyle($objWriter, $shape); } if ($shape instanceof Table) { - $this->writeTableStyle($objWriter, $shape, $this->shapeId); + $this->writeTableStyle($objWriter, $shape); } if ($shape instanceof Group) { - $this->writeGroupStyle($objWriter, $shape, $this->shapeId); + $this->writeGroupStyle($objWriter, $shape); } } } @@ -1022,7 +1024,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) /** * Write the slide note * @param XMLWriter $objWriter - * @param |PhpOffice\PhpPowerpoint\Slide\Note $note + * @param \PhpOffice\PhpPowerpoint\Slide\Note $note */ public function writeSlideNote(XMLWriter $objWriter, Note $note) { diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php b/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php index edac85bde..116d9423d 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php @@ -30,14 +30,18 @@ class Drawing extends AbstractPart /** * Get an array of all drawings * - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPowerPoint $pPHPPowerPoint * @return \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing[] All drawings in PHPPowerPoint * @throws \Exception */ - public function allDrawings(PHPPowerPoint $pPHPPowerPoint = null) + public function allDrawings(PhpPowerPoint $pPHPPowerPoint = null) { // Get an array of all drawings $aDrawings = array(); + + if (is_null($pPHPPowerPoint)) { + return $aDrawings; + } // Loop trough PHPPowerPoint $slideCount = $pPHPPowerPoint->getSlideCount(); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index 3003fa45e..aefc6fbdc 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -644,7 +644,6 @@ private function writeSeriesStyle(Chart $chart, Chart\Series $series) } /** - * @param Chart $chart */ private function writeTable() { diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007.php b/src/PhpPowerpoint/Writer/PowerPoint2007.php index 73f0745b8..c230f7fb1 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007.php @@ -324,7 +324,9 @@ public function save($pFilename) if (copy($pFilename, $originalFilename) === false) { throw new \Exception("Could not copy temporary zip file $pFilename to $originalFilename."); } - @unlink($pFilename); + if (@unlink($pFilename) === false) { + throw new \Exception('The file '.$pFilename.' could not be removed.'); + } } } else { throw new \Exception("PHPPowerPoint object unassigned."); @@ -349,11 +351,11 @@ public function getPHPPowerPoint() /** * Get PHPPowerPoint object * - * @param PHPPowerPoint $pPHPPowerPoint PHPPowerPoint object + * @param PhpPowerpoint $pPHPPowerPoint PHPPowerPoint object * @throws \Exception * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 */ - public function setPHPPowerPoint(PHPPowerPoint $pPHPPowerPoint = null) + public function setPHPPowerPoint(PhpPowerpoint $pPHPPowerPoint = null) { $this->presentation = $pPHPPowerPoint; diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 96e9d2b41..2955fa05e 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -244,13 +244,15 @@ public function writeSpreadsheet(PHPPowerPoint $presentation, $chart, $tempName) // X-axis $axisXData = array_keys($series->getValues()); - for ($i = 0; $i < count($axisXData); $i++) { + $numAxisXData = count($axisXData); + for ($i = 0; $i < $numAxisXData; $i++) { $sheet->setCellValueByColumnAndRow(0, $i + 2, $axisXData[$i]); } // Y-axis $axisYData = array_values($series->getValues()); - for ($i = 0; $i < count($axisYData); $i++) { + $numAxisYData = count($axisYData); + for ($i = 0; $i < $numAxisYData; $i++) { $sheet->setCellValueByColumnAndRow(1 + $seriesIndex, $i + 2, $axisYData[$i]); } @@ -263,7 +265,9 @@ public function writeSpreadsheet(PHPPowerPoint $presentation, $chart, $tempName) // Load file in memory $returnValue = file_get_contents($tempName); - @unlink($tempName); + if (@unlink($tempName) === false) { + throw new \Exception('The file '.$tempName.' could not removed.'); + } return $returnValue; } @@ -333,6 +337,7 @@ protected function writeMultipleValuesOrReference($objWriter, $isReference, $val } $objWriter->startElement('c:' . $dataType . $referenceType); + $numValues = count($values); if (!$isReference) { // Value @@ -342,7 +347,7 @@ protected function writeMultipleValuesOrReference($objWriter, $isReference, $val $objWriter->endElement(); // Add points - for ($i = 0; $i < count($values); $i++) { + for ($i = 0; $i < $numValues; $i++) { // c:pt $objWriter->startElement('c:pt'); $objWriter->writeAttribute('idx', $i); @@ -360,7 +365,7 @@ protected function writeMultipleValuesOrReference($objWriter, $isReference, $val $objWriter->endElement(); // Add points - for ($i = 0; $i < count($values); $i++) { + for ($i = 0; $i < $numValues; $i++) { // c:pt $objWriter->startElement('c:pt'); $objWriter->writeAttribute('idx', $i); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php b/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php index 5784ad4eb..8fa21b653 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php @@ -33,11 +33,11 @@ class ContentTypes extends AbstractPart /** * Write content types to XML format * - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPowerpoint $pPHPPowerPoint * @return string XML Output * @throws \Exception */ - public function writeContentTypes(PHPPowerPoint $pPHPPowerPoint = null) + public function writeContentTypes(PhpPowerpoint $pPHPPowerPoint = null) { $parentWriter = $this->getParentWriter(); if (!$parentWriter instanceof PowerPoint2007) { @@ -85,7 +85,8 @@ public function writeContentTypes(PHPPowerPoint $pPHPPowerPoint = null) // Slide layouts $slideLayouts = $parentWriter->getLayoutPack()->getLayouts(); - for ($i = 0; $i < count($slideLayouts); ++$i) { + $numSlideLayouts = count($slideLayouts); + for ($i = 0; $i < $numSlideLayouts; ++$i) { $this->writeOverrideContentType($objWriter, '/ppt/slideLayouts/slideLayout' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml'); } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php b/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php index fabe96ceb..d9e63fe91 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php @@ -27,11 +27,11 @@ class DocProps extends AbstractPart /** * Write docProps/app.xml to XML format * - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPowerpoint $pPHPPowerPoint * @return string XML Output * @throws \Exception */ - public function writeDocPropsApp(PHPPowerPoint $pPHPPowerPoint = null) + public function writeDocPropsApp(PhpPowerpoint $pPHPPowerPoint = null) { // Create XML writer $objWriter = $this->getXMLWriter(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php index 6d4473b9f..f9ece443e 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php @@ -30,11 +30,11 @@ class Drawing extends AbstractPart /** * Get an array of all drawings * - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPowerpoint $pPHPPowerPoint * @return \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing[] All drawings in PHPPowerPoint * @throws \Exception */ - public function allDrawings(PHPPowerPoint $pPHPPowerPoint = null) + public function allDrawings(PhpPowerpoint $pPHPPowerPoint = null) { // Get an array of all drawings $aDrawings = array(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/PptProps.php b/src/PhpPowerpoint/Writer/PowerPoint2007/PptProps.php index bddfa12ce..ad5d268aa 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/PptProps.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/PptProps.php @@ -24,7 +24,6 @@ class PptProps extends AbstractPart /** * Write ppt/presProps.xml to XML format * - * @param PhpPowerpoint $pPHPPowerPoint * @return string XML Output * @throws \Exception */ @@ -81,7 +80,6 @@ public function writePresProps() /** * Write ppt/tableStyles.xml to XML format * - * @param PhpPowerpoint $pPHPPowerPoint * @return string XML Output * @throws \Exception */ @@ -104,7 +102,6 @@ public function writeTableStyles() /** * Write ppt/viewProps.xml to XML format * - * @param PhpPowerpoint $pPHPPowerPoint * @return string XML Output * @throws \Exception */ diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php index 0ebd71c54..3e5a5c66b 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php @@ -30,11 +30,11 @@ class Presentation extends AbstractPart /** * Write presentation to XML format * - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPowerpoint $pPHPPowerPoint * @return string XML Output * @throws \Exception */ - public function writePresentation(PHPPowerPoint $pPHPPowerPoint = null) + public function writePresentation(PhpPowerpoint $pPHPPowerPoint = null) { // Create XML writer $objWriter = $this->getXMLWriter(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php index d6f74517a..32fe35bb3 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php @@ -71,11 +71,11 @@ public function writeRelationships() /** * Write presentation relationships to XML format * - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPowerpoint $pPHPPowerPoint * @return string XML Output * @throws \Exception */ - public function writePresentationRelationships(PHPPowerPoint $pPHPPowerPoint = null) + public function writePresentationRelationships(PhpPowerpoint $pPHPPowerPoint = null) { // Create XML writer $objWriter = $this->getXMLWriter(); @@ -379,9 +379,11 @@ public function writeSlideRelationships(SlideElement $pSlide) // Hyperlink in table if ($iterator->current() instanceof ShapeTable) { // Rows - for ($row = 0; $row < count($iterator->current()->getRows()); $row++) { + $countRows = count($iterator->current()->getRows()); + for ($row = 0; $row < $countRows; $row++) { // Cells in rows - for ($cell = 0; $cell < count($iterator->current()->getRow($row)->getCells()); $cell++) { + $countCells = count($iterator->current()->getRow($row)->getCells()); + for ($cell = 0; $cell < $countCells; $cell++) { $currentCell = $iterator->current()->getRow($row)->getCell($cell); // Paragraphs in cell foreach ($currentCell->getParagraphs() as $paragraph) { @@ -453,9 +455,11 @@ public function writeSlideRelationships(SlideElement $pSlide) // Hyperlink in table if ($iterator2->current() instanceof ShapeTable) { // Rows - for ($row = 0; $row < count($iterator2->current()->getRows()); $row++) { + $countRows = count($iterator2->current()->getRows()); + for ($row = 0; $row < $countRows; $row++) { // Cells in rows - for ($cell = 0; $cell < count($iterator2->current()->getRow($row)->getCells()); $cell++) { + $countCells = count($iterator2->current()->getRow($row)->getCells()); + for ($cell = 0; $cell < $countCells; $cell++) { $currentCell = $iterator2->current()->getRow($row)->getCell($cell); // Paragraphs in cell foreach ($currentCell->getParagraphs() as $paragraph) { diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index b4ad93c40..4358f822e 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -175,7 +175,7 @@ public function writeSlide(SlideElement $pSlide = null) * Write group * * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer - * @param \PhpOffice\PhpPowerpoint\Shape\Group $shape + * @param \PhpOffice\PhpPowerpoint\Shape\Group $group * @param int $shapeId */ private function writeShapeGroup(XMLWriter $objWriter, Group $group, &$shapeId) @@ -668,7 +668,8 @@ private function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) $objWriter->startElement('a:tblGrid'); // Write cell widths - for ($cell = 0; $cell < count($shape->getRow(0)->getCells()); $cell++) { + $countCells = count($shape->getRow(0)->getCells()); + for ($cell = 0; $cell < $countCells; $cell++) { // a:gridCol $objWriter->startElement('a:gridCol'); @@ -694,13 +695,15 @@ private function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) $defaultBorder = new Border(); // Write rows - for ($row = 0; $row < count($shape->getRows()); $row++) { + $countRows = count($shape->getRows()); + for ($row = 0; $row < $countRows; $row++) { // a:tr $objWriter->startElement('a:tr'); $objWriter->writeAttribute('h', SharedDrawing::pixelsToEmu($shape->getRow($row)->getHeight())); // Write cells - for ($cell = 0; $cell < count($shape->getRow($row)->getCells()); $cell++) { + $countCells = count($shape->getRow($row)->getCells()); + for ($cell = 0; $cell < $countCells; $cell++) { // Current cell $currentCell = $shape->getRow($row)->getCell($cell); From 872056530e1c88ae576021b37404227391d3d057 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Jun 2015 13:24:48 +0200 Subject: [PATCH 070/115] FIXED : Some bugfixes found with @scrutinizer-ci --- src/PhpPowerpoint/Shared/File.php | 2 +- src/PhpPowerpoint/Shared/OLERead.php | 29 ++++++++++++--------- src/PhpPowerpoint/Writer/ODPresentation.php | 6 ++--- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/PhpPowerpoint/Shared/File.php b/src/PhpPowerpoint/Shared/File.php index 95bb5017e..9025d46d2 100644 --- a/src/PhpPowerpoint/Shared/File.php +++ b/src/PhpPowerpoint/Shared/File.php @@ -68,7 +68,7 @@ public static function realpath($pFilename) if ($returnValue == '' || is_null($returnValue)) { $pathArray = explode('/', $pFilename); while (in_array('..', $pathArray) && $pathArray[0] != '..') { - $numPathArray = count($pathArray); + $numPathArray = count($pathArray); for ($i = 0; $i < $numPathArray; ++$i) { if ($pathArray[$i] == '..' && $i > 0) { unset($pathArray[$i]); diff --git a/src/PhpPowerpoint/Shared/OLERead.php b/src/PhpPowerpoint/Shared/OLERead.php index 698e8890d..96a0984ab 100644 --- a/src/PhpPowerpoint/Shared/OLERead.php +++ b/src/PhpPowerpoint/Shared/OLERead.php @@ -28,8 +28,8 @@ namespace PhpOffice\PhpPowerpoint\Shared; -if (!defined('IDENTIFIER_OLE')){ - define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); +if (!defined('IDENTIFIER_OLE')) { + define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); } class OLERead @@ -72,6 +72,9 @@ class OLERead public $pictures = null; public $rootEntry = null; public $props = array(); + public $smallBlockChain = null; + public $bigBlockChain = null; + public $entry = null; /** * Read the file @@ -99,7 +102,7 @@ public function read($sFileName) $this->data = file_get_contents($sFileName); // Total number of sectors used for the SAT - $numBigBlockDepotBlocks = self::getInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); + $numBigBlkDepotBlks = self::getInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); // SecID of the first sector of the directory stream $rootStartBlock = self::getInt4d($this->data, self::ROOT_START_BLOCK_POS); @@ -116,7 +119,7 @@ public function read($sFileName) $bigBlockDepotBlocks = array(); $pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS; - $bbdBlocks = $numBigBlockDepotBlocks; + $bbdBlocks = $numBigBlkDepotBlks; if ($numExtensionBlocks != 0) { $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4; @@ -129,7 +132,7 @@ public function read($sFileName) for ($j = 0; $j < $numExtensionBlocks; ++$j) { $pos = ($extensionBlock + 1) * self::BIG_BLOCK_SIZE; - $blocksToRead = min($numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1); + $blocksToRead = min($numBigBlkDepotBlks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1); for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) { $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); @@ -137,34 +140,34 @@ public function read($sFileName) } $bbdBlocks += $blocksToRead; - if ($bbdBlocks < $numBigBlockDepotBlocks) { + if ($bbdBlocks < $numBigBlkDepotBlks) { $extensionBlock = self::getInt4d($this->data, $pos); } } - $bigBlockChain = ''; + $this->bigBlockChain = ''; $bbs = self::BIG_BLOCK_SIZE / 4; - for ($i = 0; $i < $numBigBlockDepotBlocks; ++$i) { + for ($i = 0; $i < $numBigBlkDepotBlks; ++$i) { $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE; - $bigBlockChain .= substr($this->data, $pos, 4*$bbs); + $this->bigBlockChain .= substr($this->data, $pos, 4*$bbs); $pos += 4*$bbs; } $sbdBlock = $sbdStartBlock; - $smallBlockChain = ''; + $this->smallBlockChain = ''; while ($sbdBlock != -2) { $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE; - $smallBlockChain .= substr($this->data, $pos, 4*$bbs); + $this->smallBlockChain .= substr($this->data, $pos, 4*$bbs); $pos += 4*$bbs; - $sbdBlock = self::getInt4d($bigBlockChain, $sbdBlock*4); + $sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock*4); } // read the directory stream $block = $rootStartBlock; - $entry = $this->readData($block); + $this->entry = $this->readData($block); $this->readPropertySets(); } diff --git a/src/PhpPowerpoint/Writer/ODPresentation.php b/src/PhpPowerpoint/Writer/ODPresentation.php index 7e443f075..1a5d9c8a6 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation.php +++ b/src/PhpPowerpoint/Writer/ODPresentation.php @@ -127,8 +127,8 @@ public function save($pFilename) } } - $writerPartObjectsChart = $this->getWriterPart('charts'); - if (!$writerPartObjectsChart instanceof ObjectsChart) { + $writerPartChart = $this->getWriterPart('charts'); + if (!$writerPartChart instanceof ObjectsChart) { throw new \Exception('The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation\ObjectsChart'); } $writerPartContent = $this->getWriterPart('content'); @@ -187,7 +187,7 @@ public function save($pFilename) // Add charts foreach ($this->chartArray as $keyChart => $shapeChart) { - $arrayFile = $writerPartObjectsChart->writePart($shapeChart); + $arrayFile = $writerPartChart->writePart($shapeChart); foreach ($arrayFile as $file => $content) { if (!empty($content)) { $objZip->addFromString('Object '.$keyChart.'/' . $file, $content); From 45c602c843410aa70a6e8e8c1b752791504b29f1 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Jun 2015 13:44:52 +0200 Subject: [PATCH 071/115] FIXED : Some bugfixes found with @scrutinizer-ci --- src/PhpPowerpoint/Shared/OLERead.php | 4 ++-- src/PhpPowerpoint/Writer/ODPresentation.php | 2 +- src/PhpPowerpoint/Writer/ODPresentation/Content.php | 2 +- src/PhpPowerpoint/Writer/ODPresentation/Drawing.php | 6 +----- src/PhpPowerpoint/Writer/PowerPoint2007.php | 2 +- src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php | 2 +- src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php | 2 +- src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php | 2 +- src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php | 2 +- src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php | 2 +- 10 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/PhpPowerpoint/Shared/OLERead.php b/src/PhpPowerpoint/Shared/OLERead.php index 96a0984ab..dc92bf129 100644 --- a/src/PhpPowerpoint/Shared/OLERead.php +++ b/src/PhpPowerpoint/Shared/OLERead.php @@ -186,7 +186,7 @@ public function getStream($stream) $streamData = ''; if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) { - $rootdata = $this->readData($this->props[$this->rootentry]['startBlock']); + $rootdata = $this->readData($this->props[$this->rootEntry]['startBlock']); $block = $this->props[$stream]['startBlock']; @@ -278,7 +278,7 @@ private function readPropertySets() switch ($upName){ case 'ROOT ENTRY': case 'R': - $this->rootentry = count($this->props) - 1; + $this->rootEntry = count($this->props) - 1; break; case chr(1).'COMPOBJ': break; diff --git a/src/PhpPowerpoint/Writer/ODPresentation.php b/src/PhpPowerpoint/Writer/ODPresentation.php index 1a5d9c8a6..224e05048 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation.php +++ b/src/PhpPowerpoint/Writer/ODPresentation.php @@ -78,7 +78,7 @@ class ODPresentation implements WriterInterface /** * Create a new \PhpOffice\PhpPowerpoint\Writer\ODPresentation * - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPowerpoint $pPHPPowerPoint */ public function __construct(PHPPowerPoint $pPHPPowerPoint = null) { diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index d758868bd..bb0017be1 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -476,7 +476,7 @@ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape) if ($richtext instanceof Run) { $objWriter->writeAttribute('text:style-name', 'T_' . $richtext->getFont()->getHashCode()); } - if ($richtext->hasHyperlink() == true && $richtext->getHyperlink()->getUrl() != '') { + if ($richtext->hasHyperlink() === true && $richtext->getHyperlink()->getUrl() != '') { // text:a $objWriter->startElement('text:a'); $objWriter->writeAttribute('xlink:href', $richtext->getHyperlink()->getUrl()); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php b/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php index 116d9423d..74f33422c 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Drawing.php @@ -34,14 +34,10 @@ class Drawing extends AbstractPart * @return \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing[] All drawings in PHPPowerPoint * @throws \Exception */ - public function allDrawings(PhpPowerPoint $pPHPPowerPoint = null) + public function allDrawings(PhpPowerPoint $pPHPPowerPoint) { // Get an array of all drawings $aDrawings = array(); - - if (is_null($pPHPPowerPoint)) { - return $aDrawings; - } // Loop trough PHPPowerPoint $slideCount = $pPHPPowerPoint->getSlideCount(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007.php b/src/PhpPowerpoint/Writer/PowerPoint2007.php index c230f7fb1..711de2367 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007.php @@ -91,7 +91,7 @@ class PowerPoint2007 implements WriterInterface /** * Create a new \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 * - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPowerpoint $pPHPPowerPoint */ public function __construct(PHPPowerPoint $pPHPPowerPoint = null) { diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php b/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php index 8fa21b653..b7848239d 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php @@ -37,7 +37,7 @@ class ContentTypes extends AbstractPart * @return string XML Output * @throws \Exception */ - public function writeContentTypes(PhpPowerpoint $pPHPPowerPoint = null) + public function writeContentTypes(PhpPowerpoint $pPHPPowerPoint) { $parentWriter = $this->getParentWriter(); if (!$parentWriter instanceof PowerPoint2007) { diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php b/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php index d9e63fe91..e4a27e00e 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php @@ -31,7 +31,7 @@ class DocProps extends AbstractPart * @return string XML Output * @throws \Exception */ - public function writeDocPropsApp(PhpPowerpoint $pPHPPowerPoint = null) + public function writeDocPropsApp(PhpPowerpoint $pPHPPowerPoint) { // Create XML writer $objWriter = $this->getXMLWriter(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php index f9ece443e..0f59a733d 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Drawing.php @@ -34,7 +34,7 @@ class Drawing extends AbstractPart * @return \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing[] All drawings in PHPPowerPoint * @throws \Exception */ - public function allDrawings(PhpPowerpoint $pPHPPowerPoint = null) + public function allDrawings(PhpPowerpoint $pPHPPowerPoint) { // Get an array of all drawings $aDrawings = array(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php index 3e5a5c66b..420df4332 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php @@ -34,7 +34,7 @@ class Presentation extends AbstractPart * @return string XML Output * @throws \Exception */ - public function writePresentation(PhpPowerpoint $pPHPPowerPoint = null) + public function writePresentation(PhpPowerpoint $pPHPPowerPoint) { // Create XML writer $objWriter = $this->getXMLWriter(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php index 32fe35bb3..b078bdd20 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php @@ -75,7 +75,7 @@ public function writeRelationships() * @return string XML Output * @throws \Exception */ - public function writePresentationRelationships(PhpPowerpoint $pPHPPowerPoint = null) + public function writePresentationRelationships(PhpPowerpoint $pPHPPowerPoint) { // Create XML writer $objWriter = $this->getXMLWriter(); From b339718779a8433d749a3119c54318f37b69bf63 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Jun 2015 14:02:49 +0200 Subject: [PATCH 072/115] FIXED : Some bugfixes found with @scrutinizer-ci --- src/PhpPowerpoint/Writer/ODPresentation.php | 2 +- src/PhpPowerpoint/Writer/PowerPoint2007.php | 2 +- src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php | 4 ++-- src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/PhpPowerpoint/Writer/ODPresentation.php b/src/PhpPowerpoint/Writer/ODPresentation.php index 224e05048..0c14bf778 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation.php +++ b/src/PhpPowerpoint/Writer/ODPresentation.php @@ -273,7 +273,7 @@ public function getPHPPowerPoint() /** * Get PHPPowerPoint object * - * @param PhpPowerpoint $pPHPPowerPoint PHPPowerPoint object + * @param PhpPowerpoint $pPHPPowerPoint PhpPowerpoint object * @throws \Exception * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 */ diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007.php b/src/PhpPowerpoint/Writer/PowerPoint2007.php index 711de2367..afde85c9e 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007.php @@ -351,7 +351,7 @@ public function getPHPPowerPoint() /** * Get PHPPowerPoint object * - * @param PhpPowerpoint $pPHPPowerPoint PHPPowerPoint object + * @param PhpPowerpoint $pPHPPowerPoint PhpPowerpoint object * @throws \Exception * @return \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 */ diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php b/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php index e4a27e00e..201cb3418 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php @@ -123,11 +123,11 @@ public function writeDocPropsApp(PhpPowerpoint $pPHPPowerPoint) /** * Write docProps/core.xml to XML format * - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPowerpoint $pPHPPowerPoint * @return string XML Output * @throws \Exception */ - public function writeDocPropsCore(PHPPowerPoint $pPHPPowerPoint = null) + public function writeDocPropsCore(PhpPowerpoint $pPHPPowerPoint = null) { // Create XML writer $objWriter = $this->getXMLWriter(); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php index 420df4332..b9ab90edb 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php @@ -105,11 +105,11 @@ public function writePresentation(PhpPowerpoint $pPHPPowerPoint) * Write slides * * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer - * @param PHPPowerPoint $pPHPPowerPoint + * @param PhpPowerpoint $pPHPPowerPoint * @param int $startRelationId * @throws \Exception */ - private function writeSlides(XMLWriter $objWriter, PHPPowerPoint $pPHPPowerPoint = null, $startRelationId = 2) + private function writeSlides(XMLWriter $objWriter, PhpPowerpoint $pPHPPowerPoint, $startRelationId = 2) { // Write slides $slideCount = $pPHPPowerPoint->getSlideCount(); From 9446450028739407e7a62662d657dbaa1995eaab Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Jun 2015 14:17:31 +0200 Subject: [PATCH 073/115] FIXED : Some bugfixes found with @scrutinizer-ci --- src/PhpPowerpoint/Writer/ODPresentation.php | 2 +- src/PhpPowerpoint/Writer/PowerPoint2007.php | 2 +- src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PhpPowerpoint/Writer/ODPresentation.php b/src/PhpPowerpoint/Writer/ODPresentation.php index 0c14bf778..32992081d 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation.php +++ b/src/PhpPowerpoint/Writer/ODPresentation.php @@ -38,7 +38,7 @@ class ODPresentation implements WriterInterface /** * Private PHPPowerPoint * - * @var PHPPowerPoint + * @var PhpPowerPoint */ private $presentation; diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007.php b/src/PhpPowerpoint/Writer/PowerPoint2007.php index afde85c9e..a1bb13cfe 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007.php @@ -56,7 +56,7 @@ class PowerPoint2007 implements WriterInterface /** * Private PHPPowerPoint * - * @var PHPPowerPoint + * @var PhpPowerPoint */ protected $presentation; diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php b/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php index 201cb3418..3cae3cafb 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/DocProps.php @@ -127,7 +127,7 @@ public function writeDocPropsApp(PhpPowerpoint $pPHPPowerPoint) * @return string XML Output * @throws \Exception */ - public function writeDocPropsCore(PhpPowerpoint $pPHPPowerPoint = null) + public function writeDocPropsCore(PhpPowerpoint $pPHPPowerPoint) { // Create XML writer $objWriter = $this->getXMLWriter(); From caaafb0debc0dcc20232a9b11359b0acc38fedbf Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Jun 2015 14:33:11 +0200 Subject: [PATCH 074/115] FIXED : Some bugfixes found with @scrutinizer-ci --- src/PhpPowerpoint/Writer/ODPresentation.php | 4 ++-- src/PhpPowerpoint/Writer/PowerPoint2007.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PhpPowerpoint/Writer/ODPresentation.php b/src/PhpPowerpoint/Writer/ODPresentation.php index 32992081d..44e81cb81 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation.php +++ b/src/PhpPowerpoint/Writer/ODPresentation.php @@ -38,7 +38,7 @@ class ODPresentation implements WriterInterface /** * Private PHPPowerPoint * - * @var PhpPowerPoint + * @var \PhpOffice\PhpPowerpoint\PhpPowerpoint */ private $presentation; @@ -80,7 +80,7 @@ class ODPresentation implements WriterInterface * * @param PhpPowerpoint $pPHPPowerPoint */ - public function __construct(PHPPowerPoint $pPHPPowerPoint = null) + public function __construct(PhpPowerpoint $pPHPPowerPoint = null) { // Assign PHPPowerPoint $this->setPHPPowerPoint($pPHPPowerPoint); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007.php b/src/PhpPowerpoint/Writer/PowerPoint2007.php index a1bb13cfe..2b284596f 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007.php @@ -93,7 +93,7 @@ class PowerPoint2007 implements WriterInterface * * @param PhpPowerpoint $pPHPPowerPoint */ - public function __construct(PHPPowerPoint $pPHPPowerPoint = null) + public function __construct(PhpPowerpoint $pPHPPowerPoint = null) { // Assign PHPPowerPoint $this->setPHPPowerPoint($pPHPPowerPoint); From a676e85e7951d4c5030d6ef362bd8c9538a9eb95 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Jun 2015 15:14:19 +0200 Subject: [PATCH 075/115] FIXED : Some bugfixes found with @scrutinizer-ci --- src/PhpPowerpoint/Writer/PowerPoint2007.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007.php b/src/PhpPowerpoint/Writer/PowerPoint2007.php index 2b284596f..d5faa7806 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007.php @@ -56,7 +56,7 @@ class PowerPoint2007 implements WriterInterface /** * Private PHPPowerPoint * - * @var PhpPowerPoint + * @var \PhpOffice\PhpPowerPoint\PhpPowerpoint */ protected $presentation; From 9f9af7d64b90abab703e469aba75029af4fae2fe Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 19 Jun 2015 16:52:30 +0200 Subject: [PATCH 076/115] Added some unit tests --- tests/PhpPowerpoint/Tests/Shape/ChartTest.php | 14 +++++ .../ODPresentation/AbstractPartTest.php | 60 +++++++++++++++++++ .../Writer/ODPresentation/DrawingTest.php | 55 +++++++++++++++++ .../PowerPoint2007/AbstractPartTest.php | 59 ++++++++++++++++++ .../Writer/PowerPoint2007/ContenTypesTest.php | 50 ++++++++++++++++ .../Writer/PowerPoint2007/DrawingTest.php | 55 +++++++++++++++++ 6 files changed, 293 insertions(+) create mode 100644 tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php create mode 100644 tests/PhpPowerpoint/Tests/Writer/ODPresentation/DrawingTest.php create mode 100644 tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php create mode 100644 tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ContenTypesTest.php create mode 100644 tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/DrawingTest.php diff --git a/tests/PhpPowerpoint/Tests/Shape/ChartTest.php b/tests/PhpPowerpoint/Tests/Shape/ChartTest.php index 651477d03..fdce9d58b 100644 --- a/tests/PhpPowerpoint/Tests/Shape/ChartTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/ChartTest.php @@ -35,6 +35,20 @@ public function testConstruct() $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $object->getPlotArea()); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $object->getView3D()); } + + + public function testClone() + { + $object = new Chart(); + + $oClone = clone $object; + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart', $oClone); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $oClone->getTitle()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Legend', $oClone->getLegend()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\PlotArea', $oClone->getPlotArea()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\View3D', $oClone->getView3D()); + } public function testIncludeSpreadsheet() { diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php new file mode 100644 index 000000000..dfef00833 --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php @@ -0,0 +1,60 @@ +getParentWriter(); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation + */ + public function testWriterException() + { + $oManifest = new Manifest(); + $oManifest->setParentWriter(new PowerPoint2007()); + $oManifest->writePart(); + } +} diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/DrawingTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/DrawingTest.php new file mode 100644 index 000000000..67065889a --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/DrawingTest.php @@ -0,0 +1,55 @@ +getActiveSlide(); + $oGroup = $oSlide->createGroup(); + + $oDrawing = new Drawing(); + $this->assertInternalType('array', $oDrawing->allDrawings($oPhpPowerPoint)); + $this->assertEmpty($oDrawing->allDrawings($oPhpPowerPoint)); + + $oGroup->createDrawingShape(); + $oGroup->createDrawingShape(); + $oGroup->createDrawingShape(); + + $this->assertInternalType('array', $oDrawing->allDrawings($oPhpPowerPoint)); + $this->assertCount(3, $oDrawing->allDrawings($oPhpPowerPoint)); + } +} diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php new file mode 100644 index 000000000..fd3cee280 --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php @@ -0,0 +1,59 @@ +getParentWriter(); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\PowerPoint2007 + */ + public function testWriterException() + { + $oManifest = new Rels(); + $oManifest->setParentWriter(new ODPresentation()); + $oManifest->writeRelationships(); + } +} diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ContenTypesTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ContenTypesTest.php new file mode 100644 index 000000000..672fb28a2 --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ContenTypesTest.php @@ -0,0 +1,50 @@ +setParentWriter(new ODPresentation()); + $oContentTypes->writeContentTypes(new PhpPowerpoint()); + } +} diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/DrawingTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/DrawingTest.php new file mode 100644 index 000000000..a85c220d4 --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/DrawingTest.php @@ -0,0 +1,55 @@ +getActiveSlide(); + $oGroup = $oSlide->createGroup(); + + $oDrawing = new Drawing(); + $this->assertInternalType('array', $oDrawing->allDrawings($oPhpPowerPoint)); + $this->assertEmpty($oDrawing->allDrawings($oPhpPowerPoint)); + + $oGroup->createDrawingShape(); + $oGroup->createDrawingShape(); + $oGroup->createDrawingShape(); + + $this->assertInternalType('array', $oDrawing->allDrawings($oPhpPowerPoint)); + $this->assertCount(3, $oDrawing->allDrawings($oPhpPowerPoint)); + } +} From 43b43515337acecc60d59897d2943b0fc6c3d9e4 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 22 Jun 2015 13:33:08 +0200 Subject: [PATCH 077/115] ODPresentation & PowerPoint2007 Writer : Shadow don't work for RichTextShapes - @Progi1984 GH-81 --- .gitignore | 1 + CHANGELOG.md | 8 +- samples/Sample_11_Shape.php | 82 +++++++++++++++ .../Writer/ODPresentation/Content.php | 99 ++++++++++--------- .../Writer/PowerPoint2007/Slide.php | 92 +++++++++-------- .../Writer/ODPresentation/ContentTest.php | 16 +++ .../Tests/Writer/PowerPoint2007/SlideTest.php | 14 +++ 7 files changed, 222 insertions(+), 90 deletions(-) create mode 100644 samples/Sample_11_Shape.php diff --git a/.gitignore b/.gitignore index 4f302c6ba..f40bd628e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ vendor /samples/#70 /samples/#71 /samples/Github_*.* +/samples/#83/*.lnk diff --git a/CHANGELOG.md b/CHANGELOG.md index 952142262..d20ba7543 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,14 +20,16 @@ ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 +- ODPresentation Writer : Title in Legend in chart doesn't displayed - @Progi1984 GH-79 +- ODPresentation Writer : Segments in Pie3D Chart are now in clockwise order, as in PowerPoint2007 Writer - @Progi1984 GH-79 +- ODPresentation Writer : Axis in Line Chart have not tick marks displayed, as in PowerPoint2007 Writer - @Progi1984 GH-79 +- ODPresentation Writer : Shadow don't work for RichTextShapes - @Progi1984 GH-81 - PowerPoint2007 Writer : Fill don't work for RichTextShapes - @Progi1984 GH-61 - PowerPoint2007 Writer : Border don't work for RichTextShapes - @Progi1984 GH-61 - PowerPoint2007 Writer : Hyperlink in table doesn't work - @Progi1984 GH-70 - PowerPoint2007 Writer : AutoFitNormal works with options (fontScale & lineSpacingReduction) - @Progi1984 @desigennaro GH-71 +- PowerPoint2007 Writer : Shadow don't work for RichTextShapes - @Progi1984 GH-81 - Refactor findLayoutIndex to findLayoutId where it assumes the slideLayout order was sorted. IMPROVED: unit tests - @kenliau GH-95 -- ODPresentation Writer : Title in Legend in chart doesn't displayed - @Progi1984 GH-79 -- ODPresentation Writer : Segments in Pie3D Chart are now in clockwise order, as in PowerPoint2007 Writer - @Progi1984 GH-79 -- ODPresentation Writer : Axis in Line Chart have not tick marks displayed, as in PowerPoint2007 Writer - @Progi1984 GH-79 ### Miscellaneous diff --git a/samples/Sample_11_Shape.php b/samples/Sample_11_Shape.php new file mode 100644 index 000000000..36a17791d --- /dev/null +++ b/samples/Sample_11_Shape.php @@ -0,0 +1,82 @@ +createRichTextShape(); + $shape->setHeight(100); + $shape->setWidth(600); + $shape->setOffsetX(100); + $shape->setOffsetY(100); + $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_LEFT ); + + $textRun = $shape->createTextRun('RichText with'); + $textRun->getFont()->setBold(true); + $textRun->getFont()->setSize(28); + $textRun->getFont()->setColor(new Color( 'FF000000' )); + + $shape->createBreak(); + + $textRun = $shape->createTextRun('Multiline'); + $textRun->getFont()->setBold(true); + $textRun->getFont()->setSize(60); + $textRun->getFont()->setColor(new Color( 'FF000000' )); +} + +function fnSlideRichTextShadow(PhpPowerpoint $objPHPPowerPoint) { + // Create templated slide + echo date('H:i:s') . ' Create templated slide'.EOL; + $currentSlide = createTemplatedSlide($objPHPPowerPoint); + + // Create a shape (text) + echo date('H:i:s') . ' Create a shape (rich text) with shadow'.EOL; + $shape = $currentSlide->createRichTextShape(); + $shape->setHeight(100); + $shape->setWidth(400); + $shape->setOffsetX(100); + $shape->setOffsetY(100); + $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_LEFT ); + $shape->getShadow()->setVisible(true)->setAlpha(75)->setBlurRadius(2)->setDirection(45); + + $textRun = $shape->createTextRun('RichText with shadow'); + $textRun->getFont()->setColor(new Color( 'FF000000' )); +} + +// Create new PHPPowerPoint object +echo date('H:i:s') . ' Create new PHPPowerPoint object'.EOL; +$objPHPPowerPoint = new PhpPowerpoint(); + +// Set properties +echo date('H:i:s') . ' Set properties'.EOL; +$oProperties = $objPHPPowerPoint->getProperties(); +$oProperties->setCreator('PHPOffice') + ->setLastModifiedBy('PHPPowerPoint Team') + ->setTitle('Sample 11 Title') + ->setSubject('Sample 11 Subject') + ->setDescription('Sample 11 Description') + ->setKeywords('office 2007 openxml libreoffice odt php') + ->setCategory('Sample Category'); + +// Remove first slide +echo date('H:i:s') . ' Remove first slide'.EOL; +$objPHPPowerPoint->removeSlideByIndex(0); + +fnSlideRichText($objPHPPowerPoint); +fnSlideRichTextShadow($objPHPPowerPoint); + +// Save file +echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index bb0017be1..273b37af4 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -38,6 +38,7 @@ use PhpOffice\PhpPowerpoint\Style\Alignment; use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Fill; +use PhpOffice\PhpPowerpoint\Style\Shadow; use PhpOffice\PhpPowerpoint\Writer\ODPresentation; /** @@ -321,9 +322,7 @@ public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape) $objWriter->writeAttribute('svg:height', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); $objWriter->writeAttribute('svg:x', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); $objWriter->writeAttribute('svg:y', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); - if ($shape->getShadow()->isVisible()) { - $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId); - } + $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId); // draw:image $objWriter->startElement('draw:image'); if ($shape instanceof ShapeDrawing) { @@ -731,6 +730,9 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) $objWriter->writeAttribute('style:parent-style-name', 'standard'); // style:graphic-properties $objWriter->startElement('style:graphic-properties'); + if ($shape->getShadow()->isVisible()) { + $this->writeStylePartShadow($objWriter, $shape->getShadow()); + } if (is_bool($shape->hasAutoShrinkVertical())) { $objWriter->writeAttribute('draw:auto-grow-height', var_export($shape->hasAutoShrinkVertical(), true)); } @@ -832,50 +834,22 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) */ public function writeDrawingStyle(XMLWriter $objWriter, AbstractDrawing $shape) { - if ($shape->getShadow()->isVisible()) { - // style:style - $objWriter->startElement('style:style'); - $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId); - $objWriter->writeAttribute('style:family', 'graphic'); - $objWriter->writeAttribute('style:parent-style-name', 'standard'); - - // style:graphic-properties - $objWriter->startElement('style:graphic-properties'); - $objWriter->writeAttribute('draw:stroke', 'none'); - $objWriter->writeAttribute('draw:fill', 'none'); - $objWriter->writeAttribute('draw:shadow', 'visible'); - $objWriter->writeAttribute('draw:shadow-color', '#' . $shape->getShadow()->getColor()->getRGB()); - if ($shape->getShadow()->getDirection() == 0 || $shape->getShadow()->getDirection() == 360) { - $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '0cm'); - } elseif ($shape->getShadow()->getDirection() == 45) { - $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } elseif ($shape->getShadow()->getDirection() == 90) { - $objWriter->writeAttribute('draw:shadow-offset-x', '0cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } elseif ($shape->getShadow()->getDirection() == 135) { - $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } elseif ($shape->getShadow()->getDirection() == 180) { - $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '0cm'); - } elseif ($shape->getShadow()->getDirection() == 225) { - $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } elseif ($shape->getShadow()->getDirection() == 270) { - $objWriter->writeAttribute('draw:shadow-offset-x', '0cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } elseif ($shape->getShadow()->getDirection() == 315) { - $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($shape->getShadow()->getDistance()) . 'cm'); - } - $objWriter->writeAttribute('draw:shadow-opacity', (100 - $shape->getShadow()->getAlpha()) . '%'); - $objWriter->writeAttribute('style:mirror', 'none'); - $objWriter->endElement(); + // style:style + $objWriter->startElement('style:style'); + $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId); + $objWriter->writeAttribute('style:family', 'graphic'); + $objWriter->writeAttribute('style:parent-style-name', 'standard'); - $objWriter->endElement(); + // style:graphic-properties + $objWriter->startElement('style:graphic-properties'); + $objWriter->writeAttribute('draw:stroke', 'none'); + $objWriter->writeAttribute('draw:fill', 'none'); + if ($shape->getShadow()->isVisible()) { + $this->writeStylePartShadow($objWriter, $shape->getShadow()); } + $objWriter->endElement(); + + $objWriter->endElement(); } /** @@ -1232,4 +1206,39 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) // > style:style $objWriter->endElement(); } + + + protected function writeStylePartShadow(XMLWriter $objWriter, Shadow $oShadow) + { + $objWriter->writeAttribute('draw:shadow', 'visible'); + $objWriter->writeAttribute('draw:shadow-color', '#' . $oShadow->getColor()->getRGB()); + if ($oShadow->getDirection() == 0 || $oShadow->getDirection() == 360) { + $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '0cm'); + } elseif ($oShadow->getDirection() == 45) { + $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + } elseif ($oShadow->getDirection() == 90) { + $objWriter->writeAttribute('draw:shadow-offset-x', '0cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + } elseif ($oShadow->getDirection() == 135) { + $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + } elseif ($oShadow->getDirection() == 180) { + $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '0cm'); + } elseif ($oShadow->getDirection() == 225) { + $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + } elseif ($oShadow->getDirection() == 270) { + $objWriter->writeAttribute('draw:shadow-offset-x', '0cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + } elseif ($oShadow->getDirection() == 315) { + $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + } + $objWriter->writeAttribute('draw:shadow-opacity', (100 - $oShadow->getAlpha()) . '%'); + $objWriter->writeAttribute('style:mirror', 'none'); + + } } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 4358f822e..59a453c76 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -36,6 +36,7 @@ use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Bullet; use PhpOffice\PhpPowerpoint\Style\Fill; +use PhpOffice\PhpPowerpoint\Style\Shadow; /** * Slide writer @@ -421,31 +422,7 @@ private function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape, $sh } if ($shape->getShadow()->isVisible()) { - // a:effectLst - $objWriter->startElement('a:effectLst'); - - // a:outerShdw - $objWriter->startElement('a:outerShdw'); - $objWriter->writeAttribute('blurRad', SharedDrawing::pixelsToEmu($shape->getShadow()->getBlurRadius())); - $objWriter->writeAttribute('dist', SharedDrawing::pixelsToEmu($shape->getShadow()->getDistance())); - $objWriter->writeAttribute('dir', SharedDrawing::degreesToAngle($shape->getShadow()->getDirection())); - $objWriter->writeAttribute('algn', $shape->getShadow()->getAlignment()); - $objWriter->writeAttribute('rotWithShape', '0'); - - // a:srgbClr - $objWriter->startElement('a:srgbClr'); - $objWriter->writeAttribute('val', $shape->getShadow()->getColor()->getRGB()); - - // a:alpha - $objWriter->startElement('a:alpha'); - $objWriter->writeAttribute('val', $shape->getShadow()->getAlpha() * 1000); - $objWriter->endElement(); - - $objWriter->endElement(); - - $objWriter->endElement(); - - $objWriter->endElement(); + $this->writeShadow($objWriter, $shape->getShadow()); } $objWriter->endElement(); @@ -466,10 +443,10 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) // p:sp $objWriter->startElement('p:sp'); - // p:nvSpPr + // p:sp\p:nvSpPr $objWriter->startElement('p:nvSpPr'); - // p:cNvPr + // p:sp\p:nvSpPr\p:cNvPr $objWriter->startElement('p:cNvPr'); $objWriter->writeAttribute('id', $shapeId); $objWriter->writeAttribute('name', ''); @@ -478,41 +455,41 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) if ($shape->hasHyperlink()) { $this->writeHyperlink($objWriter, $shape); } - + // > p:sp\p:nvSpPr $objWriter->endElement(); - // p:cNvSpPr + // p:sp\p:cNvSpPr $objWriter->startElement('p:cNvSpPr'); $objWriter->writeAttribute('txBox', '1'); $objWriter->endElement(); - - // p:nvPr + // p:sp\p:cNvSpPr\p:nvPr $objWriter->writeElement('p:nvPr', null); - + // > p:sp\p:cNvSpPr $objWriter->endElement(); - // p:spPr + // p:sp\p:spPr $objWriter->startElement('p:spPr'); - // a:xfrm + // p:sp\p:spPr\a:xfrm $objWriter->startElement('a:xfrm'); $objWriter->writeAttribute('rot', SharedDrawing::degreesToAngle($shape->getRotation())); - - // a:off + + // p:sp\p:spPr\a:xfrm\a:off $objWriter->startElement('a:off'); $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($shape->getOffsetX())); $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($shape->getOffsetY())); $objWriter->endElement(); - - // a:ext + + // p:sp\p:spPr\a:xfrm\a:ext $objWriter->startElement('a:ext'); $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($shape->getWidth())); $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($shape->getHeight())); $objWriter->endElement(); - + + // > p:sp\p:spPr\a:xfrm $objWriter->endElement(); - // a:prstGeom + // p:sp\p:spPr\a:prstGeom $objWriter->startElement('a:prstGeom'); $objWriter->writeAttribute('prst', 'rect'); $objWriter->endElement(); @@ -520,11 +497,13 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) if ($shape->getFill()) { $this->writeFill($objWriter, $shape->getFill()); } - if ($shape->getBorder()->getLineStyle() != Border::LINE_NONE) { $this->writeBorder($objWriter, $shape->getBorder(), ''); } - + if ($shape->getShadow()) { + $this->writeShadow($objWriter, $shape->getShadow()); + } + // > p:sp\p:spPr $objWriter->endElement(); // p:txBody @@ -1239,6 +1218,35 @@ protected function writePatternFill(XMLWriter $objWriter, Fill $pFill) $objWriter->endElement(); } + protected function writeShadow(XMLWriter $objWriter, Shadow $oShadow) + { + // a:effectLst + $objWriter->startElement('a:effectLst'); + + // a:outerShdw + $objWriter->startElement('a:outerShdw'); + $objWriter->writeAttribute('blurRad', SharedDrawing::pixelsToEmu($oShadow->getBlurRadius())); + $objWriter->writeAttribute('dist', SharedDrawing::pixelsToEmu($oShadow->getDistance())); + $objWriter->writeAttribute('dir', SharedDrawing::degreesToAngle($oShadow->getDirection())); + $objWriter->writeAttribute('algn', $oShadow->getAlignment()); + $objWriter->writeAttribute('rotWithShape', '0'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', $oShadow->getColor()->getRGB()); + + // a:alpha + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $oShadow->getAlpha() * 1000); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + /** * Write hyperlink * diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index 59510ddec..dc50a85c0 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -239,6 +239,22 @@ public function testRichtextBorder() $this->assertStringEndsWith($oRichText1->getBorder()->getDashStyle(), $pres->getElementAttribute($element, 'draw:stroke-dash', 'content.xml')); } + public function testRichTextShadow() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oRichText = $oSlide->createRichTextShape(); + $oRichText->createTextRun('AAA'); + $oRichText->getShadow()->setVisible(true)->setAlpha(75)->setBlurRadius(2)->setDirection(45); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertEquals('visible', $pres->getElementAttribute($element, 'draw:shadow', 'content.xml')); + $this->assertStringStartsWith('#', $pres->getElementAttribute($element, 'draw:shadow-color', 'content.xml')); + } + public function testStyleAlignment() { $phpPowerPoint = new PhpPowerpoint(); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index 829fb4ade..0bdbd2433 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -519,6 +519,20 @@ public function testRichTextHyperlink() $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); } + public function testRichTextShadow() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oRichText = $oSlide->createRichTextShape(); + $oRichText->createTextRun('AAA'); + $oRichText->getShadow()->setVisible(true)->setAlpha(75)->setBlurRadius(2)->setDirection(45); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:effectLst/a:outerShdw'; + $this->assertTrue($pres->elementExists($element, 'ppt/slides/slide1.xml')); + } + public function testRichTextUpright() { $phpPowerPoint = new PhpPowerpoint(); From 220374b79a3ef169cbd96f72c98bc7034bab6f6c Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 22 Jun 2015 13:40:06 +0200 Subject: [PATCH 078/115] ODPresentation & PowerPoint2007 Writer : Shadow don't work for RichTextShapes - @Progi1984 GH-81 --- src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 59a453c76..8c3911544 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -502,7 +502,7 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) } if ($shape->getShadow()) { $this->writeShadow($objWriter, $shape->getShadow()); - } + } // > p:sp\p:spPr $objWriter->endElement(); @@ -1245,7 +1245,7 @@ protected function writeShadow(XMLWriter $objWriter, Shadow $oShadow) $objWriter->endElement(); $objWriter->endElement(); - } + } /** * Write hyperlink From 326c6c38ed96d64eb837ca364ee54cdd0ea469e7 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 22 Jun 2015 13:49:03 +0200 Subject: [PATCH 079/115] Improved the sample 04-Table for having a Text Run in a Cell - @Progi1984 GH-84 --- CHANGELOG.md | 1 + samples/Sample_04_Table.php | 14 ++++++++++++-- samples/Sample_Header.php | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d20ba7543..c5f42e7a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - Refactor findLayoutIndex to findLayoutId where it assumes the slideLayout order was sorted. IMPROVED: unit tests - @kenliau GH-95 ### Miscellaneous +- Improved the sample 04-Table for having a Text Run in a Cell - @Progi1984 GH-84 ## 0.3.0 - 2014-09-22 diff --git a/samples/Sample_04_Table.php b/samples/Sample_04_Table.php index cfbda02b2..66da8bb96 100644 --- a/samples/Sample_04_Table.php +++ b/samples/Sample_04_Table.php @@ -95,8 +95,18 @@ $row->getFill()->setFillType(Fill::FILL_SOLID) ->setStartColor(new Color('FFE06B20')) ->setEndColor(new Color('FFE06B20')); -$textRun = $row->nextCell()->createTextRun('Link'); -$textRun->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); +$textRunC1 = $row->nextCell()->createTextRun('Link'); +$textRunC1->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); +$cellC2 = $row->nextCell(); +$textRunC2 = $cellC2->createTextRun('RichText with'); +$textRunC2->getFont()->setBold(true); +$textRunC2->getFont()->setSize(12); +$textRunC2->getFont()->setColor(new Color('FF000000')); +$cellC2->createBreak(); +$textRunC2 = $cellC2->createTextRun('Multiline'); +$textRunC2->getFont()->setBold(true); +$textRunC2->getFont()->setSize(14); +$textRunC2->getFont()->setColor(new Color('FF0088FF')); // Save file echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index 6c2530dd0..81696c97c 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -5,6 +5,7 @@ use PhpOffice\PhpPowerpoint\Autoloader; use PhpOffice\PhpPowerpoint\Settings; use PhpOffice\PhpPowerpoint\IOFactory; +use PhpOffice\PhpPowerpoint\Slide; error_reporting(E_ALL); define('CLI', (PHP_SAPI == 'cli') ? true : false); @@ -112,7 +113,7 @@ function getEndingNotes($writers) * Creates a templated slide * * @param PHPPowerPoint $objPHPPowerPoint - * @return PHPPowerPoint_Slide + * @return \PhpOffice\PhpPowerpoint\Slide */ function createTemplatedSlide(PhpOffice\PhpPowerpoint\PhpPowerpoint $objPHPPowerPoint) { From a1414678f765587a647abb7b5b3c5eb47fb513dc Mon Sep 17 00:00:00 2001 From: jking Date: Tue, 23 Jun 2015 10:54:47 -0400 Subject: [PATCH 080/115] Add Pie Chart Type --- src/PhpPowerpoint/Shape/Chart/Type/Pie.php | 51 ++++++ .../Writer/ODPresentation/ObjectsChart.php | 9 +- .../Writer/PowerPoint2007/Chart.php | 172 ++++++++++++++++++ .../Tests/Shape/Chart/Type/PieTest.php | 66 +++++++ .../Writer/ODPresentation/ChartsTest.php | 43 ++++- .../Tests/Writer/PowerPoint2007/ChartTest.php | 44 ++++- 6 files changed, 374 insertions(+), 11 deletions(-) create mode 100644 src/PhpPowerpoint/Shape/Chart/Type/Pie.php create mode 100644 tests/PhpPowerpoint/Tests/Shape/Chart/Type/PieTest.php diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Pie.php b/src/PhpPowerpoint/Shape/Chart/Type/Pie.php new file mode 100644 index 000000000..5e4b68714 --- /dev/null +++ b/src/PhpPowerpoint/Shape/Chart/Type/Pie.php @@ -0,0 +1,51 @@ +hasAxisX = false; + $this->hasAxisY = false; + } + + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() + { + $hash = ''; + foreach ($this->getData() as $series) { + $hash .= $series->getHashCode(); + } + return md5($hash . __CLASS__); + } +} diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index aefc6fbdc..6dff24422 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -23,6 +23,7 @@ use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter; use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; @@ -89,7 +90,7 @@ public function writePart(Chart $chart) private function writeContentPart(Chart $chart) { $chartType = $chart->getPlotArea()->getType(); - if (!($chartType instanceof Area || $chartType instanceof Bar || $chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Pie3D || $chartType instanceof Scatter)) { + if (!($chartType instanceof Area || $chartType instanceof Bar || $chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Pie || $chartType instanceof Pie3D || $chartType instanceof Scatter)) { throw new \Exception('The chart type provided could not be rendered.'); } @@ -206,7 +207,7 @@ private function writeContentPart(Chart $chart) $this->xmlContent->writeAttribute('chart:class', 'chart:bar'); } elseif ($chartType instanceof Line) { $this->xmlContent->writeAttribute('chart:class', 'chart:line'); - } elseif ($chartType instanceof Pie3D) { + } elseif ($chartType instanceof Pie || $chartType instanceof Pie3D) { $this->xmlContent->writeAttribute('chart:class', 'chart:circle'); } elseif ($chartType instanceof Scatter) { $this->xmlContent->writeAttribute('chart:class', 'chart:scatter'); @@ -522,7 +523,7 @@ private function writeSeries(Chart $chart, Chart\Series $series) $this->xmlContent->writeAttribute('chart:class', 'chart:bar'); } elseif ($chartType instanceof Line) { $this->xmlContent->writeAttribute('chart:class', 'chart:line'); - } elseif ($chartType instanceof Pie3D) { + } elseif ($chartType instanceof Pie || $chartType instanceof Pie3D) { $this->xmlContent->writeAttribute('chart:class', 'chart:circle'); } elseif ($chartType instanceof Scatter) { $this->xmlContent->writeAttribute('chart:class', 'chart:scatter'); @@ -561,7 +562,7 @@ private function writeSeries(Chart $chart, Chart\Series $series) $this->xmlContent->writeAttribute('chart:repeated', $incRepeat); // > chart:data-point $this->xmlContent->endElement(); - } elseif ($chartType instanceof Pie3D) { + } elseif ($chartType instanceof Pie || $chartType instanceof Pie3D) { $count = count($series->getDataPointFills()); for ($inc = 0; $inc < $count; $inc++) { // chart:data-point diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 2955fa05e..cdcd8f3b0 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -25,6 +25,7 @@ use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter; use PhpOffice\PhpPowerpoint\Shape\Chart as ShapeChart; @@ -511,6 +512,8 @@ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeC $this->writeTypeBar($objWriter, $chartType, $chart->hasIncludedSpreadsheet()); } elseif ($chartType instanceof Bar3D) { $this->writeTypeBar3D($objWriter, $chartType, $chart->hasIncludedSpreadsheet()); + } elseif ($chartType instanceof Pie) { + $this->writeTypePie($objWriter, $chartType, $chart->hasIncludedSpreadsheet()); } elseif ($chartType instanceof Pie3D) { $this->writeTypePie3D($objWriter, $chartType, $chart->hasIncludedSpreadsheet()); } elseif ($chartType instanceof Line) { @@ -1492,6 +1495,175 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include $objWriter->endElement(); } + /** + * Write Type Pie + * + * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie $subject + * @param boolean $includeSheet + * @throws \Exception + */ + protected function writeTypePie(XMLWriter $objWriter, Pie $subject, $includeSheet = false) + { + // c:pieChart + $objWriter->startElement('c:pieChart'); + + // c:varyColors + $objWriter->startElement('c:varyColors'); + $objWriter->writeAttribute('val', '1'); + $objWriter->endElement(); + + // Write series + $seriesIndex = 0; + foreach ($subject->getData() as $series) { + // c:ser + $objWriter->startElement('c:ser'); + + // c:idx + $objWriter->startElement('c:idx'); + $objWriter->writeAttribute('val', $seriesIndex); + $objWriter->endElement(); + + // c:order + $objWriter->startElement('c:order'); + $objWriter->writeAttribute('val', $seriesIndex); + $objWriter->endElement(); + + // c:tx + $objWriter->startElement('c:tx'); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex(1 + $seriesIndex) . '$1' : ''); + $this->writeSingleValueOrReference($objWriter, $includeSheet, $series->getTitle(), $coords); + $objWriter->endElement(); + + // Fills for points? + $dataPointFills = $series->getDataPointFills(); + foreach ($dataPointFills as $key => $value) { + // c:dPt + $objWriter->startElement('c:dPt'); + + // c:idx + $this->writeElementWithValAttribute($objWriter, 'c:idx', $key); + + // c:spPr + $objWriter->startElement('c:spPr'); + + // Write fill + $this->writeFill($objWriter, $value); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + // c:dLbls + $objWriter->startElement('c:dLbls'); + + // c:txPr + $objWriter->startElement('c:txPr'); + + // a:bodyPr + $objWriter->writeElement('a:bodyPr', null); + + // a:lstStyle + $objWriter->writeElement('a:lstStyle', null); + + // a:p + $objWriter->startElement('a:p'); + + // a:pPr + $objWriter->startElement('a:pPr'); + + // a:defRPr + $objWriter->startElement('a:defRPr'); + + $objWriter->writeAttribute('b', ($series->getFont()->isBold() ? 'true' : 'false')); + $objWriter->writeAttribute('i', ($series->getFont()->isItalic() ? 'true' : 'false')); + $objWriter->writeAttribute('strike', ($series->getFont()->isStrikethrough() ? 'sngStrike' : 'noStrike')); + $objWriter->writeAttribute('sz', ($series->getFont()->getSize() * 100)); + $objWriter->writeAttribute('u', $series->getFont()->getUnderline()); + + if ($series->getFont()->isSuperScript() || $series->getFont()->isSubScript()) { + if ($series->getFont()->isSuperScript()) { + $objWriter->writeAttribute('baseline', '30000'); + } elseif ($series->getFont()->isSubScript()) { + $objWriter->writeAttribute('baseline', '-25000'); + } + } + + // Font - a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', $series->getFont()->getColor()->getRGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Font - a:latin + $objWriter->startElement('a:latin'); + $objWriter->writeAttribute('typeface', $series->getFont()->getName()); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:endParaRPr + $objWriter->startElement('a:endParaRPr'); + $objWriter->writeAttribute('lang', 'en-US'); + $objWriter->writeAttribute('dirty', '0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // c:dLblPos + $this->writeElementWithValAttribute($objWriter, 'c:dLblPos', $series->getLabelPosition()); + + // c:showVal + $this->writeElementWithValAttribute($objWriter, 'c:showVal', $series->hasShowValue() ? '1' : '0'); + + // c:showCatName + $this->writeElementWithValAttribute($objWriter, 'c:showCatName', $series->hasShowCategoryName() ? '1' : '0'); + + // c:showSerName + $this->writeElementWithValAttribute($objWriter, 'c:showSerName', $series->hasShowSeriesName() ? '1' : '0'); + + // c:showPercent + $this->writeElementWithValAttribute($objWriter, 'c:showPercent', $series->hasShowPercentage() ? '1' : '0'); + + // c:showLeaderLines + $this->writeElementWithValAttribute($objWriter, 'c:showLeaderLines', $series->hasShowLeaderLines() ? '1' : '0'); + + $objWriter->endElement(); + + // Write X axis data + $axisXData = array_keys($series->getValues()); + + // c:cat + $objWriter->startElement('c:cat'); + $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisXData, 'Sheet1!$A$2:$A$' . (1 + count($axisXData))); + $objWriter->endElement(); + + // Write Y axis data + $axisYData = array_values($series->getValues()); + + // c:val + $objWriter->startElement('c:val'); + $coords = ($includeSheet ? 'Sheet1!$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$2:$' . \PHPExcel_Cell::stringFromColumnIndex($seriesIndex + 1) . '$' . (1 + count($axisYData)) : ''); + $this->writeMultipleValuesOrReference($objWriter, $includeSheet, $axisYData, $coords); + $objWriter->endElement(); + + $objWriter->endElement(); + + ++$seriesIndex; + } + + $objWriter->endElement(); + } + /** * Write Type Pie3D * diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/PieTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/PieTest.php new file mode 100644 index 000000000..57625978b --- /dev/null +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/PieTest.php @@ -0,0 +1,66 @@ +assertInternalType('array', $object->getData()); + $this->assertEmpty($object->getData()); + + $array = array( + new Series(), + new Series(), + ); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie', $object->setData()); + $this->assertEmpty($object->getData()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie', $object->setData($array)); + $this->assertCount(count($array), $object->getData()); + } + + public function testSeries() + { + $object = new Pie(); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Pie', $object->addSeries(new Series())); + $this->assertCount(1, $object->getData()); + } + + + public function testHashCode() + { + $oSeries = new Series(); + + $object = new Pie(); + $object->addSeries($oSeries); + + $this->assertEquals(md5($oSeries->getHashCode().get_class($object)), $object->getHashCode()); + } +} diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php index 5d10ebca3..8e464627a 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php @@ -21,6 +21,7 @@ use PhpOffice\PhpPowerpoint\Shape\Chart\Series; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter; use PhpOffice\PhpPowerpoint\Style\Color; @@ -161,7 +162,7 @@ public function testChartLine() $this->assertEquals('#878787', $pres->getElementAttribute($element, 'svg:stroke-color', 'Object 1/content.xml')); } - public function testChartPie3D() + public function testChartPie() { $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2)); $oSeries->setShowSeriesName(true); @@ -169,13 +170,13 @@ public function testChartPie3D() $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744')); $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F')); - $oPie3D = new Pie3D(); - $oPie3D->addSeries($oSeries); + $oPie = new Pie(); + $oPie->addSeries($oSeries); $phpPowerPoint = new PhpPowerpoint(); $oSlide = $phpPowerPoint->getActiveSlide(); $oChart = $oSlide->createChartShape(); - $oChart->getPlotArea()->setType($oPie3D); + $oChart->getPlotArea()->setType($oPie); $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); @@ -194,6 +195,40 @@ public function testChartPie3D() $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:reverse-direction', 'Object 1/content.xml')); } + + public function testChartPie3D() + { + $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2)); + $oSeries->setShowSeriesName(true); + $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8')); + $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744')); + $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F')); + + $oPie3D = new Pie3D(); + $oPie3D->addSeries($oSeries); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oChart = $oSlide->createChartShape(); + $oChart->getPlotArea()->setType($oPie3D); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:body/office:chart/chart:chart'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('chart:circle', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml')); + + $element = '/office:document-content/office:body/office:chart/chart:chart/chart:plot-area/chart:series/chart:data-point'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisX\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:reverse-direction', 'Object 1/content.xml')); + + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisY\']/style:chart-properties'; + $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml')); + $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:reverse-direction', 'Object 1/content.xml')); + } public function testChartPie3DExplosion() { diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php index e699b76ab..2bd5b713c 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php @@ -21,6 +21,7 @@ use PhpOffice\PhpPowerpoint\Shape\Chart\Series; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter; use PhpOffice\PhpPowerpoint\Style\Color; @@ -274,7 +275,7 @@ public function testTypeLineSuperScript() $this->assertEquals('30000', $oXMLDoc->getElementAttribute($element, 'baseline', 'ppt/charts/'.$oShape->getIndexedFilename())); } - public function testTypePie3D() + public function testTypePie() { $seriesData = array( 'A' => 1, @@ -284,6 +285,43 @@ public function testTypePie3D() 'E' => 2, ); + $oPHPPowerPoint = new PhpPowerpoint(); + $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oShape = $oSlide->createChartShape(); + $oShape->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); + $oPie = new Pie(); + $oSeries = new Series('Downloads', $seriesData); + $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_BLUE)); + $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKBLUE)); + $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKGREEN)); + $oSeries->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKRED)); + $oSeries->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKYELLOW)); + $oPie->addSeries($oSeries); + $oShape->getPlotArea()->setType($oPie); + + $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + + $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); + $element = '/c:chartSpace/c:chart/c:plotArea/c:pieChart'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $element = '/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $element = '/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dPt/c:spPr'; + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $element = '/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:tx/c:v'; + $this->assertEquals($oSeries->getTitle(), $oXMLDoc->getElement($element, 'ppt/charts/'.$oShape->getIndexedFilename())->nodeValue); + } + public function testTypePie3D() + { + $seriesData = array( + 'A' => 1, + 'B' => 2, + 'C' => 4, + 'D' => 3, + 'E' => 2, + ); + $oPHPPowerPoint = new PhpPowerpoint(); $oSlide = $oPHPPowerPoint->getActiveSlide(); $oShape = $oSlide->createChartShape(); @@ -297,9 +335,9 @@ public function testTypePie3D() $oSeries->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_DARKYELLOW)); $oPie3D->addSeries($oSeries); $oShape->getPlotArea()->setType($oPie3D); - + $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); - + $element = '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); $element = '/c:chartSpace/c:chart/c:plotArea/c:pie3DChart'; From cb533d86a4ddb5f840043768ecba93fc6f781f5e Mon Sep 17 00:00:00 2001 From: jking Date: Tue, 23 Jun 2015 12:15:13 -0400 Subject: [PATCH 081/115] Add Pie Chart Type (chart-reverse-direction attribute) --- src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index 6dff24422..f947285e5 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -290,7 +290,7 @@ private function writeAxisStyle(Chart $chart) $this->xmlContent->writeAttribute('chart:display-label', 'true'); $this->xmlContent->writeAttribute('chart:tick-marks-major-inner', 'false'); $this->xmlContent->writeAttribute('chart:tick-marks-major-outer', 'false'); - if ($chartType instanceof Pie3D) { + if ($chartType instanceof Pie || $chartType instanceof Pie3D) { $this->xmlContent->writeAttribute('chart:reverse-direction', 'true'); } // > style:chart-properties @@ -314,7 +314,7 @@ private function writeAxisStyle(Chart $chart) $this->xmlContent->writeAttribute('chart:display-label', 'true'); $this->xmlContent->writeAttribute('chart:tick-marks-major-inner', 'false'); $this->xmlContent->writeAttribute('chart:tick-marks-major-outer', 'false'); - if ($chartType instanceof Pie3D) { + if ($chartType instanceof Pie || $chartType instanceof Pie3D) { $this->xmlContent->writeAttribute('chart:reverse-direction', 'true'); } // > style:chart-properties From eeacfb6ea8e21fba69b3240f99e1cef4ae5f7782 Mon Sep 17 00:00:00 2001 From: jking Date: Tue, 23 Jun 2015 13:04:26 -0400 Subject: [PATCH 082/115] Add Grouping Option To Bar Charts - Allows For Stacked & Stack Percentage Bar Charts --- src/PhpPowerpoint/Shape/Chart/Type/Bar.php | 37 ++++++++++++++++++ src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php | 38 ++++++++++++++++++- .../Writer/ODPresentation/ObjectsChart.php | 12 ++++++ .../Writer/PowerPoint2007/Chart.php | 13 ++++++- .../Tests/Shape/Chart/Type/Bar3DTest.php | 12 ++++++ .../Tests/Shape/Chart/Type/BarTest.php | 11 ++++++ 6 files changed, 120 insertions(+), 3 deletions(-) diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Bar.php b/src/PhpPowerpoint/Shape/Chart/Type/Bar.php index e3aa47367..a2af8f1b2 100644 --- a/src/PhpPowerpoint/Shape/Chart/Type/Bar.php +++ b/src/PhpPowerpoint/Shape/Chart/Type/Bar.php @@ -28,6 +28,12 @@ class Bar extends AbstractType implements ComparableInterface const DIRECTION_VERTICAL = 'col'; const DIRECTION_HORIZONTAL = 'bar'; + /** Grouping of bars */ + const GROUPING_CLUSTERED = 'clustered'; //Chart series are drawn next to each other along the category axis. + const GROUPING_STACKED = 'stacked'; //Chart series are drawn next to each other on the value axis. + const GROUPING_PERCENTSTACKED = 'percentStacked'; //Chart series are drawn next to each other along the value axis and scaled to total 100% + + /** * Orientation of bars * @@ -35,6 +41,15 @@ class Bar extends AbstractType implements ComparableInterface */ protected $barDirection = self::DIRECTION_VERTICAL; + + /** + * Grouping of bars + * + * @var string + */ + protected $barGrouping = self::GROUPING_CLUSTERED; + + /** * Set bar orientation * @@ -56,6 +71,28 @@ public function getBarDirection() { return $this->barDirection; } + + /** + * Set bar grouping (stack or expanded style bar) + * + * @param string $value + * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar + */ + public function setBarGrouping($value = self::GROUPING_CLUSTERED) + { + $this->barGrouping = $value; + return $this; + } + + /** + * Get grouping (stack or expanded style bar) + * + * @return string + */ + public function getBarGrouping() + { + return $this->barGrouping; + } /** * Get hash code diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php b/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php index 004c4c80e..b34dc9bb2 100644 --- a/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php +++ b/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php @@ -28,6 +28,12 @@ class Bar3D extends AbstractType implements ComparableInterface const DIRECTION_VERTICAL = 'col'; const DIRECTION_HORIZONTAL = 'bar'; + /** Grouping of bars */ + const GROUPING_CLUSTERED = 'clustered'; //Chart series are drawn next to each other along the category axis. + const GROUPING_STACKED = 'stacked'; //Chart series are drawn next to each other on the value axis. + const GROUPING_PERCENTSTACKED = 'percentStacked'; //Chart series are drawn next to each other along the value axis and scaled to total 100% + + /** * Orientation of bars * @@ -35,6 +41,16 @@ class Bar3D extends AbstractType implements ComparableInterface */ protected $barDirection = self::DIRECTION_VERTICAL; + + /** + * Grouping of bars + * + * @var string + */ + protected $barGrouping = self::GROUPING_CLUSTERED; + + + /** * Set bar orientation * @@ -56,7 +72,27 @@ public function getBarDirection() { return $this->barDirection; } - + + /** + * Set bar grouping (stack or expanded style bar) + * + * @param string $value + * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar + */ + public function setBarGrouping($value = self::GROUPING_CLUSTERED) { + $this->barGrouping = $value; + return $this; + } + + /** + * Get grouping (stack or expanded style bar) + * + * @return string + */ + public function getBarGrouping() { + return $this->barGrouping; + } + /** * Get hash code * diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index f947285e5..b1b6434c1 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -495,6 +495,18 @@ private function writePlotAreaStyle(Chart $chart) } else { $this->xmlContent->writeAttribute('chart:vertical', 'false'); } + if ( $chartType->getBarGrouping() == Bar::GROUPING_CLUSTERED ) { + $this->xmlContent->writeAttribute( 'chart:stacked', 'false' ); + $this->xmlContent->writeAttribute( 'chart:overlap', '0' ); + } elseif ( $chartType->getBarGrouping() == Bar::GROUPING_STACKED ) { + $this->xmlContent->writeAttribute( 'chart:stacked', 'true' ); + $this->xmlContent->writeAttribute( 'chart:overlap', '100' ); + } elseif ( $chartType->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED ) { + $this->xmlContent->writeAttribute( 'chart:stacked', 'true' ); + $this->xmlContent->writeAttribute( 'chart:overlap', '100' ); + $this->xmlContent->writeAttribute( 'chart:percentage', 'true' ); + } + } $this->xmlContent->writeAttribute('chart:data-label-number', 'value'); // > style:text-properties diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index cdcd8f3b0..eeb3022d7 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -1103,7 +1103,7 @@ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, $includeShee // c:grouping $objWriter->startElement('c:grouping'); - $objWriter->writeAttribute('val', 'clustered'); + $objWriter->writeAttribute('val', $subject->getBarGrouping()); $objWriter->endElement(); // Write series @@ -1261,6 +1261,15 @@ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, $includeShee ++$seriesIndex; } + // c:overlap + $objWriter->startElement('c:overlap'); + if ( $subject->getBarGrouping() == Bar::GROUPING_CLUSTERED ) { + $objWriter->writeAttribute( 'val', '0' ); + } elseif ( $subject->getBarGrouping() == Bar::GROUPING_STACKED || $subject->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED ) { + $objWriter->writeAttribute( 'val', '100' ); + } + $objWriter->endElement(); + // c:gapWidth $objWriter->startElement('c:gapWidth'); $objWriter->writeAttribute('val', '75'); @@ -1309,7 +1318,7 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include // c:grouping $objWriter->startElement('c:grouping'); - $objWriter->writeAttribute('val', 'clustered'); + $objWriter->writeAttribute('val', $subject->getBarGrouping()); $objWriter->endElement(); // Write series diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php index 79dfbc12c..6b51f5f74 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/Bar3DTest.php @@ -63,6 +63,18 @@ public function testBarDirection() $this->assertEquals(Bar3D::DIRECTION_VERTICAL, $object->getBarDirection()); } + public function testBarGrouping() + { + $object = new Bar3D(); + $this->assertEquals(Bar3D::GROUPING_CLUSTERED, $object->getBarGrouping()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar3D', $object->setBarGrouping(Bar3D::GROUPING_CLUSTERED)); + $this->assertEquals(Bar3D::GROUPING_CLUSTERED, $object->getBarGrouping()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar3D', $object->setBarGrouping(Bar3D::GROUPING_STACKED)); + $this->assertEquals(Bar3D::GROUPING_STACKED, $object->getBarGrouping()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar3D', $object->setBarGrouping(Bar3D::GROUPING_PERCENTSTACKED)); + $this->assertEquals(Bar3D::GROUPING_PERCENTSTACKED, $object->getBarGrouping()); + } + public function testHashCode() { $oSeries = new Series(); diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php index 852dd2560..fdf3bbf2d 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php @@ -63,6 +63,17 @@ public function testBarDirection() $this->assertEquals(Bar::DIRECTION_VERTICAL, $object->getBarDirection()); } + public function testBarGrouping() { + $object = new Bar(); + $this->assertEquals( Bar::GROUPING_CLUSTERED, $object->getBarGrouping() ); + $this->assertInstanceOf( 'PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_CLUSTERED ) ); + $this->assertEquals( Bar::GROUPING_CLUSTERED, $object->getBarGrouping() ); + $this->assertInstanceOf( 'PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_STACKED ) ); + $this->assertEquals( Bar::GROUPING_STACKED, $object->getBarGrouping() ); + $this->assertInstanceOf( 'PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_PERCENTSTACKED ) ); + $this->assertEquals( Bar::GROUPING_PERCENTSTACKED, $object->getBarGrouping() ); + } + public function testHashCode() { $oSeries = new Series(); From af4535f95cfa40960aba47c346c206107d6ca4a9 Mon Sep 17 00:00:00 2001 From: jking Date: Tue, 23 Jun 2015 13:39:11 -0400 Subject: [PATCH 083/115] Add in Series Color for Charts Fix Code Style (Formatting Spacing) for TravisCL --- src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php | 6 ++- .../Writer/ODPresentation/ObjectsChart.php | 20 ++++---- .../Writer/PowerPoint2007/Chart.php | 48 ++++++++++--------- .../Tests/Shape/Chart/Type/BarTest.php | 17 +++---- 4 files changed, 49 insertions(+), 42 deletions(-) diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php b/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php index b34dc9bb2..6d7bae34b 100644 --- a/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php +++ b/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php @@ -79,7 +79,8 @@ public function getBarDirection() * @param string $value * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar */ - public function setBarGrouping($value = self::GROUPING_CLUSTERED) { + public function setBarGrouping($value = self::GROUPING_CLUSTERED) + { $this->barGrouping = $value; return $this; } @@ -89,7 +90,8 @@ public function setBarGrouping($value = self::GROUPING_CLUSTERED) { * * @return string */ - public function getBarGrouping() { + public function getBarGrouping() + { return $this->barGrouping; } diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index b1b6434c1..ef2012ad8 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -495,16 +495,16 @@ private function writePlotAreaStyle(Chart $chart) } else { $this->xmlContent->writeAttribute('chart:vertical', 'false'); } - if ( $chartType->getBarGrouping() == Bar::GROUPING_CLUSTERED ) { - $this->xmlContent->writeAttribute( 'chart:stacked', 'false' ); - $this->xmlContent->writeAttribute( 'chart:overlap', '0' ); - } elseif ( $chartType->getBarGrouping() == Bar::GROUPING_STACKED ) { - $this->xmlContent->writeAttribute( 'chart:stacked', 'true' ); - $this->xmlContent->writeAttribute( 'chart:overlap', '100' ); - } elseif ( $chartType->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED ) { - $this->xmlContent->writeAttribute( 'chart:stacked', 'true' ); - $this->xmlContent->writeAttribute( 'chart:overlap', '100' ); - $this->xmlContent->writeAttribute( 'chart:percentage', 'true' ); + if ($chartType->getBarGrouping() == Bar::GROUPING_CLUSTERED) { + $this->xmlContent->writeAttribute('chart:stacked', 'false'); + $this->xmlContent->writeAttribute('chart:overlap', '0'); + } elseif ($chartType->getBarGrouping() == Bar::GROUPING_STACKED) { + $this->xmlContent->writeAttribute('chart:stacked', 'true'); + $this->xmlContent->writeAttribute('chart:overlap', '100'); + } elseif ($chartType->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED) { + $this->xmlContent->writeAttribute('chart:stacked', 'true'); + $this->xmlContent->writeAttribute('chart:overlap', '100'); + $this->xmlContent->writeAttribute('chart:percentage', 'true'); } } diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index eeb3022d7..81072fb20 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -1231,13 +1231,15 @@ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, $includeShee $objWriter->endElement(); -// // c:spPr -// $objWriter->startElement('c:spPr'); - -// // Write fill -// $this->writeFill($objWriter, $series->getFill()); - -// $objWriter->endElement(); + // c:spPr + if ($series->getFill()->getFillType() != Fill::FILL_NONE) { + // c:spPr + $objWriter->startElement('c:spPr'); + // Write fill + $this->writeFill($objWriter, $series->getFill()); + // ## c:spPr + $objWriter->endElement(); + } // Write X axis data $axisXData = array_keys($series->getValues()); @@ -1263,10 +1265,10 @@ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, $includeShee // c:overlap $objWriter->startElement('c:overlap'); - if ( $subject->getBarGrouping() == Bar::GROUPING_CLUSTERED ) { - $objWriter->writeAttribute( 'val', '0' ); - } elseif ( $subject->getBarGrouping() == Bar::GROUPING_STACKED || $subject->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED ) { - $objWriter->writeAttribute( 'val', '100' ); + if ($subject->getBarGrouping() == Bar::GROUPING_CLUSTERED) { + $objWriter->writeAttribute('val', '0'); + } elseif ($subject->getBarGrouping() == Bar::GROUPING_STACKED || $subject->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED) { + $objWriter->writeAttribute('val', '100'); } $objWriter->endElement(); @@ -1446,13 +1448,15 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include $objWriter->endElement(); -// // c:spPr -// $objWriter->startElement('c:spPr'); - -// // Write fill -// $this->writeFill($objWriter, $series->getFill()); - -// $objWriter->endElement(); + // c:spPr + if ($series->getFill()->getFillType() != Fill::FILL_NONE) { + // c:spPr + $objWriter->startElement('c:spPr'); + // Write fill + $this->writeFill($objWriter, $series->getFill()); + // ## c:spPr + $objWriter->endElement(); + } // Write X axis data $axisXData = array_keys($series->getValues()); @@ -2161,14 +2165,14 @@ protected function writeTypeScatter(XMLWriter $objWriter, Scatter $subject, $inc $this->writeElementWithValAttribute($objWriter, 'c:showLeaderLines', $series->hasShowLeaderLines() ? '1' : '0'); $objWriter->endElement(); - + if ($series->getFill()->getFillType() != Fill::FILL_NONE) { // c:spPr - // $objWriter->startElement('c:spPr'); + $objWriter->startElement('c:spPr'); // Write fill - // $this->writeFill($objWriter, $series->getFill()); + $this->writeFill($objWriter, $series->getFill()); // ## c:spPr - // $objWriter->endElement(); + $objWriter->endElement(); } // Write X axis data diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php index fdf3bbf2d..5bd1d435d 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php @@ -63,15 +63,16 @@ public function testBarDirection() $this->assertEquals(Bar::DIRECTION_VERTICAL, $object->getBarDirection()); } - public function testBarGrouping() { + public function testBarGrouping() + { $object = new Bar(); - $this->assertEquals( Bar::GROUPING_CLUSTERED, $object->getBarGrouping() ); - $this->assertInstanceOf( 'PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_CLUSTERED ) ); - $this->assertEquals( Bar::GROUPING_CLUSTERED, $object->getBarGrouping() ); - $this->assertInstanceOf( 'PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_STACKED ) ); - $this->assertEquals( Bar::GROUPING_STACKED, $object->getBarGrouping() ); - $this->assertInstanceOf( 'PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_PERCENTSTACKED ) ); - $this->assertEquals( Bar::GROUPING_PERCENTSTACKED, $object->getBarGrouping() ); + $this->assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_CLUSTERED) ); + $this->assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping() ); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_STACKED) ); + $this->assertEquals(Bar::GROUPING_STACKED, $object->getBarGrouping() ); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_PERCENTSTACKED) ); + $this->assertEquals(Bar::GROUPING_PERCENTSTACKED, $object->getBarGrouping()); } public function testHashCode() From d878b832f8669e398b47b542ef9ff441e6e46dac Mon Sep 17 00:00:00 2001 From: jking Date: Tue, 23 Jun 2015 14:08:56 -0400 Subject: [PATCH 084/115] TravisCL Formatting Fixes --- src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php | 12 ++++++------ .../PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 81072fb20..7f53f9ecf 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -1450,12 +1450,12 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include // c:spPr if ($series->getFill()->getFillType() != Fill::FILL_NONE) { - // c:spPr - $objWriter->startElement('c:spPr'); - // Write fill - $this->writeFill($objWriter, $series->getFill()); - // ## c:spPr - $objWriter->endElement(); + // c:spPr + $objWriter->startElement('c:spPr'); + // Write fill + $this->writeFill($objWriter, $series->getFill()); + // ## c:spPr + $objWriter->endElement(); } // Write X axis data diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php index 5bd1d435d..5dc2f82fa 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php @@ -67,11 +67,11 @@ public function testBarGrouping() { $object = new Bar(); $this->assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_CLUSTERED) ); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_CLUSTERED)); $this->assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping() ); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_STACKED) ); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_STACKED)); $this->assertEquals(Bar::GROUPING_STACKED, $object->getBarGrouping() ); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_PERCENTSTACKED) ); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_PERCENTSTACKED)); $this->assertEquals(Bar::GROUPING_PERCENTSTACKED, $object->getBarGrouping()); } From 45ba901194154e664e2f8734de3f0cc1af7118ed Mon Sep 17 00:00:00 2001 From: jking Date: Tue, 23 Jun 2015 14:27:24 -0400 Subject: [PATCH 085/115] TravisCL Formatting Fixes --- tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php index 5dc2f82fa..6126942e1 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/Type/BarTest.php @@ -67,11 +67,11 @@ public function testBarGrouping() { $object = new Bar(); $this->assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_CLUSTERED)); - $this->assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping() ); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_STACKED)); - $this->assertEquals(Bar::GROUPING_STACKED, $object->getBarGrouping() ); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping( Bar::GROUPING_PERCENTSTACKED)); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping(Bar::GROUPING_CLUSTERED)); + $this->assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping(Bar::GROUPING_STACKED)); + $this->assertEquals(Bar::GROUPING_STACKED, $object->getBarGrouping()); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping(Bar::GROUPING_PERCENTSTACKED)); $this->assertEquals(Bar::GROUPING_PERCENTSTACKED, $object->getBarGrouping()); } From 11aa2253ebfdfce092484ca5723f2885b2ba9105 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 24 Jun 2015 14:24:28 +0200 Subject: [PATCH 086/115] Some parts of code shared between PHPOffice projects have been moved to PhpOffice/Common --- CHANGELOG.md | 1 + composer.json | 3 +- composer.lock | 135 +++++-- src/PhpPowerpoint/DocumentLayout.php | 2 +- src/PhpPowerpoint/Reader/PowerPoint97.php | 20 +- src/PhpPowerpoint/Reader/Serialized.php | 2 +- src/PhpPowerpoint/Shared/Drawing.php | 146 -------- src/PhpPowerpoint/Shared/File.php | 86 ----- src/PhpPowerpoint/Shared/Font.php | 57 --- src/PhpPowerpoint/Shared/OLERead.php | 332 ------------------ src/PhpPowerpoint/Shared/String.php | 78 ---- src/PhpPowerpoint/Shared/XMLWriter.php | 130 ------- .../Writer/ODPresentation/AbstractPart.php | 2 +- .../Writer/ODPresentation/Content.php | 92 ++--- .../Writer/ODPresentation/Manifest.php | 2 +- .../Writer/ODPresentation/ObjectsChart.php | 18 +- .../Writer/ODPresentation/Styles.php | 10 +- .../Writer/PowerPoint2007/AbstractPart.php | 2 +- .../Writer/PowerPoint2007/Chart.php | 48 +-- .../Writer/PowerPoint2007/ContentTypes.php | 8 +- .../Writer/PowerPoint2007/Presentation.php | 6 +- .../Writer/PowerPoint2007/Rels.php | 4 +- .../Writer/PowerPoint2007/Slide.php | 176 +++++----- src/PhpPowerpoint/Writer/Serialized.php | 2 +- .../Tests/Shared/DrawingTest.php | 86 ----- tests/PhpPowerpoint/Tests/Shared/FileTest.php | 51 --- tests/PhpPowerpoint/Tests/Shared/FontTest.php | 41 --- .../PhpPowerpoint/Tests/Shared/StringTest.php | 47 --- .../Tests/Shared/XMLWriterTest.php | 47 --- .../Writer/ODPresentation/ContentTest.php | 4 +- .../Tests/Writer/PowerPoint2007/SlideTest.php | 2 +- 31 files changed, 299 insertions(+), 1341 deletions(-) delete mode 100644 src/PhpPowerpoint/Shared/Drawing.php delete mode 100644 src/PhpPowerpoint/Shared/File.php delete mode 100644 src/PhpPowerpoint/Shared/Font.php delete mode 100644 src/PhpPowerpoint/Shared/OLERead.php delete mode 100644 src/PhpPowerpoint/Shared/String.php delete mode 100644 src/PhpPowerpoint/Shared/XMLWriter.php delete mode 100644 tests/PhpPowerpoint/Tests/Shared/DrawingTest.php delete mode 100644 tests/PhpPowerpoint/Tests/Shared/FileTest.php delete mode 100644 tests/PhpPowerpoint/Tests/Shared/FontTest.php delete mode 100644 tests/PhpPowerpoint/Tests/Shared/StringTest.php delete mode 100644 tests/PhpPowerpoint/Tests/Shared/XMLWriterTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index c5f42e7a4..683a99c88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ ### Miscellaneous - Improved the sample 04-Table for having a Text Run in a Cell - @Progi1984 GH-84 +- Some parts of code shared between PHPOffice projects have been moved to PhpOffice/Common - @Progi1984 ## 0.3.0 - 2014-09-22 diff --git a/composer.json b/composer.json index 3122f98eb..6e156c85a 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "require": { "php": ">=5.3.0", "ext-xml": "*", - "ext-zip": "*" + "ext-zip": "*", + "phpoffice/common": "0.1.*" }, "require-dev": { "phpunit/phpunit": "3.7.*", diff --git a/composer.lock b/composer.lock index b85d47334..77e3cd2d8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,63 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "666f88d20d2d8c86a544b50b8b598154", - "packages": [], + "hash": "3bb9c9869b762ac0d9614d7c3330f879", + "packages": [ + { + "name": "phpoffice/common", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/Common.git", + "reference": "43d19c83c1bb6381a04d9136ddfef73ce58e3bd5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/Common/zipball/43d19c83c1bb6381a04d9136ddfef73ce58e3bd5", + "reference": "43d19c83c1bb6381a04d9136ddfef73ce58e3bd5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "2.*", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "3.7.*", + "sebastian/phpcpd": "2.*", + "squizlabs/php_codesniffer": "2.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpOffice\\Common\\": "src/Common/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Mark Baker" + }, + { + "name": "Franck Lefevre", + "homepage": "http://rootslabs.net" + } + ], + "description": "PHPOffice Common", + "homepage": "http://phpoffice.github.io", + "keywords": [ + "common", + "component", + "office", + "php" + ], + "time": "2015-06-24 12:00:26" + } + ], "packages-dev": [ { "name": "cilex/cilex", @@ -586,9 +641,9 @@ ], "authors": [ { - "name": "Johannes Schmitt", + "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", + "homepage": "http://jmsyst.com", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -714,16 +769,16 @@ }, { "name": "monolog/monolog", - "version": "1.13.1", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac" + "reference": "b287fbbe1ca27847064beff2bad7fb6920bf08cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c31a2c4e8db5da8b46c74cf275d7f109c0f249ac", - "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/b287fbbe1ca27847064beff2bad7fb6920bf08cc", + "reference": "b287fbbe1ca27847064beff2bad7fb6920bf08cc", "shasum": "" }, "require": { @@ -734,12 +789,14 @@ "psr/log-implementation": "1.0.0" }, "require-dev": { - "aws/aws-sdk-php": "~2.4, >2.4.8", + "aws/aws-sdk-php": "^2.4.9", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", - "phpunit/phpunit": "~4.0", - "raven/raven": "~0.5", - "ruflin/elastica": "0.90.*", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "raven/raven": "~0.8", + "ruflin/elastica": ">=0.90 <3.0", "swiftmailer/swiftmailer": "~5.3", "videlalvaro/php-amqplib": "~2.4" }, @@ -749,6 +806,7 @@ "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-mongo": "Allow sending log messages to a MongoDB server", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "php-console/php-console": "Allow sending log messages to Google Chrome", "raven/raven": "Allow sending log messages to a Sentry server", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server", @@ -757,7 +815,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13.x-dev" + "dev-master": "1.14.x-dev" } }, "autoload": { @@ -783,7 +841,7 @@ "logging", "psr-3" ], - "time": "2015-03-09 09:58:04" + "time": "2015-06-19 13:29:54" }, { "name": "nikic/php-parser", @@ -937,9 +995,9 @@ ], "authors": [ { - "name": "Johannes Schmitt", + "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", + "homepage": "http://jmsyst.com", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -1379,9 +1437,9 @@ ], "authors": [ { - "name": "Johannes Schmitt", + "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", + "homepage": "http://jmsyst.com", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -1504,16 +1562,16 @@ }, { "name": "phpunit/php-text-template", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { @@ -1522,20 +1580,17 @@ "type": "library", "autoload": { "classmap": [ - "Text/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1544,7 +1599,7 @@ "keywords": [ "template" ], - "time": "2014-01-30 17:20:04" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", @@ -1794,7 +1849,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" } ], "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", @@ -1980,16 +2037,16 @@ }, { "name": "sebastian/version", - "version": "1.0.5", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4" + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", - "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "shasum": "" }, "type": "library", @@ -2011,7 +2068,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-02-24 06:35:25" + "time": "2015-06-21 13:59:46" }, { "name": "seld/jsonlint", @@ -2061,16 +2118,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.3.2", + "version": "2.3.3", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "e96d8579fbed0c95ecf2a0501ec4f307a4aa6404" + "reference": "c1a26c729508f73560c1a4f767f60b8ab6b4a666" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e96d8579fbed0c95ecf2a0501ec4f307a4aa6404", - "reference": "e96d8579fbed0c95ecf2a0501ec4f307a4aa6404", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/c1a26c729508f73560c1a4f767f60b8ab6b4a666", + "reference": "c1a26c729508f73560c1a4f767f60b8ab6b4a666", "shasum": "" }, "require": { @@ -2131,7 +2188,7 @@ "phpcs", "standards" ], - "time": "2015-04-28 23:28:20" + "time": "2015-06-24 03:16:23" }, { "name": "symfony/config", diff --git a/src/PhpPowerpoint/DocumentLayout.php b/src/PhpPowerpoint/DocumentLayout.php index a32771b42..836ef53c1 100644 --- a/src/PhpPowerpoint/DocumentLayout.php +++ b/src/PhpPowerpoint/DocumentLayout.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Shared\Drawing; +use PhpOffice\Common\Drawing; /** * \PhpOffice\PhpPowerpoint\DocumentLayout diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index 9ab626f44..fa35a21f8 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpPowerpoint\Reader; -use PhpOffice\PhpPowerpoint\Shared\OLERead; +use PhpOffice\Common\Microsoft\OLERead; use PhpOffice\PhpPowerpoint\Shape\Drawing; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing; @@ -901,22 +901,22 @@ private function readRTSlide($pos) case 0x0081: // Text : dxTextLeft //@link : http://msdn.microsoft.com/en-us/library/dd953234(v=office.12).aspx - $arrShpPrimaryOpt['insetLeft'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); + $arrShpPrimaryOpt['insetLeft'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); break; case 0x0082: // Text : dyTextTop //@link : http://msdn.microsoft.com/en-us/library/dd925068(v=office.12).aspx - $arrShpPrimaryOpt['insetTop'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); + $arrShpPrimaryOpt['insetTop'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); break; case 0x0083: // Text : dxTextRight //@link : http://msdn.microsoft.com/en-us/library/dd906782(v=office.12).aspx - $arrShpPrimaryOpt['insetRight'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); + $arrShpPrimaryOpt['insetRight'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); break; case 0x0084: // Text : dyTextBottom //@link : http://msdn.microsoft.com/en-us/library/dd772858(v=office.12).aspx - $arrShpPrimaryOpt['insetBottom'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); + $arrShpPrimaryOpt['insetBottom'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); break; case 0x0085: // Text : WrapText @@ -1044,12 +1044,12 @@ private function readRTSlide($pos) case 0x0193: // Fill : fillRectRight //@link : http://msdn.microsoft.com/en-us/library/dd951294(v=office.12).aspx - // echo 'fillRectRight : '.\PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']).EOL; + // echo 'fillRectRight : '.\PhpOffice\Common\Drawing::emuToPixels($opt['op']).EOL; break; case 0x0194: // Fill : fillRectBottom //@link : http://msdn.microsoft.com/en-us/library/dd910194(v=office.12).aspx - // echo 'fillRectBottom : '.\PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']).EOL; + // echo 'fillRectBottom : '.\PhpOffice\Common\Drawing::emuToPixels($opt['op']).EOL; break; case 0x01BF: // Fill : Fill Style Boolean Properties @@ -1080,7 +1080,7 @@ private function readRTSlide($pos) case 0x01CB: // Line Style : lineWidth //@link : http://msdn.microsoft.com/en-us/library/dd926964(v=office.12).aspx - $arrShpPrimaryOpt['lineWidth'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); + $arrShpPrimaryOpt['lineWidth'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); break; case 0x01D6: // Line Style : lineJoinStyle @@ -1105,12 +1105,12 @@ private function readRTSlide($pos) case 0x0205: // Shadow Style : shadowOffsetX //@link : http://msdn.microsoft.com/en-us/library/dd945280(v=office.12).aspx - $arrShpPrimaryOpt['shadowOffsetX'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); + $arrShpPrimaryOpt['shadowOffsetX'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); break; case 0x0206: // Shadow Style : shadowOffsetY //@link : http://msdn.microsoft.com/en-us/library/dd907855(v=office.12).aspx - $arrShpPrimaryOpt['shadowOffsetY'] = \PhpOffice\PhpPowerpoint\Shared\Drawing::emuToPixels($opt['op']); + $arrShpPrimaryOpt['shadowOffsetY'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); break; case 0x023F: // Shadow Style : Shadow Style Boolean Properties diff --git a/src/PhpPowerpoint/Reader/Serialized.php b/src/PhpPowerpoint/Reader/Serialized.php index ad65619fc..b8cac323d 100644 --- a/src/PhpPowerpoint/Reader/Serialized.php +++ b/src/PhpPowerpoint/Reader/Serialized.php @@ -18,7 +18,7 @@ namespace PhpOffice\PhpPowerpoint\Reader; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; -use PhpOffice\PhpPowerpoint\Shared\File; +use PhpOffice\Common\File; /** * Serialized format reader diff --git a/src/PhpPowerpoint/Shared/Drawing.php b/src/PhpPowerpoint/Shared/Drawing.php deleted file mode 100644 index 685b0d462..000000000 --- a/src/PhpPowerpoint/Shared/Drawing.php +++ /dev/null @@ -1,146 +0,0 @@ -open($zipFile) === true) { - $returnValue = ($zip->getFromName($archiveFile) !== false); - $zip->close(); - - return $returnValue; - } else { - return false; - } - } else { - // Regular file_exists - return file_exists($pFilename); - } - } - - /** - * Returns canonicalized absolute pathname, also for ZIP archives - * - * @param string $pFilename - * @return string - */ - public static function realpath($pFilename) - { - // Try using realpath() - $returnValue = realpath($pFilename); - - // Found something? - if ($returnValue == '' || is_null($returnValue)) { - $pathArray = explode('/', $pFilename); - while (in_array('..', $pathArray) && $pathArray[0] != '..') { - $numPathArray = count($pathArray); - for ($i = 0; $i < $numPathArray; ++$i) { - if ($pathArray[$i] == '..' && $i > 0) { - unset($pathArray[$i]); - unset($pathArray[$i - 1]); - break; - } - } - } - $returnValue = implode('/', $pathArray); - } - - // Return - return $returnValue; - } -} diff --git a/src/PhpPowerpoint/Shared/Font.php b/src/PhpPowerpoint/Shared/Font.php deleted file mode 100644 index dfcaa3077..000000000 --- a/src/PhpPowerpoint/Shared/Font.php +++ /dev/null @@ -1,57 +0,0 @@ -data = file_get_contents($sFileName, false, null, 0, 8); - - // Check OLE identifier - if ($this->data != self::IDENTIFIER_OLE) { - throw new \Exception('The filename ' . $sFileName . ' is not recognised as an OLE file'); - } - - // Get the file data - $this->data = file_get_contents($sFileName); - - // Total number of sectors used for the SAT - $numBigBlkDepotBlks = self::getInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); - - // SecID of the first sector of the directory stream - $rootStartBlock = self::getInt4d($this->data, self::ROOT_START_BLOCK_POS); - - // SecID of the first sector of the SSAT (or -2 if not extant) - $sbdStartBlock = self::getInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS); - - // SecID of the first sector of the MSAT (or -2 if no additional sectors are used) - $extensionBlock = self::getInt4d($this->data, self::EXTENSION_BLOCK_POS); - - // Total number of sectors used by MSAT - $numExtensionBlocks = self::getInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS); - - $bigBlockDepotBlocks = array(); - $pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS; - - $bbdBlocks = $numBigBlkDepotBlks; - - if ($numExtensionBlocks != 0) { - $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4; - } - - for ($i = 0; $i < $bbdBlocks; ++$i) { - $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); - $pos += 4; - } - - for ($j = 0; $j < $numExtensionBlocks; ++$j) { - $pos = ($extensionBlock + 1) * self::BIG_BLOCK_SIZE; - $blocksToRead = min($numBigBlkDepotBlks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1); - - for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) { - $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); - $pos += 4; - } - - $bbdBlocks += $blocksToRead; - if ($bbdBlocks < $numBigBlkDepotBlks) { - $extensionBlock = self::getInt4d($this->data, $pos); - } - } - - $this->bigBlockChain = ''; - $bbs = self::BIG_BLOCK_SIZE / 4; - for ($i = 0; $i < $numBigBlkDepotBlks; ++$i) { - $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE; - - $this->bigBlockChain .= substr($this->data, $pos, 4*$bbs); - $pos += 4*$bbs; - } - - $sbdBlock = $sbdStartBlock; - $this->smallBlockChain = ''; - while ($sbdBlock != -2) { - $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE; - - $this->smallBlockChain .= substr($this->data, $pos, 4*$bbs); - $pos += 4*$bbs; - - $sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock*4); - } - - // read the directory stream - $block = $rootStartBlock; - $this->entry = $this->readData($block); - - $this->readPropertySets(); - } - - /** - * Extract binary stream data - * - * @return string - */ - public function getStream($stream) - { - if ($stream === null) { - return null; - } - - $streamData = ''; - - if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) { - $rootdata = $this->readData($this->props[$this->rootEntry]['startBlock']); - - $block = $this->props[$stream]['startBlock']; - - while ($block != -2) { - $pos = $block * self::SMALL_BLOCK_SIZE; - $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE); - - $block = self::getInt4d($this->smallBlockChain, $block*4); - } - - return $streamData; - } else { - $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE; - if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) { - ++$numBlocks; - } - - if ($numBlocks == 0) { - return ''; - } - - $block = $this->props[$stream]['startBlock']; - - while ($block != -2) { - $pos = ($block + 1) * self::BIG_BLOCK_SIZE; - $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); - $block = self::getInt4d($this->bigBlockChain, $block*4); - } - - return $streamData; - } - } - - /** - * Read a standard stream (by joining sectors using information from SAT) - * - * @param int $blID Sector ID where the stream starts - * @return string Data for standard stream - */ - private function readData($blID) - { - $block = $blID; - $data = ''; - - while ($block != -2) { - $pos = ($block + 1) * self::BIG_BLOCK_SIZE; - $data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); - $block = self::getInt4d($this->bigBlockChain, $block*4); - } - return $data; - } - - /** - * Read entries in the directory stream. - */ - private function readPropertySets() - { - $offset = 0; - - // loop through entires, each entry is 128 bytes - $entryLen = strlen($this->entry); - while ($offset < $entryLen) { - // entry data (128 bytes) - $data = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE); - - // size in bytes of name - $nameSize = ord($data[self::SIZE_OF_NAME_POS]) | (ord($data[self::SIZE_OF_NAME_POS+1]) << 8); - - // type of entry - $type = ord($data[self::TYPE_POS]); - - // sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook) - // sectorID of first sector of the short-stream container stream, if this entry is root entry - $startBlock = self::getInt4d($data, self::START_BLOCK_POS); - - $size = self::getInt4d($data, self::SIZE_POS); - - $name = str_replace("\x00", "", substr($data, 0, $nameSize)); - if ($size > 0) { - $this->props[] = array ( - 'name' => $name, - 'type' => $type, - 'startBlock' => $startBlock, - 'size' => $size); - - // tmp helper to simplify checks - $upName = strtoupper($name); - - switch ($upName){ - case 'ROOT ENTRY': - case 'R': - $this->rootEntry = count($this->props) - 1; - break; - case chr(1).'COMPOBJ': - break; - case chr(1).'OLE': - break; - case chr(5).'SUMMARYINFORMATION': - $this->summaryInformation = count($this->props) - 1; - break; - case chr(5).'DOCUMENTSUMMARYINFORMATION': - $this->docSummaryInfos = count($this->props) - 1; - break; - case 'CURRENT USER': - $this->currentUser = count($this->props) - 1; - break; - case 'PICTURES': - $this->pictures = count($this->props) - 1; - break; - case 'POWERPOINT DOCUMENT': - $this->powerpointDocument = count($this->props) - 1; - break; - default: - throw new \Exception('OLE Block Not defined: $upName : '.$upName. ' - $name : "'.$name.'"'); - } - } - - $offset += self::PROPERTY_STORAGE_BLOCK_SIZE; - } - } - - /** - * Read 4 bytes of data at specified position - * - * @param string $data - * @param int $pos - * @return int - */ - private static function getInt4d($data, $pos) - { - // FIX: represent numbers correctly on 64-bit system - // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334 - // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems - $or24 = ord($data[$pos + 3]); - if ($or24 >= 128) { - // negative number - $ord24 = -abs((256 - $or24) << 24); - } else { - $ord24 = ($or24 & 127) << 24; - } - return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $ord24; - } -} diff --git a/src/PhpPowerpoint/Shared/String.php b/src/PhpPowerpoint/Shared/String.php deleted file mode 100644 index c51eb339f..000000000 --- a/src/PhpPowerpoint/Shared/String.php +++ /dev/null @@ -1,78 +0,0 @@ -) - * element or in the shared string element. - * - * @param string $value Value to escape - * @return string - */ - public static function controlCharacterPHP2OOXML($value = '') - { - if (empty(self::$controlCharacters)) { - self::buildControlCharacters(); - } - - return str_replace(array_values(self::$controlCharacters), array_keys(self::$controlCharacters), $value); - } - - /** - * Return a number formatted for being integrated in xml files - * @param float $number - * @param integer $decimals - */ - public static function numberFormat($number, $decimals) - { - return number_format($number, $decimals, '.', ''); - } -} diff --git a/src/PhpPowerpoint/Shared/XMLWriter.php b/src/PhpPowerpoint/Shared/XMLWriter.php deleted file mode 100644 index e63f7a4d9..000000000 --- a/src/PhpPowerpoint/Shared/XMLWriter.php +++ /dev/null @@ -1,130 +0,0 @@ -xmlWriter = new \XMLWriter(); - - // Open temporary storage - if ($pTemporaryStorage == self::STORAGE_MEMORY) { - $this->xmlWriter->openMemory(); - } else { - // Create temporary filename - $this->tempFileName = @tempnam($pTemporaryStorageDir, 'xml'); - - // Open storage - $this->xmlWriter->openUri($this->tempFileName); - } - - // Set default values - $this->xmlWriter->setIndent(true); - } - - /** - * Destructor - */ - public function __destruct() - { - // Desctruct XMLWriter - unset($this->xmlWriter); - - // Unlink temporary files - if ($this->tempFileName != '') { - if (@unlink($this->tempFileName) === false) { - throw new \Exception('The file '.$this->tempFileName.' could not be deleted.'); - } - } - } - - /** - * Catch function calls (and pass them to internal XMLWriter) - * - * @param mixed $function - * @param mixed $args - */ - public function __call($function, $args) - { - try { - if (@call_user_func_array(array($this->xmlWriter, $function), $args) === false) { - throw new \Exception('The method '.$function.' doesn\'t exist.'); - } - } catch (\Exception $ex) { - // Do nothing! - } - } - - /** - * Get written data - * - * @return string - */ - public function getData() - { - if ($this->tempFileName == '') { - return $this->xmlWriter->outputMemory(true); - } else { - $this->xmlWriter->flush(); - return file_get_contents($this->tempFileName); - } - } -} diff --git a/src/PhpPowerpoint/Writer/ODPresentation/AbstractPart.php b/src/PhpPowerpoint/Writer/ODPresentation/AbstractPart.php index eb35ebeac..9c8b94c0c 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/AbstractPart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/AbstractPart.php @@ -17,8 +17,8 @@ namespace PhpOffice\PhpPowerpoint\Writer\ODPresentation; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Writer\WriterInterface; use PhpOffice\PhpPowerpoint\Writer\ODPresentation; diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index 273b37af4..86668fa21 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -17,6 +17,9 @@ namespace PhpOffice\PhpPowerpoint\Writer\ODPresentation; +use PhpOffice\Common\Drawing as CommonDrawing; +use PhpOffice\Common\String; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\Slide; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; @@ -30,9 +33,6 @@ use PhpOffice\PhpPowerpoint\Shape\RichText\TextElement; use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\Shape\Table; -use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; -use PhpOffice\PhpPowerpoint\Shared\String; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Slide\Note; use PhpOffice\PhpPowerpoint\Slide\Transition; use PhpOffice\PhpPowerpoint\Style\Alignment; @@ -177,11 +177,11 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) // style:list-level-properties $objWriter->startElement('style:list-level-properties'); if ($oAlign->getIndent() < 0) { - $objWriter->writeAttribute('text:space-before', SharedDrawing::pixelsToCentimeters($oAlign->getMarginLeft() - (-1 * $oAlign->getIndent())) . 'cm'); - $objWriter->writeAttribute('text:min-label-width', SharedDrawing::pixelsToCentimeters(-1 * $oAlign->getIndent()) . 'cm'); + $objWriter->writeAttribute('text:space-before', CommonDrawing::pixelsToCentimeters($oAlign->getMarginLeft() - (-1 * $oAlign->getIndent())) . 'cm'); + $objWriter->writeAttribute('text:min-label-width', CommonDrawing::pixelsToCentimeters(-1 * $oAlign->getIndent()) . 'cm'); } else { - $objWriter->writeAttribute('text:space-before', (SharedDrawing::pixelsToCentimeters($oAlign->getMarginLeft() - $oAlign->getIndent())) . 'cm'); - $objWriter->writeAttribute('text:min-label-width', SharedDrawing::pixelsToCentimeters($oAlign->getIndent()) . 'cm'); + $objWriter->writeAttribute('text:space-before', (CommonDrawing::pixelsToCentimeters($oAlign->getMarginLeft() - $oAlign->getIndent())) . 'cm'); + $objWriter->writeAttribute('text:min-label-width', CommonDrawing::pixelsToCentimeters($oAlign->getIndent()) . 'cm'); } $objWriter->endElement(); @@ -310,7 +310,7 @@ public function writePart(PhpPowerpoint $pPHPPowerPoint) /** * Write picture * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter + * @param \PhpOffice\Common\XMLWriter $objWriter * @param \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing $shape */ public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape) @@ -318,10 +318,10 @@ public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape) // draw:frame $objWriter->startElement('draw:frame'); $objWriter->writeAttribute('draw:name', $shape->getName()); - $objWriter->writeAttribute('svg:width', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); - $objWriter->writeAttribute('svg:height', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); - $objWriter->writeAttribute('svg:x', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); - $objWriter->writeAttribute('svg:y', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); + $objWriter->writeAttribute('svg:width', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); + $objWriter->writeAttribute('svg:height', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); + $objWriter->writeAttribute('svg:x', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId); // draw:image $objWriter->startElement('draw:image'); @@ -359,7 +359,7 @@ public function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape) /** * Write text * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter + * @param \PhpOffice\Common\XMLWriter $objWriter * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape */ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape) @@ -367,10 +367,10 @@ public function writeShapeTxt(XMLWriter $objWriter, RichText $shape) // draw:frame $objWriter->startElement('draw:frame'); $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId); - $objWriter->writeAttribute('svg:width', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); - $objWriter->writeAttribute('svg:height', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); - $objWriter->writeAttribute('svg:x', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); - $objWriter->writeAttribute('svg:y', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); + $objWriter->writeAttribute('svg:width', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); + $objWriter->writeAttribute('svg:height', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); + $objWriter->writeAttribute('svg:x', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); // draw:text-box $objWriter->startElement('draw:text-box'); @@ -527,10 +527,10 @@ public function writeShapeLine(XMLWriter $objWriter, Line $shape) // draw:line $objWriter->startElement('draw:line'); $objWriter->writeAttribute('draw:style-name', 'gr' . $this->shapeId); - $objWriter->writeAttribute('svg:x1', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); - $objWriter->writeAttribute('svg:y1', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); - $objWriter->writeAttribute('svg:x2', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()+$shape->getWidth()), 3) . 'cm'); - $objWriter->writeAttribute('svg:y2', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetY()+$shape->getHeight()), 3) . 'cm'); + $objWriter->writeAttribute('svg:x1', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y1', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); + $objWriter->writeAttribute('svg:x2', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()+$shape->getWidth()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y2', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()+$shape->getHeight()), 3) . 'cm'); // text:p $objWriter->writeElement('text:p'); @@ -547,10 +547,10 @@ public function writeShapeTable(XMLWriter $objWriter, Table $shape) { // draw:frame $objWriter->startElement('draw:frame'); - $objWriter->writeAttribute('svg:x', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); - $objWriter->writeAttribute('svg:y', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); - $objWriter->writeAttribute('svg:height', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); - $objWriter->writeAttribute('svg:width', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); + $objWriter->writeAttribute('svg:x', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); + $objWriter->writeAttribute('svg:height', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); + $objWriter->writeAttribute('svg:width', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); // table:table $objWriter->startElement('table:table'); @@ -631,10 +631,10 @@ public function writeShapeChart(XMLWriter $objWriter, Chart $shape) // draw:frame $objWriter->startElement('draw:frame'); $objWriter->writeAttribute('draw:name', $shape->getTitle()->getText()); - $objWriter->writeAttribute('svg:x', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); - $objWriter->writeAttribute('svg:y', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); - $objWriter->writeAttribute('svg:height', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); - $objWriter->writeAttribute('svg:width', String::numberFormat(SharedDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); + $objWriter->writeAttribute('svg:x', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetX()), 3) . 'cm'); + $objWriter->writeAttribute('svg:y', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getOffsetY()), 3) . 'cm'); + $objWriter->writeAttribute('svg:height', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getHeight()), 3) . 'cm'); + $objWriter->writeAttribute('svg:width', String::numberFormat(CommonDrawing::pixelsToCentimeters($shape->getWidth()), 3) . 'cm'); // draw:object $objWriter->startElement('draw:object'); @@ -718,7 +718,7 @@ public function writeGroupStyle(XMLWriter $objWriter, Group $group) /** * Write the default style information for a RichText shape * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter + * @param \PhpOffice\Common\XMLWriter $objWriter * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape */ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) @@ -761,7 +761,7 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) $objWriter->writeAttribute('draw:stroke', 'none'); } else { $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); - $objWriter->writeAttribute('svg:stroke-width', number_format(SharedDrawing::pointsToCentimeters($shape->getBorder()->getLineWidth()), 3, '.', '').'cm'); + $objWriter->writeAttribute('svg:stroke-width', number_format(CommonDrawing::pointsToCentimeters($shape->getBorder()->getLineWidth()), 3, '.', '').'cm'); switch ($shape->getBorder()->getDashStyle()){ case Border::DASH_SOLID: $objWriter->writeAttribute('draw:stroke', 'solid'); @@ -829,7 +829,7 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) /** * Write the default style information for an AbstractDrawing * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter + * @param \PhpOffice\Common\XMLWriter $objWriter * @param \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing $shape */ public function writeDrawingStyle(XMLWriter $objWriter, AbstractDrawing $shape) @@ -881,7 +881,7 @@ public function writeLineStyle(XMLWriter $objWriter, Line $shape) break; } $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); - $objWriter->writeAttribute('svg:stroke-width', String::numberFormat(SharedDrawing::pixelsToCentimeters((SharedDrawing::pointsToPixels($shape->getBorder()->getLineWidth()))), 3).'cm'); + $objWriter->writeAttribute('svg:stroke-width', String::numberFormat(CommonDrawing::pixelsToCentimeters((CommonDrawing::pointsToPixels($shape->getBorder()->getLineWidth()))), 3).'cm'); $objWriter->endElement(); $objWriter->endElement(); @@ -903,7 +903,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) // style:table-row-properties $objWriter->startElement('style:table-row-properties'); - $objWriter->writeAttribute('style:row-height', String::numberFormat(SharedDrawing::pixelsToCentimeters(SharedDrawing::pointsToPixels($shapeRow->getHeight())), 3).'cm'); + $objWriter->writeAttribute('style:row-height', String::numberFormat(CommonDrawing::pixelsToCentimeters(CommonDrawing::pointsToPixels($shapeRow->getHeight())), 3).'cm'); $objWriter->endElement(); $objWriter->endElement(); @@ -1213,29 +1213,29 @@ protected function writeStylePartShadow(XMLWriter $objWriter, Shadow $oShadow) $objWriter->writeAttribute('draw:shadow', 'visible'); $objWriter->writeAttribute('draw:shadow-color', '#' . $oShadow->getColor()->getRGB()); if ($oShadow->getDirection() == 0 || $oShadow->getDirection() == 360) { - $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-x', CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); $objWriter->writeAttribute('draw:shadow-offset-y', '0cm'); } elseif ($oShadow->getDirection() == 45) { - $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-x', CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); } elseif ($oShadow->getDirection() == 90) { $objWriter->writeAttribute('draw:shadow-offset-x', '0cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); } elseif ($oShadow->getDirection() == 135) { - $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-x', '-' . CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); } elseif ($oShadow->getDirection() == 180) { - $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-x', '-' . CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); $objWriter->writeAttribute('draw:shadow-offset-y', '0cm'); } elseif ($oShadow->getDirection() == 225) { - $objWriter->writeAttribute('draw:shadow-offset-x', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-x', '-' . CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '-' . CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); } elseif ($oShadow->getDirection() == 270) { $objWriter->writeAttribute('draw:shadow-offset-x', '0cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '-' . CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); } elseif ($oShadow->getDirection() == 315) { - $objWriter->writeAttribute('draw:shadow-offset-x', SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); - $objWriter->writeAttribute('draw:shadow-offset-y', '-' . SharedDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-x', CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); + $objWriter->writeAttribute('draw:shadow-offset-y', '-' . CommonDrawing::pixelsToCentimeters($oShadow->getDistance()) . 'cm'); } $objWriter->writeAttribute('draw:shadow-opacity', (100 - $oShadow->getAlpha()) . '%'); $objWriter->writeAttribute('style:mirror', 'none'); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Manifest.php b/src/PhpPowerpoint/Writer/ODPresentation/Manifest.php index 7f482c051..64c65fda3 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Manifest.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Manifest.php @@ -17,10 +17,10 @@ namespace PhpOffice\PhpPowerpoint\Writer\ODPresentation; +use PhpOffice\Common\File; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\Drawing as ShapeDrawing; use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing; -use PhpOffice\PhpPowerpoint\Shared\File; use PhpOffice\PhpPowerpoint\Writer\ODPresentation; /** diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index aefc6fbdc..4054c75a0 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -17,6 +17,9 @@ namespace PhpOffice\PhpPowerpoint\Writer\ODPresentation; +use PhpOffice\Common\Drawing as CommonDrawing; +use PhpOffice\Common\String; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\Chart; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area; @@ -25,9 +28,6 @@ use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter; -use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; -use PhpOffice\PhpPowerpoint\Shared\String; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Style\Fill; /** @@ -195,8 +195,8 @@ private function writeContentPart(Chart $chart) $this->xmlContent->startElement('office:chart'); // office:chart $this->xmlContent->startElement('chart:chart'); - $this->xmlContent->writeAttribute('svg:width', String::numberFormat(SharedDrawing::pixelsToCentimeters($chart->getWidth()), 3) . 'cm'); - $this->xmlContent->writeAttribute('svg:height', String::numberFormat(SharedDrawing::pixelsToCentimeters($chart->getHeight()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:width', String::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getWidth()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:height', String::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getHeight()), 3) . 'cm'); $this->xmlContent->writeAttribute('xlink:href', '.'); $this->xmlContent->writeAttribute('xlink:type', 'simple'); $this->xmlContent->writeAttribute('chart:style-name', 'styleChart'); @@ -383,8 +383,8 @@ private function writeLegend(Chart $chart) // chart:legend $this->xmlContent->startElement('chart:legend'); $this->xmlContent->writeAttribute('chart:legend-position', 'end'); - $this->xmlContent->writeAttribute('svg:x', String::numberFormat(SharedDrawing::pixelsToCentimeters($chart->getLegend()->getOffsetX()), 3) . 'cm'); - $this->xmlContent->writeAttribute('svg:y', String::numberFormat(SharedDrawing::pixelsToCentimeters($chart->getLegend()->getOffsetY()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:x', String::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getLegend()->getOffsetX()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:y', String::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getLegend()->getOffsetY()), 3) . 'cm'); $this->xmlContent->writeAttribute('style:legend-expansion', 'high'); $this->xmlContent->writeAttribute('chart:style-name', 'styleLegend'); // > chart:legend @@ -741,8 +741,8 @@ private function writeTitle(Chart $chart) { // chart:title $this->xmlContent->startElement('chart:title'); - $this->xmlContent->writeAttribute('svg:x', String::numberFormat(SharedDrawing::pixelsToCentimeters($chart->getTitle()->getOffsetX()), 3) . 'cm'); - $this->xmlContent->writeAttribute('svg:y', String::numberFormat(SharedDrawing::pixelsToCentimeters($chart->getTitle()->getOffsetY()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:x', String::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getTitle()->getOffsetX()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:y', String::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getTitle()->getOffsetY()), 3) . 'cm'); $this->xmlContent->writeAttribute('chart:style-name', 'styleTitle'); // > text:p $this->xmlContent->startElement('text:p'); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php b/src/PhpPowerpoint/Writer/ODPresentation/Styles.php index ed4cd5595..f5d43221c 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Styles.php @@ -17,12 +17,12 @@ namespace PhpOffice\PhpPowerpoint\Writer\ODPresentation; +use PhpOffice\Common\Drawing as CommonDrawing; +use PhpOffice\Common\String; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\Group; use PhpOffice\PhpPowerpoint\Shape\Table; -use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; -use PhpOffice\PhpPowerpoint\Shared\String; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Style\Fill; use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\Style\Border; @@ -142,8 +142,8 @@ public function writePart(PHPPowerPoint $pPHPPowerPoint) $objWriter->writeAttribute('fo:margin-bottom', '0cm'); $objWriter->writeAttribute('fo:margin-left', '0cm'); $objWriter->writeAttribute('fo:margin-right', '0cm'); - $objWriter->writeAttribute('fo:page-width', String::numberFormat(SharedDrawing::pixelsToCentimeters(SharedDrawing::emuToPixels($pPHPPowerPoint->getLayout()->getCX())), 1) . 'cm'); - $objWriter->writeAttribute('fo:page-height', String::numberFormat(SharedDrawing::pixelsToCentimeters(SharedDrawing::emuToPixels($pPHPPowerPoint->getLayout()->getCY())), 1) . 'cm'); + $objWriter->writeAttribute('fo:page-width', String::numberFormat(CommonDrawing::pixelsToCentimeters(CommonDrawing::emuToPixels($pPHPPowerPoint->getLayout()->getCX())), 1) . 'cm'); + $objWriter->writeAttribute('fo:page-height', String::numberFormat(CommonDrawing::pixelsToCentimeters(CommonDrawing::emuToPixels($pPHPPowerPoint->getLayout()->getCY())), 1) . 'cm'); if ($pPHPPowerPoint->getLayout()->getCX() > $pPHPPowerPoint->getLayout()->getCY()) { $objWriter->writeAttribute('style:print-orientation', 'landscape'); } else { diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/AbstractPart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/AbstractPart.php index 0114aba29..fe60b7657 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/AbstractPart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/AbstractPart.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\Writer\WriterInterface; use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 2955fa05e..dad53b7c2 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -28,8 +28,8 @@ use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter; use PhpOffice\PhpPowerpoint\Shape\Chart as ShapeChart; -use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; +use PhpOffice\Common\Drawing as CommonDrawing; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\Style\Border; use PhpOffice\PhpPowerpoint\Style\Fill; @@ -157,9 +157,9 @@ public function writeChart(ShapeChart $chart = null) // a:outerShdw $objWriter->startElement('a:outerShdw'); - $objWriter->writeAttribute('blurRad', SharedDrawing::pixelsToEmu($chart->getShadow()->getBlurRadius())); - $objWriter->writeAttribute('dist', SharedDrawing::pixelsToEmu($chart->getShadow()->getDistance())); - $objWriter->writeAttribute('dir', SharedDrawing::degreesToAngle($chart->getShadow()->getDirection())); + $objWriter->writeAttribute('blurRad', CommonDrawing::pixelsToEmu($chart->getShadow()->getBlurRadius())); + $objWriter->writeAttribute('dist', CommonDrawing::pixelsToEmu($chart->getShadow()->getDistance())); + $objWriter->writeAttribute('dir', CommonDrawing::degreesToAngle($chart->getShadow()->getDirection())); $objWriter->writeAttribute('algn', $chart->getShadow()->getAlignment()); $objWriter->writeAttribute('rotWithShape', '0'); @@ -275,7 +275,7 @@ public function writeSpreadsheet(PHPPowerPoint $presentation, $chart, $tempName) /** * Write element with value attribute * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param string $elementName * @param string $value */ @@ -289,7 +289,7 @@ protected function writeElementWithValAttribute($objWriter, $elementName, $value /** * Write single value or reference * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param boolean $isReference * @param mixed $value * @param string $reference @@ -320,7 +320,7 @@ protected function writeSingleValueOrReference($objWriter, $isReference, $value, /** * Write series value or reference * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param boolean $isReference * @param mixed $values * @param string $reference @@ -382,7 +382,7 @@ protected function writeMultipleValuesOrReference($objWriter, $isReference, $val /** * Write Title * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Title $subject * @throws \Exception */ @@ -410,9 +410,9 @@ protected function writeTitle(XMLWriter $objWriter, Title $subject) $objWriter->startElement('a:pPr'); $objWriter->writeAttribute('algn', $subject->getAlignment()->getHorizontal()); $objWriter->writeAttribute('fontAlgn', $subject->getAlignment()->getVertical()); - $objWriter->writeAttribute('marL', SharedDrawing::pixelsToEmu($subject->getAlignment()->getMarginLeft())); - $objWriter->writeAttribute('marR', SharedDrawing::pixelsToEmu($subject->getAlignment()->getMarginRight())); - $objWriter->writeAttribute('indent', SharedDrawing::pixelsToEmu($subject->getAlignment()->getIndent())); + $objWriter->writeAttribute('marL', CommonDrawing::pixelsToEmu($subject->getAlignment()->getMarginLeft())); + $objWriter->writeAttribute('marR', CommonDrawing::pixelsToEmu($subject->getAlignment()->getMarginRight())); + $objWriter->writeAttribute('indent', CommonDrawing::pixelsToEmu($subject->getAlignment()->getIndent())); $objWriter->writeAttribute('lvl', $subject->getAlignment()->getLevel()); // a:defRPr @@ -490,7 +490,7 @@ protected function writeTitle(XMLWriter $objWriter, Title $subject) /** * Write Plot Area * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Chart\PlotArea $subject * @param \PhpOffice\PhpPowerpoint\Shape\Chart $chart * @throws \Exception @@ -743,7 +743,7 @@ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, ShapeC /** * Write Legend * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Legend $subject * @throws \Exception */ @@ -794,9 +794,9 @@ protected function writeLegend(XMLWriter $objWriter, Legend $subject) $objWriter->startElement('a:pPr'); $objWriter->writeAttribute('algn', $subject->getAlignment()->getHorizontal()); $objWriter->writeAttribute('fontAlgn', $subject->getAlignment()->getVertical()); - $objWriter->writeAttribute('marL', SharedDrawing::pixelsToEmu($subject->getAlignment()->getMarginLeft())); - $objWriter->writeAttribute('marR', SharedDrawing::pixelsToEmu($subject->getAlignment()->getMarginRight())); - $objWriter->writeAttribute('indent', SharedDrawing::pixelsToEmu($subject->getAlignment()->getIndent())); + $objWriter->writeAttribute('marL', CommonDrawing::pixelsToEmu($subject->getAlignment()->getMarginLeft())); + $objWriter->writeAttribute('marR', CommonDrawing::pixelsToEmu($subject->getAlignment()->getMarginRight())); + $objWriter->writeAttribute('indent', CommonDrawing::pixelsToEmu($subject->getAlignment()->getIndent())); $objWriter->writeAttribute('lvl', $subject->getAlignment()->getLevel()); // a:defRPr @@ -851,7 +851,7 @@ protected function writeLegend(XMLWriter $objWriter, Legend $subject) /** * Write Layout * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param mixed $subject * @throws \Exception */ @@ -907,7 +907,7 @@ protected function writeLayout(XMLWriter $objWriter, $subject) /** * Write Type Line * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area $subject * @param boolean $includeSheet * @throws \Exception @@ -1083,7 +1083,7 @@ protected function writeTypeArea(XMLWriter $objWriter, Area $subject, $includeSh /** * Write Type Bar3D * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar $subject * @param boolean $includeSheet * @throws \Exception @@ -1289,7 +1289,7 @@ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, $includeShee /** * Write Type Bar3D * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D $subject * @param boolean $includeSheet * @throws \Exception @@ -1495,7 +1495,7 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, $include /** * Write Type Pie3D * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D $subject * @param boolean $includeSheet * @throws \Exception @@ -1669,7 +1669,7 @@ protected function writeTypePie3D(XMLWriter $objWriter, Pie3D $subject, $include /** * Write Type Line * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line $subject * @param boolean $includeSheet * @throws \Exception @@ -1844,7 +1844,7 @@ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, $includeSh /** * Write Type Scatter * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter $subject * @param boolean $includeSheet * @throws \Exception diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php b/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php index b7848239d..69f179681 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/ContentTypes.php @@ -21,8 +21,8 @@ use PhpOffice\PhpPowerpoint\Shape\Chart as ShapeChart; use PhpOffice\PhpPowerpoint\Shape\Drawing as ShapeDrawing; use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing; -use PhpOffice\PhpPowerpoint\Shared\File; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; +use PhpOffice\Common\File; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; /** @@ -200,7 +200,7 @@ private function getImageMimeType($pFile = '') /** * Write Default content type * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type * @throws \Exception @@ -221,7 +221,7 @@ private function writeDefaultContentType(XMLWriter $objWriter, $pPartname = '', /** * Write Override content type * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type * @throws \Exception diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php index b9ab90edb..746139ee8 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Presentation.php @@ -17,9 +17,9 @@ namespace PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\DocumentLayout; use PhpOffice\PhpPowerpoint\PhpPowerpoint; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; /** @@ -104,7 +104,7 @@ public function writePresentation(PhpPowerpoint $pPHPPowerPoint) /** * Write slides * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param PhpPowerpoint $pPHPPowerPoint * @param int $startRelationId * @throws \Exception @@ -122,7 +122,7 @@ private function writeSlides(XMLWriter $objWriter, PhpPowerpoint $pPHPPowerPoint /** * Write slide * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param int $pSlideId Slide id * @param int $pRelId Relationship ID * @throws \Exception diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php index b078bdd20..2452dee6d 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Rels.php @@ -17,6 +17,7 @@ namespace PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\Chart as ShapeChart; use PhpOffice\PhpPowerpoint\Shape\Drawing as ShapeDrawing; @@ -26,7 +27,6 @@ use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\Shape\RichText\TextElement; use PhpOffice\PhpPowerpoint\Shape\Table as ShapeTable; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Slide as SlideElement; use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; @@ -540,7 +540,7 @@ public function writeChartRelationships(ShapeChart $pChart) /** * Write relationship * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param int $pId Relationship ID. rId will be prepended! * @param string $pType Relationship type * @param string $pTarget Relationship target diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index 8c3911544..bd16fae9a 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -17,6 +17,9 @@ namespace PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; +use PhpOffice\Common\Drawing as CommonDrawing; +use PhpOffice\Common\String; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; use PhpOffice\PhpPowerpoint\Shape\Chart as ShapeChart; use PhpOffice\PhpPowerpoint\Shape\Group; @@ -26,9 +29,6 @@ use PhpOffice\PhpPowerpoint\Shape\RichText\Run; use PhpOffice\PhpPowerpoint\Shape\RichText\TextElement; use PhpOffice\PhpPowerpoint\Shape\Table; -use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; -use PhpOffice\PhpPowerpoint\Shared\String; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; use PhpOffice\PhpPowerpoint\Slide as SlideElement; use PhpOffice\PhpPowerpoint\Slide\Note; use PhpOffice\PhpPowerpoint\Slide\Transition; @@ -100,26 +100,26 @@ public function writeSlide(SlideElement $pSlide = null) // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($pSlide->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($pSlide->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($pSlide->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($pSlide->getOffsetY())); $objWriter->endElement(); // a:off // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($pSlide->getExtentX())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($pSlide->getExtentY())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($pSlide->getExtentX())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($pSlide->getExtentY())); $objWriter->endElement(); // a:ext // a:chOff $objWriter->startElement('a:chOff'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($pSlide->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($pSlide->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($pSlide->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($pSlide->getOffsetY())); $objWriter->endElement(); // a:chOff // a:chExt $objWriter->startElement('a:chExt'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($pSlide->getExtentX())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($pSlide->getExtentY())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($pSlide->getExtentX())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($pSlide->getExtentY())); $objWriter->endElement(); // a:chExt $objWriter->endElement(); @@ -175,7 +175,7 @@ public function writeSlide(SlideElement $pSlide = null) /** * Write group * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Group $group * @param int $shapeId */ @@ -210,26 +210,26 @@ private function writeShapeGroup(XMLWriter $objWriter, Group $group, &$shapeId) // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($group->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($group->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($group->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($group->getOffsetY())); $objWriter->endElement(); // a:off // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($group->getExtentX())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($group->getExtentY())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($group->getExtentX())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($group->getExtentY())); $objWriter->endElement(); // a:ext // a:chOff $objWriter->startElement('a:chOff'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($group->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($group->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($group->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($group->getOffsetY())); $objWriter->endElement(); // a:chOff // a:chExt $objWriter->startElement('a:chExt'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($group->getExtentX())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($group->getExtentY())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($group->getExtentX())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($group->getExtentY())); $objWriter->endElement(); // a:chExt $objWriter->endElement(); // a:xfrm @@ -263,7 +263,7 @@ private function writeShapeGroup(XMLWriter $objWriter, Group $group, &$shapeId) /** * Write chart * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Chart $shape * @param int $shapeId */ @@ -292,18 +292,18 @@ private function writeShapeChart(XMLWriter $objWriter, ShapeChart $shape, $shape // p:xfrm $objWriter->startElement('p:xfrm'); - $objWriter->writeAttribute('rot', SharedDrawing::degreesToAngle($shape->getRotation())); + $objWriter->writeAttribute('rot', CommonDrawing::degreesToAngle($shape->getRotation())); // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($shape->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($shape->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($shape->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($shape->getOffsetY())); $objWriter->endElement(); // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($shape->getWidth())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($shape->getHeight())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($shape->getWidth())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($shape->getHeight())); $objWriter->endElement(); $objWriter->endElement(); @@ -332,7 +332,7 @@ private function writeShapeChart(XMLWriter $objWriter, ShapeChart $shape, $shape /** * Write pic * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\AbstractDrawing $shape * @param int $shapeId * @throws \Exception @@ -392,18 +392,18 @@ private function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape, $sh // a:xfrm $objWriter->startElement('a:xfrm'); - $objWriter->writeAttribute('rot', SharedDrawing::degreesToAngle($shape->getRotation())); + $objWriter->writeAttribute('rot', CommonDrawing::degreesToAngle($shape->getRotation())); // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($shape->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($shape->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($shape->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($shape->getOffsetY())); $objWriter->endElement(); // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($shape->getWidth())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($shape->getHeight())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($shape->getWidth())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($shape->getHeight())); $objWriter->endElement(); $objWriter->endElement(); @@ -433,7 +433,7 @@ private function writeShapePic(XMLWriter $objWriter, AbstractDrawing $shape, $sh /** * Write txt * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\RichText $shape * @param int $shapeId * @throws \Exception @@ -472,18 +472,18 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) // p:sp\p:spPr\a:xfrm $objWriter->startElement('a:xfrm'); - $objWriter->writeAttribute('rot', SharedDrawing::degreesToAngle($shape->getRotation())); + $objWriter->writeAttribute('rot', CommonDrawing::degreesToAngle($shape->getRotation())); // p:sp\p:spPr\a:xfrm\a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($shape->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($shape->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($shape->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($shape->getOffsetY())); $objWriter->endElement(); // p:sp\p:spPr\a:xfrm\a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($shape->getWidth())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($shape->getHeight())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($shape->getWidth())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($shape->getHeight())); $objWriter->endElement(); // > p:sp\p:spPr\a:xfrm @@ -535,10 +535,10 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) $objWriter->writeAttribute('vert', 'vert'); } - $objWriter->writeAttribute('bIns', SharedDrawing::pixelsToEmu($shape->getInsetBottom())); - $objWriter->writeAttribute('lIns', SharedDrawing::pixelsToEmu($shape->getInsetLeft())); - $objWriter->writeAttribute('rIns', SharedDrawing::pixelsToEmu($shape->getInsetRight())); - $objWriter->writeAttribute('tIns', SharedDrawing::pixelsToEmu($shape->getInsetTop())); + $objWriter->writeAttribute('bIns', CommonDrawing::pixelsToEmu($shape->getInsetBottom())); + $objWriter->writeAttribute('lIns', CommonDrawing::pixelsToEmu($shape->getInsetLeft())); + $objWriter->writeAttribute('rIns', CommonDrawing::pixelsToEmu($shape->getInsetRight())); + $objWriter->writeAttribute('tIns', CommonDrawing::pixelsToEmu($shape->getInsetTop())); if ($shape->getColumns() <> 1) { $objWriter->writeAttribute('numCol', $shape->getColumns()); @@ -573,7 +573,7 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) /** * Write table * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Table $shape * @param int $shapeId * @throws \Exception @@ -614,14 +614,14 @@ private function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($shape->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($shape->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($shape->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($shape->getOffsetY())); $objWriter->endElement(); // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($shape->getWidth())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($shape->getHeight())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($shape->getWidth())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($shape->getHeight())); $objWriter->endElement(); $objWriter->endElement(); @@ -660,7 +660,7 @@ private function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) $width = $totalWidth / $colCount; } - $objWriter->writeAttribute('w', SharedDrawing::pixelsToEmu($width)); + $objWriter->writeAttribute('w', CommonDrawing::pixelsToEmu($width)); $objWriter->endElement(); } @@ -678,7 +678,7 @@ private function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) for ($row = 0; $row < $countRows; $row++) { // a:tr $objWriter->startElement('a:tr'); - $objWriter->writeAttribute('h', SharedDrawing::pixelsToEmu($shape->getRow($row)->getHeight())); + $objWriter->writeAttribute('h', CommonDrawing::pixelsToEmu($shape->getRow($row)->getHeight())); // Write cells $countCells = count($shape->getRow($row)->getCells()); @@ -793,7 +793,7 @@ private function writeShapeTable(XMLWriter $objWriter, Table $shape, $shapeId) /** * Write paragraphs * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph[] $paragraphs * @throws \Exception */ @@ -808,9 +808,9 @@ private function writeParagraphs(XMLWriter $objWriter, $paragraphs) $objWriter->startElement('a:pPr'); $objWriter->writeAttribute('algn', $paragraph->getAlignment()->getHorizontal()); $objWriter->writeAttribute('fontAlgn', $paragraph->getAlignment()->getVertical()); - $objWriter->writeAttribute('marL', SharedDrawing::pixelsToEmu($paragraph->getAlignment()->getMarginLeft())); - $objWriter->writeAttribute('marR', SharedDrawing::pixelsToEmu($paragraph->getAlignment()->getMarginRight())); - $objWriter->writeAttribute('indent', SharedDrawing::pixelsToEmu($paragraph->getAlignment()->getIndent())); + $objWriter->writeAttribute('marL', CommonDrawing::pixelsToEmu($paragraph->getAlignment()->getMarginLeft())); + $objWriter->writeAttribute('marR', CommonDrawing::pixelsToEmu($paragraph->getAlignment()->getMarginRight())); + $objWriter->writeAttribute('indent', CommonDrawing::pixelsToEmu($paragraph->getAlignment()->getIndent())); $objWriter->writeAttribute('lvl', $paragraph->getAlignment()->getLevel()); // Bullet type specified? @@ -916,7 +916,7 @@ private function writeParagraphs(XMLWriter $objWriter, $paragraphs) /** * Write Line Shape * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Shape\Line $shape * @param int $shapeId */ @@ -952,54 +952,54 @@ private function writeShapeLine(XMLWriter $objWriter, Line $shape, $shapeId) if ($shape->getWidth() >= 0 && $shape->getHeight() >= 0) { // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($shape->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($shape->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($shape->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($shape->getOffsetY())); $objWriter->endElement(); // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($shape->getWidth())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($shape->getHeight())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($shape->getWidth())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($shape->getHeight())); $objWriter->endElement(); } elseif ($shape->getWidth() < 0 && $shape->getHeight() < 0) { // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($shape->getOffsetX() + $shape->getWidth())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($shape->getOffsetY() + $shape->getHeight())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($shape->getOffsetX() + $shape->getWidth())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($shape->getOffsetY() + $shape->getHeight())); $objWriter->endElement(); // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu(-$shape->getWidth())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu(-$shape->getHeight())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu(-$shape->getWidth())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu(-$shape->getHeight())); $objWriter->endElement(); } elseif ($shape->getHeight() < 0) { $objWriter->writeAttribute('flipV', 1); // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($shape->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($shape->getOffsetY() + $shape->getHeight())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($shape->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($shape->getOffsetY() + $shape->getHeight())); $objWriter->endElement(); // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($shape->getWidth())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu(-$shape->getHeight())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($shape->getWidth())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu(-$shape->getHeight())); $objWriter->endElement(); } elseif ($shape->getWidth() < 0) { $objWriter->writeAttribute('flipV', 1); // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($shape->getOffsetX() + $shape->getWidth())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($shape->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($shape->getOffsetX() + $shape->getWidth())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($shape->getOffsetY())); $objWriter->endElement(); // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu(-$shape->getWidth())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($shape->getHeight())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu(-$shape->getWidth())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($shape->getHeight())); $objWriter->endElement(); } @@ -1022,7 +1022,7 @@ private function writeShapeLine(XMLWriter $objWriter, Line $shape, $shapeId) /** * Write Border * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Style\Border $pBorder Border * @param string $pElementName Element name * @throws \Exception @@ -1089,7 +1089,7 @@ protected function writeBorder(XMLWriter $objWriter, Border $pBorder, $pElementN /** * Write Fill * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Style\Fill $pFill Fill style * @throws \Exception */ @@ -1119,7 +1119,7 @@ protected function writeFill(XMLWriter $objWriter, Fill $pFill) /** * Write Solid Fill * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Style\Fill $pFill Fill style * @throws \Exception */ @@ -1139,7 +1139,7 @@ protected function writeSolidFill(XMLWriter $objWriter, Fill $pFill) /** * Write Gradient Fill * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Style\Fill $pFill Fill style * @throws \Exception */ @@ -1176,7 +1176,7 @@ protected function writeGradientFill(XMLWriter $objWriter, Fill $pFill) // a:lin $objWriter->startElement('a:lin'); - $objWriter->writeAttribute('ang', SharedDrawing::degreesToAngle($pFill->getRotation())); + $objWriter->writeAttribute('ang', CommonDrawing::degreesToAngle($pFill->getRotation())); $objWriter->writeAttribute('scaled', '0'); $objWriter->endElement(); @@ -1186,7 +1186,7 @@ protected function writeGradientFill(XMLWriter $objWriter, Fill $pFill) /** * Write Pattern Fill * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Style\Fill $pFill Fill style * @throws \Exception */ @@ -1225,9 +1225,9 @@ protected function writeShadow(XMLWriter $objWriter, Shadow $oShadow) // a:outerShdw $objWriter->startElement('a:outerShdw'); - $objWriter->writeAttribute('blurRad', SharedDrawing::pixelsToEmu($oShadow->getBlurRadius())); - $objWriter->writeAttribute('dist', SharedDrawing::pixelsToEmu($oShadow->getDistance())); - $objWriter->writeAttribute('dir', SharedDrawing::degreesToAngle($oShadow->getDirection())); + $objWriter->writeAttribute('blurRad', CommonDrawing::pixelsToEmu($oShadow->getBlurRadius())); + $objWriter->writeAttribute('dist', CommonDrawing::pixelsToEmu($oShadow->getDistance())); + $objWriter->writeAttribute('dir', CommonDrawing::degreesToAngle($oShadow->getDirection())); $objWriter->writeAttribute('algn', $oShadow->getAlignment()); $objWriter->writeAttribute('rotWithShape', '0'); @@ -1250,7 +1250,7 @@ protected function writeShadow(XMLWriter $objWriter, Shadow $oShadow) /** * Write hyperlink * - * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer + * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\AbstractShape|\PhpOffice\PhpPowerpoint\Shape\RichText\TextElement $shape */ private function writeHyperlink(XMLWriter $objWriter, $shape) @@ -1321,26 +1321,26 @@ public function writeNote(Note $pNote = null) // a:off $objWriter->startElement('a:off'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($pNote->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($pNote->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($pNote->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($pNote->getOffsetY())); $objWriter->endElement(); // a:off // a:ext $objWriter->startElement('a:ext'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($pNote->getExtentX())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($pNote->getExtentY())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($pNote->getExtentX())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($pNote->getExtentY())); $objWriter->endElement(); // a:ext // a:chOff $objWriter->startElement('a:chOff'); - $objWriter->writeAttribute('x', SharedDrawing::pixelsToEmu($pNote->getOffsetX())); - $objWriter->writeAttribute('y', SharedDrawing::pixelsToEmu($pNote->getOffsetY())); + $objWriter->writeAttribute('x', CommonDrawing::pixelsToEmu($pNote->getOffsetX())); + $objWriter->writeAttribute('y', CommonDrawing::pixelsToEmu($pNote->getOffsetY())); $objWriter->endElement(); // a:chOff // a:chExt $objWriter->startElement('a:chExt'); - $objWriter->writeAttribute('cx', SharedDrawing::pixelsToEmu($pNote->getExtentX())); - $objWriter->writeAttribute('cy', SharedDrawing::pixelsToEmu($pNote->getExtentY())); + $objWriter->writeAttribute('cx', CommonDrawing::pixelsToEmu($pNote->getExtentX())); + $objWriter->writeAttribute('cy', CommonDrawing::pixelsToEmu($pNote->getExtentY())); $objWriter->endElement(); // a:chExt // ## a:xfrm diff --git a/src/PhpPowerpoint/Writer/Serialized.php b/src/PhpPowerpoint/Writer/Serialized.php index 59c115512..5211949c1 100644 --- a/src/PhpPowerpoint/Writer/Serialized.php +++ b/src/PhpPowerpoint/Writer/Serialized.php @@ -17,9 +17,9 @@ namespace PhpOffice\PhpPowerpoint\Writer; +use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\AbstractDrawing; -use PhpOffice\PhpPowerpoint\Shared\XMLWriter; /** * \PhpOffice\PhpPowerpoint\Writer\Serialized diff --git a/tests/PhpPowerpoint/Tests/Shared/DrawingTest.php b/tests/PhpPowerpoint/Tests/Shared/DrawingTest.php deleted file mode 100644 index bb2f99029..000000000 --- a/tests/PhpPowerpoint/Tests/Shared/DrawingTest.php +++ /dev/null @@ -1,86 +0,0 @@ -assertEquals(0, Drawing::pixelsToCentimeters()); - $this->assertEquals($value / Drawing::DPI_96 * 2.54, Drawing::pixelsToCentimeters($value)); - $this->assertEquals(0, Drawing::centimetersToPixels()); - $this->assertEquals($value / 2.54 * Drawing::DPI_96, Drawing::centimetersToPixels($value)); - } - - /** - */ - public function testPointsCentimeters() - { - $value = rand(1, 100); - - $this->assertEquals(0, Drawing::pointsToCentimeters()); - $this->assertEquals($value * 1.333333333 / Drawing::DPI_96 * 2.54, Drawing::pointsToCentimeters($value)); - } - - /** - */ - public function testPixelsEMU() - { - $value = rand(1, 100); - - $this->assertEquals(0, Drawing::pixelsToEmu()); - $this->assertEquals(round($value*9525), Drawing::pixelsToEmu($value)); - $this->assertEquals(0, Drawing::emuToPixels()); - $this->assertEquals(round($value/9525), Drawing::emuToPixels($value)); - } - - /** - */ - public function testPixelsPoints() - { - $value = rand(1, 100); - - $this->assertEquals(0, Drawing::pixelsToPoints()); - $this->assertEquals($value*0.67777777, Drawing::pixelsToPoints($value)); - $this->assertEquals(0, Drawing::pointsToPixels()); - $this->assertEquals($value* 1.333333333, Drawing::pointsToPixels($value)); - } - - /** - */ - public function testDegreesAngle() - { - $value = rand(1, 100); - - $this->assertEquals(0, Drawing::degreesToAngle()); - $this->assertEquals((int) round($value * 60000), Drawing::degreesToAngle($value)); - $this->assertEquals(0, Drawing::angleToDegrees()); - $this->assertEquals(round($value / 60000), Drawing::angleToDegrees($value)); - } -} diff --git a/tests/PhpPowerpoint/Tests/Shared/FileTest.php b/tests/PhpPowerpoint/Tests/Shared/FileTest.php deleted file mode 100644 index 4cb228810..000000000 --- a/tests/PhpPowerpoint/Tests/Shared/FileTest.php +++ /dev/null @@ -1,51 +0,0 @@ -assertTrue(File::fileExists($pathResources.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo.png')); - $this->assertFalse(File::fileExists($pathResources.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo_404.png')); - $this->assertTrue(File::fileExists('zip://'.$pathResources.'files'.DIRECTORY_SEPARATOR.'Sample_01_Simple.pptx#[Content_Types].xml')); - $this->assertFalse(File::fileExists('zip://'.$pathResources.'files'.DIRECTORY_SEPARATOR.'Sample_01_Simple.pptx#404.xml')); - $this->assertFalse(File::fileExists('zip://'.$pathResources.'files'.DIRECTORY_SEPARATOR.'404.pptx#404.xml')); - } - - /** - */ - public function testRealPath() - { - $pathFiles = PHPPOWERPOINT_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR; - - $this->assertEquals($pathFiles.'Sample_01_Simple.pptx', File::realpath($pathFiles.'Sample_01_Simple.pptx')); - $this->assertEquals('zip://'.$pathFiles.'Sample_01_Simple.pptx#[Content_Types].xml', File::realpath('zip://'.$pathFiles.'Sample_01_Simple.pptx#[Content_Types].xml')); - $this->assertEquals('zip://'.$pathFiles.'Sample_01_Simple.pptx#/[Content_Types].xml', File::realpath('zip://'.$pathFiles.'Sample_01_Simple.pptx#/rels/../[Content_Types].xml')); - } -} diff --git a/tests/PhpPowerpoint/Tests/Shared/FontTest.php b/tests/PhpPowerpoint/Tests/Shared/FontTest.php deleted file mode 100644 index b9b307e1b..000000000 --- a/tests/PhpPowerpoint/Tests/Shared/FontTest.php +++ /dev/null @@ -1,41 +0,0 @@ -assertEquals(16, Font::fontSizeToPixels()); - $this->assertEquals((16 / 12) * $value, Font::fontSizeToPixels($value)); - $this->assertEquals(96, Font::inchSizeToPixels()); - $this->assertEquals(96 * $value, Font::inchSizeToPixels($value)); - $this->assertEquals(37.795275591, Font::centimeterSizeToPixels()); - $this->assertEquals(37.795275591 * $value, Font::centimeterSizeToPixels($value)); - } -} diff --git a/tests/PhpPowerpoint/Tests/Shared/StringTest.php b/tests/PhpPowerpoint/Tests/Shared/StringTest.php deleted file mode 100644 index 50445bf4e..000000000 --- a/tests/PhpPowerpoint/Tests/Shared/StringTest.php +++ /dev/null @@ -1,47 +0,0 @@ -assertEquals('', String::controlCharacterPHP2OOXML()); - $this->assertEquals('aeiou', String::controlCharacterPHP2OOXML('aeiou')); - $this->assertEquals('àéîöù', String::controlCharacterPHP2OOXML('àéîöù')); - - $value = rand(0, 8); - $this->assertEquals('_x'.sprintf('%04s', strtoupper(dechex($value))).'_', String::controlCharacterPHP2OOXML(chr($value))); - } - - public function testNumberFormat() - { - $this->assertEquals('2.1', String::numberFormat('2.06', 1)); - $this->assertEquals('2.1', String::numberFormat('2.12', 1)); - $this->assertEquals('1234', String::numberFormat(1234, 1)); - } -} diff --git a/tests/PhpPowerpoint/Tests/Shared/XMLWriterTest.php b/tests/PhpPowerpoint/Tests/Shared/XMLWriterTest.php deleted file mode 100644 index 94eaa5e16..000000000 --- a/tests/PhpPowerpoint/Tests/Shared/XMLWriterTest.php +++ /dev/null @@ -1,47 +0,0 @@ -startElement('element'); - $object->text('AAA'); - $object->endElement(); - $this->assertEquals('AAA'.chr(10), $object->getData()); - - // Disk - $object = new XMLWriter(XMLWriter::STORAGE_DISK); - $object->startElement('element'); - $object->text('BBB'); - $object->endElement(); - $this->assertEquals('BBB'.chr(10), $object->getData()); - } -} diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index dc50a85c0..16c6395f0 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -17,6 +17,7 @@ namespace PhpOffice\PhpPowerpoint\Tests\Writer\ODPresentation; +use PhpOffice\Common\Drawing as CommonDrawing; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\RichText\Run; use PhpOffice\PhpPowerpoint\Slide\Transition; @@ -26,7 +27,6 @@ use PhpOffice\PhpPowerpoint\Style\Color; use PhpOffice\PhpPowerpoint\Writer\ODPresentation; use PhpOffice\PhpPowerpoint\Tests\TestHelperDOCX; -use PhpOffice\PhpPowerpoint\Shared\Drawing as SharedDrawing; /** * Test class for PhpOffice\PhpPowerpoint\Writer\ODPresentation\Manifest @@ -225,7 +225,7 @@ public function testRichtextBorder() $this->assertEquals('#'.$oRichText1->getBorder()->getColor()->getRGB(), $pres->getElementAttribute($element, 'svg:stroke-color', 'content.xml')); $this->assertTrue($pres->attributeElementExists($element, 'svg:stroke-width', 'content.xml')); $this->assertStringEndsWith('cm', $pres->getElementAttribute($element, 'svg:stroke-width', 'content.xml')); - $this->assertStringStartsWith((string) number_format(SharedDrawing::pointsToCentimeters($oRichText1->getBorder()->getLineWidth()), 3, '.', ''), $pres->getElementAttribute($element, 'svg:stroke-width', 'content.xml')); + $this->assertStringStartsWith((string) number_format(CommonDrawing::pointsToCentimeters($oRichText1->getBorder()->getLineWidth()), 3, '.', ''), $pres->getElementAttribute($element, 'svg:stroke-width', 'content.xml')); $this->assertTrue($pres->attributeElementExists($element, 'draw:stroke', 'content.xml')); $this->assertEquals('solid', $pres->getElementAttribute($element, 'draw:stroke', 'content.xml')); $this->assertFalse($pres->attributeElementExists($element, 'draw:stroke-dash', 'content.xml')); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index 0bdbd2433..15e2fec3f 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -17,10 +17,10 @@ namespace PhpOffice\PhpPowerpoint\Tests\Writer\PowerPoint2007; +use PhpOffice\Common\Drawing; use PhpOffice\PhpPowerpoint\Tests\TestHelperDOCX; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\RichText; -use PhpOffice\PhpPowerpoint\Shared\Drawing; use PhpOffice\PhpPowerpoint\Style\Alignment; use PhpOffice\PhpPowerpoint\Style\Bullet; use PhpOffice\PhpPowerpoint\Style\Color; From 79ea5c3eea9f75504e403fe7139fbead4afff1de Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 24 Jun 2015 14:34:13 +0200 Subject: [PATCH 087/115] Some parts of code shared between PHPOffice projects have been moved to PhpOffice/Common --- src/PhpPowerpoint/DocumentLayout.php | 4 ++-- src/PhpPowerpoint/Reader/PowerPoint97.php | 6 ++++-- .../Writer/ODPresentation/Content.php | 18 +++++++++--------- .../Writer/ODPresentation/Styles.php | 2 +- .../Writer/PowerPoint2007/Slide.php | 2 +- .../Writer/ODPresentation/ContentTest.php | 2 +- .../Tests/Writer/ODPresentation/StylesTest.php | 2 +- .../Tests/Writer/PowerPoint2007/SlideTest.php | 2 +- 8 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/PhpPowerpoint/DocumentLayout.php b/src/PhpPowerpoint/DocumentLayout.php index 836ef53c1..1c82271b3 100644 --- a/src/PhpPowerpoint/DocumentLayout.php +++ b/src/PhpPowerpoint/DocumentLayout.php @@ -200,7 +200,7 @@ public function setCY($value, $unit = self::UNIT_EMU) protected function convertUnit($value, $fromUnit, $toUnit) { // Convert from $fromUnit to EMU - switch($fromUnit){ + switch ($fromUnit) { case self::UNIT_MILLIMETER: $value *= 36000; break; @@ -222,7 +222,7 @@ protected function convertUnit($value, $fromUnit, $toUnit) } // Convert from EMU to $toUnit - switch($toUnit){ + switch ($toUnit) { case self::UNIT_MILLIMETER: $value /= 36000; break; diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index fa35a21f8..e122ecf6f 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -823,11 +823,13 @@ private function readRTSlide($pos) } switch ($rhFB['recType']) { - case 0xF003: // OfficeArtSpgrContainer + case 0xF003: + // OfficeArtSpgrContainer // OfficeArtSpgrContainer // print_r('@OfficeArtSpgrContainer'.EOL); break; - case 0xF004: // OfficeArtSpContainer + case 0xF004: + // OfficeArtSpContainer // shapeGroup $shapeGroup = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); if ($shapeGroup['recVer'] == 0x1 && $shapeGroup['recInstance'] == 0x0000 && $shapeGroup['recType'] == 0xF009 && $shapeGroup['recLen'] == 0x00000010) { diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index 86668fa21..1c6452a21 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -740,7 +740,7 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) $objWriter->writeAttribute('draw:auto-grow-width', var_export($shape->hasAutoShrinkHorizontal(), true)); } // Fill - switch ($shape->getFill()->getFillType()){ + switch ($shape->getFill()->getFillType()) { case Fill::FILL_GRADIENT_LINEAR: case Fill::FILL_GRADIENT_PATH: $objWriter->writeAttribute('draw:fill', 'gradient'); @@ -762,7 +762,7 @@ public function writeTxtStyle(XMLWriter $objWriter, RichText $shape) } else { $objWriter->writeAttribute('svg:stroke-color', '#'.$shape->getBorder()->getColor()->getRGB()); $objWriter->writeAttribute('svg:stroke-width', number_format(CommonDrawing::pointsToCentimeters($shape->getBorder()->getLineWidth()), 3, '.', '').'cm'); - switch ($shape->getBorder()->getDashStyle()){ + switch ($shape->getBorder()->getDashStyle()) { case Border::DASH_SOLID: $objWriter->writeAttribute('draw:stroke', 'solid'); break; @@ -935,7 +935,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) $lineStyle = 'none'; $lineWidth = String::numberFormat($shapeCell->getBorders()->getBottom()->getLineWidth() / 1.75, 2); $lineColor = $shapeCell->getBorders()->getBottom()->getColor()->getRGB(); - switch ($shapeCell->getBorders()->getBottom()->getLineStyle()){ + switch ($shapeCell->getBorders()->getBottom()->getLineStyle()) { case Border::LINE_SINGLE: $lineStyle = 'solid'; } @@ -944,7 +944,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) $lineStyle = 'none'; $lineWidth = String::numberFormat($shapeCell->getBorders()->getBottom()->getLineWidth() / 1.75, 2); $lineColor = $shapeCell->getBorders()->getBottom()->getColor()->getRGB(); - switch ($shapeCell->getBorders()->getBottom()->getLineStyle()){ + switch ($shapeCell->getBorders()->getBottom()->getLineStyle()) { case Border::LINE_SINGLE: $lineStyle = 'solid'; } @@ -953,7 +953,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) $lineStyle = 'none'; $lineWidth = String::numberFormat($shapeCell->getBorders()->getTop()->getLineWidth() / 1.75, 2); $lineColor = $shapeCell->getBorders()->getTop()->getColor()->getRGB(); - switch ($shapeCell->getBorders()->getTop()->getLineStyle()){ + switch ($shapeCell->getBorders()->getTop()->getLineStyle()) { case Border::LINE_SINGLE: $lineStyle = 'solid'; } @@ -962,7 +962,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) $lineStyle = 'none'; $lineWidth = String::numberFormat($shapeCell->getBorders()->getRight()->getLineWidth() / 1.75, 2); $lineColor = $shapeCell->getBorders()->getRight()->getColor()->getRGB(); - switch ($shapeCell->getBorders()->getRight()->getLineStyle()){ + switch ($shapeCell->getBorders()->getRight()->getLineStyle()) { case Border::LINE_SINGLE: $lineStyle = 'solid'; } @@ -971,7 +971,7 @@ public function writeTableStyle(XMLWriter $objWriter, Table $shape) $lineStyle = 'none'; $lineWidth = String::numberFormat($shapeCell->getBorders()->getLeft()->getLineWidth() / 1.75, 2); $lineColor = $shapeCell->getBorders()->getLeft()->getColor()->getRGB(); - switch ($shapeCell->getBorders()->getLeft()->getLineStyle()){ + switch ($shapeCell->getBorders()->getLeft()->getLineStyle()) { case Border::LINE_SINGLE: $lineStyle = 'solid'; } @@ -1040,7 +1040,7 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) } elseif ($oTransition->hasTimeTrigger()) { $objWriter->writeAttribute('presentation:transition-type', 'automatic'); } - switch($oTransition->getSpeed()) { + switch ($oTransition->getSpeed()) { case Transition::SPEED_FAST: $objWriter->writeAttribute('presentation:transition-speed', 'fast'); break; @@ -1055,7 +1055,7 @@ public function writeStyleSlide(XMLWriter $objWriter, Slide $slide, $incPage) /** * http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-presentation_transition-style */ - switch($oTransition->getTransitionType()) { + switch ($oTransition->getTransitionType()) { case Transition::TRANSITION_BLINDS_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-stripes'); break; diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php b/src/PhpPowerpoint/Writer/ODPresentation/Styles.php index f5d43221c..a607fc9cd 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Styles.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Styles.php @@ -192,7 +192,7 @@ public function writeRichTextStyle(XMLWriter $objWriter, RichText $shape) $objWriter->startElement('draw:stroke-dash'); $objWriter->writeAttribute('draw:name', 'strokeDash_'.$shape->getBorder()->getDashStyle()); $objWriter->writeAttribute('draw:style', 'rect'); - switch ($shape->getBorder()->getDashStyle()){ + switch ($shape->getBorder()->getDashStyle()) { case Border::DASH_DASH: $objWriter->writeAttribute('draw:distance', '0.105cm'); $objWriter->writeAttribute('draw:dots2', '1'); diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index bd16fae9a..cd0ae8e09 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -1439,7 +1439,7 @@ public function writeTransition(XMLWriter $objWriter, Transition $transition) $objWriter->writeAttribute('advTm', $transition->getAdvanceTimeTrigger()); } - switch($transition->getTransitionType()) { + switch ($transition->getTransitionType()) { case Transition::TRANSITION_BLINDS_HORIZONTAL: $objWriter->startElement('p:blinds'); $objWriter->writeAttribute('dir', 'horz'); diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index 16c6395f0..af703e3d4 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -449,7 +449,7 @@ public function testTransition() $oTransition->setTransitionType($rcTransition->getConstant($key)); $oSlide->setTransition($oTransition); $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); - switch($key) { + switch ($key) { case 'TRANSITION_BLINDS_HORIZONTAL': $this->assertContains('horizontal-stripes', $pres->getElementAttribute($element, 'presentation:transition-style', 'content.xml')); break; diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php index da0492a94..83f62b797 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/StylesTest.php @@ -151,7 +151,7 @@ public function testStrokeDash() $this->assertEquals('rect', $pres->getElementAttribute($element, 'draw:style', 'styles.xml')); $this->assertTrue($pres->attributeElementExists($element, 'draw:distance', 'styles.xml')); - switch($style){ + switch ($style) { case Border::DASH_DOT: case Border::DASH_SYSDOT: $this->assertTrue($pres->attributeElementExists($element, 'draw:dots1', 'styles.xml')); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php index 15e2fec3f..7dfaedcf4 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/SlideTest.php @@ -758,7 +758,7 @@ public function testTransition() $oTransition->setTransitionType($rcTransition->getConstant($key)); $oSlide->setTransition($oTransition); $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007'); - switch($key) { + switch ($key) { case 'TRANSITION_BLINDS_HORIZONTAL': $this->assertTrue($pres->elementExists($element.'/p:blinds[@dir=\'horz\']', 'ppt/slides/slide1.xml')); break; From 27089aef34b5ccbbba7945b310f300f084e7d683 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 24 Jun 2015 15:44:36 +0200 Subject: [PATCH 088/115] Improved the sample 04-Table for having two links in a Cell - GH-93 --- CHANGELOG.md | 1 + samples/Sample_04_Table.php | 9 ++++- samples/Sample_Header.php | 2 ++ .../Writer/ODPresentation/Content.php | 34 ++++++++++++------- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 683a99c88..8ff040f42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ ### Miscellaneous - Improved the sample 04-Table for having a Text Run in a Cell - @Progi1984 GH-84 +- Improved the sample 04-Table for having two links in a Cell - @Progi1984 GH-93 - Some parts of code shared between PHPOffice projects have been moved to PhpOffice/Common - @Progi1984 ## 0.3.0 - 2014-09-22 diff --git a/samples/Sample_04_Table.php b/samples/Sample_04_Table.php index 66da8bb96..f1b3c5b24 100644 --- a/samples/Sample_04_Table.php +++ b/samples/Sample_04_Table.php @@ -95,7 +95,8 @@ $row->getFill()->setFillType(Fill::FILL_SOLID) ->setStartColor(new Color('FFE06B20')) ->setEndColor(new Color('FFE06B20')); -$textRunC1 = $row->nextCell()->createTextRun('Link'); +$cellC1 = $row->nextCell(); +$textRunC1 = $cellC1->createTextRun('Link'); $textRunC1->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')->setTooltip('PHPPowerPoint'); $cellC2 = $row->nextCell(); $textRunC2 = $cellC2->createTextRun('RichText with'); @@ -107,6 +108,12 @@ $textRunC2->getFont()->setBold(true); $textRunC2->getFont()->setSize(14); $textRunC2->getFont()->setColor(new Color('FF0088FF')); +$cellC3 = $row->nextCell(); +$textRunC3 = $cellC3->createTextRun('Link Github'); +$textRunC3->getHyperlink()->setUrl('https://github.com')->setTooltip('GitHub'); +$cellC3->createBreak(); +$textRunC3 = $cellC3->createTextRun('Link Google'); +$textRunC3->getHyperlink()->setUrl('https://google.com')->setTooltip('Google'); // Save file echo write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers); diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index 81696c97c..b85f26ab3 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -16,6 +16,8 @@ require_once __DIR__ . '/../src/PhpPowerpoint/Autoloader.php'; Autoloader::register(); +require_once __DIR__ . '/../vendor/autoload.php'; + // Set writers $writers = array('PowerPoint2007' => 'pptx', 'ODPresentation' => 'odp'); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index 1c6452a21..755ed0342 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -578,20 +578,30 @@ public function writeShapeTable(XMLWriter $objWriter, Table $shape) // text:span foreach ($shapeCell->getParagraphs() as $shapeParagraph) { foreach ($shapeParagraph->getRichTextElements() as $shapeRichText) { - $objWriter->startElement('text:span'); - if ($shapeRichText instanceof Run) { - $objWriter->writeAttribute('text:style-name', 'T_' . $shapeRichText->getFont()->getHashCode()); - } - if ($shapeRichText instanceof TextElement && $shapeRichText->hasHyperlink()) { - // text:a - $objWriter->startElement('text:a'); - $objWriter->writeAttribute('xlink:href', $shapeRichText->getHyperlink()->getUrl()); - $objWriter->text($shapeRichText->getText()); + if ($shapeRichText instanceof TextElement || $shapeRichText instanceof Run) { + // text:span + $objWriter->startElement('text:span'); + if ($shapeRichText instanceof Run) { + $objWriter->writeAttribute('text:style-name', 'T_' . $shapeRichText->getFont()->getHashCode()); + } + if ($shapeRichText->hasHyperlink() === true && $shapeRichText->getHyperlink()->getUrl() != '') { + // text:a + $objWriter->startElement('text:a'); + $objWriter->writeAttribute('xlink:href', $shapeRichText->getHyperlink()->getUrl()); + $objWriter->text($shapeRichText->getText()); + $objWriter->endElement(); + } else { + $objWriter->text($shapeRichText->getText()); + } + $objWriter->endElement(); + } elseif ($shapeRichText instanceof BreakElement) { + // text:span + $objWriter->startElement('text:span'); + // text:line-break + $objWriter->startElement('text:line-break'); + $objWriter->endElement(); $objWriter->endElement(); - } else { - $objWriter->text($shapeRichText->getText()); } - $objWriter->endElement(); } } From 97d4ea76448e0460e0abc31af3efc5455b1a40bc Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 24 Jun 2015 16:50:55 +0200 Subject: [PATCH 089/115] Improved the documentation about Table Shapes and cell width - GH-104 --- CHANGELOG.md | 1 + docs/index.rst | 8 ++++++ docs/shapes.rst | 7 ++---- docs/shapes_table.rst | 57 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 docs/shapes_table.rst diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ff040f42..3d49c6808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ ### Miscellaneous - Improved the sample 04-Table for having a Text Run in a Cell - @Progi1984 GH-84 - Improved the sample 04-Table for having two links in a Cell - @Progi1984 GH-93 +- Improved the documentation about Table Shapes and cell width - @Progi1984 GH-104 - Some parts of code shared between PHPOffice projects have been moved to PhpOffice/Common - @Progi1984 ## 0.3.0 - 2014-09-22 diff --git a/docs/index.rst b/docs/index.rst index 4539565e1..76fdd53a0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -24,6 +24,14 @@ PHPPowerPoint is a library written in pure PHP that provides a set of classes to faq credits references + +.. _shapes-docs: + +.. toctree:: + :maxdepth: 2 + :caption: Shapes + + shapes_table Indices and tables ================== diff --git a/docs/shapes.rst b/docs/shapes.rst index 12d4ed31d..68a0e907b 100644 --- a/docs/shapes.rst +++ b/docs/shapes.rst @@ -76,10 +76,7 @@ To create a drawing, use `createDrawingShape` method of slide. ->setDescription('Description of the drawing') ->setPath('/path/to/drawing.filename'); -Drawing +Table ------- -To create a table, use `createTableShape` method of slide. - -.. code-block:: php - $table = $slide->createTableShape($columns); +The Table has now :shapes_table:`its own page`. diff --git a/docs/shapes_table.rst b/docs/shapes_table.rst new file mode 100644 index 000000000..4c0b488f2 --- /dev/null +++ b/docs/shapes_table.rst @@ -0,0 +1,57 @@ +.. _shapes: + +Tables +====== + +To create a table, use `createTableShape` method of slide. + +Example: + +.. code-block:: php + $tableShape = $slide->createTableShape($columns); + +Rows +------- + +A row is a child of a table. For creating a row, use `createRow` method of a Table shape. + +.. code-block:: php + $tableShape = $slide->createTableShape($columns); + $row = $tableShape->createRow(); + +Cells +------- +A cell is a child of a row. + +You can access cell objects with `nextCell` method of a Row object. +.. code-block:: php + $tableShape = $slide->createTableShape($columns); + $row = $tableShape->createRow(); + // Get the first cell + $cellA1 = $row->nextCell(); + // Get the second cell + $cellA2 = $row->nextCell(); + +You can access cell object directly +.. code-block:: php + $tableShape = $slide->createTableShape($columns); + $row = $tableShape->createRow(); + // Get the first cell + $cellA1 = $row->getCell(0); + // Get the second cell + $cellA2 = $row->getCell(1); + + +Define the width of a cell +~~~~~~~~~~~~~~~~~~~~~~~~~~ +The width of cells are defined by the width of cell of the first row. +If not defined, all cells widths are calculated from the width of the shape and the number of columns. + +For defining the width of cell, you can use the `setWidth` method of a Cell object. +The width is in pixels. + +.. code-block:: php + $tableShape = $slide->createTableShape($columns); + $row = $tableShape->createRow(); + $cellA1 = $row->nextCell(); + $cellA1->setWidth(100); \ No newline at end of file From e05c3a0aafb55197572bb0cb5c6bcbd2d8969a93 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 24 Jun 2015 16:59:59 +0200 Subject: [PATCH 090/115] Improved the documentation about Table Shapes and cell width - GH-104 --- docs/shapes_table.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/shapes_table.rst b/docs/shapes_table.rst index 4c0b488f2..519d57142 100644 --- a/docs/shapes_table.rst +++ b/docs/shapes_table.rst @@ -8,6 +8,7 @@ To create a table, use `createTableShape` method of slide. Example: .. code-block:: php + $tableShape = $slide->createTableShape($columns); Rows @@ -16,6 +17,7 @@ Rows A row is a child of a table. For creating a row, use `createRow` method of a Table shape. .. code-block:: php + $tableShape = $slide->createTableShape($columns); $row = $tableShape->createRow(); @@ -24,7 +26,9 @@ Cells A cell is a child of a row. You can access cell objects with `nextCell` method of a Row object. + .. code-block:: php + $tableShape = $slide->createTableShape($columns); $row = $tableShape->createRow(); // Get the first cell @@ -33,7 +37,9 @@ You can access cell objects with `nextCell` method of a Row object. $cellA2 = $row->nextCell(); You can access cell object directly + .. code-block:: php + $tableShape = $slide->createTableShape($columns); $row = $tableShape->createRow(); // Get the first cell @@ -51,6 +57,7 @@ For defining the width of cell, you can use the `setWidth` method of a Cell obje The width is in pixels. .. code-block:: php + $tableShape = $slide->createTableShape($columns); $row = $tableShape->createRow(); $cellA1 = $row->nextCell(); From cf96dc8156eb836a3affff5137b223e634c69b3d Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 24 Jun 2015 17:09:41 +0200 Subject: [PATCH 091/115] Improved the documentation about Table Shapes and cell width - GH-104 --- docs/faq.rst | 6 +++--- docs/index.rst | 2 +- docs/references.rst | 1 + docs/shapes.rst | 6 ++++-- docs/shapes_table.rst | 2 +- docs/styles.rst | 18 +++++++++++------- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index 36eeec6fc..0445d9da8 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -4,7 +4,7 @@ Frequently asked questions ========================== Is this the same with PHPPowerPoint that I found in CodePlex? -------------------------------------------------------- +------------------------------------------------------------- No. This one is much better with tons of new features that you can’t find in PHPPowerPoint 0.1. The development in CodePlex is halted and @@ -12,7 +12,7 @@ switched to GitHub to allow more participation from the crowd. The more the merrier, right? I’ve been running PHPPowerPoint from CodePlex flawlessly, but I can’t use the latest PHPPowerPoint from GitHub. Why? --------------------------------------------------------------------------------------------------------- +-------------------------------------------------------------------------------------------------------------------- PHPPowerPoint requires PHP 5.3+ since 0.2, while PHPPowerPoint 0.1 from CodePlex can run with PHP 5.2. There’s a lot of new features that we can get from @@ -20,7 +20,7 @@ PHP 5.3 and it’s been around since 2009! You should upgrade your PHP version to use PHPPowerPoint 0.2+. Why am I getting a class not found error? -------------------------------------------------------- +----------------------------------------- If you have followed the instructions for either adding this package to your ``composer.json`` or registering the autoloader, then perhaps you forgot to diff --git a/docs/index.rst b/docs/index.rst index 76fdd53a0..43e5c9bbd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,7 +4,7 @@ contain the root `toctree` directive. Welcome to PHPPowerPoint's documentation -================================== +======================================== |PHPPowerPoint| diff --git a/docs/references.rst b/docs/references.rst index 081954b39..bea9c0cc4 100644 --- a/docs/references.rst +++ b/docs/references.rst @@ -18,6 +18,7 @@ ISO : `__ - `Part 4: Transitional Migration Features `__ + MSDN : - `PowerPoint Viewer `__ diff --git a/docs/shapes.rst b/docs/shapes.rst index 68a0e907b..8e31e0b75 100644 --- a/docs/shapes.rst +++ b/docs/shapes.rst @@ -15,11 +15,12 @@ Every shapes have common properties that you can set by using fluent interface. - ``fill`` see *[Fill](#fill)* - ``border`` see *[Border](#border)* - ``shadow`` see *[Shadow](#shadow)* -- ``hyperlink` +- ``hyperlink`` Example: .. code-block:: php + $richtext = $slide->createRichTextShape() ->setHeight(300) ->setWidth(600) @@ -71,6 +72,7 @@ Drawing To create a drawing, use `createDrawingShape` method of slide. .. code-block:: php + $drawing = $slide->createDrawingShape(); $drawing->setName('Unique name') ->setDescription('Description of the drawing') @@ -79,4 +81,4 @@ To create a drawing, use `createDrawingShape` method of slide. Table ------- -The Table has now :shapes_table:`its own page`. +The Table has now :ref:`its own page `. diff --git a/docs/shapes_table.rst b/docs/shapes_table.rst index 519d57142..09dc88f82 100644 --- a/docs/shapes_table.rst +++ b/docs/shapes_table.rst @@ -1,4 +1,4 @@ -.. _shapes: +.. _shapes_table: Tables ====== diff --git a/docs/styles.rst b/docs/styles.rst index 30b5c2e63..727840162 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -4,11 +4,12 @@ Styles ====== Fill -------- +---- Use this style to define fill of a shape as example below. .. code-block:: php + $shape->getFill() ->setFillType(Fill::FILL_GRADIENT_LINEAR) ->setRotation(270) @@ -23,11 +24,12 @@ Properties: - ``endColor`` Border -------- +------ Use this style to define border of a shape as example below. .. code-block:: php + $shape->getBorder() ->setLineStyle(Border::LINE_SINGLE) ->setLineWidth(4) @@ -41,11 +43,12 @@ Properties: - ``color`` Shadow -------- +------ Use this style to define shadow of a shape as example below. .. code-block:: php + $shape->getShadow() ->setVisible(true) ->setDirection(45) @@ -62,7 +65,7 @@ Properties: - ``alpha`` Alignment -------- +--------- - ``horizontal`` - ``vertical`` @@ -72,7 +75,7 @@ Alignment - ``marginRight`` Font -------- +---- - ``name`` - ``bold`` @@ -84,7 +87,7 @@ Font - ``color`` Bullet -------- +------ - ``bulletType`` - ``bulletFont`` @@ -93,10 +96,11 @@ Bullet - ``bulletNumericStartAt`` Color -------- +----- Colors can be applied to different objects, e.g. font or border. .. code-block:: php + $textRun = $shape->createTextRun('Text'); $textRun->getFont()->setColor(new Color('C00000')); From 4200e8192c9b0fc11ff03edcdcfbff67267da809 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 24 Jun 2015 17:13:45 +0200 Subject: [PATCH 092/115] Improved the documentation about Table Shapes and cell width - GH-104 --- docs/index.rst | 2 +- docs/shapes.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 43e5c9bbd..6d34252b6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -25,7 +25,7 @@ PHPPowerPoint is a library written in pure PHP that provides a set of classes to credits references -.. _shapes-docs: +.. _shapesdocs: .. toctree:: :maxdepth: 2 diff --git a/docs/shapes.rst b/docs/shapes.rst index 8e31e0b75..5f6fbf222 100644 --- a/docs/shapes.rst +++ b/docs/shapes.rst @@ -28,7 +28,7 @@ Example: ->setOffsetY(180); Rich text -------- +--------- Rich text shapes contain paragraphs of texts. To create a rich text shape, use ``createRichTextShape`` method of slide. From 2975f1f964fdab3190f25d37ec1e6f128deeaad4 Mon Sep 17 00:00:00 2001 From: jking Date: Thu, 25 Jun 2015 11:24:47 -0400 Subject: [PATCH 093/115] Update Samples for New Chart Types Add Option to Specify Data Label Number Format (so stacked % displays percent) --- samples/Sample_05_Chart.php | 203 +++++++++++++++++- src/PhpPowerpoint/Shape/Chart/Series.php | 36 ++++ .../Writer/ODPresentation/ObjectsChart.php | 9 +- .../Writer/PowerPoint2007/Chart.php | 8 + 4 files changed, 250 insertions(+), 6 deletions(-) diff --git a/samples/Sample_05_Chart.php b/samples/Sample_05_Chart.php index 5f2c5bd17..8dbceb934 100644 --- a/samples/Sample_05_Chart.php +++ b/samples/Sample_05_Chart.php @@ -7,6 +7,7 @@ use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Line; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Pie3D; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Scatter; use PhpOffice\PhpPowerpoint\Shape\Chart\Series; @@ -71,7 +72,7 @@ function fnSlide_Bar(PhpPowerpoint $objPHPPowerPoint) { $currentSlide = createTemplatedSlide($objPHPPowerPoint); // Generate sample data for first chart - echo date('H:i:s') . ' Generate sample data for first chart'.EOL; + echo date('H:i:s') . ' Generate sample data for chart'.EOL; $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293); $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379); @@ -147,6 +148,144 @@ function fnSlide_BarHorizontal(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic(true); } +function fnSlide_BarStacked(PhpPowerpoint $objPHPPowerPoint) { + global $oFill; + global $oShadow; + + // Create templated slide + echo EOL . date( 'H:i:s' ) . ' Create templated slide' . EOL; + $currentSlide = createTemplatedSlide( $objPHPPowerPoint ); + + // Generate sample data for first chart + echo date( 'H:i:s' ) . ' Generate sample data for chart' . EOL; + $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293); + $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379); + $series3Data = array('Jan' => 233, 'Feb' => 146, 'Mar' => 238, 'Apr' => 175, 'May' => 108, 'Jun' => 257, 'Jul' => 199, 'Aug' => 201, 'Sep' => 88, 'Oct' => 147, 'Nov' => 287, 'Dec' => 105); + + // Create a bar chart (that should be inserted in a shape) + echo date( 'H:i:s' ) . ' Create a stacked bar chart (that should be inserted in a chart shape)' . EOL; + $StackedBarChart = new Bar(); + $series1 = new Series( '2009', $series1Data ); + $series1->setShowSeriesName( false ); + $series1->getFill()->setFillType( Fill::FILL_SOLID )->setStartColor( new Color( 'FF4F81BD' ) ); + $series1->getFont()->getColor()->setRGB( '00FF00' ); + $series1->setShowValue( true ); + $series1->setShowPercentage( false ); + $series2 = new Series( '2010', $series2Data ); + $series2->setShowSeriesName( false ); + $series2->getFont()->getColor()->setRGB( 'FF0000' ); + $series2->getFill()->setFillType( Fill::FILL_SOLID )->setStartColor( new Color( 'FFC0504D' ) ); + $series2->setShowValue( true ); + $series2->setShowPercentage( false ); + $series3 = new Series( '2011', $series3Data ); + $series3->setShowSeriesName( false ); + $series3->getFont()->getColor()->setRGB( 'FF0000' ); + $series3->getFill()->setFillType( Fill::FILL_SOLID )->setStartColor( new Color( 'FF804DC0' ) ); + $series3->setShowValue( true ); + $series3->setShowPercentage( false ); + $StackedBarChart->addSeries( $series1 ); + $StackedBarChart->addSeries( $series2 ); + $StackedBarChart->addSeries( $series3 ); + $StackedBarChart->setBarGrouping( Bar::GROUPING_STACKED ); + // Create a shape (chart) + echo date( 'H:i:s' ) . ' Create a shape (chart)' . EOL; + $shape = $currentSlide->createChartShape(); + $shape->setName( 'PHPPowerPoint Monthly Downloads' ) + ->setResizeProportional( false ) + ->setHeight( 550 ) + ->setWidth( 700 ) + ->setOffsetX( 120 ) + ->setOffsetY( 80 ); + $shape->setShadow( $oShadow ); + $shape->setFill( $oFill ); + $shape->getBorder()->setLineStyle( Border::LINE_SINGLE ); + $shape->getTitle()->setText( 'PHPPowerPoint Monthly Downloads' ); + $shape->getTitle()->getFont()->setItalic( true ); + $shape->getTitle()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_RIGHT ); + $shape->getPlotArea()->getAxisX()->setTitle( 'Month' ); + $shape->getPlotArea()->getAxisY()->setTitle( 'Downloads' ); + $shape->getPlotArea()->setType( $StackedBarChart ); + $shape->getLegend()->getBorder()->setLineStyle( Border::LINE_SINGLE ); + $shape->getLegend()->getFont()->setItalic( true ); +} +function fnSlide_BarPercentStacked(PhpPowerpoint $objPHPPowerPoint) { + global $oFill; + global $oShadow; + + // Create templated slide + echo EOL . date( 'H:i:s' ) . ' Create templated slide' . EOL; + $currentSlide = createTemplatedSlide( $objPHPPowerPoint ); + + // Generate sample data for first chart + echo date( 'H:i:s' ) . ' Generate sample data for chart' . EOL; + $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293); + $Series1Sum = array_sum($series1Data); + foreach ($series1Data as $CatName => $Value) { + $series1Data[$CatName]= round($Value / $Series1Sum, 2); + } + $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379); + $Series2Sum = array_sum($series2Data); + foreach ($series2Data as $CatName => $Value) { + $series2Data[$CatName] = round($Value / $Series2Sum, 2); + } + $series3Data = array('Jan' => 233, 'Feb' => 146, 'Mar' => 238, 'Apr' => 175, 'May' => 108, 'Jun' => 257, 'Jul' => 199, 'Aug' => 201, 'Sep' => 88, 'Oct' => 147, 'Nov' => 287, 'Dec' => 105); + $Series3Sum = array_sum( $series3Data ); + foreach ($series3Data as $CatName => $Value) { + $series3Data[$CatName] = round($Value / $Series3Sum,2); + } + + // Create a bar chart (that should be inserted in a shape) + echo date( 'H:i:s' ) . ' Create a percent stacked horizontal bar chart (that should be inserted in a chart shape)' . EOL; + $PercentStackedBarChartHoriz = new Bar(); + $series1 = new Series( '2009', $series1Data ); + $series1->setShowSeriesName( false ); + $series1->getFill()->setFillType( Fill::FILL_SOLID )->setStartColor( new Color( 'FF4F81BD' ) ); + $series1->getFont()->getColor()->setRGB( '00FF00' ); + $series1->setShowValue( true ); + $series1->setShowPercentage( false ); + // Set Data Label Format For Chart To Display Percent + $series1->setDlblNumFormat( '#%' ); + $series2 = new Series( '2010', $series2Data ); + $series2->setShowSeriesName( false ); + $series2->getFont()->getColor()->setRGB( 'FF0000' ); + $series2->getFill()->setFillType( Fill::FILL_SOLID )->setStartColor( new Color( 'FFC0504D' ) ); + $series2->setShowValue( true ); + $series2->setShowPercentage( false ); + $series2->setDlblNumFormat( '#%' ); + $series3 = new Series( '2011', $series3Data ); + $series3->setShowSeriesName( false ); + $series3->getFont()->getColor()->setRGB( 'FF0000' ); + $series3->getFill()->setFillType( Fill::FILL_SOLID )->setStartColor( new Color( 'FF804DC0' ) ); + $series3->setShowValue( true ); + $series3->setShowPercentage( false ); + $series3->setDlblNumFormat( '#%' ); + $PercentStackedBarChartHoriz->addSeries( $series1 ); + $PercentStackedBarChartHoriz->addSeries( $series2 ); + $PercentStackedBarChartHoriz->addSeries( $series3 ); + $PercentStackedBarChartHoriz->setBarGrouping( Bar::GROUPING_PERCENTSTACKED ); + $PercentStackedBarChartHoriz->setBarDirection( Bar3D::DIRECTION_HORIZONTAL ); + // Create a shape (chart) + echo date( 'H:i:s' ) . ' Create a shape (chart)' . EOL; + $shape = $currentSlide->createChartShape(); + $shape->setName( 'PHPPowerPoint Monthly Downloads' ) + ->setResizeProportional( false ) + ->setHeight( 550 ) + ->setWidth( 700 ) + ->setOffsetX( 120 ) + ->setOffsetY( 80 ); + $shape->setShadow( $oShadow ); + $shape->setFill( $oFill ); + $shape->getBorder()->setLineStyle( Border::LINE_SINGLE ); + $shape->getTitle()->setText( 'PHPPowerPoint Monthly Downloads' ); + $shape->getTitle()->getFont()->setItalic( true ); + $shape->getTitle()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_RIGHT ); + $shape->getPlotArea()->getAxisX()->setTitle( 'Month' ); + $shape->getPlotArea()->getAxisY()->setTitle( 'Downloads' ); + $shape->getPlotArea()->setType( $PercentStackedBarChartHoriz ); + $shape->getLegend()->getBorder()->setLineStyle( Border::LINE_SINGLE ); + $shape->getLegend()->getFont()->setItalic( true ); +} + function fnSlide_Bar3D(PhpPowerpoint $objPHPPowerPoint) { global $oFill; global $oShadow; @@ -156,7 +295,7 @@ function fnSlide_Bar3D(PhpPowerpoint $objPHPPowerPoint) { $currentSlide = createTemplatedSlide($objPHPPowerPoint); // Generate sample data for first chart - echo date('H:i:s') . ' Generate sample data for first chart'.EOL; + echo date('H:i:s') . ' Generate sample data for chart'.EOL; $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293); $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379); @@ -206,7 +345,7 @@ function fnSlide_Bar3DHorizontal(PhpPowerpoint $objPHPPowerPoint) { // Create a bar chart (that should be inserted in a shape) echo date('H:i:s') . ' Create a horizontal bar chart (that should be inserted in a chart shape) '.EOL; - $bar3DChartHorz = clone $objPHPPowerPoint->getSlide(3)->getShapeCollection()->offsetGet(1)->getPlotArea()->getType(); + $bar3DChartHorz = clone $objPHPPowerPoint->getSlide(5)->getShapeCollection()->offsetGet(1)->getPlotArea()->getType(); $bar3DChartHorz->setBarDirection(Bar3D::DIRECTION_HORIZONTAL); // Create templated slide @@ -247,7 +386,7 @@ function fnSlide_Pie3D(PhpPowerpoint $objPHPPowerPoint) { $currentSlide = createTemplatedSlide($objPHPPowerPoint); // Generate sample data for second chart - echo date('H:i:s') . ' Generate sample data for second chart'.EOL; + echo date('H:i:s') . ' Generate sample data for chart'.EOL; $seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7); // Create a pie chart (that should be inserted in a shape) @@ -286,6 +425,54 @@ function fnSlide_Pie3D(PhpPowerpoint $objPHPPowerPoint) { $shape->getLegend()->getFont()->setItalic(true); } +function fnSlide_Pie(PhpPowerpoint $objPHPPowerPoint) { + global $oFill; + global $oShadow; + + // Create templated slide + echo EOL.date('H:i:s') . ' Create templated slide'.EOL; + $currentSlide = createTemplatedSlide($objPHPPowerPoint); + + // Generate sample data for second chart + echo date('H:i:s') . ' Generate sample data for chart'.EOL; + $seriesData = array('Monday' => 18, 'Tuesday' => 23, 'Wednesday' => 14, 'Thursday' => 12, 'Friday' => 20, 'Saturday' => 8, 'Sunday' => 10); + + // Create a pie chart (that should be inserted in a shape) + echo date('H:i:s') . ' Create a non-3D pie chart (that should be inserted in a chart shape)'.EOL; + $pieChart = new Pie(); + $series = new Series('Downloads', $seriesData); + $series->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF7CB5EC')); + $series->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF434348')); + $series->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF90ED7D')); + $series->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFF7A35C')); + $series->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8085E9')); + $series->getDataPointFill(5)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFF15C80')); + $series->getDataPointFill(6)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE4D354')); + $series->setShowPercentage( true ); + $series->setShowValue( false ); + $series->setShowSeriesName( false ); + $series->setShowCategoryName( true ); + $pieChart->addSeries($series); + + // Create a shape (chart) + echo date('H:i:s') . ' Create a shape (chart)'.EOL; + $shape = $currentSlide->createChartShape(); + $shape->setName('PHPPowerPoint Daily Downloads') + ->setResizeProportional(false) + ->setHeight(550) + ->setWidth(700) + ->setOffsetX(120) + ->setOffsetY(80); + $shape->setShadow($oShadow); + $shape->setFill($oFill); + $shape->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getTitle()->setText('PHPPowerPoint Daily Downloads'); + $shape->getTitle()->getFont()->setItalic(true); + $shape->getPlotArea()->setType($pieChart); + $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE); + $shape->getLegend()->getFont()->setItalic(true); +} + function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { global $oFill; global $oShadow; @@ -295,7 +482,7 @@ function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { $currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function // Generate sample data for fourth chart - echo date('H:i:s') . ' Generate sample data for fourth chart'.EOL; + echo date('H:i:s') . ' Generate sample data for chart'.EOL; $seriesData = array('Monday' => 0.1, 'Tuesday' => 0.33333, 'Wednesday' => 0.4444, 'Thursday' => 0.5, 'Friday' => 0.4666, 'Saturday' => 0.3666, 'Sunday' => 0.1666); // Create a scatter chart (that should be inserted in a shape) @@ -355,6 +542,10 @@ function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { fnSlide_Bar($objPHPPowerPoint); +fnSlide_BarStacked($objPHPPowerPoint); + +fnSlide_BarPercentStacked($objPHPPowerPoint); + fnSlide_BarHorizontal($objPHPPowerPoint); fnSlide_Bar3D($objPHPPowerPoint); @@ -363,6 +554,8 @@ function fnSlide_Scatter(PhpPowerpoint $objPHPPowerPoint) { fnSlide_Pie3D($objPHPPowerPoint); +fnSlide_Pie($objPHPPowerPoint); + fnSlide_Scatter($objPHPPowerPoint); // Save file diff --git a/src/PhpPowerpoint/Shape/Chart/Series.php b/src/PhpPowerpoint/Shape/Chart/Series.php index 26503b4e0..48f377585 100644 --- a/src/PhpPowerpoint/Shape/Chart/Series.php +++ b/src/PhpPowerpoint/Shape/Chart/Series.php @@ -44,6 +44,13 @@ class Series implements ComparableInterface */ private $title = 'Series Title'; + /** + * Data Label Number Format + * + * @var string + */ + private $DlblNumFormat = ''; + /** * Fill * @@ -160,6 +167,35 @@ public function setTitle($value = 'Series Title') return $this; } + /** + * Get Data Label NumFormat + * + * @return string + */ + public function getDlblNumFormat() { + return $this->DlblNumFormat; + } + + /** + * Has Data Label NumFormat + * + * @return string + */ + public function hasDlblNumFormat() { + return !empty($this->DlblNumFormat); + } + + /** + * Set Data Label NumFormat + * + * @param string $value + * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Series + */ + public function setDlblNumFormat($value = '') { + $this->DlblNumFormat = $value; + return $this; + } + /** * Get Fill * diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index ef2012ad8..3f6d261e4 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -508,7 +508,14 @@ private function writePlotAreaStyle(Chart $chart) } } - $this->xmlContent->writeAttribute('chart:data-label-number', 'value'); + $LabelFormat = 'value'; + if ($chartType instanceof Bar || $chartType instanceof Bar3D) { + if ($chartType->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED) { + $LabelFormat = 'percentage'; + } + } + $this->xmlContent->writeAttribute('chart:data-label-number', $LabelFormat); + // > style:text-properties $this->xmlContent->endElement(); // > style:style diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 7f53f9ecf..214011154 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -1153,6 +1153,14 @@ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, $includeShee // c:dLbls $objWriter->startElement('c:dLbls'); + if ($series->hasDlblNumFormat()) { + //c:numFmt + $objWriter->startElement('c:numFmt'); + $objWriter->writeAttribute('formatCode', $series->getDlblNumFormat()); + $objWriter->writeAttribute('sourceLinked', '0'); + $objWriter->endElement(); + } + // c:txPr $objWriter->startElement('c:txPr'); From bc6a6487154d36a948198dce0656bac9f5e12898 Mon Sep 17 00:00:00 2001 From: jking Date: Thu, 25 Jun 2015 14:17:42 -0400 Subject: [PATCH 094/115] TravisCL Formatting Fixes --- src/PhpPowerpoint/Shape/Chart/Series.php | 9 ++++++--- src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/PhpPowerpoint/Shape/Chart/Series.php b/src/PhpPowerpoint/Shape/Chart/Series.php index 48f377585..f4ce1b58f 100644 --- a/src/PhpPowerpoint/Shape/Chart/Series.php +++ b/src/PhpPowerpoint/Shape/Chart/Series.php @@ -172,7 +172,8 @@ public function setTitle($value = 'Series Title') * * @return string */ - public function getDlblNumFormat() { + public function getDlblNumFormat() + { return $this->DlblNumFormat; } @@ -181,7 +182,8 @@ public function getDlblNumFormat() { * * @return string */ - public function hasDlblNumFormat() { + public function hasDlblNumFormat() + { return !empty($this->DlblNumFormat); } @@ -191,7 +193,8 @@ public function hasDlblNumFormat() { * @param string $value * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Series */ - public function setDlblNumFormat($value = '') { + public function setDlblNumFormat($value = '') + { $this->DlblNumFormat = $value; return $this; } diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index 3f6d261e4..0c9974c5c 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -508,13 +508,13 @@ private function writePlotAreaStyle(Chart $chart) } } - $LabelFormat = 'value'; + $labelFormat = 'value'; if ($chartType instanceof Bar || $chartType instanceof Bar3D) { if ($chartType->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED) { - $LabelFormat = 'percentage'; + $labelFormat = 'percentage'; } } - $this->xmlContent->writeAttribute('chart:data-label-number', $LabelFormat); + $this->xmlContent->writeAttribute('chart:data-label-number', $labelFormat); // > style:text-properties $this->xmlContent->endElement(); From 785756bdb0e503a05cfe05cf11b594b24e33e81e Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 26 Jun 2015 10:07:31 +0200 Subject: [PATCH 095/115] Merge pull request #108 from jrking4/develop : Changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d49c6808..c2ed71bf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ - PowerPoint2007 Writer : Support for Bar Chart - @Progi1984 GH-82 - Added units in DocumentLayout - @Progi1984 GH-87 - Added support for transitions between slides - @Progi1984 +- ODPresentation Writer : Support for Pie Chart & Stack Percent Bar Charts - @jrking4 GH-108 +- PowerPoint2007 Writer : Support for Pie Chart & Stack Percent Bar Charts - @jrking4 GH-108 ### Bugfix - PSR-0 via composer broken - @Progi1984 GH-51 From 10bcca1a01fd3ea199f4bf66892bb6d1228f3c19 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 26 Jun 2015 10:38:55 +0200 Subject: [PATCH 096/115] Refactored some chart types in Abstract --- samples/Sample_05_Chart.php | 1 + .../Shape/Chart/Type/AbstractTypeBar.php | 108 ++++++++++++++++++ .../Shape/Chart/Type/AbstractTypePie.php | 76 ++++++++++++ src/PhpPowerpoint/Shape/Chart/Type/Bar.php | 78 +------------ src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php | 79 +------------ src/PhpPowerpoint/Shape/Chart/Type/Pie.php | 19 +-- src/PhpPowerpoint/Shape/Chart/Type/Pie3D.php | 46 +------- .../Writer/ODPresentation/ObjectsChart.php | 29 ++--- .../Writer/PowerPoint2007/Chart.php | 1 + 9 files changed, 209 insertions(+), 228 deletions(-) create mode 100644 src/PhpPowerpoint/Shape/Chart/Type/AbstractTypeBar.php create mode 100644 src/PhpPowerpoint/Shape/Chart/Type/AbstractTypePie.php diff --git a/samples/Sample_05_Chart.php b/samples/Sample_05_Chart.php index 8dbceb934..f3fb2a625 100644 --- a/samples/Sample_05_Chart.php +++ b/samples/Sample_05_Chart.php @@ -440,6 +440,7 @@ function fnSlide_Pie(PhpPowerpoint $objPHPPowerPoint) { // Create a pie chart (that should be inserted in a shape) echo date('H:i:s') . ' Create a non-3D pie chart (that should be inserted in a chart shape)'.EOL; $pieChart = new Pie(); + $pieChart->setExplosion(15); $series = new Series('Downloads', $seriesData); $series->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF7CB5EC')); $series->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF434348')); diff --git a/src/PhpPowerpoint/Shape/Chart/Type/AbstractTypeBar.php b/src/PhpPowerpoint/Shape/Chart/Type/AbstractTypeBar.php new file mode 100644 index 000000000..56c46c964 --- /dev/null +++ b/src/PhpPowerpoint/Shape/Chart/Type/AbstractTypeBar.php @@ -0,0 +1,108 @@ +barDirection = $value; + return $this; + } + + /** + * Get orientation + * + * @return string + */ + public function getBarDirection() + { + return $this->barDirection; + } + + /** + * Set bar grouping (stack or expanded style bar) + * + * @param string $value + * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar + */ + public function setBarGrouping($value = self::GROUPING_CLUSTERED) + { + $this->barGrouping = $value; + return $this; + } + + /** + * Get grouping (stack or expanded style bar) + * + * @return string + */ + public function getBarGrouping() + { + return $this->barGrouping; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() + { + $hash = ''; + foreach ($this->getData() as $series) { + $hash .= $series->getHashCode(); + } + return $hash; + } +} diff --git a/src/PhpPowerpoint/Shape/Chart/Type/AbstractTypePie.php b/src/PhpPowerpoint/Shape/Chart/Type/AbstractTypePie.php new file mode 100644 index 000000000..c5931e2a8 --- /dev/null +++ b/src/PhpPowerpoint/Shape/Chart/Type/AbstractTypePie.php @@ -0,0 +1,76 @@ +hasAxisX = false; + $this->hasAxisY = false; + } + + /** + * Explosion of the Pie + * + * @var integer + */ + protected $explosion = 0; + + /** + * Set explosion + * + * @param integer $value + * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractTypePie + */ + public function setExplosion($value = 0) + { + $this->explosion = $value; + return $this; + } + + /** + * Get orientation + * + * @return string + */ + public function getExplosion() + { + return $this->explosion; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() + { + $hash = ''; + foreach ($this->getData() as $series) { + $hash .= $series->getHashCode(); + } + return $hash; + } +} diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Bar.php b/src/PhpPowerpoint/Shape/Chart/Type/Bar.php index a2af8f1b2..cd27d4f49 100644 --- a/src/PhpPowerpoint/Shape/Chart/Type/Bar.php +++ b/src/PhpPowerpoint/Shape/Chart/Type/Bar.php @@ -22,78 +22,8 @@ /** * \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar */ -class Bar extends AbstractType implements ComparableInterface +class Bar extends AbstractTypeBar implements ComparableInterface { - /** Orientation of bars */ - const DIRECTION_VERTICAL = 'col'; - const DIRECTION_HORIZONTAL = 'bar'; - - /** Grouping of bars */ - const GROUPING_CLUSTERED = 'clustered'; //Chart series are drawn next to each other along the category axis. - const GROUPING_STACKED = 'stacked'; //Chart series are drawn next to each other on the value axis. - const GROUPING_PERCENTSTACKED = 'percentStacked'; //Chart series are drawn next to each other along the value axis and scaled to total 100% - - - /** - * Orientation of bars - * - * @var string - */ - protected $barDirection = self::DIRECTION_VERTICAL; - - - /** - * Grouping of bars - * - * @var string - */ - protected $barGrouping = self::GROUPING_CLUSTERED; - - - /** - * Set bar orientation - * - * @param string $value - * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar - */ - public function setBarDirection($value = self::DIRECTION_VERTICAL) - { - $this->barDirection = $value; - return $this; - } - - /** - * Get orientation - * - * @return string - */ - public function getBarDirection() - { - return $this->barDirection; - } - - /** - * Set bar grouping (stack or expanded style bar) - * - * @param string $value - * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar - */ - public function setBarGrouping($value = self::GROUPING_CLUSTERED) - { - $this->barGrouping = $value; - return $this; - } - - /** - * Get grouping (stack or expanded style bar) - * - * @return string - */ - public function getBarGrouping() - { - return $this->barGrouping; - } - /** * Get hash code * @@ -101,10 +31,6 @@ public function getBarGrouping() */ public function getHashCode() { - $hash = ''; - foreach ($this->getData() as $series) { - $hash .= $series->getHashCode(); - } - return md5($hash . __CLASS__); + return md5(parent::getHashCode() . __CLASS__); } } diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php b/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php index 6d7bae34b..bff9bd0c7 100644 --- a/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php +++ b/src/PhpPowerpoint/Shape/Chart/Type/Bar3D.php @@ -22,79 +22,8 @@ /** * \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D */ -class Bar3D extends AbstractType implements ComparableInterface +class Bar3D extends AbstractTypeBar implements ComparableInterface { - /** Orientation of bars */ - const DIRECTION_VERTICAL = 'col'; - const DIRECTION_HORIZONTAL = 'bar'; - - /** Grouping of bars */ - const GROUPING_CLUSTERED = 'clustered'; //Chart series are drawn next to each other along the category axis. - const GROUPING_STACKED = 'stacked'; //Chart series are drawn next to each other on the value axis. - const GROUPING_PERCENTSTACKED = 'percentStacked'; //Chart series are drawn next to each other along the value axis and scaled to total 100% - - - /** - * Orientation of bars - * - * @var string - */ - protected $barDirection = self::DIRECTION_VERTICAL; - - - /** - * Grouping of bars - * - * @var string - */ - protected $barGrouping = self::GROUPING_CLUSTERED; - - - - /** - * Set bar orientation - * - * @param string $value - * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D - */ - public function setBarDirection($value = self::DIRECTION_VERTICAL) - { - $this->barDirection = $value; - return $this; - } - - /** - * Get orientation - * - * @return string - */ - public function getBarDirection() - { - return $this->barDirection; - } - - /** - * Set bar grouping (stack or expanded style bar) - * - * @param string $value - * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar - */ - public function setBarGrouping($value = self::GROUPING_CLUSTERED) - { - $this->barGrouping = $value; - return $this; - } - - /** - * Get grouping (stack or expanded style bar) - * - * @return string - */ - public function getBarGrouping() - { - return $this->barGrouping; - } - /** * Get hash code * @@ -102,10 +31,6 @@ public function getBarGrouping() */ public function getHashCode() { - $hash = ''; - foreach ($this->getData() as $series) { - $hash .= $series->getHashCode(); - } - return md5($hash . __CLASS__); + return md5(parent::getHashCode() . __CLASS__); } } diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Pie.php b/src/PhpPowerpoint/Shape/Chart/Type/Pie.php index 5e4b68714..d5ab1aa1b 100644 --- a/src/PhpPowerpoint/Shape/Chart/Type/Pie.php +++ b/src/PhpPowerpoint/Shape/Chart/Type/Pie.php @@ -22,19 +22,8 @@ /** * self */ -class Pie extends AbstractType implements ComparableInterface +class Pie extends AbstractTypePie implements ComparableInterface { - - /** - * Create a new self instance - */ - public function __construct() - { - $this->hasAxisX = false; - $this->hasAxisY = false; - } - - /** * Get hash code * @@ -42,10 +31,6 @@ public function __construct() */ public function getHashCode() { - $hash = ''; - foreach ($this->getData() as $series) { - $hash .= $series->getHashCode(); - } - return md5($hash . __CLASS__); + return md5(parent::getHashCode() . __CLASS__); } } diff --git a/src/PhpPowerpoint/Shape/Chart/Type/Pie3D.php b/src/PhpPowerpoint/Shape/Chart/Type/Pie3D.php index 29aa24c00..1e23ba73e 100644 --- a/src/PhpPowerpoint/Shape/Chart/Type/Pie3D.php +++ b/src/PhpPowerpoint/Shape/Chart/Type/Pie3D.php @@ -22,46 +22,8 @@ /** * self */ -class Pie3D extends AbstractType implements ComparableInterface +class Pie3D extends AbstractTypePie implements ComparableInterface { - /** - * Explosion of the Pie3D - * - * @var integer - */ - protected $explosion = 0; - - /** - * Create a new self instance - */ - public function __construct() - { - $this->hasAxisX = false; - $this->hasAxisY = false; - } - - /** - * Set explosion - * - * @param integer $value - * @return \PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D - */ - public function setExplosion($value = 0) - { - $this->explosion = $value; - return $this; - } - - /** - * Get orientation - * - * @return string - */ - public function getExplosion() - { - return $this->explosion; - } - /** * Get hash code * @@ -69,10 +31,6 @@ public function getExplosion() */ public function getHashCode() { - $hash = ''; - foreach ($this->getData() as $series) { - $hash .= $series->getHashCode(); - } - return md5($hash . __CLASS__); + return md5(parent::getHashCode() . __CLASS__); } } diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index 1029b91e7..6b9154dd0 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -22,6 +22,8 @@ use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\Chart; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractTypeBar; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractTypePie; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; @@ -90,7 +92,7 @@ public function writePart(Chart $chart) private function writeContentPart(Chart $chart) { $chartType = $chart->getPlotArea()->getType(); - if (!($chartType instanceof Area || $chartType instanceof Bar || $chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Pie || $chartType instanceof Pie3D || $chartType instanceof Scatter)) { + if (!($chartType instanceof Area || $chartType instanceof AbstractTypeBar || $chartType instanceof Line || $chartType instanceof AbstractTypePie || $chartType instanceof Scatter)) { throw new \Exception('The chart type provided could not be rendered.'); } @@ -203,11 +205,11 @@ private function writeContentPart(Chart $chart) $this->xmlContent->writeAttribute('chart:style-name', 'styleChart'); if ($chartType instanceof Area) { $this->xmlContent->writeAttribute('chart:class', 'chart:area'); - } elseif ($chartType instanceof Bar || $chartType instanceof Bar3D) { + } elseif ($chartType instanceof AbstractTypeBar) { $this->xmlContent->writeAttribute('chart:class', 'chart:bar'); } elseif ($chartType instanceof Line) { $this->xmlContent->writeAttribute('chart:class', 'chart:line'); - } elseif ($chartType instanceof Pie || $chartType instanceof Pie3D) { + } elseif ($chartType instanceof AbstractTypePie) { $this->xmlContent->writeAttribute('chart:class', 'chart:circle'); } elseif ($chartType instanceof Scatter) { $this->xmlContent->writeAttribute('chart:class', 'chart:scatter'); @@ -290,7 +292,7 @@ private function writeAxisStyle(Chart $chart) $this->xmlContent->writeAttribute('chart:display-label', 'true'); $this->xmlContent->writeAttribute('chart:tick-marks-major-inner', 'false'); $this->xmlContent->writeAttribute('chart:tick-marks-major-outer', 'false'); - if ($chartType instanceof Pie || $chartType instanceof Pie3D) { + if ($chartType instanceof AbstractTypePie) { $this->xmlContent->writeAttribute('chart:reverse-direction', 'true'); } // > style:chart-properties @@ -314,7 +316,7 @@ private function writeAxisStyle(Chart $chart) $this->xmlContent->writeAttribute('chart:display-label', 'true'); $this->xmlContent->writeAttribute('chart:tick-marks-major-inner', 'false'); $this->xmlContent->writeAttribute('chart:tick-marks-major-outer', 'false'); - if ($chartType instanceof Pie || $chartType instanceof Pie3D) { + if ($chartType instanceof AbstractTypePie) { $this->xmlContent->writeAttribute('chart:reverse-direction', 'true'); } // > style:chart-properties @@ -489,8 +491,8 @@ private function writePlotAreaStyle(Chart $chart) $this->xmlContent->writeAttribute('chart:three-dimensional', 'true'); $this->xmlContent->writeAttribute('chart:right-angled-axes', 'true'); } - if ($chartType instanceof Bar || $chartType instanceof Bar3D) { - if ($chartType->getBarDirection() == Bar3D::DIRECTION_HORIZONTAL) { + if ($chartType instanceof AbstractTypeBar) { + if ($chartType->getBarDirection() == AbstractTypeBar::DIRECTION_HORIZONTAL) { $this->xmlContent->writeAttribute('chart:vertical', 'true'); } else { $this->xmlContent->writeAttribute('chart:vertical', 'false'); @@ -506,10 +508,9 @@ private function writePlotAreaStyle(Chart $chart) $this->xmlContent->writeAttribute('chart:overlap', '100'); $this->xmlContent->writeAttribute('chart:percentage', 'true'); } - } $labelFormat = 'value'; - if ($chartType instanceof Bar || $chartType instanceof Bar3D) { + if ($chartType instanceof AbstractTypeBar) { if ($chartType->getBarGrouping() == Bar::GROUPING_PERCENTSTACKED) { $labelFormat = 'percentage'; } @@ -538,17 +539,17 @@ private function writeSeries(Chart $chart, Chart\Series $series) $this->xmlContent->writeAttribute('chart:label-cell-address', 'table-local.$'.$this->rangeCol.'$1'); if ($chartType instanceof Area) { $this->xmlContent->writeAttribute('chart:class', 'chart:area'); - } elseif ($chartType instanceof Bar || $chartType instanceof Bar3D) { + } elseif ($chartType instanceof AbstractTypeBar) { $this->xmlContent->writeAttribute('chart:class', 'chart:bar'); } elseif ($chartType instanceof Line) { $this->xmlContent->writeAttribute('chart:class', 'chart:line'); - } elseif ($chartType instanceof Pie || $chartType instanceof Pie3D) { + } elseif ($chartType instanceof AbstractTypePie) { $this->xmlContent->writeAttribute('chart:class', 'chart:circle'); } elseif ($chartType instanceof Scatter) { $this->xmlContent->writeAttribute('chart:class', 'chart:scatter'); } $this->xmlContent->writeAttribute('chart:style-name', 'styleSeries'.$this->numSeries); - if ($chartType instanceof Area || $chartType instanceof Bar || $chartType instanceof Bar3D || $chartType instanceof Line || $chartType instanceof Scatter) { + if ($chartType instanceof Area || $chartType instanceof AbstractTypeBar || $chartType instanceof Line || $chartType instanceof Scatter) { $dataPointFills = $series->getDataPointFills(); if (empty($dataPointFills)) { $incRepeat = $numRange; @@ -581,7 +582,7 @@ private function writeSeries(Chart $chart, Chart\Series $series) $this->xmlContent->writeAttribute('chart:repeated', $incRepeat); // > chart:data-point $this->xmlContent->endElement(); - } elseif ($chartType instanceof Pie || $chartType instanceof Pie3D) { + } elseif ($chartType instanceof AbstractTypePie) { $count = count($series->getDataPointFills()); for ($inc = 0; $inc < $count; $inc++) { // chart:data-point @@ -612,7 +613,7 @@ private function writeSeriesStyle(Chart $chart, Chart\Series $series) $this->xmlContent->startElement('style:chart-properties'); $this->xmlContent->writeAttribute('chart:data-label-number', 'value'); $this->xmlContent->writeAttribute('chart:label-position', 'center'); - if ($chartType instanceof Pie3D) { + if ($chartType instanceof AbstractTypePie) { $this->xmlContent->writeAttribute('chart:pie-offset', $chartType->getExplosion()); } if ($chartType instanceof Line) { diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index 01c3929c2..b09b521ad 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -21,6 +21,7 @@ use PhpOffice\PhpPowerpoint\Shape\Chart\Legend; use PhpOffice\PhpPowerpoint\Shape\Chart\PlotArea; use PhpOffice\PhpPowerpoint\Shape\Chart\Title; +use PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractTypeBar; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Bar3D; From 9531032e9a9d10b2884de31f61de00147db69002 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 26 Jun 2015 10:53:53 +0200 Subject: [PATCH 097/115] Improved : Some PHPUnit tests --- .../Tests/Shape/Chart/SeriesTest.php | 18 ++++++++++++++++++ tests/PhpPowerpoint/Tests/Shape/GroupTest.php | 2 +- tests/PhpPowerpoint/Tests/SlideTest.php | 18 ++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php b/tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php index b7acdfa09..93e3c8272 100644 --- a/tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/Chart/SeriesTest.php @@ -40,6 +40,24 @@ public function testConstruct() $this->assertInternalType('array', $object->getValues()); $this->assertEmpty($object->getValues()); } + + public function testDataLabelNumFormat() + { + $object = new Series(); + + $this->assertEmpty($object->getDlblNumFormat()); + $this->assertFalse($object->hasDlblNumFormat()); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setDlblNumFormat('#%')); + + $this->assertEquals('#%', $object->getDlblNumFormat()); + $this->assertTrue($object->hasDlblNumFormat()); + + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Series', $object->setDlblNumFormat()); + + $this->assertEmpty($object->getDlblNumFormat()); + $this->assertFalse($object->hasDlblNumFormat()); + } public function testDataPointFills() { diff --git a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php index 4cb2de864..9f019cdfb 100644 --- a/tests/PhpPowerpoint/Tests/Shape/GroupTest.php +++ b/tests/PhpPowerpoint/Tests/Shape/GroupTest.php @@ -78,7 +78,7 @@ public function testOffsetX() $this->assertEquals(10, $object->getOffsetX()); - $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->setOffsetY(rand(1, 100))); + $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Group', $object->setOffsetX(rand(1, 100))); $this->assertEquals(10, $object->getOffsetX()); } diff --git a/tests/PhpPowerpoint/Tests/SlideTest.php b/tests/PhpPowerpoint/Tests/SlideTest.php index 8cfcc8977..6dd0783bd 100644 --- a/tests/PhpPowerpoint/Tests/SlideTest.php +++ b/tests/PhpPowerpoint/Tests/SlideTest.php @@ -28,6 +28,24 @@ */ class SlideTest extends \PHPUnit_Framework_TestCase { + public function testExtents() + { + $object = new Slide(); + $this->assertNotNull($object->getExtentX()); + + $object = new Slide(); + $this->assertNotNull($object->getExtentY()); + } + + public function testOffset() + { + $object = new Slide(); + $this->assertNotNull($object->getOffsetX()); + + $object = new Slide(); + $this->assertNotNull($object->getOffsetY()); + } + public function testParent() { $object = new Slide(); From 388b211a0f4afd663486b2b7a1da276aa170191f Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 26 Jun 2015 13:46:38 +0200 Subject: [PATCH 098/115] Documentation for Charts - GH-78 --- docs/credits.rst | 2 + docs/images/chart_columnpercent_52x60.png | Bin 0 -> 218 bytes docs/images/chart_columns_52x60.png | Bin 0 -> 214 bytes docs/images/chart_columnstack_52x60.png | Bin 0 -> 218 bytes docs/index.rst | 1 + docs/shapes_chart.rst | 72 ++++++++++++++++++++++ 6 files changed, 75 insertions(+) create mode 100644 docs/images/chart_columnpercent_52x60.png create mode 100644 docs/images/chart_columns_52x60.png create mode 100644 docs/images/chart_columnstack_52x60.png create mode 100644 docs/shapes_chart.rst diff --git a/docs/credits.rst b/docs/credits.rst index 9b6e46c68..379ff303d 100644 --- a/docs/credits.rst +++ b/docs/credits.rst @@ -2,3 +2,5 @@ Credits ======= + + Images from chart page come from the `LibreOffice Core `. \ No newline at end of file diff --git a/docs/images/chart_columnpercent_52x60.png b/docs/images/chart_columnpercent_52x60.png new file mode 100644 index 0000000000000000000000000000000000000000..a1de70236e18fa79378dd2b0e295989da7adedd8 GIT binary patch literal 218 zcmeAS@N?(olHy`uVBq!ia0vp^Hb88`!3-oH7OvI>QYryHA+B!TG5`Pn|NY3bpzI@% z0p#WsG?X(if10Q2qdWVeqDoR)`TFm=ML_jTB|(0{z6{1Le+q!SWKS2zkczmsr>%t= z3^*7915SSb_x-967uSN0lN+9%v(dPxrZnZaWUIk}BA@QU$(sI$#n)@TUv5!2Rr2G5 zx$UdZbg;jdnPX8nUGn4E*M)ad&2;WRv)HKF_V#U`dgX5eB@6CH;_q@T{u_wAnhUg! N!PC{xWt~$(699)zR|o(A literal 0 HcmV?d00001 diff --git a/docs/images/chart_columns_52x60.png b/docs/images/chart_columns_52x60.png new file mode 100644 index 0000000000000000000000000000000000000000..d7237172873491527808d811aa3c8633458ea63a GIT binary patch literal 214 zcmeAS@N?(olHy`uVBq!ia0vp^Hb88`!3-oH7OvI>QYryHA+B!TG5`Pn|NY1lNCMdf zWgp8Km~#pmKFw40(Vcx!Q6(v@eC@J{mx1b;N`m}?eHn~h{uBUt@t!V@Ar*0NPkZw< zDDbcz5Ig<<-}kMlC(pU_2wDGL*z@Yl6#WT0sf*r5+MK`C@NAjcv!n|$SGp~EGxD;M z_1Mlj%FbQgSR69{+|>h?tLoFw&$G2RN<3_R1yqDwjCo=9YJp#0f!PC{x JWt~$(69BZYRa5`~ literal 0 HcmV?d00001 diff --git a/docs/images/chart_columnstack_52x60.png b/docs/images/chart_columnstack_52x60.png new file mode 100644 index 0000000000000000000000000000000000000000..a9c009c64cedbfcf85c520bf37a4ed427f48abbc GIT binary patch literal 218 zcmeAS@N?(olHy`uVBq!ia0vp^Hb88`!3-oH7OvI>QYryHA+B!TG5`Pn2a-7j4M}O` zKDx8Z8JIuKQ~mwO^P-|kLD@&3?9JCNKLgb>l?3?(`!X22{3!tPl097createChartShape(); + +Types +------- + +Area +^^^^ + +TODO + +Bar & Bar3D +^^^^^^^^^^^ + +Stacking +"""""""" + +You can stack multiples series in a same chart. After adding multiples series, you can define the bar grouping with `setBarGrouping` method of AbstractTypeBar. + +.. code-block:: php + + $oBarChart = new Bar(); + $oBarChart->addSeries($oSeries1); + $oBarChart->addSeries($oSeries2); + $oBarChart->addSeries($oSeries3); + $oBarChart->setBarGrouping(Bar::GROUPING_CLUSTERED); + // OR + $oBarChart->setBarGrouping(Bar::GROUPING_STACKED); + // OR + $oBarChart->setBarGrouping(Bar::GROUPING_PERCENTSTACKED); + +- Bar::GROUPING_CLUSTERED +.. image:: images/chart_columns_52x60.png + :width: 120px + :alt: Bar::GROUPING_CLUSTERED + +- Bar::GROUPING_STACKED +.. image:: images/chart_columnstack_52x60.png + :width: 120px + :alt: Bar::GROUPING_STACKED + +- Bar::GROUPING_PERCENTSTACKED +.. image:: images/chart_columnpercent_52x60.png + :width: 120px + :alt: Bar::GROUPING_PERCENTSTACKED + + +Line +^^^^ + +TODO + +Pie & Pie3D +^^^^^^^^^^^ + +TODO + +Scatter +^^^^^^^ + +TODO + From cd5c7069f3df432af5cb955a780513b8aa2f40de Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 26 Jun 2015 13:58:15 +0200 Subject: [PATCH 099/115] Documentation for Charts - GH-78 --- docs/shapes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/shapes.rst b/docs/shapes.rst index 5f6fbf222..c892bd19c 100644 --- a/docs/shapes.rst +++ b/docs/shapes.rst @@ -64,7 +64,7 @@ To create a line, use `createLineShape` method of slide. Chart ------- -To create a chart, use `createChartShape` method of slide. +The Chart has now :ref:`its own page `. Drawing ------- From 895a059b3ee93f12100f4e2ae19d465e67895d53 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 29 Jun 2015 12:35:11 +0200 Subject: [PATCH 100/115] ODPresentation & PowerPoint2007 Writer : Shadow don't work for RichTextShapes - @Progi1984 GH-81 --- src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php index cd0ae8e09..a67395b1b 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Slide.php @@ -500,7 +500,7 @@ private function writeShapeText(XMLWriter $objWriter, RichText $shape, $shapeId) if ($shape->getBorder()->getLineStyle() != Border::LINE_NONE) { $this->writeBorder($objWriter, $shape->getBorder(), ''); } - if ($shape->getShadow()) { + if ($shape->getShadow()->isVisible()) { $this->writeShadow($objWriter, $shape->getShadow()); } // > p:sp\p:spPr From 728d663275306f051ab875dc0614029c7e7acf6f Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 1 Jul 2015 14:04:46 +0200 Subject: [PATCH 101/115] Refactored the PowerPoint97 Reader for managing the group shape and improving evolutions - @Progi1984 GH-110 --- CHANGELOG.md | 1 + src/PhpPowerpoint/Reader/PowerPoint97.php | 4001 +++++++++++++-------- 2 files changed, 2472 insertions(+), 1530 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2ed71bf9..3e39d2214 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ - Improved the sample 04-Table for having two links in a Cell - @Progi1984 GH-93 - Improved the documentation about Table Shapes and cell width - @Progi1984 GH-104 - Some parts of code shared between PHPOffice projects have been moved to PhpOffice/Common - @Progi1984 +- Refactored the PowerPoint97 Reader for managing the group shape and improving evolutions - @Progi1984 GH-110 ## 0.3.0 - 2014-09-22 diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index e122ecf6f..a3515aef6 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -29,6 +29,9 @@ use PhpOffice\PhpPowerpoint\Style\Bullet; use PhpOffice\PhpPowerpoint\Shape\Hyperlink; use PhpOffice\PhpPowerpoint\Shape\Line; +use PhpOffice\Common\String; +use PhpOffice\PhpPowerPoint\Shape\Group; +use PhpOffice\PhpPowerpoint\Shape\PhpOffice\PhpPowerpoint\Shape; /** * Serialized format reader @@ -316,6 +319,20 @@ class PowerPoint97 implements ReaderInterface * @var PhpPowerpoint */ private $oPhpPowerpoint; + /** + * Group Object + * @var Group + */ + private $oCurrentGroup; + /** + * @var boolean + */ + private $bFirstShapeGroup = false; + /** + * Shape Object + * @var AbstractShape + */ + private $oCurrentShape; /** * Stream "Powerpoint Document" * @var string @@ -456,10 +473,12 @@ private function loadOLE($pFilename) */ private function loadPicturesStream() { + $stream = $this->streamPictures; + $pos = 0; $readSuccess = true; do { - $arrayRH = $this->loadRecordHeader($this->streamPictures, $pos); + $arrayRH = $this->loadRecordHeader($stream, $pos); $pos += 8; if ($arrayRH['recVer'] == 0x00 && ($arrayRH['recType'] == 0xF007 || ($arrayRH['recType'] >= 0xF018 && $arrayRH['recType'] <= 0xF117))) { //@link : http://msdn.microsoft.com/en-us/library/dd950560(v=office.12).aspx @@ -468,27 +487,10 @@ private function loadPicturesStream() throw new \Exception('Feature not implemented (l.'.__LINE__.')'); } if ($arrayRH['recType'] >= 0xF018 && $arrayRH['recType'] <= 0xF117) { - //@link : http://msdn.microsoft.com/en-us/library/dd910081(v=office.12).aspx - switch ($arrayRH['recType']) { - case self::OFFICEARTBLIPJPG: - case self::OFFICEARTBLIPPNG: - // rgbUid1 - $pos += 16; - $arrayRH['recLen'] -= 16; - if ($arrayRH['recInstance'] == 0x6E1) { - // rgbUid2 - $pos += 16; - $arrayRH['recLen'] -= 16; - } - // tag - $pos += 1; - $arrayRH['recLen'] -= 1; - // BLIPFileData - $this->arrayPictures[] = substr($this->streamPictures, $pos, $arrayRH['recLen']); - $pos += $arrayRH['recLen']; - break; - default: - throw new \Exception('Feature not implemented (l.'.__LINE__.' : '.dechex($arrayRH['recType'].')')); + $arrayRecord = $this->readRecordOfficeArtBlip($stream, $pos - 8); + if($arrayRecord['length'] > 0) { + $pos += $arrayRecord['length']; + $this->arrayPictures[] = $arrayRecord['picture']; } } } else { @@ -601,9 +603,9 @@ private function loadCurrentUserStream() */ private function loadPowerpointDocumentStream() { - $this->loadUserEditAtom(); + $this->readRecordUserEditAtom($this->streamPowerpointDocument, $this->offsetToCurrentEdit); - $this->loadPersistDirectoryAtom(); + $this->readRecordPersistDirectoryAtom($this->streamPowerpointDocument, $this->offsetPersistDirectory); foreach ($this->rgPersistDirEntry as $offsetDir) { $pos = $offsetDir; @@ -612,1510 +614,196 @@ private function loadPowerpointDocumentStream() $pos += 8; switch ($rh['recType']) { case self::RT_DOCUMENT: - $this->readRTDocument($pos); + $this->readRecordDocumentContainer($this->streamPowerpointDocument, $pos); break; case self::RT_SLIDE: - $this->readRTSlide($pos); + $this->readRecordSlideContainer($this->streamPowerpointDocument, $pos); break; - case self::RT_MAINMASTER: - case self::RT_NOTES: default: + // throw new \Exception('Feature not implemented : l.'.__LINE__.'('.dechex($rh['recType']).')'); break; } } } /** - * UserEditAtom - * @link http://msdn.microsoft.com/en-us/library/dd945746(v=office.12).aspx - * @throws \Exception + * Read a record header + * @param string $stream + * @param integer $pos + * @return multitype */ - private function loadUserEditAtom() + private function loadRecordHeader($stream, $pos) { - $pos = $this->offsetToCurrentEdit; - - $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - if ($rHeader['recVer'] != 0x0 || $rHeader['recInstance'] != 0x000 || $rHeader['recType'] != self::RT_USEREDITATOM || ($rHeader['recLen'] != 0x0000001C && $rHeader['recLen'] != 0x00000020)) { - throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > RecordHeader).'); - } - - // lastSlideIdRef - $pos += 4; - // version - $pos += 2; - - // minorVersion - $minorVersion = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - if ($minorVersion != 0x00) { - throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > minorVersion).'); - } - - // majorVersion - $majorVersion = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - if ($majorVersion != 0x03) { - throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > majorVersion).'); - } - - // offsetLastEdit - $pos += 4; - // offsetPersistDirectory - $this->offsetPersistDirectory = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - - // docPersistIdRef - $docPersistIdRef = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - if ($docPersistIdRef != 0x00000001) { - throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > docPersistIdRef).'); - } - - // persistIdSeed - $pos += 4; - // lastView - $pos += 2; - // unused - $pos += 2; + $rec = self::getInt2d($stream, $pos); + $recType = self::getInt2d($stream, $pos + 2); + $recLen = self::getInt4d($stream, $pos + 4); +// var_export(array( +// 'recVer' => ($rec >> 0) & bindec('1111'), +// 'recInstance' => ($rec >> 4) & bindec('111111111111'), +// 'recType' => $recType, +// 'recLen' => $recLen, +// )); +// echo EOL; + return array( + 'recVer' => ($rec >> 0) & bindec('1111'), + 'recInstance' => ($rec >> 4) & bindec('111111111111'), + 'recType' => $recType, + 'recLen' => $recLen, + ); } /** - * PersistDirectoryAtom - * @link http://msdn.microsoft.com/en-us/library/dd952680(v=office.12).aspx - * @throws \Exception + * Read 8-bit unsigned integer + * + * @param string $data + * @param int $pos + * @return int */ - private function loadPersistDirectoryAtom() + public static function getInt1d($data, $pos) { - $pos = $this->offsetPersistDirectory; - - $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - if ($rHeader['recVer'] != 0x0 || $rHeader['recInstance'] != 0x000 || $rHeader['recType'] != self::RT_PERSISTDIRECTORYATOM) { - throw new \Exception('File PowerPoint 97 in error (Location : PersistDirectoryAtom > RecordHeader).'); - } - // rgPersistDirEntry - // @link : http://msdn.microsoft.com/en-us/library/dd947347(v=office.12).aspx - do { - $data = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - //$persistId = ($data >> 0) & bindec('11111111111111111111'); - $cPersist = ($data >> 20) & bindec('111111111111'); - - $rgPersistOffset = array(); - for ($inc = 0; $inc < $cPersist; $inc++) { - $rgPersistOffset[] = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - } - } while ($rHeader['recLen'] > 0); - $this->rgPersistDirEntry = $rgPersistOffset; + return ord($data[$pos]); } /** - * SlideContainer - * @link http://msdn.microsoft.com/en-us/library/dd946323(v=office.12).aspx + * Read 16-bit unsigned integer + * + * @param string $data * @param int $pos + * @return int */ - private function readRTSlide($pos) + public static function getInt2d($data, $pos) { - $oSlide = $this->oPhpPowerpoint->createSlide(); - // echo '@slide'.EOL; - - // *** slideAtom (32 bytes) - // slideAtom > rh - $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - if ($rHeader['recVer'] != 0x2 || $rHeader['recInstance'] != 0x000 || $rHeader['recType'] != self::RT_SLIDEATOM) { - throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > RecordHeader).'); - } - - // slideAtom > geom - $pos += 4; - - // slideAtom > rgPlaceholderTypes - $rgPlaceholderTypes = array(); - for ($inc = 0; $inc < 8; $inc++) { - $rgPlaceholderTypes[] = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - } - - // slideAtom > masterIdRef - $pos += 4; - // slideAtom > notesIdRef - $pos += 4; - // slideAtom > slideFlags - $pos += 2; - // slideAtom > unused; - $pos += 2; - // *** slideShowSlideInfoAtom (24 bytes) - $pos += 24; - - // perSlideHFContainer (variable) : optional - // perSlideHFContainer > rh - $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - if ($rHeader['recVer'] == 0xF && $rHeader['recInstance'] == 0x000 && $rHeader['recType'] == self::RT_HEADERSFOOTERS) { - $pos += 8; - $pos += $rHeader['recLen']; - } - - // *** rtSlideSyncInfo12 (variable) : optional - // *** drawing (variable) - // drawing > rh - $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - if ($rHeader['recVer'] != 0xF || $rHeader['recInstance'] != 0x000 || $rHeader['recType'] != self::RT_DRAWING) { - throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > rh).'); - } - // print_r('@PPDrawing'.EOL); - - // drawing > OfficeArtDg - // drawing > OfficeArtDg > rh - $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - if ($rHeader['recVer'] != 0xF || $rHeader['recInstance'] != 0x000 || $rHeader['recType'] != 0xF002) { - throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > OfficeArtDg > rh).'); - } - - // drawing > OfficeArtDg > drawingData - // drawing > OfficeArtDg > drawingData > rh - $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - if ($rHeader['recVer'] != 0x0 || $rHeader['recInstance'] >= 0xFFE || $rHeader['recType'] != 0xF008 || $rHeader['recLen'] != 0x00000008) { - throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > OfficeArtDg > drawingData > rh).'); + return ord($data[$pos]) | (ord($data[$pos+1]) << 8); + } + + /** + * Read 32-bit signed integer + * + * @param string $data + * @param int $pos + * @return int + */ + public static function getInt4d($data, $pos) + { + // FIX: represent numbers correctly on 64-bit system + // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334 + // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems + $or24 = ord($data[$pos + 3]); + if ($or24 >= 128) { + // negative number + $ord24 = -abs((256 - $or24) << 24); + } else { + $ord24 = ($or24 & 127) << 24; } - - // drawing > OfficeArtDg > drawingData > csp - $pos += 4; - // drawing > OfficeArtDg > drawingData > spidCur - $pos += 4; - - // drawing > OfficeArtDg > groupShape - // drawing > OfficeArtDg > groupShape > rh - $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $ord24; + } + + /** + * A container record that specifies the animation and sound information for a shape. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd772900(v=office.12).aspx + */ + private function readRecordAnimationInfoContainer($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_ANIMATIONINFO) { + // Record Header + $arrayReturn['length'] += 8; + // animationAtom + // animationSound + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + + return $arrayReturn; + } + + /** + * A container record that specifies information about the document. + * @param string $stream + * @param integer $pos + * @link http://msdn.microsoft.com/en-us/library/dd947357(v=office.12).aspx + */ + private function readRecordDocumentContainer($stream, $pos) + { + $documentAtom = $this->loadRecordHeader($stream, $pos); $pos += 8; - if ($rHeader['recVer'] != 0xF || $rHeader['recInstance'] >= 0xF000 || $rHeader['recType'] != 0xF003) { - throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > OfficeArtDg > groupShape > rh).'); + if ($documentAtom['recVer'] != 0x1 || $documentAtom['recInstance'] != 0x000 || $documentAtom['recType'] != self::RT_DOCUMENTATOM) { + throw new \Exception('File PowerPoint 97 in error (Location : RTDocument > DocumentAtom).'); } + $pos += $documentAtom['recLen']; - // drawing > OfficeArtDg > groupShape > rgfb - do { - $shape = null; - - $arrShpPrimaryOpt = array(); - $arrClientAnchor = array(); - $arrClientTextBox = array(); - $arrClientTextBox['hyperlink'] = array(); - $arrClientTextBox['text'] = ''; - $arrClientTextBox['numParts'] = 0; - $arrClientTextBox['numTexts'] = 0; - - $rhFB = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + $exObjList = $this->loadRecordHeader($stream, $pos); + if ($exObjList['recVer'] == 0xF && $exObjList['recInstance'] == 0x000 && $exObjList['recType'] == self::RT_EXTERNALOBJECTLIST) { $pos += 8; - $rHeader['recLen'] -= 8; - - // print_r(EOL); - // print_r($rhFB); - // print_r(EOL); - if ($rhFB['recVer'] != 0xF || $rhFB['recInstance'] != 0x0000 || ($rhFB['recType'] != 0xF003 && $rhFB['recType'] != 0xF004)) { - throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > OfficeArtDg > groupShape > rgfb).'); + // exObjListAtom > rh + $exObjListAtom = $this->loadRecordHeader($stream, $pos); + if ($exObjListAtom['recVer'] != 0x0 || $exObjListAtom['recInstance'] != 0x000 || $exObjListAtom['recType'] != self::RT_EXTERNALOBJECTLISTATOM || $exObjListAtom['recLen'] != 0x00000004) { + throw new \Exception('File PowerPoint 97 in error (Location : RTDocument > DocumentAtom > exObjList > exObjListAtom).'); } - - switch ($rhFB['recType']) { - case 0xF003: - // OfficeArtSpgrContainer - // OfficeArtSpgrContainer - // print_r('@OfficeArtSpgrContainer'.EOL); - break; - case 0xF004: - // OfficeArtSpContainer - // shapeGroup - $shapeGroup = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - if ($shapeGroup['recVer'] == 0x1 && $shapeGroup['recInstance'] == 0x0000 && $shapeGroup['recType'] == 0xF009 && $shapeGroup['recLen'] == 0x00000010) { - // print_r('$shapeGroup'.EOL); + $pos += 8; + // exObjListAtom > exObjIdSeed + $pos += 4; + // rgChildRec + $exObjList['recLen'] -= 12; + do { + $childRec = $this->loadRecordHeader($stream, $pos); + $pos += 8; + $exObjList['recLen'] -= 8; + switch ($childRec['recType']) { + case self::RT_EXTERNALHYPERLINK: + //@link : http://msdn.microsoft.com/en-us/library/dd944995(v=office.12).aspx + // exHyperlinkAtom > rh + $exHyperlinkAtom = $this->loadRecordHeader($stream, $pos); + if ($exHyperlinkAtom['recVer'] != 0x0 || $exHyperlinkAtom['recInstance'] != 0x000 || $exHyperlinkAtom['recType'] != self::RT_EXTERNALHYPERLINKATOM || $exObjListAtom['recLen'] != 0x00000004) { + throw new \Exception('File PowerPoint 97 in error (Location : RTDocument > DocumentAtom > exObjList > rgChildRec > RT_ExternalHyperlink).'); + } $pos += 8; - $rHeader['recLen'] -= 8; - //$arrShapeGroup['xLeft'] = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - //$arrShapeGroup['yTop'] = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - //$arrShapeGroup['xRight'] = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - //$arrShapeGroup['yBottom'] = self::getInt4d($this->streamPowerpointDocument, $pos); + $exObjList['recLen'] -= 8; + // exHyperlinkAtom > exHyperlinkId + $exHyperlinkId = self::getInt4d($stream, $pos); $pos += 4; - $rHeader['recLen'] -= 4; - } - - // shapeProp - $shapeProp = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - if ($shapeProp['recVer'] == 0x2 && $shapeProp['recType'] == 0xF00A && $shapeProp['recLen'] == 0x00000008) { - $pos += 8; - $rHeader['recLen'] -= 8; - // print_r('$shapeProp'.EOL); + $exObjList['recLen'] -= 4; - // spid - $pos += 4; - $rHeader['recLen'] -= 4; - // data - $pos += 4; - $rHeader['recLen'] -= 4; - } - - // shapePrimaryOptions - $shapePrimaryOptions = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - if ($shapePrimaryOptions['recVer'] == 0x3 && $shapePrimaryOptions['recType'] == 0xF00B) { - $pos += 8; - $rHeader['recLen'] -= 8; - // print_r('$shapePrimaryOptions'.EOL); - //@link : http://msdn.microsoft.com/en-us/library/dd906086(v=office.12).aspx - $officeArtFOPTE = array(); - for ($inc = 0; $inc < $shapePrimaryOptions['recInstance']; $inc++) { - $opid = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $shapePrimaryOptions['recLen'] -= 2; - $optOp = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - $shapePrimaryOptions['recLen'] -= 4; - $officeArtFOPTE[] = array( - 'opid' => ($opid >> 0) & bindec('11111111111111'), - 'fBid' => ($opid >> 14) & bindec('1'), - 'fComplex' => ($opid >> 15) & bindec('1'), - 'op' => $optOp, - ); - } - //@link : http://code.metager.de/source/xref/kde/calligra/filters/libmso/OPID - foreach ($officeArtFOPTE as $opt) { - switch ($opt['opid']) { - case 0x007F: - // Transform : Protection Boolean Properties - //@link : http://msdn.microsoft.com/en-us/library/dd909131(v=office.12).aspx - break; - case 0x0080: - // Text : ltxid - //@link : http://msdn.microsoft.com/en-us/library/dd947446(v=office.12).aspx - break; - case 0x0081: - // Text : dxTextLeft - //@link : http://msdn.microsoft.com/en-us/library/dd953234(v=office.12).aspx - $arrShpPrimaryOpt['insetLeft'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); - break; - case 0x0082: - // Text : dyTextTop - //@link : http://msdn.microsoft.com/en-us/library/dd925068(v=office.12).aspx - $arrShpPrimaryOpt['insetTop'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); - break; - case 0x0083: - // Text : dxTextRight - //@link : http://msdn.microsoft.com/en-us/library/dd906782(v=office.12).aspx - $arrShpPrimaryOpt['insetRight'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); - break; - case 0x0084: - // Text : dyTextBottom - //@link : http://msdn.microsoft.com/en-us/library/dd772858(v=office.12).aspx - $arrShpPrimaryOpt['insetBottom'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); - break; - case 0x0085: - // Text : WrapText - //@link : http://msdn.microsoft.com/en-us/library/dd924770(v=office.12).aspx - break; - case 0x0087: - // Text : anchorText - //@link : http://msdn.microsoft.com/en-us/library/dd948575(v=office.12).aspx - break; - case 0x00BF: - // Text : Text Boolean Properties - //@link : http://msdn.microsoft.com/en-us/library/dd950905(v=office.12).aspx - break; - case 0x0104: - // Blip : pib - //@link : http://msdn.microsoft.com/en-us/library/dd772837(v=office.12).aspx - if ($opt['fComplex'] == 0) { - $arrShpPrimaryOpt['pib'] = $opt['op']; - } else { - // pib Complex - } - break; - case 0x140: - // Geometry : geoLeft - //@link : http://msdn.microsoft.com/en-us/library/dd947489(v=office.12).aspx - // print_r('geoLeft : '.$opt['op'].EOL); - break; - case 0x141: - // Geometry : geoTop - //@link : http://msdn.microsoft.com/en-us/library/dd949459(v=office.12).aspx - // print_r('geoTop : '.$opt['op'].EOL); - break; - case 0x142: - // Geometry : geoRight - //@link : http://msdn.microsoft.com/en-us/library/dd947117(v=office.12).aspx - // print_r('geoRight : '.$opt['op'].EOL); - break; - case 0x143: - // Geometry : geoBottom - //@link : http://msdn.microsoft.com/en-us/library/dd948602(v=office.12).aspx - // print_r('geoBottom : '.$opt['op'].EOL); - break; - case 0x144: - // Geometry : shapePath - //@link : http://msdn.microsoft.com/en-us/library/dd945249(v=office.12).aspx - $arrShpPrimaryOpt['line'] = true; - break; - case 0x145: - // Geometry : pVertices - //@link : http://msdn.microsoft.com/en-us/library/dd949814(v=office.12).aspx - if ($opt['fComplex'] == 1) { - $pos += $opt['op']; - $rHeader['recLen'] -= $opt['op']; - $shapePrimaryOptions['recLen'] -= $opt['op']; - } - break; - case 0x146: - // Geometry : pSegmentInfo - //@link : http://msdn.microsoft.com/en-us/library/dd905742(v=office.12).aspx - if ($opt['fComplex'] == 1) { - $pos += $opt['op']; - $rHeader['recLen'] -= $opt['op']; - $shapePrimaryOptions['recLen'] -= $opt['op']; - } - break; - case 0x155: - // Geometry : pAdjustHandles - //@link : http://msdn.microsoft.com/en-us/library/dd905890(v=office.12).aspx - if ($opt['fComplex'] == 1) { - $pos += $opt['op']; - $rHeader['recLen'] -= $opt['op']; - $shapePrimaryOptions['recLen'] -= $opt['op']; - } - break; - case 0x156: - // Geometry : pGuides - //@link : http://msdn.microsoft.com/en-us/library/dd910801(v=office.12).aspx - if ($opt['fComplex'] == 1) { - $pos += $opt['op']; - $rHeader['recLen'] -= $opt['op']; - $shapePrimaryOptions['recLen'] -= $opt['op']; - } - break; - case 0x157: - // Geometry : pInscribe - //@link : http://msdn.microsoft.com/en-us/library/dd904889(v=office.12).aspx - if ($opt['fComplex'] == 1) { - $pos += $opt['op']; - $rHeader['recLen'] -= $opt['op']; - $shapePrimaryOptions['recLen'] -= $opt['op']; - } - break; - case 0x17F: - // Geometry Boolean Properties - //@link : http://msdn.microsoft.com/en-us/library/dd944968(v=office.12).aspx - break; - case 0x0180: - // Fill : fillType - //@link : http://msdn.microsoft.com/en-us/library/dd947909(v=office.12).aspx - break; - case 0x0181: - // Fill : fillColor - //@link : http://msdn.microsoft.com/en-us/library/dd921332(v=office.12).aspx - $red = ($opt['op'] >> 0) & bindec('11111111'); - $green = ($opt['op'] >> 8) & bindec('11111111'); - $blue = ($opt['op'] >> 16) & bindec('11111111'); - - $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); - $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); - $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); - // echo 'fillColor : '.$strColor.EOL; - break; - case 0x0183: - // Fill : fillBackColor - //@link : http://msdn.microsoft.com/en-us/library/dd950634(v=office.12).aspx - $red = ($opt['op'] >> 0) & bindec('11111111'); - $green = ($opt['op'] >> 8) & bindec('11111111'); - $blue = ($opt['op'] >> 16) & bindec('11111111'); - - $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); - $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); - $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); - // echo 'fillBackColor : '.$strColor.EOL; - break; - case 0x0193: - // Fill : fillRectRight - //@link : http://msdn.microsoft.com/en-us/library/dd951294(v=office.12).aspx - // echo 'fillRectRight : '.\PhpOffice\Common\Drawing::emuToPixels($opt['op']).EOL; - break; - case 0x0194: - // Fill : fillRectBottom - //@link : http://msdn.microsoft.com/en-us/library/dd910194(v=office.12).aspx - // echo 'fillRectBottom : '.\PhpOffice\Common\Drawing::emuToPixels($opt['op']).EOL; - break; - case 0x01BF: - // Fill : Fill Style Boolean Properties - //@link : http://msdn.microsoft.com/en-us/library/dd909380(v=office.12).aspx - break; - case 0x01C0: - // Line Style : lineColor - //@link : http://msdn.microsoft.com/en-us/library/dd920397(v=office.12).aspx - $red = ($opt['op'] >> 0) & bindec('11111111'); - $green = ($opt['op'] >> 8) & bindec('11111111'); - $blue = ($opt['op'] >> 16) & bindec('11111111'); - - $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); - $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); - $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); - - $arrShpPrimaryOpt['lineColor'] = $strColor; - break; - case 0x01C1: - // Line Style : lineOpacity - //@link : http://msdn.microsoft.com/en-us/library/dd923433(v=office.12).aspx - // echo 'lineOpacity : '.dechex($opt['op']).EOL; - break; - case 0x01C2: - // Line Style : lineBackColor - //@link : http://msdn.microsoft.com/en-us/library/dd947669(v=office.12).aspx - break; - case 0x01CB: - // Line Style : lineWidth - //@link : http://msdn.microsoft.com/en-us/library/dd926964(v=office.12).aspx - $arrShpPrimaryOpt['lineWidth'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); - break; - case 0x01D6: - // Line Style : lineJoinStyle - //@link : http://msdn.microsoft.com/en-us/library/dd909643(v=office.12).aspx - break; - case 0x01D7: - // Line Style : lineEndCapStyle - //@link : http://msdn.microsoft.com/en-us/library/dd925071(v=office.12).aspx - break; - case 0x01FF: - // Line Style : Line Style Boolean Properties - //@link : http://msdn.microsoft.com/en-us/library/dd951605(v=office.12).aspx - break; - case 0x0201: - // Shadow Style : shadowColor - //@link : http://msdn.microsoft.com/en-us/library/dd923454(v=office.12).aspx - break; - case 0x0204: - // Shadow Style : shadowOpacity - //@link : http://msdn.microsoft.com/en-us/library/dd920720(v=office.12).aspx - break; - case 0x0205: - // Shadow Style : shadowOffsetX - //@link : http://msdn.microsoft.com/en-us/library/dd945280(v=office.12).aspx - $arrShpPrimaryOpt['shadowOffsetX'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); - break; - case 0x0206: - // Shadow Style : shadowOffsetY - //@link : http://msdn.microsoft.com/en-us/library/dd907855(v=office.12).aspx - $arrShpPrimaryOpt['shadowOffsetY'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); - break; - case 0x023F: - // Shadow Style : Shadow Style Boolean Properties - //@link : http://msdn.microsoft.com/en-us/library/dd947887(v=office.12).aspx - break; - case 0x0304: - // Shape : bWMode - //@link : http://msdn.microsoft.com/en-us/library/dd947659(v=office.12).aspx - break; - case 0x033F: - // Shape Boolean Properties - //@link : http://msdn.microsoft.com/en-us/library/dd951345(v=office.12).aspx - break; - case 0x0380: - // Group Shape Property Set : wzName - //@link : http://msdn.microsoft.com/en-us/library/dd950681(v=office.12).aspx - if ($opt['fComplex'] == 1) { - $pos += $opt['op']; - $rHeader['recLen'] -= $opt['op']; - $shapePrimaryOptions['recLen'] -= $opt['op']; - } - break; - case 0x03BF: - // Group Shape Property Set : Group Shape Boolean Properties - //@link : http://msdn.microsoft.com/en-us/library/dd949807(v=office.12).aspx - break; - default: - throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($opt['opid']).')'); + $this->arrayHyperlinks[$exHyperlinkId] = array(); + // friendlyNameAtom + $friendlyNameAtom = $this->loadRecordHeader($stream, $pos); + if ($friendlyNameAtom['recVer'] == 0x0 && $friendlyNameAtom['recInstance'] == 0x000 && $friendlyNameAtom['recType'] == self::RT_CSTRING && $friendlyNameAtom['recLen'] % 2 == 0) { + $pos += 8; + $exObjList['recLen'] -= 8; + $this->arrayHyperlinks[$exHyperlinkId]['text'] = ''; + for ($inc = 0; $inc < ($friendlyNameAtom['recLen'] / 2); $inc++) { + $char = self::getInt2d($stream, $pos); + $pos += 2; + $exObjList['recLen'] -= 2; + $this->arrayHyperlinks[$exHyperlinkId]['text'] .= chr($char); } } - $pos += $shapePrimaryOptions['recLen']; - $rHeader['recLen'] -= $shapePrimaryOptions['recLen']; - } - - $shpSecondaryOptions1 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $bShpSecondaryOpt1 = false; - if ($shpSecondaryOptions1['recVer'] == 0x3 && $shpSecondaryOptions1['recType'] == 0xF121) { - $pos += 8; - $rHeader['recLen'] -= 8; - $bShpSecondaryOpt1 = true; - // echo '@$rhShapeSecondaryOptions1'.EOL; - } - - $shpTertiaryOptions1 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $bShpTertiaryOptions1 = false; - if ($shpTertiaryOptions1['recVer'] == 0x3 && $shpTertiaryOptions1['recType'] == 0xF122) { - $pos += 8; - $rHeader['recLen'] -= 8; - $bShpTertiaryOptions1 = true; - // echo '@$rhShapeTertiaryOptions1'.EOL; - } - - $rhChildAnchor = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - if ($rhChildAnchor['recVer'] == 0x0 && $rhChildAnchor['recInstance'] == 0x000 && $rhChildAnchor['recType'] == 0xF00F && $rhChildAnchor['recLen'] == 0x00000010) { - $pos += 8; - $rHeader['recLen'] -= 8; - // echo '@$rhChildAnchor'.EOL; - } - - $rhClientAnchor = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - $rHeader['recLen'] -= 8; - //@link : http://msdn.microsoft.com/en-us/library/dd922797(v=office.12).aspx - if ($rhClientAnchor['recVer'] == 0x0 && $rhClientAnchor['recInstance'] == 0x000 && $rhClientAnchor['recType'] == 0xF010 && ($rhClientAnchor['recLen'] == 0x00000008 || $rhClientAnchor['recLen'] == 0x00000010)) { - // echo '$rhClientAnchor'.EOL; - switch ($rhClientAnchor['recLen']) { - case 0x00000008: - // echo '$rhClientAnchor:0x000000008'.EOL; - $arrClientAnchor['top'] = (int) self::getInt2d($this->streamPowerpointDocument, $pos) / 6; - $arrClientAnchor['left'] = (int) self::getInt2d($this->streamPowerpointDocument, $pos + 2) / 6; - $arrClientAnchor['width'] = ((int) self::getInt2d($this->streamPowerpointDocument, $pos + 4) / 6) - $arrClientAnchor['left']; - $arrClientAnchor['height'] = ((int) self::getInt2d($this->streamPowerpointDocument, $pos + 6) / 6) - $arrClientAnchor['left']; - // print_r($arrClientAnchor); - $pos += 8; - break; - case 0x00000010: - // echo '@$rhClientAnchor:0x00000010'.EOL; - break; - } - } else { - $pos -= 8; - $rHeader['recLen'] += 8; - } - - //@link : http://msdn.microsoft.com/en-us/library/dd950927(v=office.12).aspx - $clientData = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - $rHeader['recLen'] -= 8; - if ($clientData['recVer'] == 0xF && $clientData['recInstance'] == 0x000 && $clientData['recType'] == 0xF011) { - // echo '@$clientData'.EOL; - } else { - $pos -= 8; - $rHeader['recLen'] += 8; - } - - //@link : http://msdn.microsoft.com/en-us/library/dd910958(v=office.12).aspx - $clientTextbox = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - $rHeader['recLen'] -= 8; - if ($clientTextbox['recVer'] == 0xF && $clientTextbox['recInstance'] == 0x000 && $clientTextbox['recType'] == 0xF00D) { - // echo '@$clientTextbox'.EOL; - $strLen = 0; - do { - $rhRgChildRec = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - $rHeader['recLen'] -= 8; - $clientTextbox['recLen'] -= 8; - switch ($rhRgChildRec['recType']) { - case self::RT_INTERACTIVEINFO: - // echo '$clientTextbox:RT_InteractiveInfo'.EOL; - //@link : http://msdn.microsoft.com/en-us/library/dd948623(v=office.12).aspx - if ($rhRgChildRec['recInstance'] == 0x0000) { - //@link : http://msdn.microsoft.com/en-us/library/dd952348(v=office.12).aspx - $rhInteractiveAtom = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - $rHeader['recLen'] -= 8; - $clientTextbox['recLen'] -= 8; - if ($rhInteractiveAtom['recVer'] != 0x0 || $rhInteractiveAtom['recInstance'] != 0x000 || $rhInteractiveAtom['recType'] != self::RT_INTERACTIVEINFOATOM || $rhInteractiveAtom['recLen'] != 0x00000010) { - throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > drawing > OfficeArtDg > groupShape > rgfb > shapePrimaryOptions > clientTextbox).'); - } - // soundIdRef - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - // exHyperlinkIdRef - $exHyperlinkIdRef = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - // action - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - // oleVerb - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - // jump - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - // fAnimated (1 bit) - // fStopSound (1 bit) - // fCustomShowReturn (1 bit) - // fVisited (1 bit) - // reserved (4 bits) - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - // hyperlinkType - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - // unused - $pos += 3; - $rHeader['recLen'] -= 3; - $clientTextbox['recLen'] -= 3; - - // Shape - $arrClientTextBox['hyperlink'][]['id'] = $exHyperlinkIdRef; - } - if ($rhRgChildRec['recInstance'] == 0x0001) { - // echo '@todo l.'.__LINE__; - } - break; - case self::RT_STYLETEXTPROPATOM: - // echo '$clientTextbox:RT_StyleTextPropAtom'.EOL; - // @link : http://msdn.microsoft.com/en-us/library/dd950647(v=office.12).aspx - $strLenRT = $strLen + 1; - do { - // rgTextPFRun - $countRgTextPFRun = self::getInt4d($this->streamPowerpointDocument, $pos); - $strLenRT -= $countRgTextPFRun; - $arrClientTextBox['numTexts']++; - $arrClientTextBox['text'.$arrClientTextBox['numTexts']] = array(); - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - - // indent - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - - $masks = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - - $masksData = array(); - $masksData['hasBullet'] = ($masks >> 0) & bindec('1'); - $masksData['bulletHasFont'] = ($masks >> 1) & bindec('1'); - $masksData['bulletHasColor'] = ($masks >> 2) & bindec('1'); - $masksData['bulletHasSize'] = ($masks >> 3) & bindec('1'); - $masksData['bulletFont'] = ($masks >> 4) & bindec('1'); - $masksData['bulletColor'] = ($masks >> 5) & bindec('1'); - $masksData['bulletSize'] = ($masks >> 6) & bindec('1'); - $masksData['bulletChar'] = ($masks >> 7) & bindec('1'); - $masksData['leftMargin'] = ($masks >> 8) & bindec('1'); - $masksData['unused'] = ($masks >> 9) & bindec('1'); - $masksData['indent'] = ($masks >> 10) & bindec('1'); - $masksData['align'] = ($masks >> 11) & bindec('1'); - $masksData['lineSpacing'] = ($masks >> 12) & bindec('1'); - $masksData['spaceBefore'] = ($masks >> 13) & bindec('1'); - $masksData['spaceAfter'] = ($masks >> 14) & bindec('1'); - $masksData['defaultTabSize'] = ($masks >> 15) & bindec('1'); - $masksData['fontAlign'] = ($masks >> 16) & bindec('1'); - $masksData['charWrap'] = ($masks >> 17) & bindec('1'); - $masksData['wordWrap'] = ($masks >> 18) & bindec('1'); - $masksData['overflow'] = ($masks >> 19) & bindec('1'); - $masksData['tabStops'] = ($masks >> 20) & bindec('1'); - $masksData['textDirection'] = ($masks >> 21) & bindec('1'); - $masksData['reserved1'] = ($masks >> 22) & bindec('1'); - $masksData['bulletBlip'] = ($masks >> 23) & bindec('1'); - $masksData['bulletScheme'] = ($masks >> 24) & bindec('1'); - $masksData['bulletHasScheme'] = ($masks >> 25) & bindec('1'); - - $bulletFlags = array(); - if ($masksData['hasBullet'] == 1 || $masksData['bulletHasFont'] == 1 || $masksData['bulletHasColor'] == 1 || $masksData['bulletHasSize '] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - - $bulletFlags['fHasBullet'] = ($data >> 0) & bindec('1'); - $bulletFlags['fBulletHasFont'] = ($data >> 1) & bindec('1'); - $bulletFlags['fBulletHasColor'] = ($data >> 2) & bindec('1'); - $bulletFlags['fBulletHasSize'] = ($data >> 3) & bindec('1'); - } - if ($masksData['bulletChar'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - $arrClientTextBox['text'.$arrClientTextBox['numTexts']]['bulletChar'] = chr($data); - } - if ($masksData['bulletFont'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['bulletSize'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['bulletColor'] == 1) { - $red = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - $green = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - $blue = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - $index = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - - if ($index == 0xFE) { - $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); - $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); - $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); - } - } - if ($masksData['align'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - switch ($data) { - case 0x0000: - $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_LEFT; - break; - case 0x0001: - $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_CENTER; - break; - case 0x0002: - $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_RIGHT; - break; - case 0x0003: - $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_JUSTIFY; - break; - case 0x0004: - $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; - break; - case 0x0005: - $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; - break; - case 0x0006: - $arrClientTextBox['alignH'] = Alignment::HORIZONTAL_JUSTIFY; - break; - default: - break; - } - } - if ($masksData['lineSpacing'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['spaceBefore'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['spaceAfter'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['leftMargin'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - $arrClientTextBox['text'.$arrClientTextBox['numTexts']]['leftMargin'] = (int)round($data/6); - } - if ($masksData['indent'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - $arrClientTextBox['text'.$arrClientTextBox['numTexts']]['indent'] = (int)round($data/6); - } - if ($masksData['defaultTabSize'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['tabStops'] == 1) { - // echo '@todo l.'.__LINE__; - } - if ($masksData['fontAlign'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['charWrap'] == 1 || $masksData['wordWrap'] == 1 || $masksData['overflow'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['textDirection'] == 1) { - // echo '@todo l.'.__LINE__; - } - } while ($strLenRT > 0); - - $strLenRT = $strLen + 1; - do { - // rgTextCFRun - $countRgTextCFRun = self::getInt4d($this->streamPowerpointDocument, $pos); - $strLenRT -= $countRgTextCFRun; - $arrClientTextBox['numParts']++; - $arrClientTextBox['part'.$arrClientTextBox['numParts']] = array(); - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - $arrClientTextBox['part'.$arrClientTextBox['numParts']]['length'] = $countRgTextCFRun; - - $masks = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - - $masksData = array(); - $masksData['bold'] = ($masks >> 0) & bindec('1'); - $masksData['italic'] = ($masks >> 1) & bindec('1'); - $masksData['underline'] = ($masks >> 2) & bindec('1'); - $masksData['unused1'] = ($masks >> 3) & bindec('1'); - $masksData['shadow'] = ($masks >> 4) & bindec('1'); - $masksData['fehint'] = ($masks >> 5) & bindec('1'); - $masksData['unused2'] = ($masks >> 6) & bindec('1'); - $masksData['kumi'] = ($masks >> 7) & bindec('1'); - $masksData['unused3'] = ($masks >> 8) & bindec('1'); - $masksData['emboss'] = ($masks >> 9) & bindec('1'); - $masksData['fHasStyle'] = ($masks >> 10) & bindec('1111'); - $masksData['unused4'] = ($masks >> 14) & bindec('11'); - $masksData['typeface'] = ($masks >> 16) & bindec('1'); - $masksData['size'] = ($masks >> 17) & bindec('1'); - $masksData['color'] = ($masks >> 18) & bindec('1'); - $masksData['position'] = ($masks >> 19) & bindec('1'); - $masksData['pp10ext'] = ($masks >> 20) & bindec('1'); - $masksData['oldEATypeface'] = ($masks >> 21) & bindec('1'); - $masksData['ansiTypeface'] = ($masks >> 22) & bindec('1'); - $masksData['symbolTypeface'] = ($masks >> 23) & bindec('1'); - $masksData['newEATypeface'] = ($masks >> 24) & bindec('1'); - $masksData['csTypeface'] = ($masks >> 25) & bindec('1'); - $masksData['pp11ext'] = ($masks >> 26) & bindec('1'); - if ($masksData['bold'] == 1 || $masksData['italic'] == 1 || $masksData['underline'] == 1 || $masksData['shadow'] == 1 || $masksData['fehint'] == 1 || $masksData['kumi'] == 1 || $masksData['emboss'] == 1 || $masksData['fHasStyle'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - - $fontStyleFlags = array(); - $fontStyleFlags['bold'] = ($data >> 0) & bindec('1'); - $fontStyleFlags['italic'] = ($data >> 1) & bindec('1'); - $fontStyleFlags['underline'] = ($data >> 2) & bindec('1'); - $fontStyleFlags['unused1'] = ($data >> 3) & bindec('1'); - $fontStyleFlags['shadow'] = ($data >> 4) & bindec('1'); - $fontStyleFlags['fehint'] = ($data >> 5) & bindec('1'); - $fontStyleFlags['unused2'] = ($data >> 6) & bindec('1'); - $fontStyleFlags['kumi'] = ($data >> 7) & bindec('1'); - $fontStyleFlags['unused3'] = ($data >> 8) & bindec('1'); - $fontStyleFlags['emboss'] = ($data >> 9) & bindec('1'); - $fontStyleFlags['pp9rt'] = ($data >> 10) & bindec('1111'); - $fontStyleFlags['unused4'] = ($data >> 14) & bindec('11'); - - $arrClientTextBox['part'.$arrClientTextBox['numParts']]['bold'] = ($fontStyleFlags['bold'] == 1) ? true : false; - $arrClientTextBox['part'.$arrClientTextBox['numParts']]['italic'] = ($fontStyleFlags['italic'] == 1) ? true : false; - $arrClientTextBox['part'.$arrClientTextBox['numParts']]['underline'] = ($fontStyleFlags['underline'] == 1) ? true : false; - } - if ($masksData['typeface'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - $arrClientTextBox['part'.$arrClientTextBox['numParts']]['fontName'] = isset($this->arrayFonts[$data]) ? $this->arrayFonts[$data] : ''; - } - if ($masksData['oldEATypeface'] == 1) { - // echo '@todo l.'.__LINE__; - } - if ($masksData['ansiTypeface'] == 1) { - // echo '@todo l.'.__LINE__; - } - if ($masksData['symbolTypeface'] == 1) { - // echo '@todo l.'.__LINE__; - } - if ($masksData['size'] == 1) { - $arrClientTextBox['part'.$arrClientTextBox['numParts']]['fontSize'] = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['color'] == 1) { - $red = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - $green = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - $blue = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - $index = self::getInt1d($this->streamPowerpointDocument, $pos); - $pos += 1; - $rHeader['recLen'] -= 1; - $clientTextbox['recLen'] -= 1; - - if ($index == 0xFE) { - $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); - $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); - $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); - - $arrClientTextBox['part'.$arrClientTextBox['numParts']]['color'] = new Color('FF'.$strColor); - } - } - if ($masksData['position'] == 1) { - // echo '@todo l.'.__LINE__; - } - } while ($strLenRT > 0); - break; - case self::RT_TEXTCHARSATOM: - // echo '$clientTextbox:RT_TextCharsAtom'.EOL; - // @link : http://msdn.microsoft.com/en-us/library/dd772921(v=office.12).aspx - $strLen = (int)($rhRgChildRec['recLen']/2); - for ($inc = 0; $inc < $rhRgChildRec['recLen']/2; $inc++) { - $char = self::getInt2d($this->streamPowerpointDocument, $pos); - if ($char == 0x0B) { - $char = 0x20; - } - $arrClientTextBox['text'] .= chr($char); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - // echo $arrClientTextBox['text'].EOL; - break; - case self::RT_TEXTHEADERATOM: - // echo '$clientTextbox:RT_TextHeaderAtom'.EOL; - // @link : http://msdn.microsoft.com/en-us/library/dd905272(v=office.12).aspx - // textType - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - break; - case self::RT_TEXTINTERACTIVEINFOATOM: - // echo '$clientTextbox:RT_TextInteractiveInfoAtom'.EOL; - //@link : http://msdn.microsoft.com/en-us/library/dd947973(v=office.12).aspx - if ($rhRgChildRec['recInstance'] == 0x0000) { - //@link : http://msdn.microsoft.com/en-us/library/dd944072(v=office.12).aspx - $arrClientTextBox['hyperlink'][count($arrClientTextBox['hyperlink']) - 1]['start'] = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - - $arrClientTextBox['hyperlink'][count($arrClientTextBox['hyperlink']) - 1]['end'] = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - } - if ($rhRgChildRec['recInstance'] == 0x0001) { - // echo '@todo l.'.__LINE__; - } - break; - case self::RT_TEXTSPECIALINFOATOM: - // echo '$clientTextbox:RT_TextSpecialInfoAtom'.EOL; - // @link : http://msdn.microsoft.com/en-us/library/dd945296(v=office.12).aspx - $strLenRT = $strLen + 1; - do { - $count = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - $strLenRT -= $count; - $data = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - $masksData = array(); - $masksData['spell'] = ($data >> 0) & bindec('1'); - $masksData['lang'] = ($data >> 1) & bindec('1'); - $masksData['altLang'] = ($data >> 2) & bindec('1'); - $masksData['unused1'] = ($data >> 3) & bindec('1'); - $masksData['unused2'] = ($data >> 4) & bindec('1'); - $masksData['fPp10ext'] = ($data >> 5) & bindec('1'); - $masksData['fBidi'] = ($data >> 6) & bindec('1'); - $masksData['unused3'] = ($data >> 7) & bindec('1'); - $masksData['reserved1'] = ($data >> 8) & bindec('1'); - $masksData['smartTag'] = ($data >> 9) & bindec('1'); - - if ($masksData['spell'] == 1) { - $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - $masksSpell = array(); - $masksSpell['error'] = ($data >> 0) & bindec('1'); - $masksSpell['clean'] = ($data >> 1) & bindec('1'); - $masksSpell['grammar'] = ($data >> 2) & bindec('1'); - } - if ($masksData['lang'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['altLang'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['fBidi'] == 1) { - // echo '@todo l.'.__LINE__; - } - if ($masksData['fPp10ext'] == 1) { - // echo '@todo l.'.__LINE__; - } - if ($masksData['smartTag'] == 1) { - // echo '@todo l.'.__LINE__; - } - } while ($strLenRT > 0); - break; - case self::RT_TEXTRULERATOM: - // echo '$clientTextbox:RT_TextRulerAtom'.EOL; - // @link : http://msdn.microsoft.com/en-us/library/dd953212(v=office.12).aspx - $data = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $rHeader['recLen'] -= 4; - $clientTextbox['recLen'] -= 4; - $masksData = array(); - $masksData['fDefaultTabSize'] = ($data >> 0) & bindec('1'); - $masksData['fCLevels'] = ($data >> 1) & bindec('1'); - $masksData['fTabStops'] = ($data >> 2) & bindec('1'); - $masksData['fLeftMargin1'] = ($data >> 3) & bindec('1'); - $masksData['fLeftMargin2'] = ($data >> 4) & bindec('1'); - $masksData['fLeftMargin3'] = ($data >> 5) & bindec('1'); - $masksData['fLeftMargin4'] = ($data >> 6) & bindec('1'); - $masksData['fLeftMargin5'] = ($data >> 7) & bindec('1'); - $masksData['fIndent1'] = ($data >> 8) & bindec('1'); - $masksData['fIndent2'] = ($data >> 9) & bindec('1'); - $masksData['fIndent3'] = ($data >> 10) & bindec('1'); - $masksData['fIndent4'] = ($data >> 11) & bindec('1'); - $masksData['fIndent5'] = ($data >> 12) & bindec('1'); - - if ($masksData['fCLevels'] == 1) { - // echo '@todo l.'.__LINE__; - } - if ($masksData['fDefaultTabSize'] == 1) { - // echo '@todo l.'.__LINE__; - } - if ($masksData['fTabStops'] == 1) { - $count = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - $arrayTabStops = array(); - for ($inc = 0; $inc < $count; $inc++) { - $position = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - $type = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - $arrayTabStops[] = array( - 'position' => $position, - 'type' => $type, - ); - } - } - if ($masksData['fLeftMargin1'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['fIndent1'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['fLeftMargin2'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['fIndent2'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['fLeftMargin3'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['fIndent3'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['fLeftMargin4'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['fIndent4'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['fLeftMargin5'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - if ($masksData['fIndent5'] == 1) { - // $data = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $rHeader['recLen'] -= 2; - $clientTextbox['recLen'] -= 2; - } - break; - default: - // echo EOL; - // print_r($rhRgChildRec); - // echo EOL; - // echo '@$type : '.dechex($rhRgChildRec['recType']).EOL; - } - } while ($clientTextbox['recLen'] > 0); - } else { - $pos -= 8; - $rHeader['recLen'] += 8; - } - $shpSecondaryOptions2 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - $rHeader['recLen'] -= 8; - if ($bShpSecondaryOpt1 === true && $shpSecondaryOptions2['recVer'] == 0x3 && $shpSecondaryOptions2['recType'] == 0xF121) { - } else { - $pos -= 8; - $rHeader['recLen'] += 8; - } - - $shpTertiaryOptions2 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - $rHeader['recLen'] -= 8; - if ($bShpTertiaryOptions1 === true && $shpTertiaryOptions2['recVer'] == 0x3 && $shpTertiaryOptions2['recType'] == 0xF122) { - } else { - $pos -= 8; - $rHeader['recLen'] += 8; - } - break; - } - - // Cleaning variables - if (empty($arrClientTextBox['hyperlink'])) { - unset($arrClientTextBox['hyperlink']); - } - if (empty($arrClientTextBox['text'])) { - unset($arrClientTextBox['text']); - } - if (empty($arrClientTextBox['numParts'])) { - unset($arrClientTextBox['numParts']); - } - if (empty($arrClientTextBox['numTexts'])) { - unset($arrClientTextBox['numTexts']); - } - // echo EOL; - if (isset($arrShpPrimaryOpt['pib']) && isset($this->arrayPictures[$arrShpPrimaryOpt['pib'] - 1])) { - // echo '//IMAGE'.EOL; - $gdImage = imagecreatefromstring($this->arrayPictures[$arrShpPrimaryOpt['pib'] - 1]); - - $shape = new MemoryDrawing(); - $shape->setImageResource($gdImage); - - if (isset($arrShpPrimaryOpt['shadowOffsetX']) && $arrShpPrimaryOpt['shadowOffsetX'] != 0 && isset($arrShpPrimaryOpt['shadowOffsetY']) && $arrShpPrimaryOpt['shadowOffsetY'] != 0) { - $shape->getShadow()->setVisible(true); - if ($arrShpPrimaryOpt['shadowOffsetX'] > 0 && $arrShpPrimaryOpt['shadowOffsetX'] == $arrShpPrimaryOpt['shadowOffsetY']) { - $shape->getShadow()->setDistance($arrShpPrimaryOpt['shadowOffsetX'])->setDirection(45); - } - } - if (!is_null($shape) && !empty($arrClientAnchor)) { - $shape->setOffsetX($arrClientAnchor['left']); - $shape->setOffsetY($arrClientAnchor['top']); - $shape->setWidth($arrClientAnchor['width']); - $shape->setHeight($arrClientAnchor['height']); - } - } - - if (!empty($arrClientTextBox) && isset($arrClientTextBox)) { - // echo '//TEXT'.EOL; - // echo '

';
-                // print_r($arrClientTextBox);
-                // echo '
'; - $shape = new RichText(); - if (isset($arrClientTextBox['alignH'])) { - $shape->getActiveParagraph()->getAlignment()->setHorizontal($arrClientTextBox['alignH']); - } - - $start = 0; - // echo $arrClientTextBox['text'].EOL; - - $lastLevel = -1; - $lastMarginLeft = 0; - for ($inc = 1; $inc <= $arrClientTextBox['numParts']; $inc++) { - if ($arrClientTextBox['numParts'] == $arrClientTextBox['numTexts'] && isset($arrClientTextBox['text'.$inc])) { - if (isset($arrClientTextBox['text'.$inc]['bulletChar'])) { - $shape->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET); - $shape->getActiveParagraph()->getBulletStyle()->setBulletChar($arrClientTextBox['text'.$inc]['bulletChar']); - } - // Indent - $indent = 0; - if (isset($arrClientTextBox['text'.$inc]['indent'])) { - $indent = $arrClientTextBox['text'.$inc]['indent']; - } - if (isset($arrClientTextBox['text'.$inc]['leftMargin'])) { - if ($lastMarginLeft > $arrClientTextBox['text'.$inc]['leftMargin']) { - $lastLevel--; - } - if ($lastMarginLeft < $arrClientTextBox['text'.$inc]['leftMargin']) { - $lastLevel++; - } - $shape->getActiveParagraph()->getAlignment()->setLevel($lastLevel); - $lastMarginLeft = $arrClientTextBox['text'.$inc]['leftMargin']; - - $shape->getActiveParagraph()->getAlignment()->setMarginLeft($arrClientTextBox['text'.$inc]['leftMargin']); - $shape->getActiveParagraph()->getAlignment()->setIndent($indent - $arrClientTextBox['text'.$inc]['leftMargin']); - } - - } - // Texte - $sText = substr($arrClientTextBox['text'], $start, $arrClientTextBox['part'.$inc]['length']); - $sHyperlinkURL = ''; - if (empty($sText)) { - // Is there a hyperlink ? - if (isset($arrClientTextBox['hyperlink']) && is_array($arrClientTextBox['hyperlink']) && !empty($arrClientTextBox['hyperlink'])) { - foreach ($arrClientTextBox['hyperlink'] as $itmHyperlink) { - if ($itmHyperlink['start'] == $start && ($itmHyperlink['end'] - $itmHyperlink['start']) == $arrClientTextBox['part'.$inc]['length']) { - $sText = $this->arrayHyperlinks[$itmHyperlink['id']]['text']; - $sHyperlinkURL = $this->arrayHyperlinks[$itmHyperlink['id']]['url']; - break; - } - } - } - } - // New paragraph - $bCreateParagraph = false; - if (strpos($sText, "\r") !== false) { - $bCreateParagraph = true; - $sText = str_replace("\r", '', $sText); - } - // TextRun - $txtRun = $shape->createTextRun($sText); - if (isset($arrClientTextBox['part'.$inc]['bold'])) { - $txtRun->getFont()->setBold($arrClientTextBox['part'.$inc]['bold']); - } - if (isset($arrClientTextBox['part'.$inc]['italic'])) { - $txtRun->getFont()->setItalic($arrClientTextBox['part'.$inc]['italic']); - } - if (isset($arrClientTextBox['part'.$inc]['underline'])) { - $txtRun->getFont()->setUnderline($arrClientTextBox['part'.$inc]['underline']); - } - if (isset($arrClientTextBox['part'.$inc]['fontName'])) { - $txtRun->getFont()->setName($arrClientTextBox['part'.$inc]['fontName']); - } - if (isset($arrClientTextBox['part'.$inc]['fontSize'])) { - $txtRun->getFont()->setSize($arrClientTextBox['part'.$inc]['fontSize']); - } - if (isset($arrClientTextBox['part'.$inc]['color'])) { - $txtRun->getFont()->setColor($arrClientTextBox['part'.$inc]['color']); - } - // Hyperlink - if (!empty($sHyperlinkURL)) { - $txtRun->setHyperlink(new Hyperlink($sHyperlinkURL)); - } - - $start += $arrClientTextBox['part'.$inc]['length']; - if ($bCreateParagraph) { - $shape->createParagraph(); - } - } - if (!is_null($shape) && !empty($arrClientAnchor)) { - $shape->setOffsetX($arrClientAnchor['left']); - $shape->setOffsetY($arrClientAnchor['top']); - $shape->setWidth($arrClientAnchor['width']); - $shape->setHeight($arrClientAnchor['height']); - } - } - if (isset($arrShpPrimaryOpt['line']) && $arrShpPrimaryOpt['line'] == true) { - // echo '//LINE'.EOL; - $shape = new Line(0, 0, 0, 0); - if (isset($arrShpPrimaryOpt['lineColor'])) { - $shape->getBorder()->getColor()->setARGB('FF'.$arrShpPrimaryOpt['lineColor']); - } - if (!empty($arrClientAnchor)) { - $shape->setOffsetX($arrClientAnchor['left']); - $shape->setOffsetY($arrClientAnchor['top']); - $shape->setWidth($arrClientAnchor['width']); - $shape->setHeight($arrShpPrimaryOpt['lineWidth']); - } - } - - if ($shape instanceof RichText) { - if (isset($arrShpPrimaryOpt['insetBottom'])) { - $shape->setInsetBottom($arrShpPrimaryOpt['insetBottom']); - } - if (isset($arrShpPrimaryOpt['insetLeft'])) { - $shape->setInsetLeft($arrShpPrimaryOpt['insetLeft']); - } - if (isset($arrShpPrimaryOpt['insetRight'])) { - $shape->setInsetRight($arrShpPrimaryOpt['insetRight']); - } - if (isset($arrShpPrimaryOpt['insetTop'])) { - $shape->setInsetTop($arrShpPrimaryOpt['insetTop']); - } - } - - - if (!is_null($shape) && $shape instanceof AbstractShape) { - // echo '//SHAPE'.EOL; - $oSlide->addShape($shape); - } - // echo '//END.....'.EOL.EOL.EOL; - } while ($rHeader['recLen'] > 0); - - - // *** slideSchemeColorSchemeAtom (40 bytes) - // slideSchemeColorSchemeAtom > rh - $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - if ($rHeader['recVer'] != 0x0 || $rHeader['recInstance'] != 0x001 || $rHeader['recType'] != self::RT_COLORSCHEMEATOM || $rHeader['recLen'] != 0x00000020) { - throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > slideSchemeColorSchemeAtom > rh).'); - } - // slideSchemeColorSchemeAtom > rgSchemeColor - $rgSchemeColor = array(); - for ($inc = 0; $inc <= 7; $inc++) { - $rgSchemeColor[] = array( - 'red' => self::getInt1d($this->streamPowerpointDocument, $pos + $inc * 4), - 'green' => self::getInt1d($this->streamPowerpointDocument, $pos + $inc * 4 + 1), - 'blue' => self::getInt1d($this->streamPowerpointDocument, $pos + $inc * 4 + 2), - ); - } - $pos += (8 * 4); - - // *** slideNameAtom (variable) - // *** slideProgTagsContainer (variable). - // slideProgTagsContainer > rh - $rHeader = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - if ($rHeader['recVer'] != 0xF || $rHeader['recInstance'] != 0x000 || $rHeader['recType'] != self::RT_PROGTAGS) { - throw new \Exception('File PowerPoint 97 in error (Location : RTSlide > slideProgTagsContainer > rh).'); - } - } - - /** - * DocumentContainer - * @link http://msdn.microsoft.com/en-us/library/dd947357(v=office.12).aspx - * @param integer $pos - */ - private function readRTDocument($pos) - { - $documentAtom = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - if ($documentAtom['recVer'] != 0x1 || $documentAtom['recInstance'] != 0x000 || $documentAtom['recType'] != self::RT_DOCUMENTATOM) { - throw new \Exception('File PowerPoint 97 in error (Location : RTDocument > DocumentAtom).'); - } - $pos += $documentAtom['recLen']; - - $exObjList = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - if ($exObjList['recVer'] == 0xF && $exObjList['recInstance'] == 0x000 && $exObjList['recType'] == self::RT_EXTERNALOBJECTLIST) { - $pos += 8; - // exObjListAtom > rh - $exObjListAtom = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - if ($exObjListAtom['recVer'] != 0x0 || $exObjListAtom['recInstance'] != 0x000 || $exObjListAtom['recType'] != self::RT_EXTERNALOBJECTLISTATOM || $exObjListAtom['recLen'] != 0x00000004) { - throw new \Exception('File PowerPoint 97 in error (Location : RTDocument > DocumentAtom > exObjList > exObjListAtom).'); - } - $pos += 8; - // exObjListAtom > exObjIdSeed - $pos += 4; - // rgChildRec - $exObjList['recLen'] -= 12; - do { - $childRec = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - $pos += 8; - $exObjList['recLen'] -= 8; - switch ($childRec['recType']) { - case self::RT_EXTERNALHYPERLINK: - //@link : http://msdn.microsoft.com/en-us/library/dd944995(v=office.12).aspx - // exHyperlinkAtom > rh - $exHyperlinkAtom = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - if ($exHyperlinkAtom['recVer'] != 0x0 || $exHyperlinkAtom['recInstance'] != 0x000 || $exHyperlinkAtom['recType'] != self::RT_EXTERNALHYPERLINKATOM || $exObjListAtom['recLen'] != 0x00000004) { - throw new \Exception('File PowerPoint 97 in error (Location : RTDocument > DocumentAtom > exObjList > rgChildRec > RT_ExternalHyperlink).'); - } - $pos += 8; - $exObjList['recLen'] -= 8; - // exHyperlinkAtom > exHyperlinkId - $exHyperlinkId = self::getInt4d($this->streamPowerpointDocument, $pos); - $pos += 4; - $exObjList['recLen'] -= 4; - - $this->arrayHyperlinks[$exHyperlinkId] = array(); - // friendlyNameAtom - $friendlyNameAtom = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - if ($friendlyNameAtom['recVer'] == 0x0 && $friendlyNameAtom['recInstance'] == 0x000 && $friendlyNameAtom['recType'] == self::RT_CSTRING && $friendlyNameAtom['recLen'] % 2 == 0) { - $pos += 8; - $exObjList['recLen'] -= 8; - $this->arrayHyperlinks[$exHyperlinkId]['text'] = ''; - for ($inc = 0; $inc < ($friendlyNameAtom['recLen'] / 2); $inc++) { - $char = self::getInt2d($this->streamPowerpointDocument, $pos); - $pos += 2; - $exObjList['recLen'] -= 2; - $this->arrayHyperlinks[$exHyperlinkId]['text'] .= chr($char); - } - } - // targetAtom - $targetAtom = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); - if ($targetAtom['recVer'] == 0x0 && $targetAtom['recInstance'] == 0x001 && $targetAtom['recType'] == self::RT_CSTRING && $targetAtom['recLen'] % 2 == 0) { + // targetAtom + $targetAtom = $this->loadRecordHeader($stream, $pos); + if ($targetAtom['recVer'] == 0x0 && $targetAtom['recInstance'] == 0x001 && $targetAtom['recType'] == self::RT_CSTRING && $targetAtom['recLen'] % 2 == 0) { $pos += 8; $exObjList['recLen'] -= 8; $this->arrayHyperlinks[$exHyperlinkId]['url'] = ''; for ($inc = 0; $inc < ($targetAtom['recLen'] / 2); $inc++) { - $char = self::getInt2d($this->streamPowerpointDocument, $pos); + $char = self::getInt2d($stream, $pos); $pos += 2; $exObjList['recLen'] -= 2; $this->arrayHyperlinks[$exHyperlinkId]['url'] .= chr($char); } } // locationAtom - $locationAtom = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + $locationAtom = $this->loadRecordHeader($stream, $pos); if ($locationAtom['recVer'] == 0x0 && $locationAtom['recInstance'] == 0x003 && $locationAtom['recType'] == self::RT_CSTRING && $locationAtom['recLen'] % 2 == 0) { $pos += 8; $exObjList['recLen'] -= 8; $string = ''; for ($inc = 0; $inc < ($locationAtom['recLen'] / 2); $inc++) { - $char = self::getInt2d($this->streamPowerpointDocument, $pos); + $char = self::getInt2d($stream, $pos); $pos += 2; $exObjList['recLen'] -= 2; $string .= chr($char); @@ -2129,22 +817,22 @@ private function readRTDocument($pos) } //@link : http://msdn.microsoft.com/en-us/library/dd907813(v=office.12).aspx - $documentTextInfo = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + $documentTextInfo = $this->loadRecordHeader($stream, $pos); if ($documentTextInfo['recVer'] == 0xF && $documentTextInfo['recInstance'] == 0x000 && $documentTextInfo['recType'] == self::RT_ENVIRONMENT) { $pos += 8; //@link : http://msdn.microsoft.com/en-us/library/dd952717(v=office.12).aspx - $kinsoku = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + $kinsoku = $this->loadRecordHeader($stream, $pos); if ($kinsoku['recVer'] == 0xF && $kinsoku['recInstance'] == 0x002 && $kinsoku['recType'] == self::RT_KINSOKU) { $pos += 8; $pos += $kinsoku['recLen']; } //@link : http://msdn.microsoft.com/en-us/library/dd948152(v=office.12).aspx - $fontCollection = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + $fontCollection = $this->loadRecordHeader($stream, $pos); if ($fontCollection['recVer'] == 0xF && $fontCollection['recInstance'] == 0x000 && $fontCollection['recType'] == self::RT_FONTCOLLECTION) { $pos += 8; do { - $fontEntityAtom = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + $fontEntityAtom = $this->loadRecordHeader($stream, $pos); $pos += 8; $fontCollection['recLen'] -= 8; if ($fontEntityAtom['recVer'] != 0x0 || $fontEntityAtom['recInstance'] > 128 || $fontEntityAtom['recType'] != self::RT_FONTENTITYATOM) { @@ -2152,7 +840,7 @@ private function readRTDocument($pos) } else { $string = ''; for ($inc = 0; $inc < 32; $inc++) { - $char = self::getInt2d($this->streamPowerpointDocument, $pos); + $char = self::getInt2d($stream, $pos); $pos += 2; $fontCollection['recLen'] -= 2; $string .= chr($char); @@ -2181,7 +869,7 @@ private function readRTDocument($pos) $fontCollection['recLen'] -= 1; } - $fontEmbedData1 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + $fontEmbedData1 = $this->loadRecordHeader($stream, $pos); if ($fontEmbedData1['recVer'] == 0x0 && $fontEmbedData1['recInstance'] >= 0x000 && $fontEmbedData1['recInstance'] <= 0x003 && $fontEmbedData1['recType'] == self::RT_FONTEMBEDDATABLOB) { $pos += 8; $fontCollection['recLen'] -= 8; @@ -2189,7 +877,7 @@ private function readRTDocument($pos) $fontCollection['recLen'] -= $fontEmbedData1['recLen']; } - $fontEmbedData2 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + $fontEmbedData2 = $this->loadRecordHeader($stream, $pos); if ($fontEmbedData2['recVer'] == 0x0 && $fontEmbedData2['recInstance'] >= 0x000 && $fontEmbedData2['recInstance'] <= 0x003 && $fontEmbedData2['recType'] == self::RT_FONTEMBEDDATABLOB) { $pos += 8; $fontCollection['recLen'] -= 8; @@ -2197,7 +885,7 @@ private function readRTDocument($pos) $fontCollection['recLen'] -= $fontEmbedData2['recLen']; } - $fontEmbedData3 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + $fontEmbedData3 = $this->loadRecordHeader($stream, $pos); if ($fontEmbedData3['recVer'] == 0x0 && $fontEmbedData3['recInstance'] >= 0x000 && $fontEmbedData3['recInstance'] <= 0x003 && $fontEmbedData3['recType'] == self::RT_FONTEMBEDDATABLOB) { $pos += 8; $fontCollection['recLen'] -= 8; @@ -2205,7 +893,7 @@ private function readRTDocument($pos) $fontCollection['recLen'] -= $fontEmbedData3['recLen']; } - $fontEmbedData4 = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); + $fontEmbedData4 = $this->loadRecordHeader($stream, $pos); if ($fontEmbedData4['recVer'] == 0x0 && $fontEmbedData4['recInstance'] >= 0x000 && $fontEmbedData4['recInstance'] <= 0x003 && $fontEmbedData4['recType'] == self::RT_FONTEMBEDDATABLOB) { $pos += 8; $fontCollection['recLen'] -= 8; @@ -2217,69 +905,2322 @@ private function readRTDocument($pos) } } } - + /** - * Read a record header + * An atom record that specifies information about a slide. * @param string $stream * @param integer $pos - * @return multitype + * @link https://msdn.microsoft.com/en-us/library/dd923801(v=office.12).aspx */ - private function loadRecordHeader($stream, $pos) + private function readRecordDrawingContainer($stream, $pos) { - $rec = self::getInt2d($stream, $pos); - $recType = self::getInt2d($stream, $pos + 2); - $recLen = self::getInt4d($stream, $pos + 4); - return array( - 'recVer' => ($rec >> 0) & bindec('1111'), - 'recInstance' => ($rec >> 4) & bindec('111111111111'), - 'recType' => $recType, - 'recLen' => $recLen, + $arrayReturn = array( + 'length' => 0, ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_DRAWING) { + // Record Header + $arrayReturn['length'] += 8; + + $officeArtDg = $this->readRecordOfficeArtDgContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $officeArtDg['length']; + } + + return $arrayReturn; } /** - * Read 8-bit unsigned integer - * - * @param string $data - * @param int $pos - * @return int + * An atom record that specifies a reference to an external object. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd910388(v=office.12).aspx */ - public static function getInt1d($data, $pos) + private function readRecordExObjRefAtom($stream, $pos) { - return ord($data[$pos]); + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_EXTERNALOBJECTREFATOM && $data['recLen'] == 0x00000004) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; } /** - * Read 16-bit unsigned integer - * - * @param string $data - * @param int $pos - * @return int + * An atom record that specifies a type of action to be performed. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd953300(v=office.12).aspx */ - public static function getInt2d($data, $pos) + private function readRecordInteractiveInfoAtom($stream, $pos) { - return ord($data[$pos]) | (ord($data[$pos+1]) << 8); + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_INTERACTIVEINFOATOM && $data['recLen'] == 0x00000010) { + // Record Header + $arrayReturn['length'] += 8; + // soundIdRef + $arrayReturn['length'] += 4; + // exHyperlinkIdRef + $arrayReturn['exHyperlinkIdRef'] = self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + // action + $arrayReturn['length'] += 1; + // oleVerb + $arrayReturn['length'] += 1; + // jump + $arrayReturn['length'] += 1; + // fAnimated (1 bit) + // fStopSound (1 bit) + // fCustomShowReturn (1 bit) + // fVisited (1 bit) + // reserved (4 bits) + $arrayReturn['length'] += 1; + // hyperlinkType + $arrayReturn['length'] += 1; + // unused + $arrayReturn['length'] += 3; + } + + return $arrayReturn; } /** - * Read 32-bit signed integer - * - * @param string $data - * @param int $pos - * @return int + * An atom record that specifies the name of a macro, a file name, or a named show. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd925121(v=office.12).aspx */ - public static function getInt4d($data, $pos) + private function readRecordMacroNameAtom($stream, $pos) { - // FIX: represent numbers correctly on 64-bit system - // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334 - // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems - $or24 = ord($data[$pos + 3]); - if ($or24 >= 128) { - // negative number - $ord24 = -abs((256 - $or24) << 24); - } else { - $ord24 = ($or24 & 127) << 24; + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x002 && $data['recType'] == self::RT_CSTRING && $data['recLen'] % 2 == 0) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * A container record that specifies what actions to perform when interacting with an object by means of a mouse click. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd952348(v=office.12).aspx + */ + private function readRecordMouseClickInteractiveInfoContainer($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_INTERACTIVEINFO) { + // Record Header + $arrayReturn['length'] += 8; + // interactiveInfoAtom + $dataInteractiveInfoAtom = $this->readRecordInteractiveInfoAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataInteractiveInfoAtom['length']; + if ($dataInteractiveInfoAtom['length'] > 0) { + $arrayReturn['exHyperlinkIdRef'] = $dataInteractiveInfoAtom['exHyperlinkIdRef']; + } + // macroNameAtom + $dataInteractiveInfoAtom = $this->readRecordMacroNameAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataInteractiveInfoAtom['length']; + } + + return $arrayReturn; + } + + /** + * A container record that specifies what actions to perform when interacting with an object by moving the mouse cursor over it. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd925811(v=office.12).aspx + */ + private function readRecordMouseOverInteractiveInfoContainer($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x001 && $data['recType'] == self::RT_INTERACTIVEINFO) { + // Record Header + $arrayReturn['length'] += 8; + // interactiveInfoAtom + // macroNameAtom + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + + return $arrayReturn; + } + + /** + * The OfficeArtBlip record specifies BLIP file data. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd910081(v=office.12).aspx + */ + private function readRecordOfficeArtBlip($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + 'picture' => null + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && ($data['recType'] >= 0xF018 && $data['recType'] <= 0xF117)) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + switch ($data['recType']) { + case self::OFFICEARTBLIPJPG: + case self::OFFICEARTBLIPPNG: + // rgbUid1 + $arrayReturn['length'] += 16; + $data['recLen'] -= 16; + if ($data['recInstance'] == 0x6E1) { + // rgbUid2 + $arrayReturn['length'] += 16; + $data['recLen'] -= 16; + } + // tag + $arrayReturn['length'] += 1; + $data['recLen'] -= 1; + // BLIPFileData + $arrayReturn['picture'] = substr($this->streamPictures, $pos + $arrayReturn['length'], $data['recLen']); + $arrayReturn['length'] += $data['recLen']; + break; + default: + throw new \Exception('Feature not implemented (l.'.__LINE__.' : '.dechex($arrayRH['recType'].')')); + } } - return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $ord24; + + return $arrayReturn; + } + + /** + * The OfficeArtChildAnchor record specifies four signed integers that specify the anchor for the shape that contains this record. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd922720(v=office.12).aspx + */ + private function readRecordOfficeArtChildAnchor($stream, $pos) + { + $arrayReturn = array( + 'length' => 0 + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == 0xF00F && $data['recLen'] == 0x00000010) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['left'] = (int) self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + $arrayReturn['top'] = (int) self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + $arrayReturn['width'] = (int) self::getInt4d($stream, $pos + $arrayReturn['length']) - $arrayReturn['left']; + $arrayReturn['length'] += 4; + $arrayReturn['height'] = (int) self::getInt4d($stream, $pos + $arrayReturn['length']) - $arrayReturn['top']; + $arrayReturn['length'] += 4; + } + + return $arrayReturn; + } + + + + /** + * An atom record that specifies the location of a shape. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd922797(v=office.12).aspx + */ + private function readRecordOfficeArtClientAnchor($stream, $pos) + { + $arrayReturn = array( + 'length' => 0 + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == 0xF010 && ($data['recLen'] == 0x00000008 || $data['recLen'] == 0x00000010)) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + switch ($data['recLen']) { + case 0x00000008: + $arrayReturn['top'] = (int) (self::getInt2d($stream, $pos + $arrayReturn['length']) / 6); + $arrayReturn['length'] += 2; + $arrayReturn['left'] = (int) (self::getInt2d($stream, $pos + $arrayReturn['length']) / 6); + $arrayReturn['length'] += 2; + $arrayReturn['width'] = (int) (self::getInt2d($stream, $pos + $arrayReturn['length']) / 6) - $arrayReturn['left']; + $arrayReturn['length'] += 2; + $arrayReturn['height'] = (int) (self::getInt2d($stream, $pos + $arrayReturn['length']) / 6) - $arrayReturn['left']; + $arrayReturn['length'] += 2; + $pos += 8; + break; + case 0x00000010: + throw new \Exception('PowerPoint97 Reader : record OfficeArtClientAnchor (0x00000010)'); + break; + } + } + + return $arrayReturn; + } + /** + * A container record that specifies text related data for a shape. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd910958(v=office.12).aspx + */ + private function readRecordOfficeArtClientTextbox($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + 'text' => '', + 'numParts' => 0, + 'numTexts' => 0, + 'hyperlink' => array(), + ); + + $data = $this->loadRecordHeader($stream, $pos); + // recVer 0xF + // Doc : 0x0 https://msdn.microsoft.com/en-us/library/dd910958(v=office.12).aspx + // Sample : 0xF https://msdn.microsoft.com/en-us/library/dd953497(v=office.12).aspx + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF00D) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $strLen = 0; + do { + $rhChild = $this->loadRecordHeader($stream, $pos + $arrayReturn['length']); + /** + * @link : https://msdn.microsoft.com/en-us/library/dd947039(v=office.12).aspx + */ + // echo dechex($rhChild['recType']).'-'.$rhChild['recType'].EOL; + switch ($rhChild['recType']) { + case self::RT_INTERACTIVEINFO: + //@link : http://msdn.microsoft.com/en-us/library/dd948623(v=office.12).aspx + if ($rhChild['recInstance'] == 0x0000) { + $mouseClickInteractiveInfoContainer = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseClickInteractiveInfoContainer['length']; + $arrayReturn['hyperlink'][]['id'] = $mouseClickInteractiveInfoContainer['exHyperlinkIdRef']; + } + if ($rhChild['recInstance'] == 0x0001) { + $mouseOverInteractiveInfoContainer = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseOverInteractiveInfoContainer['length']; + } + break; + case self::RT_STYLETEXTPROPATOM: + $arrayReturn['length'] += 8; + // @link : http://msdn.microsoft.com/en-us/library/dd950647(v=office.12).aspx + // rgTextPFRun + $strLenRT = $strLen + 1; + do { + $strucTextPFRun = $this->readStructureTextPFRun($stream, $pos + $arrayReturn['length'], $strLenRT); + $arrayReturn['numTexts']++; + $arrayReturn['text'.$arrayReturn['numTexts']] = $strucTextPFRun; + if(isset($strucTextPFRun['alignH'])) { + $arrayReturn['alignH'] = $strucTextPFRun['alignH']; + } + $strLenRT = $strucTextPFRun['strLenRT']; + $arrayReturn['length'] += $strucTextPFRun['length']; + } while ($strLenRT > 0); + // rgTextCFRun + $strLenRT = $strLen + 1; + do { + $strucTextCFRun = $this->readStructureTextCFRun($stream, $pos + $arrayReturn['length'], $strLenRT); + $arrayReturn['numParts']++; + $arrayReturn['part'.$arrayReturn['numParts']] = $strucTextCFRun; + $strLenRT = $strucTextCFRun['strLenRT']; + $arrayReturn['length'] += $strucTextCFRun['length']; + } while ($strLenRT > 0); + break; + case self::RT_TEXTBYTESATOM: + $arrayReturn['length'] += 8; + // @link : https://msdn.microsoft.com/en-us/library/dd947905(v=office.12).aspx + $strLen = (int)$rhChild['recLen']; + for ($inc = 0; $inc < $strLen; $inc++) { + $char = self::getInt1d($stream, $pos + $arrayReturn['length']); + if ($char == 0x0B) { + $char = 0x20; + } + $arrayReturn['text'] .= String::chr($char); + $arrayReturn['length'] += 1; + } + break; + case self::RT_TEXTCHARSATOM: + $arrayReturn['length'] += 8; + // @link : http://msdn.microsoft.com/en-us/library/dd772921(v=office.12).aspx + $strLen = (int)($rhChild['recLen']/2); + for ($inc = 0; $inc < $strLen; $inc++) { + $char = self::getInt2d($stream, $pos + $arrayReturn['length']); + if ($char == 0x0B) { + $char = 0x20; + } + $arrayReturn['text'] .= String::chr($char); + $arrayReturn['length'] += 2; + } + break; + case self::RT_TEXTHEADERATOM: + $arrayReturn['length'] += 8; + // @link : http://msdn.microsoft.com/en-us/library/dd905272(v=office.12).aspx + // textType + $arrayReturn['length'] += 4; + break; + case self::RT_TEXTINTERACTIVEINFOATOM: + $arrayReturn['length'] += 8; + //@link : http://msdn.microsoft.com/en-us/library/dd947973(v=office.12).aspx + if ($rhChild['recInstance'] == 0x0000) { + //@todo : MouseClickTextInteractiveInfoAtom + $arrayReturn['hyperlink'][count($arrayReturn['hyperlink']) - 1]['start'] = self::getInt4d($stream, $pos + + $arrayReturn['length']); + $arrayReturn['length'] += 4; + + $arrayReturn['hyperlink'][count($arrayReturn['hyperlink']) - 1]['end'] = self::getInt4d($stream, $pos + + $arrayReturn['length']); + $arrayReturn['length'] += 4; + } + if ($rhChild['recInstance'] == 0x0001) { + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + break; + case self::RT_TEXTSPECIALINFOATOM: + $arrayReturn['length'] += 8; + // @link : http://msdn.microsoft.com/en-us/library/dd945296(v=office.12).aspx + $strLenRT = $strLen + 1; + do { + $structTextSIRun = $this->readStructureTextSIRun($stream, $pos + $arrayReturn['length'], $strLenRT); + $strLenRT = $structTextSIRun['strLenRT']; + $arrayReturn['length'] += $structTextSIRun['length']; + } while ($strLenRT > 0); + break; + case self::RT_TEXTRULERATOM: + $arrayReturn['length'] += 8; + // @link : http://msdn.microsoft.com/en-us/library/dd953212(v=office.12).aspx + $structRuler = $this->readStructureTextRuler($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $structRuler['length']; + break; + case self::RT_SLIDENUMBERMETACHARATOM: + $datasRecord = $this->readRecordSlideNumberMCAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $datasRecord['length']; + break; + default: + throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($rhChild['recType']).')'); + } + } while (($data['recLen'] - $arrayReturn['length']) > 0); + } + return $arrayReturn; + } + + /** + * The OfficeArtSpContainer record specifies a shape container. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd943794(v=office.12).aspx + */ + private function readRecordOfficeArtSpContainer($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + 'shape' => null, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF004) { + // Record Header + $arrayReturn['length'] += 8; + // shapeGroup + $shapeGroup = $this->readRecordOfficeArtFSPGR($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shapeGroup['length']; + + // shapeProp + $shapeProp = $this->readRecordOfficeArtFSP($stream, $pos + $arrayReturn['length']); + if($shapeProp['length'] == 0) { + throw new \Exception('PowerPoint97 Reader : record OfficeArtFSP'); + } + $arrayReturn['length'] += $shapeProp['length']; + + if($shapeProp['fDeleted'] == 0x1 && $shapeProp['fChild'] == 0x0) { + // deletedShape + $deletedShape = $this->readRecordOfficeArtFPSPL($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $deletedShape['length']; + } + + // shapePrimaryOptions + $shapePrimaryOptions = $this->readRecordOfficeArtFOPT($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shapePrimaryOptions['length']; + + // shapeSecondaryOptions1 + $shapeSecondaryOptions1 = $this->readRecordOfficeArtSecondaryFOPT($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shapeSecondaryOptions1['length']; + + // shapeTertiaryOptions1 + $shapeTertiaryOptions1 = $this->readRecordOfficeArtTertiaryFOPT($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shapeTertiaryOptions1['length']; + + // childAnchor + $childAnchor = $this->readRecordOfficeArtChildAnchor($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $childAnchor['length']; + + // clientAnchor + $clientAnchor = $this->readRecordOfficeArtClientAnchor($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $clientAnchor['length']; + + // clientData + $clientData = $this->readRecordOfficeArtClientData($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $clientData['length']; + + // clientTextbox + $clientTextbox = $this->readRecordOfficeArtClientTextbox($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $clientTextbox['length']; + + // shapeSecondaryOptions2 + if($shapeSecondaryOptions1['length'] == 0) { + $shapeSecondaryOptions2 = $this->readRecordOfficeArtSecondaryFOPT($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shapeSecondaryOptions2['length']; + } + + // shapeTertiaryOptions2 + if($shapeTertiaryOptions1['length'] == 0) { + $shapeTertiaryOptions2 = $this->readRecordOfficeArtTertiaryFOPT($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shapeTertiaryOptions2['length']; + } + + // Core : Shape + // Informations about group are not defined + $arrayDimensions = array(); + $bIsGroup = false; + if(is_object($this->oCurrentGroup)){ + if(!$this->bFirstShapeGroup){ + if($clientAnchor['length'] > 0){ + $this->oCurrentGroup->setOffsetX($clientAnchor['left']); + $this->oCurrentGroup->setOffsetY($clientAnchor['top']); + $this->oCurrentGroup->setHeight($clientAnchor['height']); + $this->oCurrentGroup->setWidth($clientAnchor['width']); + } + $bIsGroup = true; + $this->bFirstShapeGroup = true; + } else { + if($childAnchor['length'] > 0){ + $arrayDimensions = $childAnchor; + } + } + } else { + if($clientAnchor['length'] > 0){ + $arrayDimensions = $clientAnchor; + } + } + if (!$bIsGroup) { + // *** Shape *** + if(isset($shapePrimaryOptions['pib'])) { + // isDrawing + $drawingPib = $shapePrimaryOptions['pib']; + if(isset($this->arrayPictures[$drawingPib - 1])){ + $gdImage = imagecreatefromstring($this->arrayPictures[$drawingPib - 1]); + $arrayReturn['shape'] = new MemoryDrawing(); + $arrayReturn['shape']->setImageResource($gdImage); + } + } elseif (isset($shapePrimaryOptions['line']) && $shapePrimaryOptions['line']) { + // isLine + $arrayReturn['shape'] = new Line(0, 0, 0, 0); + } elseif ($clientTextbox['length'] > 0) { + $arrayReturn['shape'] = new RichText(); + if (isset($clientTextbox['alignH'])) { + $arrayReturn['shape']->getActiveParagraph()->getAlignment()->setHorizontal($clientTextbox['alignH']); + } + + $start = 0; + $lastLevel = -1; + $lastMarginLeft = 0; + for ($inc = 1; $inc <= $clientTextbox['numParts']; $inc++) { + if ($clientTextbox['numParts'] == $clientTextbox['numTexts'] && isset($clientTextbox['text'.$inc])) { + if (isset($clientTextbox['text'.$inc]['bulletChar'])) { + $arrayReturn['shape']->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET); + $arrayReturn['shape']->getActiveParagraph()->getBulletStyle()->setBulletChar($clientTextbox['text'.$inc]['bulletChar']); + } + // Indent + $indent = 0; + if (isset($clientTextbox['text'.$inc]['indent'])) { + $indent = $clientTextbox['text'.$inc]['indent']; + } + if (isset($clientTextbox['text'.$inc]['leftMargin'])) { + if ($lastMarginLeft > $clientTextbox['text'.$inc]['leftMargin']) { + $lastLevel--; + } + if ($lastMarginLeft < $clientTextbox['text'.$inc]['leftMargin']) { + $lastLevel++; + } + $arrayReturn['shape']->getActiveParagraph()->getAlignment()->setLevel($lastLevel); + $lastMarginLeft = $clientTextbox['text'.$inc]['leftMargin']; + + $arrayReturn['shape']->getActiveParagraph()->getAlignment()->setMarginLeft($clientTextbox['text'.$inc]['leftMargin']); + $arrayReturn['shape']->getActiveParagraph()->getAlignment()->setIndent($indent - $clientTextbox['text'.$inc]['leftMargin']); + } + } + // Texte + $sText = substr(isset($clientTextbox['text']) ? $clientTextbox['text'] : '', $start, $clientTextbox['part'.$inc]['partLength']); + $sHyperlinkURL = ''; + if (empty($sText)) { + // Is there a hyperlink ? + if (isset($clientTextbox['hyperlink']) && is_array($clientTextbox['hyperlink']) && !empty($clientTextbox['hyperlink'])) { + foreach ($clientTextbox['hyperlink'] as $itmHyperlink) { + if ($itmHyperlink['start'] == $start && ($itmHyperlink['end'] - $itmHyperlink['start']) == $clientTextbox['part'.$inc]['partLength']) { + $sText = $this->arrayHyperlinks[$itmHyperlink['id']]['text']; + $sHyperlinkURL = $this->arrayHyperlinks[$itmHyperlink['id']]['url']; + break; + } + } + } + } + // New paragraph + $bCreateParagraph = false; + if (strpos($sText, "\r") !== false) { + $bCreateParagraph = true; + $sText = str_replace("\r", '', $sText); + } + // TextRun + $txtRun = $arrayReturn['shape']->createTextRun($sText); + if (isset($clientTextbox['part'.$inc]['bold'])) { + $txtRun->getFont()->setBold($clientTextbox['part'.$inc]['bold']); + } + if (isset($clientTextbox['part'.$inc]['italic'])) { + $txtRun->getFont()->setItalic($clientTextbox['part'.$inc]['italic']); + } + if (isset($clientTextbox['part'.$inc]['underline'])) { + $txtRun->getFont()->setUnderline($clientTextbox['part'.$inc]['underline']); + } + if (isset($clientTextbox['part'.$inc]['fontName'])) { + $txtRun->getFont()->setName($clientTextbox['part'.$inc]['fontName']); + } + if (isset($clientTextbox['part'.$inc]['fontSize'])) { + $txtRun->getFont()->setSize($clientTextbox['part'.$inc]['fontSize']); + } + if (isset($clientTextbox['part'.$inc]['color'])) { + $txtRun->getFont()->setColor($clientTextbox['part'.$inc]['color']); + } + // Hyperlink + if (!empty($sHyperlinkURL)) { + $txtRun->setHyperlink(new Hyperlink($sHyperlinkURL)); + } + + $start += $clientTextbox['part'.$inc]['partLength']; + if ($bCreateParagraph) { + $arrayReturn['shape']->createParagraph(); + } + } + } + + // *** Properties *** + // Dimensions + if($arrayReturn['shape'] instanceof AbstractShape) { + if(!empty($arrayDimensions)){ + $arrayReturn['shape']->setOffsetX($arrayDimensions['left']); + $arrayReturn['shape']->setOffsetY($arrayDimensions['top']); + $arrayReturn['shape']->setHeight($arrayDimensions['height']); + $arrayReturn['shape']->setWidth($arrayDimensions['width']); + } + // Rotation + if(isset($shapePrimaryOptions['rotation'])) { + $rotation = $shapePrimaryOptions['rotation']; + $arrayReturn['shape']->setRotation($rotation); + } + // Shadow + if (isset($shapePrimaryOptions['shadowOffsetX']) && isset($shapePrimaryOptions['shadowOffsetY'])) { + $shadowOffsetX = $shapePrimaryOptions['shadowOffsetX']; + $shadowOffsetY = $shapePrimaryOptions['shadowOffsetY']; + if($shadowOffsetX != 0 && $shadowOffsetX != 0) { + $arrayReturn['shape']->getShadow()->setVisible(true); + if ($shadowOffsetX > 0 && $shadowOffsetX == $shadowOffsetY) { + $arrayReturn['shape']->getShadow()->setDistance($shadowOffsetX)->setDirection(45); + } + } + } + // Specific Line + if ($arrayReturn['shape'] instanceof Line) { + if (isset($shapePrimaryOptions['lineColor'])) { + $arrayReturn['shape']->getBorder()->getColor()->setARGB('FF'.$shapePrimaryOptions['lineColor']); + } + if (isset($shapePrimaryOptions['lineWidth'])) { + $arrayReturn['shape']->setHeight($shapePrimaryOptions['lineWidth']); + } + } + // Specific RichText + if ($arrayReturn['shape'] instanceof RichText) { + if (isset($shapePrimaryOptions['insetBottom'])) { + $arrayReturn['shape']->setInsetBottom($shapePrimaryOptions['insetBottom']); + } + if (isset($shapePrimaryOptions['insetLeft'])) { + $arrayReturn['shape']->setInsetLeft($shapePrimaryOptions['insetLeft']); + } + if (isset($shapePrimaryOptions['insetRight'])) { + $arrayReturn['shape']->setInsetRight($shapePrimaryOptions['insetRight']); + } + if (isset($shapePrimaryOptions['insetTop'])) { + $arrayReturn['shape']->setInsetTop($shapePrimaryOptions['insetTop']); + } + } + } + } else { + // Rotation + if(isset($shapePrimaryOptions['rotation'])) { + $rotation = $shapePrimaryOptions['rotation']; + $this->oCurrentGroup->setRotation($rotation); + } + } + } + + return $arrayReturn; + } + + /** + * The OfficeArtSpgrContainer record specifies a container for groups of shapes. + * @param string $stream + * @param integer $pos + * @param boolean $bInGroup + * @link : https://msdn.microsoft.com/en-us/library/dd910416(v=office.12).aspx + */ + private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = false) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF003) { + $arrayReturn['length'] += 8; + + do { + $rhFileBlock = $this->loadRecordHeader($stream, $pos + $arrayReturn['length']); + if (!($rhFileBlock['recVer'] == 0xF && $rhFileBlock['recInstance'] == 0x0000 && ($rhFileBlock['recType'] == 0xF003 || $rhFileBlock['recType'] == 0xF004))) { + throw new \Exception('PowerPoint97 Reader : readRecordOfficeArtSpgrContainer.'); + } + + switch ($rhFileBlock['recType']) { + case 0xF003: + // Core + $this->oCurrentGroup = $this->oPhpPowerpoint->getActiveSlide()->createGroup(); + $this->bFirstShapeGroup = false; + // OfficeArtSpgrContainer + $fileBlock = $this->readRecordOfficeArtSpgrContainer($stream, $pos + $arrayReturn['length'], true); + $arrayReturn['length'] += $fileBlock['length']; + $data['recLen'] -= $fileBlock['length']; + break; + case 0xF004: + // Core + if(!$bInGroup) { + $this->oCurrentGroup = null; + } + // OfficeArtSpContainer + $fileBlock = $this->readRecordOfficeArtSpContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $fileBlock['length']; + $data['recLen'] -= $fileBlock['length']; + // Core + //@todo + if(!is_null($fileBlock['shape'])){ + if($bInGroup) { + $this->oCurrentGroup->addShape($fileBlock['shape']); + } else { + $this->oPhpPowerpoint->getActiveSlide()->addShape($fileBlock['shape']); + } + } + + break; + } + } while ($data['recLen'] > 0); + } + return $arrayReturn; + } + + /** + * The OfficeArtTertiaryFOPT record specifies a table of OfficeArtRGFOPTE records,. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd950206(v=office.12).aspx + */ + private function readRecordOfficeArtTertiaryFOPT($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x3 && $data['recType'] == 0xF122) { + // Record Header + $arrayReturn['length'] += 8; + + $officeArtFOPTE = array(); + for ($inc = 0; $inc < $data['recInstance']; $inc++) { + $opid = self::getInt2d($this->streamPowerpointDocument, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $optOp = self::getInt4d($this->streamPowerpointDocument, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + $officeArtFOPTE[] = array( + 'opid' => ($opid >> 0) & bindec('11111111111111'), + 'fBid' => ($opid >> 14) & bindec('1'), + 'fComplex' => ($opid >> 15) & bindec('1'), + 'op' => $optOp, + ); + } + //@link : http://code.metager.de/source/xref/kde/calligra/filters/libmso/OPID + foreach ($officeArtFOPTE as $opt) { + switch ($opt['opid']) { + case 0x039F: + // Table properties + //@link : https://msdn.microsoft.com/en-us/library/dd922773(v=office.12).aspx + break; + case 0x03A0: + // Table Row Properties + //@link : https://msdn.microsoft.com/en-us/library/dd923419(v=office.12).aspx + if($opt['fComplex'] == 0x1) { + $arrayReturn['length'] += $opt['op']; + } + break; + case 0x03A9: + // GroupShape : metroBlob + //@link : https://msdn.microsoft.com/en-us/library/dd943388(v=office.12).aspx + if($opt['fComplex'] == 0x1) { + $arrayReturn['length'] += $opt['op']; + } + break; + case 0x01FF: + // Line Style Boolean + //@link : https://msdn.microsoft.com/en-us/library/dd951605(v=office.12).aspx + break; + default: + throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($opt['opid']).')'); + } + } + } + return $arrayReturn; + } + + /** + * The OfficeArtDgContainer record specifies the container for all the file records for the objects in a drawing. + * @param string $stream + * @param integer $pos + * @link : https://msdn.microsoft.com/en-us/library/dd924455(v=office.12).aspx + */ + private function readRecordOfficeArtDgContainer($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF002) { + // Record Header + $arrayReturn['length'] += 8; + // drawingData + $drawingData = $this->readRecordOfficeArtFDG($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $drawingData['length']; + // regroupItems + //@todo + // groupShape + $groupShape = $this->readRecordOfficeArtSpgrContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $groupShape['length']; + // shape + $shape = $this->readRecordOfficeArtSpContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shape['length']; + // solvers1 + //@todo + // deletedShapes + //@todo + // solvers1 + //@todo + } + + return $arrayReturn; + } + + /** + * The OfficeArtFDG record specifies the number of shapes, the drawing identifier, and the shape identifier of the last shape in a drawing. + * @param string $stream + * @param integer $pos + * @link : https://msdn.microsoft.com/en-us/library/dd946757(v=office.12).aspx + */ + private function readRecordOfficeArtFDG($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] <= 0xFFE && $data['recType'] == 0xF008 && $data['recLen'] == 0x00000008) { + // Record Header + $arrayReturn['length'] += 8; + // Length + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * The OfficeArtFOPT record specifies a table of OfficeArtRGFOPTE records. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd943404(v=office.12).aspx + */ + private function readRecordOfficeArtFOPT($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x3 && $data['recType'] == 0xF00B) { + // Record Header + $arrayReturn['length'] += 8; + + //@link : http://msdn.microsoft.com/en-us/library/dd906086(v=office.12).aspx + $officeArtFOPTE = array(); + for ($inc = 0; $inc < $data['recInstance']; $inc++) { + $opid = self::getInt2d($this->streamPowerpointDocument, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $data['recLen'] -= 2; + $optOp = self::getInt4d($this->streamPowerpointDocument, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + $data['recLen'] -= 4; + $officeArtFOPTE[] = array( + 'opid' => ($opid >> 0) & bindec('11111111111111'), + 'fBid' => ($opid >> 14) & bindec('1'), + 'fComplex' => ($opid >> 15) & bindec('1'), + 'op' => $optOp, + ); + } + //@link : http://code.metager.de/source/xref/kde/calligra/filters/libmso/OPID + foreach ($officeArtFOPTE as $opt) { + // echo $opt['opid'].'-0x'.dechex($opt['opid']).EOL; + switch ($opt['opid']) { + case 0x0004: + // Transform : rotation + //@link : https://msdn.microsoft.com/en-us/library/dd949750(v=office.12).aspx + $arrayReturn['rotation'] = $opt['op']; + break; + case 0x007F: + // Transform : Protection Boolean Properties + //@link : http://msdn.microsoft.com/en-us/library/dd909131(v=office.12).aspx + break; + case 0x0080: + // Text : ltxid + //@link : http://msdn.microsoft.com/en-us/library/dd947446(v=office.12).aspx + break; + case 0x0081: + // Text : dxTextLeft + //@link : http://msdn.microsoft.com/en-us/library/dd953234(v=office.12).aspx + $arrayReturn['insetLeft'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); + break; + case 0x0082: + // Text : dyTextTop + //@link : http://msdn.microsoft.com/en-us/library/dd925068(v=office.12).aspx + $arrayReturn['insetTop'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); + break; + case 0x0083: + // Text : dxTextRight + //@link : http://msdn.microsoft.com/en-us/library/dd906782(v=office.12).aspx + $arrayReturn['insetRight'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); + break; + case 0x0084: + // Text : dyTextBottom + //@link : http://msdn.microsoft.com/en-us/library/dd772858(v=office.12).aspx + $arrayReturn['insetBottom'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); + break; + case 0x0085: + // Text : WrapText + //@link : http://msdn.microsoft.com/en-us/library/dd924770(v=office.12).aspx + break; + case 0x0087: + // Text : anchorText + //@link : http://msdn.microsoft.com/en-us/library/dd948575(v=office.12).aspx + break; + case 0x00BF: + // Text : Text Boolean Properties + //@link : http://msdn.microsoft.com/en-us/library/dd950905(v=office.12).aspx + break; + case 0x0104: + // Blip : pib + //@link : http://msdn.microsoft.com/en-us/library/dd772837(v=office.12).aspx + if ($opt['fComplex'] == 0) { + $arrayReturn['pib'] = $opt['op']; + $data['recLen'] -= $opt['op']; + } else { + // pib Complex + } + break; + case 0x13F: + // Blip Boolean Properties + //@link : https://msdn.microsoft.com/en-us/library/dd944215(v=office.12).aspx + break; + case 0x140: + // Geometry : geoLeft + //@link : http://msdn.microsoft.com/en-us/library/dd947489(v=office.12).aspx + // print_r('geoLeft : '.$opt['op'].EOL); + break; + case 0x141: + // Geometry : geoTop + //@link : http://msdn.microsoft.com/en-us/library/dd949459(v=office.12).aspx + // print_r('geoTop : '.$opt['op'].EOL); + break; + case 0x142: + // Geometry : geoRight + //@link : http://msdn.microsoft.com/en-us/library/dd947117(v=office.12).aspx + // print_r('geoRight : '.$opt['op'].EOL); + break; + case 0x143: + // Geometry : geoBottom + //@link : http://msdn.microsoft.com/en-us/library/dd948602(v=office.12).aspx + // print_r('geoBottom : '.$opt['op'].EOL); + break; + case 0x144: + // Geometry : shapePath + //@link : http://msdn.microsoft.com/en-us/library/dd945249(v=office.12).aspx + $arrayReturn['line'] = true; + break; + case 0x145: + // Geometry : pVertices + //@link : http://msdn.microsoft.com/en-us/library/dd949814(v=office.12).aspx + if ($opt['fComplex'] == 1) { + $arrayReturn['length'] += $opt['op']; + $data['recLen'] -= $opt['op']; + } + break; + case 0x146: + // Geometry : pSegmentInfo + //@link : http://msdn.microsoft.com/en-us/library/dd905742(v=office.12).aspx + if ($opt['fComplex'] == 1) { + $arrayReturn['length'] += $opt['op']; + $data['recLen'] -= $opt['op']; + } + break; + case 0x155: + // Geometry : pAdjustHandles + //@link : http://msdn.microsoft.com/en-us/library/dd905890(v=office.12).aspx + if ($opt['fComplex'] == 1) { + $arrayReturn['length'] += $opt['op']; + $data['recLen'] -= $opt['op']; + } + break; + case 0x156: + // Geometry : pGuides + //@link : http://msdn.microsoft.com/en-us/library/dd910801(v=office.12).aspx + if ($opt['fComplex'] == 1) { + $arrayReturn['length'] += $opt['op']; + $data['recLen'] -= $opt['op']; + } + break; + case 0x157: + // Geometry : pInscribe + //@link : http://msdn.microsoft.com/en-us/library/dd904889(v=office.12).aspx + if ($opt['fComplex'] == 1) { + $arrayReturn['length'] += $opt['op']; + $data['recLen'] -= $opt['op']; + } + break; + case 0x17F: + // Geometry Boolean Properties + //@link : http://msdn.microsoft.com/en-us/library/dd944968(v=office.12).aspx + break; + case 0x0180: + // Fill : fillType + //@link : http://msdn.microsoft.com/en-us/library/dd947909(v=office.12).aspx + break; + case 0x0181: + // Fill : fillColor + //@link : http://msdn.microsoft.com/en-us/library/dd921332(v=office.12).aspx + $strColor = str_pad(dechex(($opt['op'] >> 0) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); + $strColor .= str_pad(dechex(($opt['op'] >> 8) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); + $strColor .= str_pad(dechex(($opt['op'] >> 16) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); + // echo 'fillColor : '.$strColor.EOL; + break; + case 0x0183: + // Fill : fillBackColor + //@link : http://msdn.microsoft.com/en-us/library/dd950634(v=office.12).aspx + $strColor = str_pad(dechex(($opt['op'] >> 0) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); + $strColor .= str_pad(dechex(($opt['op'] >> 8) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); + $strColor .= str_pad(dechex(($opt['op'] >> 16) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); + // echo 'fillBackColor : '.$strColor.EOL; + break; + case 0x0193: + // Fill : fillRectRight + //@link : http://msdn.microsoft.com/en-us/library/dd951294(v=office.12).aspx + // echo 'fillRectRight : '.\PhpOffice\Common\Drawing::emuToPixels($opt['op']).EOL; + break; + case 0x0194: + // Fill : fillRectBottom + //@link : http://msdn.microsoft.com/en-us/library/dd910194(v=office.12).aspx + // echo 'fillRectBottom : '.\PhpOffice\Common\Drawing::emuToPixels($opt['op']).EOL; + break; + case 0x01BF: + // Fill : Fill Style Boolean Properties + //@link : http://msdn.microsoft.com/en-us/library/dd909380(v=office.12).aspx + break; + case 0x01C0: + // Line Style : lineColor + //@link : http://msdn.microsoft.com/en-us/library/dd920397(v=office.12).aspx + $strColor = str_pad(dechex(($opt['op'] >> 0) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); + $strColor .= str_pad(dechex(($opt['op'] >> 8) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); + $strColor .= str_pad(dechex(($opt['op'] >> 16) & bindec('11111111')), 2, STR_PAD_LEFT, '0'); + $arrayReturn['lineColor'] = $strColor; + break; + case 0x01C1: + // Line Style : lineOpacity + //@link : http://msdn.microsoft.com/en-us/library/dd923433(v=office.12).aspx + // echo 'lineOpacity : '.dechex($opt['op']).EOL; + break; + case 0x01C2: + // Line Style : lineBackColor + //@link : http://msdn.microsoft.com/en-us/library/dd947669(v=office.12).aspx + break; + case 0x01CB: + // Line Style : lineWidth + //@link : http://msdn.microsoft.com/en-us/library/dd926964(v=office.12).aspx + $arrayReturn['lineWidth'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); + break; + case 0x01D6: + // Line Style : lineJoinStyle + //@link : http://msdn.microsoft.com/en-us/library/dd909643(v=office.12).aspx + break; + case 0x01D7: + // Line Style : lineEndCapStyle + //@link : http://msdn.microsoft.com/en-us/library/dd925071(v=office.12).aspx + break; + case 0x01FF: + // Line Style : Line Style Boolean Properties + //@link : http://msdn.microsoft.com/en-us/library/dd951605(v=office.12).aspx + break; + case 0x0201: + // Shadow Style : shadowColor + //@link : http://msdn.microsoft.com/en-us/library/dd923454(v=office.12).aspx + break; + case 0x0204: + // Shadow Style : shadowOpacity + //@link : http://msdn.microsoft.com/en-us/library/dd920720(v=office.12).aspx + break; + case 0x0205: + // Shadow Style : shadowOffsetX + //@link : http://msdn.microsoft.com/en-us/library/dd945280(v=office.12).aspx + $arrayReturn['shadowOffsetX'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); + break; + case 0x0206: + // Shadow Style : shadowOffsetY + //@link : http://msdn.microsoft.com/en-us/library/dd907855(v=office.12).aspx + $arrayReturn['shadowOffsetY'] = \PhpOffice\Common\Drawing::emuToPixels($opt['op']); + break; + case 0x023F: + // Shadow Style : Shadow Style Boolean Properties + //@link : http://msdn.microsoft.com/en-us/library/dd947887(v=office.12).aspx + break; + case 0x0304: + // Shape : bWMode + //@link : http://msdn.microsoft.com/en-us/library/dd947659(v=office.12).aspx + break; + case 0x033F: + // Shape Boolean Properties + //@link : http://msdn.microsoft.com/en-us/library/dd951345(v=office.12).aspx + break; + case 0x0380: + // Group Shape Property Set : wzName + //@link : http://msdn.microsoft.com/en-us/library/dd950681(v=office.12).aspx + if ($opt['fComplex'] == 1) { + $arrayReturn['length'] += $opt['op']; + $data['recLen'] -= $opt['op']; + } + break; + case 0x03BF: + // Group Shape Property Set : Group Shape Boolean Properties + //@link : http://msdn.microsoft.com/en-us/library/dd949807(v=office.12).aspx + break; + default: + throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($opt['opid']).')'); + } + } + if($data['recLen'] > 0) { + $arrayReturn['length'] += $data['recLen']; + } + } + + return $arrayReturn; + } + + /** + * The OfficeArtFPSPL record specifies the former hierarchical position of the containing object that is either a shape or a group of shapes. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd947479(v=office.12).aspx + */ + private function readRecordOfficeArtFPSPL($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == 0xF11D && $data['recLen'] == 0x00000004) { + $arrayReturn['length'] += 8; + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * The OfficeArtFSP record specifies an instance of a shape. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd925898(v=office.12).aspx + */ + private function readRecordOfficeArtFSP($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x2 && $data['recType'] == 0xF00A && $data['recLen'] == 0x00000008) { + $arrayReturn['length'] += 8; + // spid + $arrayReturn['length'] += 4; + // data + $data = self::getInt4d($this->streamPowerpointDocument, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + $arrayReturn['fGroup'] = ($data >> 0) & bindec('1'); + $arrayReturn['fChild'] = ($data >> 1) & bindec('1'); + $arrayReturn['fPatriarch'] = ($data >> 2) & bindec('1'); + $arrayReturn['fDeleted'] = ($data >> 3) & bindec('1'); + } + + return $arrayReturn; + } + + /** + * The OfficeArtFSPGR record specifies the coordinate system of the group shape that the anchors of the child shape are expressed in. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd925381(v=office.12).aspx + */ + private function readRecordOfficeArtFSPGR($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x1 && $data['recInstance'] == 0x000 && $data['recType'] == 0xF009 && $data['recLen'] == 0x00000010) { + $arrayReturn['length'] += 8; + //$arrShapeGroup['xLeft'] = self::getInt4d($this->streamPowerpointDocument, $pos); + $arrayReturn['length'] += 4; + //$arrShapeGroup['yTop'] = self::getInt4d($this->streamPowerpointDocument, $pos); + $arrayReturn['length'] += 4; + //$arrShapeGroup['xRight'] = self::getInt4d($this->streamPowerpointDocument, $pos); + $arrayReturn['length'] += 4; + //$arrShapeGroup['yBottom'] = self::getInt4d($this->streamPowerpointDocument, $pos); + $arrayReturn['length'] += 4; + } + + return $arrayReturn; + } + + /** + * The OfficeArtSecondaryFOPT record specifies a table of OfficeArtRGFOPTE records. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd950259(v=office.12).aspx + */ + private function readRecordOfficeArtSecondaryFOPT($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x3 && $data['recType'] == 0xF121) { + // Record Header + $arrayReturn['length'] += 8; + // Length + $arrayReturn['length'] += $data['recLen']; + } + return $arrayReturn; + } + + /** + * A container record that specifies information about a shape. + * @param string $stream + * @param integer $pos + * @link : https://msdn.microsoft.com/en-us/library/dd950927(v=office.12).aspx + */ + private function readRecordOfficeArtClientData($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF011) { + $arrayReturn['length'] += 8; + // shapeFlagsAtom (9 bytes) + $dataShapeFlagsAtom = $this->readRecordShapeFlagsAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataShapeFlagsAtom['length']; + + // shapeFlags10Atom (9 bytes) + $dataShapeFlags10Atom = $this->readRecordShapeFlags10Atom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataShapeFlags10Atom['length']; + + // exObjRefAtom (12 bytes) + $dataExObjRefAtom = $this->readRecordExObjRefAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataExObjRefAtom['length']; + + // animationInfo (variable) + $dataAnimationInfo = $this->readRecordAnimationInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataAnimationInfo['length']; + + // mouseClickInteractiveInfo (variable) + $dataMouseClickInteractiveInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataMouseClickInteractiveInfo['length']; + + // mouseOverInteractiveInfo (variable) + $dataMouseOverInteractiveInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataMouseOverInteractiveInfo['length']; + + // placeholderAtom (16 bytes) + $dataPlaceholderAtom = $this->readRecordPlaceholderAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataPlaceholderAtom['length']; + + // recolorInfoAtom (variable) + $dataRecolorInfo = $this->readRecordRecolorInfoAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataRecolorInfo['length']; + + // rgShapeClientRoundtripData (variable) + $array = array( + self::RT_PROGTAGS, + self::RT_ROUNDTRIPNEWPLACEHOLDERID12ATOM, + self::RT_ROUNDTRIPSHAPEID12ATOM, + self::RT_ROUNDTRIPHFPLACEHOLDER12ATOM, + self::RT_ROUNDTRIPSHAPECHECKSUMFORCL12ATOM, + ); + do { + $dataHeaderRG = $this->loadRecordHeader($stream, $pos + $arrayReturn['length']); + if(in_array($dataHeaderRG['recType'], $array)){ + switch ($dataHeaderRG['recType']) { + case self::RT_PROGTAGS: + $dataRG = $this->readRecordShapeProgTagsContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataRG['length']; + break; + case self::RT_ROUNDTRIPHFPLACEHOLDER12ATOM: + $dataRG = $this->readRecordRoundTripHFPlaceholder12Atom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataRG['length']; + break; + case self::RT_ROUNDTRIPSHAPEID12ATOM: + $dataRG = $this->readRecordRoundTripShapeId12Atom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataRG['length']; + break; + default: + throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($dataHeaderRG['recType']).')'); + } + } + } while(in_array($dataHeaderRG['recType'], $array)); + } + + return $arrayReturn; + } + + /** + * An atom record that specifies a persist object directory. Each persist object identifier specified MUST be unique in that persist object directory. + * @link http://msdn.microsoft.com/en-us/library/dd952680(v=office.12).aspx + * @throws \Exception + */ + private function readRecordPersistDirectoryAtom($stream, $pos) + { + $rHeader = $this->loadRecordHeader($stream, $pos); + $pos += 8; + if ($rHeader['recVer'] != 0x0 || $rHeader['recInstance'] != 0x000 || $rHeader['recType'] != self::RT_PERSISTDIRECTORYATOM) { + throw new \Exception('File PowerPoint 97 in error (Location : PersistDirectoryAtom > RecordHeader).'); + } + // rgPersistDirEntry + // @link : http://msdn.microsoft.com/en-us/library/dd947347(v=office.12).aspx + do { + $data = self::getInt4d($stream, $pos); + $pos += 4; + $rHeader['recLen'] -= 4; + //$persistId = ($data >> 0) & bindec('11111111111111111111'); + $cPersist = ($data >> 20) & bindec('111111111111'); + + $rgPersistOffset = array(); + for ($inc = 0; $inc < $cPersist; $inc++) { + $rgPersistOffset[] = self::getInt4d($stream, $pos); + $pos += 4; + $rHeader['recLen'] -= 4; + } + } while ($rHeader['recLen'] > 0); + $this->rgPersistDirEntry = $rgPersistOffset; + } + + /** + * A container record that specifies information about the headers (1) and footers within a slide. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd904856(v=office.12).aspx + */ + private function readRecordPerSlideHeadersFootersContainer($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_HEADERSFOOTERS) { + // Record Header + $arrayReturn['length'] += 8; + // Length + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * An atom record that specifies whether a shape is a placeholder shape. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd923930(v=office.12).aspx + */ + private function readRecordPlaceholderAtom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_PLACEHOLDERATOM && $data['recLen'] == 0x00000008) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * An atom record that specifies a collection of re-color mappings for a metafile ([MS-WMF]). + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd904899(v=office.12).aspx + */ + private function readRecordRecolorInfoAtom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_RECOLORINFOATOM) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * An atom record that specifies that a shape is a header or footerplaceholder shape. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd910800(v=office.12).aspx + */ + private function readRecordRoundTripHFPlaceholder12Atom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_ROUNDTRIPHFPLACEHOLDER12ATOM && $data['recLen'] == 0x00000001) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * An atom record that specifies a shape identifier. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd772926(v=office.12).aspx + */ + private function readRecordRoundTripShapeId12Atom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_ROUNDTRIPSHAPEID12ATOM && $data['recLen'] == 0x00000004) { + // Record Header + $arrayReturn['length'] += 8; + // Length + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * A container record that specifies information about a slide that synchronizes to a slide in a slide library. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd923801(v=office.12).aspx + */ + private function readRecordRoundTripSlideSyncInfo12Container($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_ROUNDTRIPSLIDESYNCINFO12) { + // Record Header + $arrayReturn['length'] += 8; + // Length + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * An atom record that specifies shape-level Boolean flags. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd908949(v=office.12).aspx + */ + private function readRecordShapeFlags10Atom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_SHAPEFLAGS10ATOM && $data['recLen'] == 0x00000001) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * An atom record that specifies shape-level Boolean flags. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd925824(v=office.12).aspx + */ + private function readRecordShapeFlagsAtom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_SHAPEATOM && $data['recLen'] == 0x00000001) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * A container record that specifies programmable tags with additional binary shape data. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd911033(v=office.12).aspx + */ + private function readRecordShapeProgBinaryTagContainer($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_PROGBINARYTAG) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * A container record that specifies programmable tags with additional shape data. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd911266(v=office.12).aspx + */ + private function readRecordShapeProgTagsContainer($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_PROGTAGS) { + // Record Header + $arrayReturn['length'] += 8; + + $length = 0; + do { + $dataHeaderRG = $this->loadRecordHeader($stream, $pos + $arrayReturn['length'] + $length); + switch ($dataHeaderRG['recType']) { + case self::RT_PROGBINARYTAG: + $dataRG = $this->readRecordShapeProgBinaryTagContainer($stream, $pos + $arrayReturn['length'] + $length); + $length += $dataRG['length']; + break; + //case self::RT_PROGSTRINGTAG: + default: + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + } while($length < $data['recLen']); + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * An atom record that specifies information about a slide. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd923801(v=office.12).aspx + */ + private function readRecordSlideAtom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x2 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_SLIDEATOM) { + // Record Header + $arrayReturn['length'] += 8; + // slideAtom > geom + $arrayReturn['length'] += 4; + // slideAtom > rgPlaceholderTypes + $rgPlaceholderTypes = array(); + for ($inc = 0; $inc < 8; $inc++) { + $rgPlaceholderTypes[] = self::getInt1d($this->streamPowerpointDocument, $pos); + $arrayReturn['length'] += 1; + } + + // slideAtom > masterIdRef + $arrayReturn['length'] += 4; + // slideAtom > notesIdRef + $arrayReturn['length'] += 4; + // slideAtom > slideFlags + $arrayReturn['length'] += 2; + // slideAtom > unused; + $arrayReturn['length'] += 2; + } + + return $arrayReturn; + } + + /** + * A container record that specifies a presentation slide or title master slide. + * @param string $stream + * @param int $pos + * @link http://msdn.microsoft.com/en-us/library/dd946323(v=office.12).aspx + */ + private function readRecordSlideContainer($stream, $pos) + { + // Core + $this->oPhpPowerpoint->createSlide(); + $this->oPhpPowerpoint->setActiveSlideIndex($this->oPhpPowerpoint->getSlideCount() - 1); + + // *** slideAtom (32 bytes) + $slideAtom = $this->readRecordSlideAtom($stream, $pos); + if($slideAtom['length'] == 0) { + throw new \Exception('PowerPoint97 Reader : record SlideAtom'); + } + $pos += $slideAtom['length']; + + // *** slideShowSlideInfoAtom (24 bytes) + $slideShowSlideInfoAtom = $this->readRecordSlideShowSlideInfoAtom($stream, $pos); + $pos += $slideShowSlideInfoAtom['length']; + + // *** perSlideHFContainer (variable) : optional + $perSlideHFContainer = $this->readRecordPerSlideHeadersFootersContainer($stream, $pos); + $pos += $perSlideHFContainer['length']; + + // *** rtSlideSyncInfo12 (variable) : optional + $rtSlideSyncInfo12 = $this->readRecordRoundTripSlideSyncInfo12Container ($stream, $pos); + $pos += $rtSlideSyncInfo12['length']; + + // *** drawing (variable) + $drawing = $this->readRecordDrawingContainer($stream, $pos); + $pos += $drawing['length']; + + // *** slideSchemeColorSchemeAtom (40 bytes) + $slideSchemeColorSchemeAtom = $this->readRecordSlideSchemeColorSchemeAtom($stream, $pos); + if ($slideSchemeColorSchemeAtom['length'] == 0) { + throw new \Exception('PowerPoint97 Reader : record SlideSchemeColorSchemeAtom'); + } + $pos += $slideSchemeColorSchemeAtom['length']; + + // *** slideNameAtom (variable) + $slideNameAtom = $this->readRecordSlideNameAtom($stream, $pos); + $pos += $slideNameAtom['length']; + + // *** slideProgTagsContainer (variable). + $slideProgTagsContainer = $this->readRecordSlideProgTagsContainer($stream, $pos); + $pos += $slideProgTagsContainer['length']; + + // *** rgRoundTripSlide (variable) + } + + /** + * An atom record that specifies the name of a slide. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd906297(v=office.12).aspx + */ + private function readRecordSlideNameAtom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + 'slideName' => '', + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x003 && $data['recType'] == self::RT_CSTRING && $data['recLen'] % 2 == 0) { + // Record Header + $arrayReturn['length'] += 8; + // Length + $strLen = ($data['recLen'] / 2); + for ($inc = 0; $inc < $strLen; $inc++) { + $char = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $arrayReturn['slideName'] .= String::chr($char); + } + } + + return $arrayReturn; + } + + /** + * An atom record that specifies a slide number metacharacter. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd945703(v=office.12).aspx + */ + private function readRecordSlideNumberMCAtom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_SLIDENUMBERMETACHARATOM && $data['recLen'] == 0x00000004) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + + + /** + * A container record that specifies programmable tags with additional slide data. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd951946(v=office.12).aspx + */ + private function readRecordSlideProgTagsContainer($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_PROGTAGS) { + // Record Header + $arrayReturn['length'] += 8; + // Length + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * A container record that specifies the color scheme used by a slide. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd949420(v=office.12).aspx + */ + private function readRecordSlideSchemeColorSchemeAtom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x001 && $data['recType'] == self::RT_COLORSCHEMEATOM && $data['recLen'] == 0x00000020) { + // Record Header + $arrayReturn['length'] += 8; + // Length + $rgSchemeColor = array(); + for ($inc = 0; $inc <= 7; $inc++) { + $rgSchemeColor[] = array( + 'red' => self::getInt1d($stream, $pos + $arrayReturn['length'] + $inc * 4), + 'green' => self::getInt1d($stream, $pos + $arrayReturn['length'] + $inc * 4 + 1), + 'blue' => self::getInt1d($stream, $pos + $arrayReturn['length'] + $inc * 4 + 2), + ); + } + $arrayReturn['length'] += (8 * 4); + } + + return $arrayReturn; + } + + /** + * An atom record that specifies what transition effect to perform during a slide show, and how to advance to the next presentation slide. + * @param string $stream + * @param integer $pos + * @link https://msdn.microsoft.com/en-us/library/dd943408(v=office.12).aspx + */ + private function readRecordSlideShowSlideInfoAtom($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_SLIDESHOWSLIDEINFOATOM && $data['recLen'] == 0x00000010) { + // Record Header + $arrayReturn['length'] += 8; + // Length; + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; + } + + /** + * UserEditAtom + * @link http://msdn.microsoft.com/en-us/library/dd945746(v=office.12).aspx + * @throws \Exception + */ + private function readRecordUserEditAtom($stream, $pos) + { + $rHeader = $this->loadRecordHeader($stream, $pos); + $pos += 8; + if ($rHeader['recVer'] != 0x0 || $rHeader['recInstance'] != 0x000 || $rHeader['recType'] != self::RT_USEREDITATOM || ($rHeader['recLen'] != 0x0000001C && $rHeader['recLen'] != 0x00000020)) { + throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > RecordHeader).'); + } + + // lastSlideIdRef + $pos += 4; + // version + $pos += 2; + + // minorVersion + $minorVersion = self::getInt1d($stream, $pos); + $pos += 1; + if ($minorVersion != 0x00) { + throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > minorVersion).'); + } + + // majorVersion + $majorVersion = self::getInt1d($stream, $pos); + $pos += 1; + if ($majorVersion != 0x03) { + throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > majorVersion).'); + } + + // offsetLastEdit + $pos += 4; + // offsetPersistDirectory + $this->offsetPersistDirectory = self::getInt4d($stream, $pos); + $pos += 4; + + // docPersistIdRef + $docPersistIdRef = self::getInt4d($stream, $pos); + $pos += 4; + if ($docPersistIdRef != 0x00000001) { + throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > docPersistIdRef).'); + } + + // persistIdSeed + $pos += 4; + // lastView + $pos += 2; + // unused + $pos += 2; + } + + /** + * A structure that specifies the character-level formatting of a run of text. + * @param string $stream + * @param int $pos + * @param int $strLenRT + * @link https://msdn.microsoft.com/en-us/library/dd945870(v=office.12).aspx + */ + private function readStructureTextCFRun($stream, $pos, $strLenRT) + { + $arrayReturn = array( + 'length' => 0, + 'strLenRT' => $strLenRT, + ); + + // rgTextCFRun + $countRgTextCFRun = self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['strLenRT'] -= $countRgTextCFRun; + $arrayReturn['length'] += 4; + $arrayReturn['partLength'] = $countRgTextCFRun; + + $masks = self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + + $masksData = array(); + $masksData['bold'] = ($masks >> 0) & bindec('1'); + $masksData['italic'] = ($masks >> 1) & bindec('1'); + $masksData['underline'] = ($masks >> 2) & bindec('1'); + $masksData['unused1'] = ($masks >> 3) & bindec('1'); + $masksData['shadow'] = ($masks >> 4) & bindec('1'); + $masksData['fehint'] = ($masks >> 5) & bindec('1'); + $masksData['unused2'] = ($masks >> 6) & bindec('1'); + $masksData['kumi'] = ($masks >> 7) & bindec('1'); + $masksData['unused3'] = ($masks >> 8) & bindec('1'); + $masksData['emboss'] = ($masks >> 9) & bindec('1'); + $masksData['fHasStyle'] = ($masks >> 10) & bindec('1111'); + $masksData['unused4'] = ($masks >> 14) & bindec('11'); + $masksData['typeface'] = ($masks >> 16) & bindec('1'); + $masksData['size'] = ($masks >> 17) & bindec('1'); + $masksData['color'] = ($masks >> 18) & bindec('1'); + $masksData['position'] = ($masks >> 19) & bindec('1'); + $masksData['pp10ext'] = ($masks >> 20) & bindec('1'); + $masksData['oldEATypeface'] = ($masks >> 21) & bindec('1'); + $masksData['ansiTypeface'] = ($masks >> 22) & bindec('1'); + $masksData['symbolTypeface'] = ($masks >> 23) & bindec('1'); + $masksData['newEATypeface'] = ($masks >> 24) & bindec('1'); + $masksData['csTypeface'] = ($masks >> 25) & bindec('1'); + $masksData['pp11ext'] = ($masks >> 26) & bindec('1'); + if ($masksData['bold'] == 1 || $masksData['italic'] == 1 || $masksData['underline'] == 1 || $masksData['shadow'] == 1 || $masksData['fehint'] == 1 || $masksData['kumi'] == 1 || $masksData['emboss'] == 1 || $masksData['fHasStyle'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + + $fontStyleFlags = array(); + $fontStyleFlags['bold'] = ($data >> 0) & bindec('1'); + $fontStyleFlags['italic'] = ($data >> 1) & bindec('1'); + $fontStyleFlags['underline'] = ($data >> 2) & bindec('1'); + $fontStyleFlags['unused1'] = ($data >> 3) & bindec('1'); + $fontStyleFlags['shadow'] = ($data >> 4) & bindec('1'); + $fontStyleFlags['fehint'] = ($data >> 5) & bindec('1'); + $fontStyleFlags['unused2'] = ($data >> 6) & bindec('1'); + $fontStyleFlags['kumi'] = ($data >> 7) & bindec('1'); + $fontStyleFlags['unused3'] = ($data >> 8) & bindec('1'); + $fontStyleFlags['emboss'] = ($data >> 9) & bindec('1'); + $fontStyleFlags['pp9rt'] = ($data >> 10) & bindec('1111'); + $fontStyleFlags['unused4'] = ($data >> 14) & bindec('11'); + + $arrayReturn['bold'] = ($fontStyleFlags['bold'] == 1) ? true : false; + $arrayReturn['italic'] = ($fontStyleFlags['italic'] == 1) ? true : false; + $arrayReturn['underline'] = ($fontStyleFlags['underline'] == 1) ? true : false; + } + if ($masksData['typeface'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $arrayReturn['fontName'] = isset($this->arrayFonts[$data]) ? $this->arrayFonts[$data] : ''; + } + if ($masksData['oldEATypeface'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['ansiTypeface'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['symbolTypeface'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['size'] == 1) { + $arrayReturn['fontSize'] = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['color'] == 1) { + $red = self::getInt1d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 1; + $green = self::getInt1d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 1; + $blue = self::getInt1d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 1; + $index = self::getInt1d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 1; + + if ($index == 0xFE) { + $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); + $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); + $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); + + $arrayReturn['color'] = new Color('FF'.$strColor); + } + } + if ($masksData['position'] == 1) { + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + + return $arrayReturn; + } + + /** + * A structure that specifies the paragraph-level formatting of a run of text. + * @param string $stream + * @param itn $pos + * @link https://msdn.microsoft.com/en-us/library/dd923535(v=office.12).aspx + */ + private function readStructureTextPFRun($stream, $pos, $strLenRT) + { + $arrayReturn = array( + 'length' => 0, + 'strLenRT' => $strLenRT, + ); + + // rgTextPFRun + $countRgTextPFRun = self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['strLenRT'] -= $countRgTextPFRun; + $arrayReturn['length'] += 4; + + // indent + $arrayReturn['length'] += 2; + + $masks = self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + + $masksData = array(); + $masksData['hasBullet'] = ($masks >> 0) & bindec('1'); + $masksData['bulletHasFont'] = ($masks >> 1) & bindec('1'); + $masksData['bulletHasColor'] = ($masks >> 2) & bindec('1'); + $masksData['bulletHasSize'] = ($masks >> 3) & bindec('1'); + $masksData['bulletFont'] = ($masks >> 4) & bindec('1'); + $masksData['bulletColor'] = ($masks >> 5) & bindec('1'); + $masksData['bulletSize'] = ($masks >> 6) & bindec('1'); + $masksData['bulletChar'] = ($masks >> 7) & bindec('1'); + $masksData['leftMargin'] = ($masks >> 8) & bindec('1'); + $masksData['unused'] = ($masks >> 9) & bindec('1'); + $masksData['indent'] = ($masks >> 10) & bindec('1'); + $masksData['align'] = ($masks >> 11) & bindec('1'); + $masksData['lineSpacing'] = ($masks >> 12) & bindec('1'); + $masksData['spaceBefore'] = ($masks >> 13) & bindec('1'); + $masksData['spaceAfter'] = ($masks >> 14) & bindec('1'); + $masksData['defaultTabSize'] = ($masks >> 15) & bindec('1'); + $masksData['fontAlign'] = ($masks >> 16) & bindec('1'); + $masksData['charWrap'] = ($masks >> 17) & bindec('1'); + $masksData['wordWrap'] = ($masks >> 18) & bindec('1'); + $masksData['overflow'] = ($masks >> 19) & bindec('1'); + $masksData['tabStops'] = ($masks >> 20) & bindec('1'); + $masksData['textDirection'] = ($masks >> 21) & bindec('1'); + $masksData['reserved1'] = ($masks >> 22) & bindec('1'); + $masksData['bulletBlip'] = ($masks >> 23) & bindec('1'); + $masksData['bulletScheme'] = ($masks >> 24) & bindec('1'); + $masksData['bulletHasScheme'] = ($masks >> 25) & bindec('1'); + + $bulletFlags = array(); + if ($masksData['hasBullet'] == 1 || $masksData['bulletHasFont'] == 1 || $masksData['bulletHasColor'] == 1 || $masksData['bulletHasSize'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + + $bulletFlags['fHasBullet'] = ($data >> 0) & bindec('1'); + $bulletFlags['fBulletHasFont'] = ($data >> 1) & bindec('1'); + $bulletFlags['fBulletHasColor'] = ($data >> 2) & bindec('1'); + $bulletFlags['fBulletHasSize'] = ($data >> 3) & bindec('1'); + } + if ($masksData['bulletChar'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $arrayReturn['bulletChar'] = chr($data); + } + if ($masksData['bulletFont'] == 1) { + // $data = self::getInt2d($stream, $pos); + $arrayReturn['length'] += 2; + } + if ($masksData['bulletSize'] == 1) { + // $data = self::getInt2d($stream, $pos); + $arrayReturn['length'] += 2; + } + if ($masksData['bulletColor'] == 1) { + $red = self::getInt1d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 1; + $green = self::getInt1d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 1; + $blue = self::getInt1d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 1; + $index = self::getInt1d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 1; + + if ($index == 0xFE) { + $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); + $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); + $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); + } + } + if ($masksData['align'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + switch ($data) { + case 0x0000: + $arrayReturn['alignH'] = Alignment::HORIZONTAL_LEFT; + break; + case 0x0001: + $arrayReturn['alignH'] = Alignment::HORIZONTAL_CENTER; + break; + case 0x0002: + $arrayReturn['alignH'] = Alignment::HORIZONTAL_RIGHT; + break; + case 0x0003: + $arrayReturn['alignH'] = Alignment::HORIZONTAL_JUSTIFY; + break; + case 0x0004: + $arrayReturn['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; + break; + case 0x0005: + $arrayReturn['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; + break; + case 0x0006: + $arrayReturn['alignH'] = Alignment::HORIZONTAL_JUSTIFY; + break; + default: + break; + } + } + if ($masksData['lineSpacing'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['spaceBefore'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['spaceAfter'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['leftMargin'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $arrayReturn['leftMargin'] = (int)round($data/6); + } + if ($masksData['indent'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $arrayReturn['indent'] = (int)round($data/6); + } + if ($masksData['defaultTabSize'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['tabStops'] == 1) { + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + if ($masksData['fontAlign'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['charWrap'] == 1 || $masksData['wordWrap'] == 1 || $masksData['overflow'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['textDirection'] == 1) { + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + + return $arrayReturn; + } + + + /** + * A structure that specifies language and spelling information for a run of text. + * @param string $stream + * @param itn $pos + * @link https://msdn.microsoft.com/en-us/library/dd909603(v=office.12).aspx + */ + private function readStructureTextSIRun($stream, $pos, $strLenRT) + { + $arrayReturn = array( + 'length' => 0, + 'strLenRT' => $strLenRT, + ); + + $arrayReturn['strLenRT'] -= self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + + $data = self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + $masksData = array(); + $masksData['spell'] = ($data >> 0) & bindec('1'); + $masksData['lang'] = ($data >> 1) & bindec('1'); + $masksData['altLang'] = ($data >> 2) & bindec('1'); + $masksData['unused1'] = ($data >> 3) & bindec('1'); + $masksData['unused2'] = ($data >> 4) & bindec('1'); + $masksData['fPp10ext'] = ($data >> 5) & bindec('1'); + $masksData['fBidi'] = ($data >> 6) & bindec('1'); + $masksData['unused3'] = ($data >> 7) & bindec('1'); + $masksData['reserved1'] = ($data >> 8) & bindec('1'); + $masksData['smartTag'] = ($data >> 9) & bindec('1'); + + if ($masksData['spell'] == 1) { + $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $masksSpell = array(); + $masksSpell['error'] = ($data >> 0) & bindec('1'); + $masksSpell['clean'] = ($data >> 1) & bindec('1'); + $masksSpell['grammar'] = ($data >> 2) & bindec('1'); + } + if ($masksData['lang'] == 1) { + // $data = self::getInt2d($stream, $pos); + $arrayReturn['length'] += 2; + } + if ($masksData['altLang'] == 1) { + // $data = self::getInt2d($stream, $pos); + $arrayReturn['length'] += 2; + } + if ($masksData['fBidi'] == 1) { + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + if ($masksData['fPp10ext'] == 1) { + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + if ($masksData['smartTag'] == 1) { + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + + return $arrayReturn; + } + + /** + * A structure that specifies tabbing, margins, and indentation for text. + * @param string $stream + * @param int $pos + * @link https://msdn.microsoft.com/en-us/library/dd922749(v=office.12).aspx + */ + private function readStructureTextRuler($stream, $pos) + { + $arrayReturn = array( + 'length' => 0, + ); + + $data = self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + + $masksData = array(); + $masksData['fDefaultTabSize'] = ($data >> 0) & bindec('1'); + $masksData['fCLevels'] = ($data >> 1) & bindec('1'); + $masksData['fTabStops'] = ($data >> 2) & bindec('1'); + $masksData['fLeftMargin1'] = ($data >> 3) & bindec('1'); + $masksData['fLeftMargin2'] = ($data >> 4) & bindec('1'); + $masksData['fLeftMargin3'] = ($data >> 5) & bindec('1'); + $masksData['fLeftMargin4'] = ($data >> 6) & bindec('1'); + $masksData['fLeftMargin5'] = ($data >> 7) & bindec('1'); + $masksData['fIndent1'] = ($data >> 8) & bindec('1'); + $masksData['fIndent2'] = ($data >> 9) & bindec('1'); + $masksData['fIndent3'] = ($data >> 10) & bindec('1'); + $masksData['fIndent4'] = ($data >> 11) & bindec('1'); + $masksData['fIndent5'] = ($data >> 12) & bindec('1'); + + if ($masksData['fCLevels'] == 1) { + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + if ($masksData['fDefaultTabSize'] == 1) { + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + if ($masksData['fTabStops'] == 1) { + $count = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $arrayTabStops = array(); + for ($inc = 0; $inc < $count; $inc++) { + $position = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $type = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + $arrayTabStops[] = array( + 'position' => $position, + 'type' => $type, + ); + } + } + if ($masksData['fLeftMargin1'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['fIndent1'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['fLeftMargin2'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['fIndent2'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['fLeftMargin3'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['fIndent3'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['fLeftMargin4'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['fIndent4'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['fLeftMargin5'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + if ($masksData['fIndent5'] == 1) { + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 2; + } + + return $arrayReturn; } } From b9ff9fcdde6db35d31063deba0cf4435a0195d7c Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 1 Jul 2015 14:19:11 +0200 Subject: [PATCH 102/115] Refactored the PowerPoint97 Reader for managing the group shape and improving evolutions - @Progi1984 GH-110 --- src/PhpPowerpoint/Reader/PowerPoint97.php | 923 +++++++++++----------- 1 file changed, 459 insertions(+), 464 deletions(-) diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index a3515aef6..a38166274 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -46,7 +46,7 @@ class PowerPoint97 implements ReaderInterface const OFFICEARTBLIPDIB = 0xF01F; const OFFICEARTBLIPTIFF = 0xF029; const OFFICEARTBLIPJPEG = 0xF02A; - + /** * @link http://msdn.microsoft.com/en-us/library/dd945336(v=office.12).aspx */ @@ -268,7 +268,7 @@ class PowerPoint97 implements ReaderInterface const RT_VIEWINFOATOM = 0x03FD; const RT_VISUALPAGEATOM = 0x2B01; const RT_VISUALSHAPEATOM = 0x2AFB; - + /** * @var http://msdn.microsoft.com/en-us/library/dd926394(v=office.12).aspx */ @@ -286,7 +286,7 @@ class PowerPoint97 implements ReaderInterface const SL_TWOROWSCOLUMN = 0x0000000B; const SL_VERTICALTITLEBODY = 0x00000011; const SL_VERTICALTWOROWS = 0x00000012; - + /** * Array with Fonts */ @@ -328,11 +328,6 @@ class PowerPoint97 implements ReaderInterface * @var boolean */ private $bFirstShapeGroup = false; - /** - * Shape Object - * @var AbstractShape - */ - private $oCurrentShape; /** * Stream "Powerpoint Document" * @var string @@ -358,7 +353,7 @@ class PowerPoint97 implements ReaderInterface * @var string */ private $streamPictures; - + /** * Can the current \PhpOffice\PhpPowerpoint\Reader\ReaderInterface read the file? * @@ -428,7 +423,7 @@ private function loadFile($pFilename) { $this->oPhpPowerpoint = new PhpPowerpoint(); $this->oPhpPowerpoint->removeSlideByIndex(); - + // Read OLE Blocks $this->loadOLE($pFilename); // Read pictures in the Pictures Stream @@ -437,10 +432,10 @@ private function loadFile($pFilename) $this->loadCurrentUserStream(); // Read information in the PowerPoint Document Stream $this->loadPowerpointDocumentStream(); - + return $this->oPhpPowerpoint; } - + /** * Read OLE Part * @param string $pFilename @@ -453,16 +448,16 @@ private function loadOLE($pFilename) // PowerPoint Document Stream $this->streamPowerpointDocument = $oOLE->getStream($oOLE->powerpointDocument); - + // Current User Stream $this->streamCurrentUser = $oOLE->getStream($oOLE->currentUser); - + // Get summary information data $this->streamSummaryInformation = $oOLE->getStream($oOLE->summaryInformation); - + // Get additional document summary information data $this->streamDocumentSummaryInformation = $oOLE->getStream($oOLE->docSummaryInfos); - + // Get pictures data $this->streamPictures = $oOLE->getStream($oOLE->pictures); } @@ -474,7 +469,7 @@ private function loadOLE($pFilename) private function loadPicturesStream() { $stream = $this->streamPictures; - + $pos = 0; $readSuccess = true; do { @@ -488,7 +483,7 @@ private function loadPicturesStream() } if ($arrayRH['recType'] >= 0xF018 && $arrayRH['recType'] <= 0xF117) { $arrayRecord = $this->readRecordOfficeArtBlip($stream, $pos - 8); - if($arrayRecord['length'] > 0) { + if ($arrayRecord['length'] > 0) { $pos += $arrayRecord['length']; $this->arrayPictures[] = $arrayRecord['picture']; } @@ -498,7 +493,7 @@ private function loadPicturesStream() } } while ($readSuccess === true); } - + /** * Stream Current User * @link http://msdn.microsoft.com/en-us/library/dd908567(v=office.12).aspx @@ -506,7 +501,7 @@ private function loadPicturesStream() private function loadCurrentUserStream() { $pos = 0; - + /** * CurrentUserAtom : http://msdn.microsoft.com/en-us/library/dd948895(v=office.12).aspx */ @@ -562,10 +557,10 @@ private function loadCurrentUserStream() if ($minorVersion != 0x00) { throw new \Exception('File PowerPoint 97 in error (Location : CurrentUserAtom > minorVersion).'); } - + // unused $pos += 2; - + // ansiUserName $ansiUserName = ''; do { @@ -584,7 +579,7 @@ private function loadCurrentUserStream() if ($relVersion != 0x00000008 && $relVersion != 0x00000009) { throw new \Exception('File PowerPoint 97 in error (Location : CurrentUserAtom > relVersion).'); } - + // unicodeUserName $unicodeUserName = ''; for ($inc = 0; $inc < $lenUserName; $inc++) { @@ -596,7 +591,7 @@ private function loadCurrentUserStream() $pos += 2; } } - + /** * Stream Powerpoint Document * @link http://msdn.microsoft.com/en-us/library/dd921564(v=office.12).aspx @@ -604,12 +599,12 @@ private function loadCurrentUserStream() private function loadPowerpointDocumentStream() { $this->readRecordUserEditAtom($this->streamPowerpointDocument, $this->offsetToCurrentEdit); - + $this->readRecordPersistDirectoryAtom($this->streamPowerpointDocument, $this->offsetPersistDirectory); - + foreach ($this->rgPersistDirEntry as $offsetDir) { $pos = $offsetDir; - + $rh = $this->loadRecordHeader($this->streamPowerpointDocument, $pos); $pos += 8; switch ($rh['recType']) { @@ -625,7 +620,7 @@ private function loadPowerpointDocumentStream() } } } - + /** * Read a record header * @param string $stream @@ -651,7 +646,7 @@ private function loadRecordHeader($stream, $pos) 'recLen' => $recLen, ); } - + /** * Read 8-bit unsigned integer * @@ -663,7 +658,7 @@ public static function getInt1d($data, $pos) { return ord($data[$pos]); } - + /** * Read 16-bit unsigned integer * @@ -675,7 +670,7 @@ public static function getInt2d($data, $pos) { return ord($data[$pos]) | (ord($data[$pos+1]) << 8); } - + /** * Read 32-bit signed integer * @@ -697,7 +692,7 @@ public static function getInt4d($data, $pos) } return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $ord24; } - + /** * A container record that specifies the animation and sound information for a shape. * @param string $stream @@ -706,22 +701,22 @@ public static function getInt4d($data, $pos) */ private function readRecordAnimationInfoContainer($stream, $pos) { - $arrayReturn = array( - 'length' => 0, - ); - - $data = $this->loadRecordHeader($stream, $pos); - if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_ANIMATIONINFO) { - // Record Header - $arrayReturn['length'] += 8; - // animationAtom - // animationSound - throw new \Exception('Feature not implemented (l.'.__LINE__.')'); - } - - return $arrayReturn; + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_ANIMATIONINFO) { + // Record Header + $arrayReturn['length'] += 8; + // animationAtom + // animationSound + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + + return $arrayReturn; } - + /** * A container record that specifies information about the document. * @param string $stream @@ -736,7 +731,7 @@ private function readRecordDocumentContainer($stream, $pos) throw new \Exception('File PowerPoint 97 in error (Location : RTDocument > DocumentAtom).'); } $pos += $documentAtom['recLen']; - + $exObjList = $this->loadRecordHeader($stream, $pos); if ($exObjList['recVer'] == 0xF && $exObjList['recInstance'] == 0x000 && $exObjList['recType'] == self::RT_EXTERNALOBJECTLIST) { $pos += 8; @@ -768,7 +763,7 @@ private function readRecordDocumentContainer($stream, $pos) $exHyperlinkId = self::getInt4d($stream, $pos); $pos += 4; $exObjList['recLen'] -= 4; - + $this->arrayHyperlinks[$exHyperlinkId] = array(); // friendlyNameAtom $friendlyNameAtom = $this->loadRecordHeader($stream, $pos); @@ -815,7 +810,7 @@ private function readRecordDocumentContainer($stream, $pos) } } while ($exObjList['recLen'] > 0); } - + //@link : http://msdn.microsoft.com/en-us/library/dd907813(v=office.12).aspx $documentTextInfo = $this->loadRecordHeader($stream, $pos); if ($documentTextInfo['recVer'] == 0xF && $documentTextInfo['recInstance'] == 0x000 && $documentTextInfo['recType'] == self::RT_ENVIRONMENT) { @@ -826,7 +821,7 @@ private function readRecordDocumentContainer($stream, $pos) $pos += 8; $pos += $kinsoku['recLen']; } - + //@link : http://msdn.microsoft.com/en-us/library/dd948152(v=office.12).aspx $fontCollection = $this->loadRecordHeader($stream, $pos); if ($fontCollection['recVer'] == 0xF && $fontCollection['recInstance'] == 0x000 && $fontCollection['recType'] == self::RT_FONTCOLLECTION) { @@ -846,16 +841,16 @@ private function readRecordDocumentContainer($stream, $pos) $string .= chr($char); } $this->arrayFonts[] = $string; - + // lfCharSet (1 byte) $pos += 1; $fontCollection['recLen'] -= 1; - + // fEmbedSubsetted (1 bit) // unused (7 bits) $pos += 1; $fontCollection['recLen'] -= 1; - + // rasterFontType (1 bit) // deviceFontType (1 bit) // truetypeFontType (1 bit) @@ -863,12 +858,12 @@ private function readRecordDocumentContainer($stream, $pos) // reserved (4 bits) $pos += 1; $fontCollection['recLen'] -= 1; - + // lfPitchAndFamily (1 byte) $pos += 1; $fontCollection['recLen'] -= 1; } - + $fontEmbedData1 = $this->loadRecordHeader($stream, $pos); if ($fontEmbedData1['recVer'] == 0x0 && $fontEmbedData1['recInstance'] >= 0x000 && $fontEmbedData1['recInstance'] <= 0x003 && $fontEmbedData1['recType'] == self::RT_FONTEMBEDDATABLOB) { $pos += 8; @@ -876,7 +871,7 @@ private function readRecordDocumentContainer($stream, $pos) $pos += $fontEmbedData1['recLen']; $fontCollection['recLen'] -= $fontEmbedData1['recLen']; } - + $fontEmbedData2 = $this->loadRecordHeader($stream, $pos); if ($fontEmbedData2['recVer'] == 0x0 && $fontEmbedData2['recInstance'] >= 0x000 && $fontEmbedData2['recInstance'] <= 0x003 && $fontEmbedData2['recType'] == self::RT_FONTEMBEDDATABLOB) { $pos += 8; @@ -884,7 +879,7 @@ private function readRecordDocumentContainer($stream, $pos) $pos += $fontEmbedData2['recLen']; $fontCollection['recLen'] -= $fontEmbedData2['recLen']; } - + $fontEmbedData3 = $this->loadRecordHeader($stream, $pos); if ($fontEmbedData3['recVer'] == 0x0 && $fontEmbedData3['recInstance'] >= 0x000 && $fontEmbedData3['recInstance'] <= 0x003 && $fontEmbedData3['recType'] == self::RT_FONTEMBEDDATABLOB) { $pos += 8; @@ -892,7 +887,7 @@ private function readRecordDocumentContainer($stream, $pos) $pos += $fontEmbedData3['recLen']; $fontCollection['recLen'] -= $fontEmbedData3['recLen']; } - + $fontEmbedData4 = $this->loadRecordHeader($stream, $pos); if ($fontEmbedData4['recVer'] == 0x0 && $fontEmbedData4['recInstance'] >= 0x000 && $fontEmbedData4['recInstance'] <= 0x003 && $fontEmbedData4['recType'] == self::RT_FONTEMBEDDATABLOB) { $pos += 8; @@ -900,7 +895,7 @@ private function readRecordDocumentContainer($stream, $pos) $pos += $fontEmbedData4['recLen']; $fontCollection['recLen'] -= $fontEmbedData4['recLen']; } - + } while ($fontCollection['recLen'] > 0); } } @@ -917,19 +912,19 @@ private function readRecordDrawingContainer($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_DRAWING) { // Record Header $arrayReturn['length'] += 8; - + $officeArtDg = $this->readRecordOfficeArtDgContainer($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $officeArtDg['length']; } - + return $arrayReturn; } - + /** * An atom record that specifies a reference to an external object. * @param string $stream @@ -938,21 +933,21 @@ private function readRecordDrawingContainer($stream, $pos) */ private function readRecordExObjRefAtom($stream, $pos) { - $arrayReturn = array( - 'length' => 0, - ); - - $data = $this->loadRecordHeader($stream, $pos); - if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_EXTERNALOBJECTREFATOM && $data['recLen'] == 0x00000004) { - // Record Header - $arrayReturn['length'] += 8; - // Datas - $arrayReturn['length'] += $data['recLen']; - } - - return $arrayReturn; + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_EXTERNALOBJECTREFATOM && $data['recLen'] == 0x00000004) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; } - + /** * An atom record that specifies a type of action to be performed. * @param string $stream @@ -961,63 +956,63 @@ private function readRecordExObjRefAtom($stream, $pos) */ private function readRecordInteractiveInfoAtom($stream, $pos) { - $arrayReturn = array( - 'length' => 0, - ); - - $data = $this->loadRecordHeader($stream, $pos); - if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_INTERACTIVEINFOATOM && $data['recLen'] == 0x00000010) { - // Record Header - $arrayReturn['length'] += 8; - // soundIdRef - $arrayReturn['length'] += 4; - // exHyperlinkIdRef - $arrayReturn['exHyperlinkIdRef'] = self::getInt4d($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += 4; - // action - $arrayReturn['length'] += 1; - // oleVerb - $arrayReturn['length'] += 1; - // jump - $arrayReturn['length'] += 1; - // fAnimated (1 bit) - // fStopSound (1 bit) - // fCustomShowReturn (1 bit) - // fVisited (1 bit) - // reserved (4 bits) - $arrayReturn['length'] += 1; - // hyperlinkType - $arrayReturn['length'] += 1; - // unused - $arrayReturn['length'] += 3; - } - - return $arrayReturn; + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_INTERACTIVEINFOATOM && $data['recLen'] == 0x00000010) { + // Record Header + $arrayReturn['length'] += 8; + // soundIdRef + $arrayReturn['length'] += 4; + // exHyperlinkIdRef + $arrayReturn['exHyperlinkIdRef'] = self::getInt4d($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += 4; + // action + $arrayReturn['length'] += 1; + // oleVerb + $arrayReturn['length'] += 1; + // jump + $arrayReturn['length'] += 1; + // fAnimated (1 bit) + // fStopSound (1 bit) + // fCustomShowReturn (1 bit) + // fVisited (1 bit) + // reserved (4 bits) + $arrayReturn['length'] += 1; + // hyperlinkType + $arrayReturn['length'] += 1; + // unused + $arrayReturn['length'] += 3; + } + + return $arrayReturn; } - + /** * An atom record that specifies the name of a macro, a file name, or a named show. * @param string $stream * @param integer $pos - * @link https://msdn.microsoft.com/en-us/library/dd925121(v=office.12).aspx + * @link https://msdn.microsoft.com/en-us/library/dd925121(v=office.12).aspx */ private function readRecordMacroNameAtom($stream, $pos) { - $arrayReturn = array( - 'length' => 0, - ); - - $data = $this->loadRecordHeader($stream, $pos); - if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x002 && $data['recType'] == self::RT_CSTRING && $data['recLen'] % 2 == 0) { - // Record Header - $arrayReturn['length'] += 8; - // Datas - $arrayReturn['length'] += $data['recLen']; - } - - return $arrayReturn; + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x002 && $data['recType'] == self::RT_CSTRING && $data['recLen'] % 2 == 0) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; } - + /** * A container record that specifies what actions to perform when interacting with an object by means of a mouse click. * @param string $stream @@ -1026,28 +1021,28 @@ private function readRecordMacroNameAtom($stream, $pos) */ private function readRecordMouseClickInteractiveInfoContainer($stream, $pos) { - $arrayReturn = array( - 'length' => 0, - ); - - $data = $this->loadRecordHeader($stream, $pos); - if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_INTERACTIVEINFO) { - // Record Header - $arrayReturn['length'] += 8; - // interactiveInfoAtom - $dataInteractiveInfoAtom = $this->readRecordInteractiveInfoAtom($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataInteractiveInfoAtom['length']; - if ($dataInteractiveInfoAtom['length'] > 0) { - $arrayReturn['exHyperlinkIdRef'] = $dataInteractiveInfoAtom['exHyperlinkIdRef']; - } - // macroNameAtom - $dataInteractiveInfoAtom = $this->readRecordMacroNameAtom($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataInteractiveInfoAtom['length']; - } - - return $arrayReturn; + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_INTERACTIVEINFO) { + // Record Header + $arrayReturn['length'] += 8; + // interactiveInfoAtom + $interactiveInfoAtom = $this->readRecordInteractiveInfoAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $interactiveInfoAtom['length']; + if ($interactiveInfoAtom['length'] > 0) { + $arrayReturn['exHyperlinkIdRef'] = $interactiveInfoAtom['exHyperlinkIdRef']; + } + // macroNameAtom + $macroNameAtom = $this->readRecordMacroNameAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $macroNameAtom['length']; + } + + return $arrayReturn; } - + /** * A container record that specifies what actions to perform when interacting with an object by moving the mouse cursor over it. * @param string $stream @@ -1056,22 +1051,22 @@ private function readRecordMouseClickInteractiveInfoContainer($stream, $pos) */ private function readRecordMouseOverInteractiveInfoContainer($stream, $pos) { - $arrayReturn = array( - 'length' => 0, - ); - - $data = $this->loadRecordHeader($stream, $pos); - if ($data['recVer'] == 0xF && $data['recInstance'] == 0x001 && $data['recType'] == self::RT_INTERACTIVEINFO) { - // Record Header - $arrayReturn['length'] += 8; - // interactiveInfoAtom - // macroNameAtom - throw new \Exception('Feature not implemented (l.'.__LINE__.')'); - } - - return $arrayReturn; + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x001 && $data['recType'] == self::RT_INTERACTIVEINFO) { + // Record Header + $arrayReturn['length'] += 8; + // interactiveInfoAtom + // macroNameAtom + throw new \Exception('Feature not implemented (l.'.__LINE__.')'); + } + + return $arrayReturn; } - + /** * The OfficeArtBlip record specifies BLIP file data. * @param string $stream @@ -1084,7 +1079,7 @@ private function readRecordOfficeArtBlip($stream, $pos) 'length' => 0, 'picture' => null ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && ($data['recType'] >= 0xF018 && $data['recType'] <= 0xF117)) { // Record Header @@ -1109,15 +1104,15 @@ private function readRecordOfficeArtBlip($stream, $pos) $arrayReturn['length'] += $data['recLen']; break; default: - throw new \Exception('Feature not implemented (l.'.__LINE__.' : '.dechex($arrayRH['recType'].')')); + throw new \Exception('Feature not implemented (l.'.__LINE__.' : '.dechex($data['recType'].')')); } } - + return $arrayReturn; } - + /** - * The OfficeArtChildAnchor record specifies four signed integers that specify the anchor for the shape that contains this record. + * The OfficeArtChildAnchor record specifies four signed integers that specify the anchor for the shape that contains this record. * @param string $stream * @param integer $pos * @link https://msdn.microsoft.com/en-us/library/dd922720(v=office.12).aspx @@ -1127,7 +1122,7 @@ private function readRecordOfficeArtChildAnchor($stream, $pos) $arrayReturn = array( 'length' => 0 ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == 0xF00F && $data['recLen'] == 0x00000010) { // Record Header @@ -1142,10 +1137,10 @@ private function readRecordOfficeArtChildAnchor($stream, $pos) $arrayReturn['height'] = (int) self::getInt4d($stream, $pos + $arrayReturn['length']) - $arrayReturn['top']; $arrayReturn['length'] += 4; } - + return $arrayReturn; } - + /** @@ -1159,7 +1154,7 @@ private function readRecordOfficeArtClientAnchor($stream, $pos) $arrayReturn = array( 'length' => 0 ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == 0xF010 && ($data['recLen'] == 0x00000008 || $data['recLen'] == 0x00000010)) { // Record Header @@ -1178,11 +1173,11 @@ private function readRecordOfficeArtClientAnchor($stream, $pos) $pos += 8; break; case 0x00000010: - throw new \Exception('PowerPoint97 Reader : record OfficeArtClientAnchor (0x00000010)'); + throw new \Exception('PowerPoint97 Reader : record OfficeArtClientAnchor (0x00000010)'); break; } } - + return $arrayReturn; } /** @@ -1200,7 +1195,7 @@ private function readRecordOfficeArtClientTextbox($stream, $pos) 'numTexts' => 0, 'hyperlink' => array(), ); - + $data = $this->loadRecordHeader($stream, $pos); // recVer 0xF // Doc : 0x0 https://msdn.microsoft.com/en-us/library/dd910958(v=office.12).aspx @@ -1220,13 +1215,13 @@ private function readRecordOfficeArtClientTextbox($stream, $pos) case self::RT_INTERACTIVEINFO: //@link : http://msdn.microsoft.com/en-us/library/dd948623(v=office.12).aspx if ($rhChild['recInstance'] == 0x0000) { - $mouseClickInteractiveInfoContainer = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $mouseClickInteractiveInfoContainer['length']; - $arrayReturn['hyperlink'][]['id'] = $mouseClickInteractiveInfoContainer['exHyperlinkIdRef']; + $mouseClickInteractiveInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseClickInteractiveInfo['length']; + $arrayReturn['hyperlink'][]['id'] = $mouseClickInteractiveInfo['exHyperlinkIdRef']; } if ($rhChild['recInstance'] == 0x0001) { - $mouseOverInteractiveInfoContainer = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $mouseOverInteractiveInfoContainer['length']; + $mouseOverInteractiveInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseOverInteractiveInfo['length']; } break; case self::RT_STYLETEXTPROPATOM: @@ -1238,7 +1233,7 @@ private function readRecordOfficeArtClientTextbox($stream, $pos) $strucTextPFRun = $this->readStructureTextPFRun($stream, $pos + $arrayReturn['length'], $strLenRT); $arrayReturn['numTexts']++; $arrayReturn['text'.$arrayReturn['numTexts']] = $strucTextPFRun; - if(isset($strucTextPFRun['alignH'])) { + if (isset($strucTextPFRun['alignH'])) { $arrayReturn['alignH'] = $strucTextPFRun['alignH']; } $strLenRT = $strucTextPFRun['strLenRT']; @@ -1293,7 +1288,7 @@ private function readRecordOfficeArtClientTextbox($stream, $pos) //@todo : MouseClickTextInteractiveInfoAtom $arrayReturn['hyperlink'][count($arrayReturn['hyperlink']) - 1]['start'] = self::getInt4d($stream, $pos + + $arrayReturn['length']); $arrayReturn['length'] += 4; - + $arrayReturn['hyperlink'][count($arrayReturn['hyperlink']) - 1]['end'] = self::getInt4d($stream, $pos + + $arrayReturn['length']); $arrayReturn['length'] += 4; } @@ -1328,7 +1323,7 @@ private function readRecordOfficeArtClientTextbox($stream, $pos) } return $arrayReturn; } - + /** * The OfficeArtSpContainer record specifies a shape container. * @param string $stream @@ -1341,7 +1336,7 @@ private function readRecordOfficeArtSpContainer($stream, $pos) 'length' => 0, 'shape' => null, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF004) { // Record Header @@ -1349,67 +1344,67 @@ private function readRecordOfficeArtSpContainer($stream, $pos) // shapeGroup $shapeGroup = $this->readRecordOfficeArtFSPGR($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $shapeGroup['length']; - + // shapeProp $shapeProp = $this->readRecordOfficeArtFSP($stream, $pos + $arrayReturn['length']); - if($shapeProp['length'] == 0) { + if ($shapeProp['length'] == 0) { throw new \Exception('PowerPoint97 Reader : record OfficeArtFSP'); } $arrayReturn['length'] += $shapeProp['length']; - - if($shapeProp['fDeleted'] == 0x1 && $shapeProp['fChild'] == 0x0) { + + if ($shapeProp['fDeleted'] == 0x1 && $shapeProp['fChild'] == 0x0) { // deletedShape $deletedShape = $this->readRecordOfficeArtFPSPL($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $deletedShape['length']; } - + // shapePrimaryOptions - $shapePrimaryOptions = $this->readRecordOfficeArtFOPT($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $shapePrimaryOptions['length']; - + $shpPrimaryOptions = $this->readRecordOfficeArtFOPT($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shpPrimaryOptions['length']; + // shapeSecondaryOptions1 - $shapeSecondaryOptions1 = $this->readRecordOfficeArtSecondaryFOPT($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $shapeSecondaryOptions1['length']; - + $shpSecondaryOptions1 = $this->readRecordOfficeArtSecondaryFOPT($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shpSecondaryOptions1['length']; + // shapeTertiaryOptions1 - $shapeTertiaryOptions1 = $this->readRecordOfficeArtTertiaryFOPT($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $shapeTertiaryOptions1['length']; - + $shpTertiaryOptions1 = $this->readRecordOfficeArtTertiaryFOPT($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shpTertiaryOptions1['length']; + // childAnchor $childAnchor = $this->readRecordOfficeArtChildAnchor($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $childAnchor['length']; - + // clientAnchor $clientAnchor = $this->readRecordOfficeArtClientAnchor($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $clientAnchor['length']; - + // clientData $clientData = $this->readRecordOfficeArtClientData($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $clientData['length']; - - // clientTextbox + + // clientTextbox $clientTextbox = $this->readRecordOfficeArtClientTextbox($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $clientTextbox['length']; - + // shapeSecondaryOptions2 - if($shapeSecondaryOptions1['length'] == 0) { - $shapeSecondaryOptions2 = $this->readRecordOfficeArtSecondaryFOPT($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $shapeSecondaryOptions2['length']; + if ($shpSecondaryOptions1['length'] == 0) { + $shpSecondaryOptions2 = $this->readRecordOfficeArtSecondaryFOPT($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shpSecondaryOptions2['length']; } - + // shapeTertiaryOptions2 - if($shapeTertiaryOptions1['length'] == 0) { - $shapeTertiaryOptions2 = $this->readRecordOfficeArtTertiaryFOPT($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $shapeTertiaryOptions2['length']; + if ($shpTertiaryOptions1['length'] == 0) { + $shpTertiaryOptions2 = $this->readRecordOfficeArtTertiaryFOPT($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $shpTertiaryOptions2['length']; } - + // Core : Shape // Informations about group are not defined $arrayDimensions = array(); $bIsGroup = false; - if(is_object($this->oCurrentGroup)){ - if(!$this->bFirstShapeGroup){ - if($clientAnchor['length'] > 0){ + if (is_object($this->oCurrentGroup)) { + if (!$this->bFirstShapeGroup) { + if ($clientAnchor['length'] > 0) { $this->oCurrentGroup->setOffsetX($clientAnchor['left']); $this->oCurrentGroup->setOffsetY($clientAnchor['top']); $this->oCurrentGroup->setHeight($clientAnchor['height']); @@ -1418,26 +1413,26 @@ private function readRecordOfficeArtSpContainer($stream, $pos) $bIsGroup = true; $this->bFirstShapeGroup = true; } else { - if($childAnchor['length'] > 0){ + if ($childAnchor['length'] > 0) { $arrayDimensions = $childAnchor; } } } else { - if($clientAnchor['length'] > 0){ + if ($clientAnchor['length'] > 0) { $arrayDimensions = $clientAnchor; } } if (!$bIsGroup) { // *** Shape *** - if(isset($shapePrimaryOptions['pib'])) { + if (isset($shpPrimaryOptions['pib'])) { // isDrawing - $drawingPib = $shapePrimaryOptions['pib']; - if(isset($this->arrayPictures[$drawingPib - 1])){ + $drawingPib = $shpPrimaryOptions['pib']; + if (isset($this->arrayPictures[$drawingPib - 1])) { $gdImage = imagecreatefromstring($this->arrayPictures[$drawingPib - 1]); $arrayReturn['shape'] = new MemoryDrawing(); $arrayReturn['shape']->setImageResource($gdImage); } - } elseif (isset($shapePrimaryOptions['line']) && $shapePrimaryOptions['line']) { + } elseif (isset($shpPrimaryOptions['line']) && $shpPrimaryOptions['line']) { // isLine $arrayReturn['shape'] = new Line(0, 0, 0, 0); } elseif ($clientTextbox['length'] > 0) { @@ -1519,33 +1514,33 @@ private function readRecordOfficeArtSpContainer($stream, $pos) if (!empty($sHyperlinkURL)) { $txtRun->setHyperlink(new Hyperlink($sHyperlinkURL)); } - + $start += $clientTextbox['part'.$inc]['partLength']; if ($bCreateParagraph) { $arrayReturn['shape']->createParagraph(); } } } - + // *** Properties *** // Dimensions - if($arrayReturn['shape'] instanceof AbstractShape) { - if(!empty($arrayDimensions)){ + if ($arrayReturn['shape'] instanceof AbstractShape) { + if (!empty($arrayDimensions)) { $arrayReturn['shape']->setOffsetX($arrayDimensions['left']); $arrayReturn['shape']->setOffsetY($arrayDimensions['top']); $arrayReturn['shape']->setHeight($arrayDimensions['height']); $arrayReturn['shape']->setWidth($arrayDimensions['width']); } // Rotation - if(isset($shapePrimaryOptions['rotation'])) { - $rotation = $shapePrimaryOptions['rotation']; + if (isset($shpPrimaryOptions['rotation'])) { + $rotation = $shpPrimaryOptions['rotation']; $arrayReturn['shape']->setRotation($rotation); } // Shadow - if (isset($shapePrimaryOptions['shadowOffsetX']) && isset($shapePrimaryOptions['shadowOffsetY'])) { - $shadowOffsetX = $shapePrimaryOptions['shadowOffsetX']; - $shadowOffsetY = $shapePrimaryOptions['shadowOffsetY']; - if($shadowOffsetX != 0 && $shadowOffsetX != 0) { + if (isset($shpPrimaryOptions['shadowOffsetX']) && isset($shpPrimaryOptions['shadowOffsetY'])) { + $shadowOffsetX = $shpPrimaryOptions['shadowOffsetX']; + $shadowOffsetY = $shpPrimaryOptions['shadowOffsetY']; + if ($shadowOffsetX != 0 && $shadowOffsetX != 0) { $arrayReturn['shape']->getShadow()->setVisible(true); if ($shadowOffsetX > 0 && $shadowOffsetX == $shadowOffsetY) { $arrayReturn['shape']->getShadow()->setDistance($shadowOffsetX)->setDirection(45); @@ -1554,43 +1549,43 @@ private function readRecordOfficeArtSpContainer($stream, $pos) } // Specific Line if ($arrayReturn['shape'] instanceof Line) { - if (isset($shapePrimaryOptions['lineColor'])) { - $arrayReturn['shape']->getBorder()->getColor()->setARGB('FF'.$shapePrimaryOptions['lineColor']); + if (isset($shpPrimaryOptions['lineColor'])) { + $arrayReturn['shape']->getBorder()->getColor()->setARGB('FF'.$shpPrimaryOptions['lineColor']); } - if (isset($shapePrimaryOptions['lineWidth'])) { - $arrayReturn['shape']->setHeight($shapePrimaryOptions['lineWidth']); + if (isset($shpPrimaryOptions['lineWidth'])) { + $arrayReturn['shape']->setHeight($shpPrimaryOptions['lineWidth']); } } // Specific RichText if ($arrayReturn['shape'] instanceof RichText) { - if (isset($shapePrimaryOptions['insetBottom'])) { - $arrayReturn['shape']->setInsetBottom($shapePrimaryOptions['insetBottom']); + if (isset($shpPrimaryOptions['insetBottom'])) { + $arrayReturn['shape']->setInsetBottom($shpPrimaryOptions['insetBottom']); } - if (isset($shapePrimaryOptions['insetLeft'])) { - $arrayReturn['shape']->setInsetLeft($shapePrimaryOptions['insetLeft']); + if (isset($shpPrimaryOptions['insetLeft'])) { + $arrayReturn['shape']->setInsetLeft($shpPrimaryOptions['insetLeft']); } - if (isset($shapePrimaryOptions['insetRight'])) { - $arrayReturn['shape']->setInsetRight($shapePrimaryOptions['insetRight']); + if (isset($shpPrimaryOptions['insetRight'])) { + $arrayReturn['shape']->setInsetRight($shpPrimaryOptions['insetRight']); } - if (isset($shapePrimaryOptions['insetTop'])) { - $arrayReturn['shape']->setInsetTop($shapePrimaryOptions['insetTop']); + if (isset($shpPrimaryOptions['insetTop'])) { + $arrayReturn['shape']->setInsetTop($shpPrimaryOptions['insetTop']); } } } } else { // Rotation - if(isset($shapePrimaryOptions['rotation'])) { - $rotation = $shapePrimaryOptions['rotation']; + if (isset($shpPrimaryOptions['rotation'])) { + $rotation = $shpPrimaryOptions['rotation']; $this->oCurrentGroup->setRotation($rotation); } } } - + return $arrayReturn; } - + /** - * The OfficeArtSpgrContainer record specifies a container for groups of shapes. + * The OfficeArtSpgrContainer record specifies a container for groups of shapes. * @param string $stream * @param integer $pos * @param boolean $bInGroup @@ -1601,17 +1596,17 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF003) { $arrayReturn['length'] += 8; - + do { $rhFileBlock = $this->loadRecordHeader($stream, $pos + $arrayReturn['length']); if (!($rhFileBlock['recVer'] == 0xF && $rhFileBlock['recInstance'] == 0x0000 && ($rhFileBlock['recType'] == 0xF003 || $rhFileBlock['recType'] == 0xF004))) { throw new \Exception('PowerPoint97 Reader : readRecordOfficeArtSpgrContainer.'); } - + switch ($rhFileBlock['recType']) { case 0xF003: // Core @@ -1624,7 +1619,7 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal break; case 0xF004: // Core - if(!$bInGroup) { + if (!$bInGroup) { $this->oCurrentGroup = null; } // OfficeArtSpContainer @@ -1633,14 +1628,14 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal $data['recLen'] -= $fileBlock['length']; // Core //@todo - if(!is_null($fileBlock['shape'])){ - if($bInGroup) { + if (!is_null($fileBlock['shape'])) { + if ($bInGroup) { $this->oCurrentGroup->addShape($fileBlock['shape']); } else { $this->oPhpPowerpoint->getActiveSlide()->addShape($fileBlock['shape']); } } - + break; } } while ($data['recLen'] > 0); @@ -1659,12 +1654,12 @@ private function readRecordOfficeArtTertiaryFOPT($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x3 && $data['recType'] == 0xF122) { // Record Header $arrayReturn['length'] += 8; - + $officeArtFOPTE = array(); for ($inc = 0; $inc < $data['recInstance']; $inc++) { $opid = self::getInt2d($this->streamPowerpointDocument, $pos + $arrayReturn['length']); @@ -1688,14 +1683,14 @@ private function readRecordOfficeArtTertiaryFOPT($stream, $pos) case 0x03A0: // Table Row Properties //@link : https://msdn.microsoft.com/en-us/library/dd923419(v=office.12).aspx - if($opt['fComplex'] == 0x1) { + if ($opt['fComplex'] == 0x1) { $arrayReturn['length'] += $opt['op']; } break; case 0x03A9: // GroupShape : metroBlob //@link : https://msdn.microsoft.com/en-us/library/dd943388(v=office.12).aspx - if($opt['fComplex'] == 0x1) { + if ($opt['fComplex'] == 0x1) { $arrayReturn['length'] += $opt['op']; } break; @@ -1710,7 +1705,7 @@ private function readRecordOfficeArtTertiaryFOPT($stream, $pos) } return $arrayReturn; } - + /** * The OfficeArtDgContainer record specifies the container for all the file records for the objects in a drawing. * @param string $stream @@ -1722,7 +1717,7 @@ private function readRecordOfficeArtDgContainer($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF002) { // Record Header @@ -1735,20 +1730,20 @@ private function readRecordOfficeArtDgContainer($stream, $pos) // groupShape $groupShape = $this->readRecordOfficeArtSpgrContainer($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $groupShape['length']; - // shape + // shape $shape = $this->readRecordOfficeArtSpContainer($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $shape['length']; - // solvers1 + // solvers1 //@todo - // deletedShapes + // deletedShapes + //@todo + // solvers1 //@todo - // solvers1 - //@todo } - + return $arrayReturn; } - + /** * The OfficeArtFDG record specifies the number of shapes, the drawing identifier, and the shape identifier of the last shape in a drawing. * @param string $stream @@ -1760,7 +1755,7 @@ private function readRecordOfficeArtFDG($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] <= 0xFFE && $data['recType'] == 0xF008 && $data['recLen'] == 0x00000008) { // Record Header @@ -1768,7 +1763,7 @@ private function readRecordOfficeArtFDG($stream, $pos) // Length $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } @@ -1783,12 +1778,12 @@ private function readRecordOfficeArtFOPT($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x3 && $data['recType'] == 0xF00B) { // Record Header $arrayReturn['length'] += 8; - + //@link : http://msdn.microsoft.com/en-us/library/dd906086(v=office.12).aspx $officeArtFOPTE = array(); for ($inc = 0; $inc < $data['recInstance']; $inc++) { @@ -2051,16 +2046,16 @@ private function readRecordOfficeArtFOPT($stream, $pos) throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($opt['opid']).')'); } } - if($data['recLen'] > 0) { + if ($data['recLen'] > 0) { $arrayReturn['length'] += $data['recLen']; } } - + return $arrayReturn; } - + /** - * The OfficeArtFPSPL record specifies the former hierarchical position of the containing object that is either a shape or a group of shapes. + * The OfficeArtFPSPL record specifies the former hierarchical position of the containing object that is either a shape or a group of shapes. * @param string $stream * @param integer $pos * @link https://msdn.microsoft.com/en-us/library/dd947479(v=office.12).aspx @@ -2070,18 +2065,18 @@ private function readRecordOfficeArtFPSPL($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == 0xF11D && $data['recLen'] == 0x00000004) { $arrayReturn['length'] += 8; $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** - * The OfficeArtFSP record specifies an instance of a shape. + * The OfficeArtFSP record specifies an instance of a shape. * @param string $stream * @param integer $pos * @link https://msdn.microsoft.com/en-us/library/dd925898(v=office.12).aspx @@ -2091,7 +2086,7 @@ private function readRecordOfficeArtFSP($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x2 && $data['recType'] == 0xF00A && $data['recLen'] == 0x00000008) { $arrayReturn['length'] += 8; @@ -2105,12 +2100,12 @@ private function readRecordOfficeArtFSP($stream, $pos) $arrayReturn['fPatriarch'] = ($data >> 2) & bindec('1'); $arrayReturn['fDeleted'] = ($data >> 3) & bindec('1'); } - + return $arrayReturn; } - + /** - * The OfficeArtFSPGR record specifies the coordinate system of the group shape that the anchors of the child shape are expressed in. + * The OfficeArtFSPGR record specifies the coordinate system of the group shape that the anchors of the child shape are expressed in. * @param string $stream * @param integer $pos * @link https://msdn.microsoft.com/en-us/library/dd925381(v=office.12).aspx @@ -2120,7 +2115,7 @@ private function readRecordOfficeArtFSPGR($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x1 && $data['recInstance'] == 0x000 && $data['recType'] == 0xF009 && $data['recLen'] == 0x00000010) { $arrayReturn['length'] += 8; @@ -2133,10 +2128,10 @@ private function readRecordOfficeArtFSPGR($stream, $pos) //$arrShapeGroup['yBottom'] = self::getInt4d($this->streamPowerpointDocument, $pos); $arrayReturn['length'] += 4; } - + return $arrayReturn; } - + /** * The OfficeArtSecondaryFOPT record specifies a table of OfficeArtRGFOPTE records. * @param string $stream @@ -2148,7 +2143,7 @@ private function readRecordOfficeArtSecondaryFOPT($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x3 && $data['recType'] == 0xF121) { // Record Header @@ -2158,7 +2153,7 @@ private function readRecordOfficeArtSecondaryFOPT($stream, $pos) } return $arrayReturn; } - + /** * A container record that specifies information about a shape. * @param string $stream @@ -2167,79 +2162,79 @@ private function readRecordOfficeArtSecondaryFOPT($stream, $pos) */ private function readRecordOfficeArtClientData($stream, $pos) { - $arrayReturn = array( - 'length' => 0, - ); - - $data = $this->loadRecordHeader($stream, $pos); - if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF011) { - $arrayReturn['length'] += 8; - // shapeFlagsAtom (9 bytes) - $dataShapeFlagsAtom = $this->readRecordShapeFlagsAtom($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataShapeFlagsAtom['length']; - - // shapeFlags10Atom (9 bytes) - $dataShapeFlags10Atom = $this->readRecordShapeFlags10Atom($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataShapeFlags10Atom['length']; - - // exObjRefAtom (12 bytes) - $dataExObjRefAtom = $this->readRecordExObjRefAtom($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataExObjRefAtom['length']; - - // animationInfo (variable) - $dataAnimationInfo = $this->readRecordAnimationInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataAnimationInfo['length']; - - // mouseClickInteractiveInfo (variable) - $dataMouseClickInteractiveInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataMouseClickInteractiveInfo['length']; - - // mouseOverInteractiveInfo (variable) - $dataMouseOverInteractiveInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataMouseOverInteractiveInfo['length']; - - // placeholderAtom (16 bytes) - $dataPlaceholderAtom = $this->readRecordPlaceholderAtom($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataPlaceholderAtom['length']; - - // recolorInfoAtom (variable) - $dataRecolorInfo = $this->readRecordRecolorInfoAtom($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataRecolorInfo['length']; - - // rgShapeClientRoundtripData (variable) - $array = array( - self::RT_PROGTAGS, - self::RT_ROUNDTRIPNEWPLACEHOLDERID12ATOM, - self::RT_ROUNDTRIPSHAPEID12ATOM, - self::RT_ROUNDTRIPHFPLACEHOLDER12ATOM, + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == 0xF011) { + $arrayReturn['length'] += 8; + // shapeFlagsAtom (9 bytes) + $dataShapeFlagsAtom = $this->readRecordShapeFlagsAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataShapeFlagsAtom['length']; + + // shapeFlags10Atom (9 bytes) + $dataShapeFlags10Atom = $this->readRecordShapeFlags10Atom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataShapeFlags10Atom['length']; + + // exObjRefAtom (12 bytes) + $dataExObjRefAtom = $this->readRecordExObjRefAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataExObjRefAtom['length']; + + // animationInfo (variable) + $dataAnimationInfo = $this->readRecordAnimationInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataAnimationInfo['length']; + + // mouseClickInteractiveInfo (variable) + $mouseClickInteractiveInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseClickInteractiveInfo['length']; + + // mouseOverInteractiveInfo (variable) + $mouseOverInteractiveInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseOverInteractiveInfo['length']; + + // placeholderAtom (16 bytes) + $dataPlaceholderAtom = $this->readRecordPlaceholderAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataPlaceholderAtom['length']; + + // recolorInfoAtom (variable) + $dataRecolorInfo = $this->readRecordRecolorInfoAtom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataRecolorInfo['length']; + + // rgShapeClientRoundtripData (variable) + $array = array( + self::RT_PROGTAGS, + self::RT_ROUNDTRIPNEWPLACEHOLDERID12ATOM, + self::RT_ROUNDTRIPSHAPEID12ATOM, + self::RT_ROUNDTRIPHFPLACEHOLDER12ATOM, self::RT_ROUNDTRIPSHAPECHECKSUMFORCL12ATOM, - ); - do { - $dataHeaderRG = $this->loadRecordHeader($stream, $pos + $arrayReturn['length']); - if(in_array($dataHeaderRG['recType'], $array)){ - switch ($dataHeaderRG['recType']) { - case self::RT_PROGTAGS: - $dataRG = $this->readRecordShapeProgTagsContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataRG['length']; - break; - case self::RT_ROUNDTRIPHFPLACEHOLDER12ATOM: - $dataRG = $this->readRecordRoundTripHFPlaceholder12Atom($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataRG['length']; - break; - case self::RT_ROUNDTRIPSHAPEID12ATOM: - $dataRG = $this->readRecordRoundTripShapeId12Atom($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $dataRG['length']; - break; - default: - throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($dataHeaderRG['recType']).')'); - } - } - } while(in_array($dataHeaderRG['recType'], $array)); - } - - return $arrayReturn; + ); + do { + $dataHeaderRG = $this->loadRecordHeader($stream, $pos + $arrayReturn['length']); + if (in_array($dataHeaderRG['recType'], $array)) { + switch ($dataHeaderRG['recType']) { + case self::RT_PROGTAGS: + $dataRG = $this->readRecordShapeProgTagsContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataRG['length']; + break; + case self::RT_ROUNDTRIPHFPLACEHOLDER12ATOM: + $dataRG = $this->readRecordRoundTripHFPlaceholder12Atom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataRG['length']; + break; + case self::RT_ROUNDTRIPSHAPEID12ATOM: + $dataRG = $this->readRecordRoundTripShapeId12Atom($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $dataRG['length']; + break; + default: + throw new \Exception('Feature not implemented (l.'.__LINE__.' : 0x'.dechex($dataHeaderRG['recType']).')'); + } + } + } while (in_array($dataHeaderRG['recType'], $array)); + } + + return $arrayReturn; } - + /** * An atom record that specifies a persist object directory. Each persist object identifier specified MUST be unique in that persist object directory. * @link http://msdn.microsoft.com/en-us/library/dd952680(v=office.12).aspx @@ -2260,7 +2255,7 @@ private function readRecordPersistDirectoryAtom($stream, $pos) $rHeader['recLen'] -= 4; //$persistId = ($data >> 0) & bindec('11111111111111111111'); $cPersist = ($data >> 20) & bindec('111111111111'); - + $rgPersistOffset = array(); for ($inc = 0; $inc < $cPersist; $inc++) { $rgPersistOffset[] = self::getInt4d($stream, $pos); @@ -2270,7 +2265,7 @@ private function readRecordPersistDirectoryAtom($stream, $pos) } while ($rHeader['recLen'] > 0); $this->rgPersistDirEntry = $rgPersistOffset; } - + /** * A container record that specifies information about the headers (1) and footers within a slide. * @param string $stream @@ -2282,7 +2277,7 @@ private function readRecordPerSlideHeadersFootersContainer($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_HEADERSFOOTERS) { // Record Header @@ -2290,10 +2285,10 @@ private function readRecordPerSlideHeadersFootersContainer($stream, $pos) // Length $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** * An atom record that specifies whether a shape is a placeholder shape. * @param string $stream @@ -2302,21 +2297,21 @@ private function readRecordPerSlideHeadersFootersContainer($stream, $pos) */ private function readRecordPlaceholderAtom($stream, $pos) { - $arrayReturn = array( - 'length' => 0, - ); - - $data = $this->loadRecordHeader($stream, $pos); - if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_PLACEHOLDERATOM && $data['recLen'] == 0x00000008) { - // Record Header - $arrayReturn['length'] += 8; - // Datas - $arrayReturn['length'] += $data['recLen']; - } - - return $arrayReturn; + $arrayReturn = array( + 'length' => 0, + ); + + $data = $this->loadRecordHeader($stream, $pos); + if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_PLACEHOLDERATOM && $data['recLen'] == 0x00000008) { + // Record Header + $arrayReturn['length'] += 8; + // Datas + $arrayReturn['length'] += $data['recLen']; + } + + return $arrayReturn; } - + /** * An atom record that specifies a collection of re-color mappings for a metafile ([MS-WMF]). * @param string $stream @@ -2328,7 +2323,7 @@ private function readRecordRecolorInfoAtom($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_RECOLORINFOATOM) { // Record Header @@ -2336,10 +2331,10 @@ private function readRecordRecolorInfoAtom($stream, $pos) // Datas $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** * An atom record that specifies that a shape is a header or footerplaceholder shape. * @param string $stream @@ -2351,7 +2346,7 @@ private function readRecordRoundTripHFPlaceholder12Atom($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_ROUNDTRIPHFPLACEHOLDER12ATOM && $data['recLen'] == 0x00000001) { // Record Header @@ -2359,10 +2354,10 @@ private function readRecordRoundTripHFPlaceholder12Atom($stream, $pos) // Datas $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** * An atom record that specifies a shape identifier. * @param string $stream @@ -2374,7 +2369,7 @@ private function readRecordRoundTripShapeId12Atom($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_ROUNDTRIPSHAPEID12ATOM && $data['recLen'] == 0x00000004) { // Record Header @@ -2382,10 +2377,10 @@ private function readRecordRoundTripShapeId12Atom($stream, $pos) // Length $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** * A container record that specifies information about a slide that synchronizes to a slide in a slide library. * @param string $stream @@ -2397,7 +2392,7 @@ private function readRecordRoundTripSlideSyncInfo12Container($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_ROUNDTRIPSLIDESYNCINFO12) { // Record Header @@ -2405,7 +2400,7 @@ private function readRecordRoundTripSlideSyncInfo12Container($stream, $pos) // Length $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } @@ -2420,7 +2415,7 @@ private function readRecordShapeFlags10Atom($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_SHAPEFLAGS10ATOM && $data['recLen'] == 0x00000001) { // Record Header @@ -2428,7 +2423,7 @@ private function readRecordShapeFlags10Atom($stream, $pos) // Datas $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } @@ -2443,7 +2438,7 @@ private function readRecordShapeFlagsAtom($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_SHAPEATOM && $data['recLen'] == 0x00000001) { // Record Header @@ -2451,10 +2446,10 @@ private function readRecordShapeFlagsAtom($stream, $pos) // Datas $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** * A container record that specifies programmable tags with additional binary shape data. * @param string $stream @@ -2466,7 +2461,7 @@ private function readRecordShapeProgBinaryTagContainer($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_PROGBINARYTAG) { // Record Header @@ -2474,10 +2469,10 @@ private function readRecordShapeProgBinaryTagContainer($stream, $pos) // Datas $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** * A container record that specifies programmable tags with additional shape data. * @param string $stream @@ -2489,32 +2484,32 @@ private function readRecordShapeProgTagsContainer($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_PROGTAGS) { // Record Header $arrayReturn['length'] += 8; - + $length = 0; do { $dataHeaderRG = $this->loadRecordHeader($stream, $pos + $arrayReturn['length'] + $length); switch ($dataHeaderRG['recType']) { case self::RT_PROGBINARYTAG: - $dataRG = $this->readRecordShapeProgBinaryTagContainer($stream, $pos + $arrayReturn['length'] + $length); - $length += $dataRG['length']; - break; + $dataRG = $this->readRecordShapeProgBinaryTagContainer($stream, $pos + $arrayReturn['length'] + $length); + $length += $dataRG['length']; + break; //case self::RT_PROGSTRINGTAG: default: throw new \Exception('Feature not implemented (l.'.__LINE__.')'); } - } while($length < $data['recLen']); + } while ($length < $data['recLen']); // Datas $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** * An atom record that specifies information about a slide. * @param string $stream @@ -2526,7 +2521,7 @@ private function readRecordSlideAtom($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x2 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_SLIDEATOM) { // Record Header @@ -2539,7 +2534,7 @@ private function readRecordSlideAtom($stream, $pos) $rgPlaceholderTypes[] = self::getInt1d($this->streamPowerpointDocument, $pos); $arrayReturn['length'] += 1; } - + // slideAtom > masterIdRef $arrayReturn['length'] += 4; // slideAtom > notesIdRef @@ -2549,10 +2544,10 @@ private function readRecordSlideAtom($stream, $pos) // slideAtom > unused; $arrayReturn['length'] += 2; } - + return $arrayReturn; } - + /** * A container record that specifies a presentation slide or title master slide. * @param string $stream @@ -2564,45 +2559,45 @@ private function readRecordSlideContainer($stream, $pos) // Core $this->oPhpPowerpoint->createSlide(); $this->oPhpPowerpoint->setActiveSlideIndex($this->oPhpPowerpoint->getSlideCount() - 1); - + // *** slideAtom (32 bytes) $slideAtom = $this->readRecordSlideAtom($stream, $pos); - if($slideAtom['length'] == 0) { + if ($slideAtom['length'] == 0) { throw new \Exception('PowerPoint97 Reader : record SlideAtom'); } $pos += $slideAtom['length']; - + // *** slideShowSlideInfoAtom (24 bytes) - $slideShowSlideInfoAtom = $this->readRecordSlideShowSlideInfoAtom($stream, $pos); - $pos += $slideShowSlideInfoAtom['length']; - + $slideShowInfoAtom = $this->readRecordSlideShowSlideInfoAtom($stream, $pos); + $pos += $slideShowInfoAtom['length']; + // *** perSlideHFContainer (variable) : optional $perSlideHFContainer = $this->readRecordPerSlideHeadersFootersContainer($stream, $pos); $pos += $perSlideHFContainer['length']; - + // *** rtSlideSyncInfo12 (variable) : optional $rtSlideSyncInfo12 = $this->readRecordRoundTripSlideSyncInfo12Container ($stream, $pos); $pos += $rtSlideSyncInfo12['length']; - + // *** drawing (variable) $drawing = $this->readRecordDrawingContainer($stream, $pos); $pos += $drawing['length']; // *** slideSchemeColorSchemeAtom (40 bytes) - $slideSchemeColorSchemeAtom = $this->readRecordSlideSchemeColorSchemeAtom($stream, $pos); - if ($slideSchemeColorSchemeAtom['length'] == 0) { + $slideSchemeColorAtom = $this->readRecordSlideSchemeColorSchemeAtom($stream, $pos); + if ($slideSchemeColorAtom['length'] == 0) { throw new \Exception('PowerPoint97 Reader : record SlideSchemeColorSchemeAtom'); } - $pos += $slideSchemeColorSchemeAtom['length']; - + $pos += $slideSchemeColorAtom['length']; + // *** slideNameAtom (variable) $slideNameAtom = $this->readRecordSlideNameAtom($stream, $pos); $pos += $slideNameAtom['length']; - + // *** slideProgTagsContainer (variable). - $slideProgTagsContainer = $this->readRecordSlideProgTagsContainer($stream, $pos); - $pos += $slideProgTagsContainer['length']; - + $slideProgTags = $this->readRecordSlideProgTagsContainer($stream, $pos); + $pos += $slideProgTags['length']; + // *** rgRoundTripSlide (variable) } @@ -2618,7 +2613,7 @@ private function readRecordSlideNameAtom($stream, $pos) 'length' => 0, 'slideName' => '', ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x003 && $data['recType'] == self::RT_CSTRING && $data['recLen'] % 2 == 0) { // Record Header @@ -2631,10 +2626,10 @@ private function readRecordSlideNameAtom($stream, $pos) $arrayReturn['slideName'] .= String::chr($char); } } - + return $arrayReturn; } - + /** * An atom record that specifies a slide number metacharacter. * @param string $stream @@ -2646,7 +2641,7 @@ private function readRecordSlideNumberMCAtom($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_SLIDENUMBERMETACHARATOM && $data['recLen'] == 0x00000004) { // Record Header @@ -2654,10 +2649,10 @@ private function readRecordSlideNumberMCAtom($stream, $pos) // Datas $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** @@ -2671,7 +2666,7 @@ private function readRecordSlideProgTagsContainer($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0xF && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_PROGTAGS) { // Record Header @@ -2679,10 +2674,10 @@ private function readRecordSlideProgTagsContainer($stream, $pos) // Length $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** * A container record that specifies the color scheme used by a slide. * @param string $stream @@ -2694,7 +2689,7 @@ private function readRecordSlideSchemeColorSchemeAtom($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x001 && $data['recType'] == self::RT_COLORSCHEMEATOM && $data['recLen'] == 0x00000020) { // Record Header @@ -2710,10 +2705,10 @@ private function readRecordSlideSchemeColorSchemeAtom($stream, $pos) } $arrayReturn['length'] += (8 * 4); } - + return $arrayReturn; } - + /** * An atom record that specifies what transition effect to perform during a slide show, and how to advance to the next presentation slide. * @param string $stream @@ -2725,7 +2720,7 @@ private function readRecordSlideShowSlideInfoAtom($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = $this->loadRecordHeader($stream, $pos); if ($data['recVer'] == 0x0 && $data['recInstance'] == 0x000 && $data['recType'] == self::RT_SLIDESHOWSLIDEINFOATOM && $data['recLen'] == 0x00000010) { // Record Header @@ -2733,10 +2728,10 @@ private function readRecordSlideShowSlideInfoAtom($stream, $pos) // Length; $arrayReturn['length'] += $data['recLen']; } - + return $arrayReturn; } - + /** * UserEditAtom * @link http://msdn.microsoft.com/en-us/library/dd945746(v=office.12).aspx @@ -2749,39 +2744,39 @@ private function readRecordUserEditAtom($stream, $pos) if ($rHeader['recVer'] != 0x0 || $rHeader['recInstance'] != 0x000 || $rHeader['recType'] != self::RT_USEREDITATOM || ($rHeader['recLen'] != 0x0000001C && $rHeader['recLen'] != 0x00000020)) { throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > RecordHeader).'); } - + // lastSlideIdRef $pos += 4; // version $pos += 2; - + // minorVersion $minorVersion = self::getInt1d($stream, $pos); $pos += 1; if ($minorVersion != 0x00) { throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > minorVersion).'); } - + // majorVersion $majorVersion = self::getInt1d($stream, $pos); $pos += 1; if ($majorVersion != 0x03) { throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > majorVersion).'); } - + // offsetLastEdit $pos += 4; // offsetPersistDirectory $this->offsetPersistDirectory = self::getInt4d($stream, $pos); $pos += 4; - + // docPersistIdRef $docPersistIdRef = self::getInt4d($stream, $pos); $pos += 4; if ($docPersistIdRef != 0x00000001) { throw new \Exception('File PowerPoint 97 in error (Location : UserEditAtom > docPersistIdRef).'); } - + // persistIdSeed $pos += 4; // lastView @@ -2789,7 +2784,7 @@ private function readRecordUserEditAtom($stream, $pos) // unused $pos += 2; } - + /** * A structure that specifies the character-level formatting of a run of text. * @param string $stream @@ -2798,7 +2793,7 @@ private function readRecordUserEditAtom($stream, $pos) * @link https://msdn.microsoft.com/en-us/library/dd945870(v=office.12).aspx */ private function readStructureTextCFRun($stream, $pos, $strLenRT) - { + { $arrayReturn = array( 'length' => 0, 'strLenRT' => $strLenRT, @@ -2809,10 +2804,10 @@ private function readStructureTextCFRun($stream, $pos, $strLenRT) $arrayReturn['strLenRT'] -= $countRgTextCFRun; $arrayReturn['length'] += 4; $arrayReturn['partLength'] = $countRgTextCFRun; - + $masks = self::getInt4d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 4; - + $masksData = array(); $masksData['bold'] = ($masks >> 0) & bindec('1'); $masksData['italic'] = ($masks >> 1) & bindec('1'); @@ -2840,7 +2835,7 @@ private function readStructureTextCFRun($stream, $pos, $strLenRT) if ($masksData['bold'] == 1 || $masksData['italic'] == 1 || $masksData['underline'] == 1 || $masksData['shadow'] == 1 || $masksData['fehint'] == 1 || $masksData['kumi'] == 1 || $masksData['emboss'] == 1 || $masksData['fHasStyle'] == 1) { $data = self::getInt2d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 2; - + $fontStyleFlags = array(); $fontStyleFlags['bold'] = ($data >> 0) & bindec('1'); $fontStyleFlags['italic'] = ($data >> 1) & bindec('1'); @@ -2854,7 +2849,7 @@ private function readStructureTextCFRun($stream, $pos, $strLenRT) $fontStyleFlags['emboss'] = ($data >> 9) & bindec('1'); $fontStyleFlags['pp9rt'] = ($data >> 10) & bindec('1111'); $fontStyleFlags['unused4'] = ($data >> 14) & bindec('11'); - + $arrayReturn['bold'] = ($fontStyleFlags['bold'] == 1) ? true : false; $arrayReturn['italic'] = ($fontStyleFlags['italic'] == 1) ? true : false; $arrayReturn['underline'] = ($fontStyleFlags['underline'] == 1) ? true : false; @@ -2889,22 +2884,22 @@ private function readStructureTextCFRun($stream, $pos, $strLenRT) $arrayReturn['length'] += 1; $index = self::getInt1d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 1; - + if ($index == 0xFE) { $strColor = str_pad(dechex($red), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($green), 2, STR_PAD_LEFT, '0'); $strColor .= str_pad(dechex($blue), 2, STR_PAD_LEFT, '0'); - + $arrayReturn['color'] = new Color('FF'.$strColor); } } if ($masksData['position'] == 1) { throw new \Exception('Feature not implemented (l.'.__LINE__.')'); } - + return $arrayReturn; } - + /** * A structure that specifies the paragraph-level formatting of a run of text. * @param string $stream @@ -2917,7 +2912,7 @@ private function readStructureTextPFRun($stream, $pos, $strLenRT) 'length' => 0, 'strLenRT' => $strLenRT, ); - + // rgTextPFRun $countRgTextPFRun = self::getInt4d($stream, $pos + $arrayReturn['length']); $arrayReturn['strLenRT'] -= $countRgTextPFRun; @@ -3065,10 +3060,10 @@ private function readStructureTextPFRun($stream, $pos, $strLenRT) if ($masksData['textDirection'] == 1) { throw new \Exception('Feature not implemented (l.'.__LINE__.')'); } - + return $arrayReturn; } - + /** * A structure that specifies language and spelling information for a run of text. @@ -3082,10 +3077,10 @@ private function readStructureTextSIRun($stream, $pos, $strLenRT) 'length' => 0, 'strLenRT' => $strLenRT, ); - + $arrayReturn['strLenRT'] -= self::getInt4d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 4; - + $data = self::getInt4d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 4; $masksData = array(); @@ -3099,7 +3094,7 @@ private function readStructureTextSIRun($stream, $pos, $strLenRT) $masksData['unused3'] = ($data >> 7) & bindec('1'); $masksData['reserved1'] = ($data >> 8) & bindec('1'); $masksData['smartTag'] = ($data >> 9) & bindec('1'); - + if ($masksData['spell'] == 1) { $data = self::getInt2d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 2; @@ -3125,7 +3120,7 @@ private function readStructureTextSIRun($stream, $pos, $strLenRT) if ($masksData['smartTag'] == 1) { throw new \Exception('Feature not implemented (l.'.__LINE__.')'); } - + return $arrayReturn; } @@ -3140,7 +3135,7 @@ private function readStructureTextRuler($stream, $pos) $arrayReturn = array( 'length' => 0, ); - + $data = self::getInt4d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 4; @@ -3220,7 +3215,7 @@ private function readStructureTextRuler($stream, $pos) // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 2; } - + return $arrayReturn; } } From 66142391e79d75f2aa345bc752fbdc14cb77a091 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 1 Jul 2015 15:53:10 +0200 Subject: [PATCH 103/115] Refactored the PowerPoint97 Reader for managing the group shape and improving evolutions - @Progi1984 GH-110 --- src/PhpPowerpoint/Reader/PowerPoint97.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index a38166274..bcdf252a6 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -1215,13 +1215,13 @@ private function readRecordOfficeArtClientTextbox($stream, $pos) case self::RT_INTERACTIVEINFO: //@link : http://msdn.microsoft.com/en-us/library/dd948623(v=office.12).aspx if ($rhChild['recInstance'] == 0x0000) { - $mouseClickInteractiveInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $mouseClickInteractiveInfo['length']; - $arrayReturn['hyperlink'][]['id'] = $mouseClickInteractiveInfo['exHyperlinkIdRef']; + $mouseClickInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseClickInfo['length']; + $arrayReturn['hyperlink'][]['id'] = $mouseClickInfo['exHyperlinkIdRef']; } if ($rhChild['recInstance'] == 0x0001) { - $mouseOverInteractiveInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $mouseOverInteractiveInfo['length']; + $mouseOverInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseOverInfo['length']; } break; case self::RT_STYLETEXTPROPATOM: @@ -2186,12 +2186,12 @@ private function readRecordOfficeArtClientData($stream, $pos) $arrayReturn['length'] += $dataAnimationInfo['length']; // mouseClickInteractiveInfo (variable) - $mouseClickInteractiveInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $mouseClickInteractiveInfo['length']; + $mouseClickInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseClickInfo['length']; // mouseOverInteractiveInfo (variable) - $mouseOverInteractiveInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $mouseOverInteractiveInfo['length']; + $mouseOverInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseOverInfo['length']; // placeholderAtom (16 bytes) $dataPlaceholderAtom = $this->readRecordPlaceholderAtom($stream, $pos + $arrayReturn['length']); @@ -2576,7 +2576,7 @@ private function readRecordSlideContainer($stream, $pos) $pos += $perSlideHFContainer['length']; // *** rtSlideSyncInfo12 (variable) : optional - $rtSlideSyncInfo12 = $this->readRecordRoundTripSlideSyncInfo12Container ($stream, $pos); + $rtSlideSyncInfo12 = $this->readRecordRoundTripSlideSyncInfo12Container($stream, $pos); $pos += $rtSlideSyncInfo12['length']; // *** drawing (variable) From 7f6cbfde4a57bd6541d5822e70d253193c61391d Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 1 Jul 2015 21:04:02 +0200 Subject: [PATCH 104/115] Refactored the PowerPoint97 Reader for managing the group shape and improving evolutions - @Progi1984 GH-110 --- composer.lock | 26 +++++++++++------------ src/PhpPowerpoint/Reader/PowerPoint97.php | 20 ++++++++--------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/composer.lock b/composer.lock index 77e3cd2d8..5cf90aa57 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "phpoffice/common", - "version": "0.1", + "version": "0.1.1", "source": { "type": "git", "url": "https://github.com/PHPOffice/Common.git", - "reference": "43d19c83c1bb6381a04d9136ddfef73ce58e3bd5" + "reference": "8b8ae85e7d10d5a5ffd36a4a6ba964fd3b55a76f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/Common/zipball/43d19c83c1bb6381a04d9136ddfef73ce58e3bd5", - "reference": "43d19c83c1bb6381a04d9136ddfef73ce58e3bd5", + "url": "https://api.github.com/repos/PHPOffice/Common/zipball/8b8ae85e7d10d5a5ffd36a4a6ba964fd3b55a76f", + "reference": "8b8ae85e7d10d5a5ffd36a4a6ba964fd3b55a76f", "shasum": "" }, "require": { @@ -58,7 +58,7 @@ "office", "php" ], - "time": "2015-06-24 12:00:26" + "time": "2015-07-01 14:41:21" } ], "packages-dev": [ @@ -641,9 +641,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -995,9 +995,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -1437,9 +1437,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -1849,9 +1849,7 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index a38166274..bcdf252a6 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -1215,13 +1215,13 @@ private function readRecordOfficeArtClientTextbox($stream, $pos) case self::RT_INTERACTIVEINFO: //@link : http://msdn.microsoft.com/en-us/library/dd948623(v=office.12).aspx if ($rhChild['recInstance'] == 0x0000) { - $mouseClickInteractiveInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $mouseClickInteractiveInfo['length']; - $arrayReturn['hyperlink'][]['id'] = $mouseClickInteractiveInfo['exHyperlinkIdRef']; + $mouseClickInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseClickInfo['length']; + $arrayReturn['hyperlink'][]['id'] = $mouseClickInfo['exHyperlinkIdRef']; } if ($rhChild['recInstance'] == 0x0001) { - $mouseOverInteractiveInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $mouseOverInteractiveInfo['length']; + $mouseOverInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseOverInfo['length']; } break; case self::RT_STYLETEXTPROPATOM: @@ -2186,12 +2186,12 @@ private function readRecordOfficeArtClientData($stream, $pos) $arrayReturn['length'] += $dataAnimationInfo['length']; // mouseClickInteractiveInfo (variable) - $mouseClickInteractiveInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $mouseClickInteractiveInfo['length']; + $mouseClickInfo = $this->readRecordMouseClickInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseClickInfo['length']; // mouseOverInteractiveInfo (variable) - $mouseOverInteractiveInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); - $arrayReturn['length'] += $mouseOverInteractiveInfo['length']; + $mouseOverInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); + $arrayReturn['length'] += $mouseOverInfo['length']; // placeholderAtom (16 bytes) $dataPlaceholderAtom = $this->readRecordPlaceholderAtom($stream, $pos + $arrayReturn['length']); @@ -2576,7 +2576,7 @@ private function readRecordSlideContainer($stream, $pos) $pos += $perSlideHFContainer['length']; // *** rtSlideSyncInfo12 (variable) : optional - $rtSlideSyncInfo12 = $this->readRecordRoundTripSlideSyncInfo12Container ($stream, $pos); + $rtSlideSyncInfo12 = $this->readRecordRoundTripSlideSyncInfo12Container($stream, $pos); $pos += $rtSlideSyncInfo12['length']; // *** drawing (variable) From 2724dc2a7cb7d7105370e8595213795e554b3320 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Thu, 2 Jul 2015 13:59:36 +0200 Subject: [PATCH 105/115] Added Sample for the PowerPoint97 Reader - @Progi1984 GH-110 --- samples/Sample_12_Reader_PowerPoint97.php | 172 ++++++++++++++++++++++ samples/Sample_Footer.php | 1 + samples/bootstrap/css/phppowerpoint.css | 75 +++++++++- samples/bootstrap/js/script.js | 20 +++ samples/resources/Sample_12.ppt | Bin 0 -> 88576 bytes 5 files changed, 267 insertions(+), 1 deletion(-) create mode 100644 samples/Sample_12_Reader_PowerPoint97.php create mode 100644 samples/bootstrap/js/script.js create mode 100644 samples/resources/Sample_12.ppt diff --git a/samples/Sample_12_Reader_PowerPoint97.php b/samples/Sample_12_Reader_PowerPoint97.php new file mode 100644 index 000000000..cec570d8f --- /dev/null +++ b/samples/Sample_12_Reader_PowerPoint97.php @@ -0,0 +1,172 @@ +oPhpPowerpoint = $oPHPPpt; + } + + public function display() + { + $this->append('
'); + $this->append('
'); + $this->append('
'); + $this->append('
'); + $this->append('
    '); + $this->displayPhpPowerpoint($this->oPhpPowerpoint); + $this->append('
'); + $this->append('
'); + $this->append('
'); + $this->append('
'); + $this->displayPhpPowerpointInfo($this->oPhpPowerpoint); + $this->append('
'); + $this->append('
'); + $this->append('
'); + + return $this->htmlOutput; + } + + protected function append($sHTML) + { + $this->htmlOutput .= $sHTML; + } + + protected function displayPhpPowerpoint(PhpPowerpoint $oPHPPpt) + { + $this->append('
  • PhpPowerpoint'); + $this->append('
      '); + $this->append('
    • Info "PhpPowerpoint"
    • '); + foreach ($oPHPPpt->getAllSlides() as $oSlide) { + $this->append('
    • Slide'); + $this->append('
        '); + $this->append('
      • Info "Slide"
      • '); + foreach ($oSlide->getShapeCollection() as $oShape) { + if($oShape instanceof Group) { + $this->append('
      • Shape "Group"'); + $this->append('
          '); + // $this->append('
        • Info "Group"
        • '); + foreach ($oShape->getShapeCollection() as $oShapeChild) { + $this->displayShape($oShapeChild); + } + $this->append('
        '); + $this->append('
      • '); + } else { + $this->displayShape($oShape); + } + } + $this->append('
      '); + $this->append('
    • '); + } + $this->append('
    '); + $this->append('
  • '); + } + + protected function displayShape(AbstractShape $shape) + { + if($shape instanceof MemoryDrawing) { + $this->append('
  • Shape "MemoryDrawing"
  • '); + } elseif($shape instanceof RichText) { + $this->append('
  • Shape "RichText"
  • '); + } else { + var_export($shape); + } + } + + protected function displayPhpPowerpointInfo(PhpPowerpoint $oPHPPpt) + { + $this->append('
    '); + $this->append('
    '); + $this->append('
    Number of slides
    '.$oPHPPpt->getSlideCount().'
    '); + $this->append('
    Document Layout Height
    '.$oPHPPpt->getLayout()->getCY(DocumentLayout::UNIT_MILLIMETER).' mm
    '); + $this->append('
    Document Layout Width
    '.$oPHPPpt->getLayout()->getCX(DocumentLayout::UNIT_MILLIMETER).' mm
    '); + $this->append('
    Properties : Category
    '.$oPHPPpt->getProperties()->getCategory().'
    '); + $this->append('
    Properties : Company
    '.$oPHPPpt->getProperties()->getCompany().'
    '); + $this->append('
    Properties : Created
    '.$oPHPPpt->getProperties()->getCreated().'
    '); + $this->append('
    Properties : Creator
    '.$oPHPPpt->getProperties()->getCreator().'
    '); + $this->append('
    Properties : Description
    '.$oPHPPpt->getProperties()->getDescription().'
    '); + $this->append('
    Properties : Keywords
    '.$oPHPPpt->getProperties()->getKeywords().'
    '); + $this->append('
    Properties : Last Modified By
    '.$oPHPPpt->getProperties()->getLastModifiedBy().'
    '); + $this->append('
    Properties : Modified
    '.$oPHPPpt->getProperties()->getModified().'
    '); + $this->append('
    Properties : Subject
    '.$oPHPPpt->getProperties()->getSubject().'
    '); + $this->append('
    Properties : Title
    '.$oPHPPpt->getProperties()->getTitle().'
    '); + $this->append('
    '); + $this->append('
    '); + + foreach ($oPHPPpt->getAllSlides() as $oSlide) { + $this->append('
    '); + $this->append('
    '); + $this->append('
    HashCode
    '.$oSlide->getHashCode().'
    '); + $this->append('
    Slide Layout
    '.$oSlide->getSlideLayout().'
    '); + $this->append('
    Offset X
    '.$oSlide->getOffsetX().'
    '); + $this->append('
    Offset Y
    '.$oSlide->getOffsetY().'
    '); + $this->append('
    Extent X
    '.$oSlide->getExtentX().'
    '); + $this->append('
    Extent Y
    '.$oSlide->getExtentY().'
    '); + $this->append('
    '); + $this->append('
    '); + + foreach ($oSlide->getShapeCollection() as $oShape) { + if($oShape instanceof Group) { + foreach ($oShape->getShapeCollection() as $oShapeChild) { + $this->displayShapeInfo($oShapeChild); + } + } else { + $this->displayShapeInfo($oShape); + } + } + } + } + + protected function displayShapeInfo(AbstractShape $oShape) + { + $this->append('
    '); + $this->append('
    '); + $this->append('
    HashCode
    '.$oShape->getHashCode().'
    '); + $this->append('
    Offset X
    '.$oShape->getOffsetX().'
    '); + $this->append('
    Offset Y
    '.$oShape->getOffsetY().'
    '); + $this->append('
    Height
    '.$oShape->getHeight().'
    '); + $this->append('
    Width
    '.$oShape->getWidth().'
    '); + $this->append('
    Rotation
    '.$oShape->getRotation().'°
    '); + $this->append('
    Hyperlink
    '.ucfirst(var_export($oShape->hasHyperlink(), true)).'
    '); + $this->append('
    Fill
    @Todo
    '); + $this->append('
    Border
    @Todo
    '); + if($oShape instanceof MemoryDrawing) { + ob_start(); + call_user_func($oShape->getRenderingFunction(), $oShape->getImageResource()); + $sShapeImgContents = ob_get_contents(); + ob_end_clean(); + $this->append('
    Mime-Type
    '.$oShape->getMimeType().'
    '); + $this->append('
    Image
    '); + } else { + // Add another shape + } + $this->append('
    '); + $this->append('
    '); + } +} + +$pptReader = PhpOffice\PhpPowerpoint\IOFactory::createReader('PowerPoint97'); +$oPHPPowerPoint = $pptReader->load('resources/Sample_12.ppt'); + +$oTree = new PhpPptTree($oPHPPowerPoint); +echo $oTree->display(); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/samples/Sample_Footer.php b/samples/Sample_Footer.php index 892f9262b..4aeadf902 100644 --- a/samples/Sample_Footer.php +++ b/samples/Sample_Footer.php @@ -6,5 +6,6 @@ + \ No newline at end of file diff --git a/samples/bootstrap/css/phppowerpoint.css b/samples/bootstrap/css/phppowerpoint.css index fc410ec21..5829df2ac 100644 --- a/samples/bootstrap/css/phppowerpoint.css +++ b/samples/bootstrap/css/phppowerpoint.css @@ -1,7 +1,6 @@ body { padding-top: 20px; padding-bottom: 20px; - min-height: 1000px; } .navbar { margin-bottom: 20px; @@ -12,3 +11,77 @@ body { .failed { color: #ff0000; } +.tree { + min-height:20px; + padding:19px; + margin-bottom:20px; + background-color:#fbfbfb; + -webkit-border-radius:4px; + -moz-border-radius:4px; +} +.tree li { + list-style-type:none; + margin:0; + padding:10px 5px 0 5px; + position:relative +} +.tree li::before, .tree li::after { + content:''; + left:-20px; + position:absolute; + right:auto +} +.tree li::before { + border-left:1px solid #999; + bottom:50px; + height:100%; + top:0; + width:1px +} +.tree li::after { + border-top:1px solid #999; + height:20px; + top:30px; + width:25px +} +.tree li span { + -moz-border-radius:5px; + -webkit-border-radius:5px; + border:1px solid #999; + border-radius:5px; + display:inline-block; + padding:3px 8px; + text-decoration:none +} +.tree li.parent_li>span { + cursor:pointer +} +.tree>ul>li::before, .tree>ul>li::after { + border:0 +} +.tree li:last-child::before { + height:30px +} +.tree li.parent_li>span:hover, .tree li.parent_li>span:hover+ul li span { + background:#eee; + border:1px solid #94a0b4; + color:#000 +} + +.tree .shape { + cursor: pointer; +} + +.infoBlk { + display:none; +} + +.pptTree { + background-color:#fbfbfb; +} +.pptTree dd { + margin-left: 20px; +} + +.pptTree dd img { + max-width: 50%; \ No newline at end of file diff --git a/samples/bootstrap/js/script.js b/samples/bootstrap/js/script.js new file mode 100644 index 000000000..27dccff33 --- /dev/null +++ b/samples/bootstrap/js/script.js @@ -0,0 +1,20 @@ + $(function () { + $('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch'); + $('.tree li.parent_li > span').on('click', function (e) { + var children = $(this).parent('li.parent_li').find(' > ul > li'); + if (children.is(":visible")) { + children.hide('fast'); + $(this).attr('title', 'Expand this branch').find(' > i').addClass('fa-plus-square').removeClass('fa-minus-square'); + } else { + children.show('fast'); + $(this).attr('title', 'Collapse this branch').find(' > i').addClass('fa-minus-square').removeClass('fa-plus-square'); + } + e.stopPropagation(); + }); + + $('.tree .shape').on('click', function (e) { + $('.infoBlk').hide(); + $('.infoBlk#' + $(this).attr('id') + 'Info').show(); + e.stopPropagation(); + }); + }); diff --git a/samples/resources/Sample_12.ppt b/samples/resources/Sample_12.ppt new file mode 100644 index 0000000000000000000000000000000000000000..032c9605b981cddf3a79fbb65f45f822900d1251 GIT binary patch literal 88576 zcmeHQ2|QKX_dj~r0{qnx?@Xq%TrJ=c$55mnW4 zgtS;Z6a4!`VI_jVFaxNny1H5v9S9x>((Ye^z}K37A`kZh@1%f`=Q2RDKypA$faHM` zfE0n60&##q1W4Yiz`Yqzb0Afq7C2NY6H|3s2xyyAT^*4KwO}XK%Ia(1Mz^= zfw};71?mRW9jFITPaqATUO<{aT0q)By@7OqbbIr$PmZ~s2`9qP=BBS zKm&nHfJ}kRfCd4X0}TeU0I~$)16cuC0}TNh3Sk#-otT0_1fAoup4QZ0*Kc>^}*F=B;(!hcR9!ICNYO(XC z;dhjmy#+OYs(Y?7$b*d?*VcQsi?6M>yO$r=5SP_&9D_0gzKQ#}z$Xr_`=~pnoL~ED z6fC$3L@A2};X(eszAn(}=$S6QsEZ`Is%o@BnBOH~4D;dbhnqFqDn+c9C3srg%%@n6wlXJE zQDc%Z{GnFEhMzIKSGX)J~Na%qM>jf*ZF8Bw5uQ&XegMRA;>AfM| z0({!=rw3$6=tG(*Xgod8bcW>0PU$lt)QdVC`-gfQ@1ihxYvVg$z)P)282~tVP3|QI zyC`+Guw@cT)giXSEESuy!7(XX@y$WUF_BNUvRIoMW9u2L$9Cu_RG3OiN?a~iTU*=2 z#KhLt*1^HS$H!+|zaD!AX&klEOdO_tZd~^>cD-ZlhMpGKo|-@7LVxY6gL>Z>qVwD2 zo)^dJT($3$GNRA3DH``i_kA$2?@ia9x19RkchbD?rSaTD>%Oc019$yL9tKaG^q&a~ zGCT}2d^FQ%80OgbeCw|9%B4@Xm+nh1qkJd5{ONiH?grVjdgRX5d_S-2+Xb50embvw zjdJGd(Mf*k+9hw#x7`SH5nr+**9X@Bo{^fs#}?xjtbaZuqAY2 zv#}MwMF{0{2WjP_1_yZ$v@M1^Hr)o?+BHbpjq*;k; zb;{QP*MkF(%y})JW~BS()&|{eb6$M5e;sx>|GJ%Ox#nqNt7ft>-+1&onULN4O1QT)t-3)cJl+PEIX)^wrltA$y#?u*Ghp$w$u^ z^V`^YFJy<=PYv^%{ND4oFu#wp9L)>O_*X5tos_~K>B=hvpG(G^GIa@zRn z3D*uQTcT(+{P5*#W!*ma?Vj%$rOX?CKU9CL{NT+SWUQuo#EcKKG;%jdeVCr!(_quR zd#*dLJ-x*=7alWRL0ANK&s*e~t{#awSDN{@m*N!^JXmdFQPHZi^dRP0MHAlH_&%j4 z9nw2E3IM?FvT}}WeNUqe?emgCJ2HZaK|uwwIy{r%N7`ErloFZ@39<xMJvDc z^tqchyQQv9iKlarPEf%$oz)ZW2ZpP((gg?Y_&HJIn1Z`@u#gzybm^7>Z~Tx^n%+kKYLjiQj@x(JR=ZXB;rlkLx8AU{ z8E~MewV;WHT!A@D=;yy9(A>c}c=nDF{el)KHkrWa+%vE0w|R+YWpt+s&FAk6YCW;P zzf!@q4c1HVub8+mXIz4FPFVTm2|3xRuEV}6IgkIEzj;!g)A?|pK^NQV8F-u>vgDCm zo8vlzN}3No*z;QWnd1e_TVWYv3RZVYT$640m~FMLoxb9{O&47~X5O)@=uD^uU32%E zxgt(KJ=ZR8)=mGbvPU}Kd*n8|Pg=8ryi=-4{gqyI)^och@bH*5S1`*7_@j+C{YT-g`&uMM6c#mxg*9KFh?rjXt@{c_b9m+UDfw~UQB8zW zFyZvrJ`+@mjr%P;W8=2rp;SotRCT_`f!Ff3>iqdO$8!d&sV%xKoxtRsIArhL^=$FI zL%H3Su(KEhBRNSJTAf+#pjyR`YhinLqjdDG&xZ?DSFY=2wc&+b(||2PzF|oZMY9>+ zv4L|8uXHqx<5a|DJq}2k{$yvu`2Fqo%39q~eeF57J1^;q$|J^?&^)E8O1WOwn;hqT z-T%JH6_2P``;BDCH(`h4Q zto+)T#n0Q(q02j-;W2Zi@#BcXU9!xv(R(`aTq*;WM~-~R2odgVVl`gj<Z>g7qEUxh{O6os+} zFSN<1=(?T}?i-RGKKxR^;MuI({H}#=SE8JgJr;J@%DW%Ew)Eos)Ly*tF4M4#jqpk3 z_)#CUUh5oD-*Wq5;pzR|w_W=B_Mz{xh-91;5y6Rq0i$FIa%Em z+Gqu{ukz;T3u99sJk=oh&s9S;pV<`N0ukQGRX*()*W>!qr6={2qM9gOND2yHdgs-- zLWeQWSEzjqERBA1v9g?F-aNwIy!%Gm+2vgZaPoTVnT>R6`_)O)vb9&omqb*PS6$Ky zI5Pt8=1BXLP7b@vl-Ag)({=DogMb#xCnrrz?>EAnY3Vta%S&1mwLkBYla69{MvB03 zK;P1fThz<5h2}#i>gPnQ8D3Z^m_5!|u`Ng0TULHfa29*r=1ZyV69Sk~1{#x>`!2Rw zcF@u+c4^Lu?2f%>jkZ?5U}O*<8<}rqd-LGr>9cz}v4;(2MLB1E^ji2i#@^<9xQ4Ao zU=l-k(k)~DT)xJFcgh`zW|t2#(s>gYi6auU!ulp&(YEgTas31hM)G~rVxvfTg}2a? ztG&mV#7Fq1xG0CW_Ydy5KX&bv{W@uB!z>og`%*DC>+p-h*BK_^_Az0%hM!t`Ib42` zG%|CnAjo`wmmOUy9vo@gxz)sl@=KexY*BRNUGJ=}Bh5lPCnk9;37#Ud8$f=A^GmvU21Hw%;&Z;jDp=lofw(E-o=`4h@~3aQ$G94Ql4R zH0?Wk+TO@IsJvN8zGruvjUCRboSx@Cpta*{b$+Y63)NYZm@9o#%wF$eN@w?pXYKu|$mM&ET|CWKPU;{Lo*g-a&*#osw#D6S^|GG22L3Yrn1c)bN7#&vGS*9e<>(Tj z{@~1mS2ug@_E`~s!aCDBUi7>>`G8_Z|IQs%XPcE8 zlxX;#4BF#0eW7O5+JL#U`lQ*#$%PH-a!*0}Vw9@#+Q&P4%ob*D>^;wVa&toNc;}-} z3LJC2?EQB2w@TUVXv|cQOW=Kx8EigAozEYCoN=y+O2pXfYvYu;N1s@vRyKPZ8ME=; z+yk9%ByYE)gTr+m~m;p<*Of*wlcnJH?OLKSO z2R*gd?3B4|>nfFef5$a4TZkK>sVxSFl|E-I%l5j}ix;|gPL^kQh(Ta%fbH$@>`Jrk z4<`5sqhX{PipdGacVtgk2dua_NsaUR+LBA2M(^T|2df<29ePF8V45Id==QMb*RCy} z+g;CU%2GL%j=rWc#ZRZ%JZm-6CwkS+wqZi0GoD_-0ZR^=xlWikv88~W;(oTj^aOn` z=HsqPDwp{>j9ykpSE_eU-LJfR2rj3chg{++PYAuNenio!x@B_9O*clAKDWLSyKrM0 zH?vi7U3$p(mKvOz^|UO9e~Sq5@foMN$Kb>E%W8|R_Q`Mv3VwN|fA8du>$o8*uB_cx zIbn;VFV9jwskuA+@@k&Sph45lhevZeGOq5rlA@)!V>46bw|3*(*ncTM5N&vF$SsSq zI8Dtlx7k~So2})(x^Ed7xgsZK_^#rLJu>kDde#Yt%))Q3=)W-0ugRPVI|lr=qAHyT zxz66Z%4VBf_#?LtO((p3Q1+yiXU3=wcgl_!A72sl$eDS1Q(u`OJN8=Ls6hQSu6tYG zH>GZ@kpA0E#=^>d=10STO$TIjNM*lWBp_YPcU|H`GeIr_geDD=Bb1a zD0!qcf1Xp>;}eHAo_}X&_11G&Op>7w!^-5!b}v5js$gHIM{lktwz`vZzn|T#;E@$> zs!j@fhL22to21_%H`?0z700NaqnpO)AQ2D9;ZfojMsl+eLP~3txU7Ese1|p$8K0( z?Q5bEyDNN)*^JTqP8hf3A2J(KVxw?ajp+E)U+%iGz&W=cas6Ct6`j}Z5_Bw7hA~2> zt{%3oougXH^~uw`+$@c>EvvWr+~c+1F<0lvJSZ`;Gy!l*Z z*ZKAayrZqgmv}g5?;65iC@qXxk^-i zock(KhnFzP)9{&VGhS7U`knSkZv4Xdhb#;4pz{xV@dDRwkl_?^UPfofo0u&ND((Di z(8aVK7mIYfIV+~7jPENS@#LA>&6fj0g_)^spQj~_<9pr93Cj$!&|j1>Q#FF%JKSpG zS6!w5St~-lw?O7fl6++Q1APZAu(L7Zn9ORD)2m&G z+tDs5D&aj(T&q~w`3}KbG<&+08rNc3A&c)YbmZw$VbSw$yJM{{%-7ab*KZ*$RQB(D z*x_|dyE{!sx8xo0pQ&u)AS-vI^ZAEiLvJzppK`5NuJem8p5IEd_dw%H#k<*8Use;m zN~NdK$D*3NAL)AghQdL^XlJ{OYZG@y4bN~IIZ1fra>qIS+76BxR$$LHohBq)S!4Ij zm}Yh3z5b)eEw^cOiMS5#2S-|WSQ@&+hQ)89 zxvL3xo%43xn}hd+U+B6l*z(XtpKjaycolQ~^}2uR+3&`fmum&1+^40qD`q~Fk$Yd! z@|pTJzso5T2l6T=#`U_qIwtPJF7F2pRyW#oUf)(_yT#Ks;|-Gyw;Ss|@qX5$#j+2b zhj&d=kkfc56H=7g<7~R++b{i`Y#u1c^;FYaK7R3)7G>(2l;h82m9Cl+s6ONC!hGes zmZgIxcS?FDlzo^le?d)gNVK(vew*wK7yPC?IXU`d3;Tlc!43l~mo0vJb}vVzIDhdq zf#!PE$=y{acn+;6hMix*uhrpU@o3Yyu}q$K66`aS-C)Qg-F!;IT*hzl(r_M$8+BkAm=5_kXW9lIMQ&)&&9 z7PlqMlf|3kvN`OIm8(?9#Xa46M?FkDwKVp?IbJUl9itm9<`28Am{3)c?wy=G`|eSn z@Xy}S3NJGEFT9c?A9#6#%E1wx)N=K`Mn5*55wPUWgPd8`{C3^f3YMm>IzDKJKx=|Z zNk)R<$sT2;=M~EqTrJ!>vG>VTttTJzpC0S5cPM|vf>W}phs!!~XTq)(3kXY_H2zpsZ*!EFw6MzY4UGFW(g_==1v|pafI4~HNoSs) zg5Ikb|J4g75pE0J8I|Wb>te5`F+xA=b=GOU=-kp~?Y)PF_1_p!>XY@d?9%cjv(=92 z9`pQgwb*NL;w9$gBYFv?>t;IZ-rsML5f?T}m2vaTTQ&VQrgmDJ=7jW^q1ZNZRD}hz zAi_QM#yFkQJBED2r2~3Kp6>tJH1FX0B%g#!!eC3j{j0O%SMXcposhbFvDkCY;4>F5 z&(~3{p3%0e(fE0NKFQ|3>}+y9bKt@q8%EDlO0nxVY}({^@%p{WRM$CNyD?_m`g?jQ zL!Zvrc-ZW->j9w-Hv50* zHWMbws$pk*jTbw2w0W*D{HkkW(;-FuJbu$sWAd*qRyP$MNL?Ks8hrVFd5D?WxmgJs z3*y*M*Y;VkQ&)MLlrVC2N8Z#YtGTm3toiN8SVaNuSeOZ~&0=p_yF1{5Yl>`ewrXIu z(#cH^j~=yrbv`ntgR>RvmyEmJ%*;6cq>6RN<+spMLoSe= zwOHeNX6D(xobaoUid}o%Kk0aB$(Vf4g)#kkm!BF3oY%O1@6Bw7ClyL3yv{8X225$? z?fkWT{D*^kubgtJnlWe3(m1IE=JioJ>!PhMzj|@yRk5R|RVKIi&GhQZH)k)*8~0hC z;JFpuSrR+q3igQ_f!r`3(*;|c!$ z^ZOfAxqZA6dg`NohcyG{M#WzE_@(8x84FTMTe+*|c0I6OsLZx1Uo&O$x%uU9VH+2g z-g!@6zP-X*b?9r*^p;JQIyrJG3*VpZ8T8`olG#4fH+HI=mYl#@I3!@Q@s@~EcnyxL3| zT-Exj({|ZvTZ<#T3^TW7eHpm%wXA%r@Mi781B87}u3i}!(JAPXrVgW@nbP*i70n#h zN-bWoS=c&Ejkk5*jU|`uMt>csSFmXMyrqXtaEH`t@G$d3W)4BlKFC4#EU6h`R|hg* z?&Dbhh{HFUu^fC~8%Um*!FMkz>>i6Ko_sUeQ5P+Q33%F3W8Ml7f2MjKh{85?j+q=s&0m=GN zneW>vVmZJx{85=C=%_PL-MEyb0%0mjF2f<@*}0IJLl8xoSc;G?a)2u?1bE)7I}qZC zumFgF26e}^04gO3&x?o%If8z~9n-N4-sNiUSQmyn5R4)XxH}OtMLf7mOV@w<4Clt+ zoiyeZxv7LanRhXRI9W|BAvu-IP=XcUJOcu<)eKo^kHLgK%9;>r#V8k0UKZ0Z?lZil z?m!fA+L0B0VBvWK9FLd_L_dePD>DEJbs(xmdDuAjMGhP05EU#}GNOt+r$7SqmDLBL z@c5VW5AFwA5=5FJL6lZjS04b`!s>j8FD!%#oey|KVN5dtK5z&bwlSGXwXqNU*MJ(j zOKPJ-y)GkW1XW!>@L`u5x?^<;AR^t$tE*2+=rVRuyvsO*fy7gC#e~6l^-E zTz?o^5yuDGCJ2fn$Z;gnVHZh9rJ-br(#Y}B(wOziiKG#;vue_`>a~mTi^`MS z#LP8)5=k${)NfZL(U?}hU7SIpIz{cm3lO#~W`?Q&%0-m-&t0h@y~Rlhc$Tp$;n)t7 zc+aXm)lyH)F`olbB*TR}^Z|neoKYa}#H|g4uI?@3)~#wHK0dxSALOjfi$$t8Kz8t8 z>8Plv+I-d3x5#<~0$r#RPGxR@JH|kr)wcv<`KWevb#*b7$jHbb`(R^ZL%ePnAinmV^pwfx0qvs8D6{swJT! zD#QH&D$e8?XRMr(6`X<;5Alvp0TXLSSjR);zZxWoqawMCI4V>baa1Ii`Mw=-R3w)X zM}=xf9F_WIXiH0y8mt$k;oH3In!I&VAnF53!MAxG8Zk;7n5Y!BzBF!>RNlsolFHk- zQBrvuH%cn6PrXrczImE(CQq`~@sjw4mz-~&9;m!^yrjO6AgZWQN~*Vxm(;0MqKX=& zq4YJ=-p9WO$V>);EJk+2}Iqsi+S@|w)Rex7Iaafu}^fS*BJWZc|1 zk$A*FE%TVX;&X)@F%Tj!PKoLp_`v=o`?ea=RciXotm#`b=o?yBiy)5_5lHZ~=fW2v z!YK?Qh`4r`AeNB+VA8)7@)5*x@|p~TW)qF;72sF%j3(ZzvaGT!4xwCw>?L{R06OFX zhfu6}Hr+-(NnmFQB8G$G>H)N!(*>>=g3Q)&#Kv_Sbf{C5Uri?x4hA z&vz(L62rpgL1K2ob1y#piAzl5u>M{G5NDADgo#N2yQZ!B5|I7>E&<3blmOJ71ksQL zbc3`S2?)SD^M^9M)BMKnZ7j{k^$(>1O$jK#h1d!KWaK#e7kQe3#2PPhT0YSNa<)X!?nExRzx{h9 zMnFBtOWf6MT!}%D(~Fds#+I;y5&?~_AIIxM%28wbgHnciMGJ`fl9fSz!^$MDEb_`G zziwrd-wmOVQIePpJ_Z&d*YaU-7fB*o68Q0K1gzzH;0+|REyf+7nw`uD#`$HTL?lBg z&J8rF3Y0_*E=#akxcfAag{!twBlm1zPmSdR+KE9FliP|=Q6N+Ty;5LnLp<6#-Qdm@ zw{>8lMO)`QOfZ~BxT5~9tpjC18It)=!(B95*oY-HSAA{5)2*9#kVE3ULty^gyd#*W zm@hcbn(feIESz5nv4}vbGFKBY;kkBM{dfI6c0#={i9eIRjFtg!d^R zja0ZRgzD_M@&Bq_vIwZ0AWJ%%Vb zH5mR-3M>9n1jVILx&Z{U|3?U-6iP-AJBA4URZ`d(s~q{!xS7m{oT8a5gI$FMa|vi) zZSa1pcb}hi1HHR?Td0`cg;xHM-YsNJ02L#8_aeSe0L=!%5=K5{5=1$ROrr!2@+)H! zp!w}PGaM`G?D_EIi8|X4?%Fjv8@vPy#)LY%6`9^hoegC~IvY6`&#u{@fOve`tkV~P z&|&dsPBytg5y-%n8~^-CZblGnrb-~R%Pf;-5YpszAiSr=nMLhP7{f1fNJ}>deZelW zhG@~Q3A3hG5wJ4>MWILL`nYmvyWpNgbUgAD{lTPvDb!cDCm{`AJewe_gruDnF2q|b zM!^v6tYFO83&@wokB-`3!QBt6iE@BXAo}nQLm~Zm$6RnXVG#@mDgT0A=bC5G8hBkczuVxjCnv)~__W9Td%2v|1-r=rX=cEvsCPAF2OvfiZYq`o z_b+hwWglr-V_DQ;)NTuws|#VNx)AQf;3(KYu(bjX-=_S`ZVai_p`2(fz&V3!f#@`W z$nHk#`_J3mE1FG!{&9$v%|?=NoF-4FOaaY11(3Fdr>WjBg9#$EnGTu$4!0JG@=2E& z+HEagg10A*6kP|xyci`Oeg~(Ri#IWcGf?F4O%iM{L7V-H5g`+XSuxIU1}ZqL}d+#$w7WQX964l5W)s26LHp>E`P3rxp`MUF!l7bDGJlbRJ4$Igc309RO# zpLr^RG7?u<^TbZXnd{~ zx%w-t2E&+;ZK1=$6*im9^z90ZvOkt^BlkPFu(IOWKk5Xdq!o1_Wb zc1=5?@@N6zj-Na1!3v;mYy+(Y+>>>O{?^}}oe5*v&N&ZPYQ|L0V8ZIy3*^ul;)p8p zN~{AJri_?|(@BegXgHl*?0=9>wU4$2k8GK0uP#j0Ul*q8s|%wgVo)=Vx_R}jU4nJg zrC|+qA+$?y1}ZS{ckh1ICi&6qTL-n)w^>jN(KZWU@UOL5+QItSkj;Xp22rwp)@B(1 zdJLZm_26zRZnJ<&K$|5EDn&^`ee=6Jxll%;&4TI$`u_j_REXOzB8|kX=~bOZa{fg% z(x0_i(on4GX{1gNBeGe#l6nEZ!oam2bp`4MKk~ORDN6;PExxx@Fjlgqf+^pxlYgJ3 zQVLaz5ZWqeaX6FpI6{6qkTLvzhq77(5I>!?G3L~3 zV`fc0MffHN{}kaj?*eMA7<`Y3vWk`v`Wv=i>fR}1ZzWmdT=-Qz{3ShovUfOU>Wdq9 zcxUYbJs0(W3%~p~9a=)`NYp0vwUP^bAHl8ZCt5~$rUnjqfNR*YLDLe>yZKA9oGvgl z-~kqnh5SwqoJ~Kj1LrvOLSiduVNlOJKdwWb%qO`Hs;AWR%8znTXw=zVlwn;L#`%$+lVK3@J*oV3h_Mk3=?bn5{^|}zY zT^IWP32g$Tw}W~1*V~7P{&zMau6^{r*1ywcS|=01 zzo<-%gN+FoI5CdeeE*4^tS3@v9|~Z-ssG$y4l#pB>kDl_ktIg$KzYM2)T3>Pdq-#i zQnn-Yp2?C7^T9TBf-k>OYi{RQz_l|FNJ+i-N*&4AIt@;C1lB&0g-{pfV$Le~LYsqA z9nRsB?^@7@c~GL@!5G{N^29G{a;in@9Tc`xr@gU6L!rN4M)B>K==~HM2Se-ef2|%b zV&#J{iB8_3D1r$Hy0-qC{k{;Vz>bD=)Xze=`-s2Uhs{US&)vxMM(SrMBht^~piR*^ zat3Z>!m2k2PCuY_y8{2zOEa%$oZD%5&;?0`8pB znD0)&VQ+Cs!!?Rp+9xaoYvKQ=bUpSIvEXM>|Njfq1AtKX1_I$+2m@jR zMFXL{#sb0784^9Tug?I<0$l^bb3zY*z%(H;fe@E`AYdy|285@X*w6_64;m%7V>|di zS@78u+eY_S`muf-p9zr2nTR}aZ^)1A)_#fKG*?&S*ibZMfDju7d8`UNkY3+me%jFp z&F|Frs?&v#r(P0ON@64=LBZM&kE;^} z;+X~b&2l1Du(oo@AV`G%)HsMwOcxS_ptgIBZ-}agYE-psza#E3$Hl+NCSr7PatFnAa}awZ&_TP}v0JRIe2Ps;VD1RFA))@C8CJ)zCo?s1~Up zTq%j72K$R$#ZjW>V?7vQybbYJV*c95zXK?Vz5T-t{deYXtt5kN16<-TO60G^{PiOL zFzi1lNOi0+4T;a+hAR9o@VB9{|J&mm!{2}V80r4g2+#=72+#=72+#=72+#=p?-4Kp zLld5OVIMeMC=|dJ5^e>|6Qm-EI4B-Dkwe@n+ zK^g%X0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s z0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s0U7}s zfqw-8U!j*l@MYl=pkSb-K+AxZ1FZlG0a^(Z3KRyk3TQRZ8X)|Bcr8#kPy|pU&^n+f zp!Gn}KpTKI0&N1?473GkE6_He7@+MyJAifq#RA0v?E=~jvrpGdRW>{Y8)!9NRMeqxR?6hh$M>iM{=4d{i#Y zUkZ)C`wH`S`t<4b=5Ks_JT-rTkDE7d9y@mI`}gnD($ZX9T%bQkjvVpv@macb>BEN) zgMxyn`3pRK@#2M*l~rkJ>7+@Ml9G}F0|Sp8I|h^5)zx*~o>vo>q)}suN%=f>3(eoZ zo3S4Zf@?jZQDM4_)weK*4DPxPkADDX7(L( z*Vr%9ASh2aGJo`r9D4rNgXmu!{PMN>PI~d}XCH4rFT0gdmS0l&uO1HFc^Uy40UCk7 z4*@WTX!j35Km+>VM)<*>4>6N4BDCPom2ii!8{tnl5t_tQ!kd^5v9<&sXgDE&KX-_A zsg1LR9J3+p3+djF<^`p-pxzEZjDNrw=`J*kz)0YjH}H!~3?}*JOU!9FvxJlugcLrs zk`8&Tv}&>Qrr~##m%SzS5vRK6N+?3GATp3ir7(y=(EfCgzTqHk9+I;EFiwSF!XH7_ ziJkaiX0b%W8b1Tt^#s}dqpk_GPK}Kv91lY z&xXuWK#d(g;)U}boh><+{m5RpK-)j-5dWVYKlZnEE2 Date: Thu, 2 Jul 2015 14:00:01 +0200 Subject: [PATCH 106/115] Modified .gitignore --- .gitignore | 23 +++++++++++++---------- CHANGELOG.md | 1 + 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index f40bd628e..54a5d8203 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,27 @@ +### Temporary files .DS_Store ._* .Spotlight-V100 .Trashes Thumbs.db Desktop.ini + +### IDE Jetbrains PhpStorm .idea +### IDE Eclipse +*.settings +*.project +*.buildpath + +### Continuous Integration build/ phpunit.xml composer.phar vendor -*.settings -*.project -*.buildpath +/batch_CI.bat -/samples/results -/phpunit.bat -/todo.txt +### Samples /samples/Sample_00_Test.php -/samples/#47 -/samples/#70 -/samples/#71 +/samples/#* /samples/Github_*.* -/samples/#83/*.lnk +/samples/results diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e39d2214..8c105f6df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - Improved the documentation about Table Shapes and cell width - @Progi1984 GH-104 - Some parts of code shared between PHPOffice projects have been moved to PhpOffice/Common - @Progi1984 - Refactored the PowerPoint97 Reader for managing the group shape and improving evolutions - @Progi1984 GH-110 +- Added a sample (12) for PowerPoint97 Reader with tree of the PhpPowerPoint object - @Progi1984 GH-110 ## 0.3.0 - 2014-09-22 From 655687415993cba93eb74c17ea9bd2dd5b4e6e18 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 3 Jul 2015 08:08:50 +0200 Subject: [PATCH 107/115] Removed composer.lock --- composer.lock | 3562 ------------------------------------------------- 1 file changed, 3562 deletions(-) delete mode 100644 composer.lock diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 5cf90aa57..000000000 --- a/composer.lock +++ /dev/null @@ -1,3562 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "3bb9c9869b762ac0d9614d7c3330f879", - "packages": [ - { - "name": "phpoffice/common", - "version": "0.1.1", - "source": { - "type": "git", - "url": "https://github.com/PHPOffice/Common.git", - "reference": "8b8ae85e7d10d5a5ffd36a4a6ba964fd3b55a76f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/Common/zipball/8b8ae85e7d10d5a5ffd36a4a6ba964fd3b55a76f", - "reference": "8b8ae85e7d10d5a5ffd36a4a6ba964fd3b55a76f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "2.*", - "phploc/phploc": "2.*", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "3.7.*", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "2.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "PhpOffice\\Common\\": "src/Common/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Mark Baker" - }, - { - "name": "Franck Lefevre", - "homepage": "http://rootslabs.net" - } - ], - "description": "PHPOffice Common", - "homepage": "http://phpoffice.github.io", - "keywords": [ - "common", - "component", - "office", - "php" - ], - "time": "2015-07-01 14:41:21" - } - ], - "packages-dev": [ - { - "name": "cilex/cilex", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/Cilex/Cilex.git", - "reference": "7acd965a609a56d0345e8b6071c261fbdb926cb5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Cilex/Cilex/zipball/7acd965a609a56d0345e8b6071c261fbdb926cb5", - "reference": "7acd965a609a56d0345e8b6071c261fbdb926cb5", - "shasum": "" - }, - "require": { - "cilex/console-service-provider": "1.*", - "php": ">=5.3.3", - "pimple/pimple": "~1.0", - "symfony/finder": "~2.1", - "symfony/process": "~2.1" - }, - "require-dev": { - "phpunit/phpunit": "3.7.*", - "symfony/validator": "~2.1" - }, - "suggest": { - "monolog/monolog": ">=1.0.0", - "symfony/validator": ">=1.0.0", - "symfony/yaml": ">=1.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "Cilex": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" - } - ], - "description": "The PHP micro-framework for Command line tools based on the Symfony2 Components", - "homepage": "http://cilex.github.com", - "keywords": [ - "cli", - "microframework" - ], - "time": "2014-03-29 14:03:13" - }, - { - "name": "cilex/console-service-provider", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/Cilex/console-service-provider.git", - "reference": "25ee3d1875243d38e1a3448ff94bdf944f70d24e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Cilex/console-service-provider/zipball/25ee3d1875243d38e1a3448ff94bdf944f70d24e", - "reference": "25ee3d1875243d38e1a3448ff94bdf944f70d24e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "pimple/pimple": "1.*@dev", - "symfony/console": "~2.1" - }, - "require-dev": { - "cilex/cilex": "1.*@dev", - "silex/silex": "1.*@dev" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "Cilex\\Provider\\Console": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Beau Simensen", - "email": "beau@dflydev.com", - "homepage": "http://beausimensen.com" - }, - { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" - } - ], - "description": "Console Service Provider", - "keywords": [ - "cilex", - "console", - "pimple", - "service-provider", - "silex" - ], - "time": "2012-12-19 10:50:58" - }, - { - "name": "doctrine/annotations", - "version": "v1.2.6", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/f4a91702ca3cd2e568c3736aa031ed00c3752af4", - "reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "php": ">=5.3.2" - }, - "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "4.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Annotations\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2015-06-17 12:21:22" - }, - { - "name": "doctrine/lexer", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "lexer", - "parser" - ], - "time": "2014-09-09 13:34:57" - }, - { - "name": "dompdf/dompdf", - "version": "v0.6.1", - "source": { - "type": "git", - "url": "https://github.com/dompdf/dompdf.git", - "reference": "cf7d8a0a27270418850cc7d7ea532159e5eeb3eb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dompdf/dompdf/zipball/cf7d8a0a27270418850cc7d7ea532159e5eeb3eb", - "reference": "cf7d8a0a27270418850cc7d7ea532159e5eeb3eb", - "shasum": "" - }, - "require": { - "phenx/php-font-lib": "0.2.*" - }, - "type": "library", - "autoload": { - "classmap": [ - "include/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Fabien Ménager", - "email": "fabien.menager@gmail.com" - }, - { - "name": "Brian Sweeney", - "email": "eclecticgeek@gmail.com" - } - ], - "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", - "homepage": "https://github.com/dompdf/dompdf", - "time": "2014-03-11 01:59:52" - }, - { - "name": "erusev/parsedown", - "version": "1.5.3", - "source": { - "type": "git", - "url": "https://github.com/erusev/parsedown.git", - "reference": "b9e5228e92e5f5c17d7774cfb2de8e5e8362de1a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/b9e5228e92e5f5c17d7774cfb2de8e5e8362de1a", - "reference": "b9e5228e92e5f5c17d7774cfb2de8e5e8362de1a", - "shasum": "" - }, - "type": "library", - "autoload": { - "psr-0": { - "Parsedown": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Emanuil Rusev", - "email": "hello@erusev.com", - "homepage": "http://erusev.com" - } - ], - "description": "Parser for Markdown.", - "homepage": "http://parsedown.org", - "keywords": [ - "markdown", - "parser" - ], - "time": "2015-04-29 20:22:24" - }, - { - "name": "herrera-io/json", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/herrera-io/php-json.git", - "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/herrera-io/php-json/zipball/60c696c9370a1e5136816ca557c17f82a6fa83f1", - "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1", - "shasum": "" - }, - "require": { - "ext-json": "*", - "justinrainbow/json-schema": ">=1.0,<2.0-dev", - "php": ">=5.3.3", - "seld/jsonlint": ">=1.0,<2.0-dev" - }, - "require-dev": { - "herrera-io/phpunit-test-case": "1.*", - "mikey179/vfsstream": "1.1.0", - "phpunit/phpunit": "3.7.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "files": [ - "src/lib/json_version.php" - ], - "psr-0": { - "Herrera\\Json": "src/lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kevin Herrera", - "email": "kevin@herrera.io", - "homepage": "http://kevin.herrera.io/", - "role": "Developer" - } - ], - "description": "A library for simplifying JSON linting and validation.", - "homepage": "http://herrera-io.github.com/php-json", - "keywords": [ - "json", - "lint", - "schema", - "validate" - ], - "time": "2013-10-30 16:51:34" - }, - { - "name": "herrera-io/phar-update", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/herrera-io/php-phar-update.git", - "reference": "00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/herrera-io/php-phar-update/zipball/00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b", - "reference": "00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b", - "shasum": "" - }, - "require": { - "herrera-io/json": "1.*", - "kherge/version": "1.*", - "php": ">=5.3.3" - }, - "require-dev": { - "herrera-io/phpunit-test-case": "1.*", - "mikey179/vfsstream": "1.1.0", - "phpunit/phpunit": "3.7.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "files": [ - "src/lib/constants.php" - ], - "psr-0": { - "Herrera\\Phar\\Update": "src/lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kevin Herrera", - "email": "kevin@herrera.io", - "homepage": "http://kevin.herrera.io/", - "role": "Developer" - } - ], - "description": "A library for self-updating Phars.", - "homepage": "http://herrera-io.github.com/php-phar-update", - "keywords": [ - "phar", - "update" - ], - "time": "2013-10-30 17:23:01" - }, - { - "name": "jms/metadata", - "version": "1.5.1", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/metadata.git", - "reference": "22b72455559a25777cfd28c4ffda81ff7639f353" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/22b72455559a25777cfd28c4ffda81ff7639f353", - "reference": "22b72455559a25777cfd28c4ffda81ff7639f353", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "doctrine/cache": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.5.x-dev" - } - }, - "autoload": { - "psr-0": { - "Metadata\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache" - ], - "authors": [ - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" - } - ], - "description": "Class/method/property metadata management in PHP", - "keywords": [ - "annotations", - "metadata", - "xml", - "yaml" - ], - "time": "2014-07-12 07:13:19" - }, - { - "name": "jms/parser-lib", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/parser-lib.git", - "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/parser-lib/zipball/c509473bc1b4866415627af0e1c6cc8ac97fa51d", - "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d", - "shasum": "" - }, - "require": { - "phpoption/phpoption": ">=0.9,<2.0-dev" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "JMS\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache2" - ], - "description": "A library for easily creating recursive-descent parsers.", - "time": "2012-11-18 18:08:43" - }, - { - "name": "jms/serializer", - "version": "0.16.0", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/serializer.git", - "reference": "c8a171357ca92b6706e395c757f334902d430ea9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/c8a171357ca92b6706e395c757f334902d430ea9", - "reference": "c8a171357ca92b6706e395c757f334902d430ea9", - "shasum": "" - }, - "require": { - "doctrine/annotations": "1.*", - "jms/metadata": "~1.1", - "jms/parser-lib": "1.*", - "php": ">=5.3.2", - "phpcollection/phpcollection": "~0.1" - }, - "require-dev": { - "doctrine/orm": "~2.1", - "doctrine/phpcr-odm": "~1.0.1", - "jackalope/jackalope-doctrine-dbal": "1.0.*", - "propel/propel1": "~1.7", - "symfony/filesystem": "2.*", - "symfony/form": "~2.1", - "symfony/translation": "~2.0", - "symfony/validator": "~2.0", - "symfony/yaml": "2.*", - "twig/twig": ">=1.8,<2.0-dev" - }, - "suggest": { - "symfony/yaml": "Required if you'd like to serialize data to YAML format." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.15-dev" - } - }, - "autoload": { - "psr-0": { - "JMS\\Serializer": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache2" - ], - "authors": [ - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" - } - ], - "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.", - "homepage": "http://jmsyst.com/libs/serializer", - "keywords": [ - "deserialization", - "jaxb", - "json", - "serialization", - "xml" - ], - "time": "2014-03-18 08:39:00" - }, - { - "name": "justinrainbow/json-schema", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "7dfe4f1db8a62be3dd35710efce663537d515653" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/7dfe4f1db8a62be3dd35710efce663537d515653", - "reference": "7dfe4f1db8a62be3dd35710efce663537d515653", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "json-schema/json-schema-test-suite": "1.1.0", - "phpdocumentor/phpdocumentor": "~2", - "phpunit/phpunit": "~3.7" - }, - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "psr-0": { - "JsonSchema": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ], - "time": "2015-06-14 20:01:28" - }, - { - "name": "kherge/version", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/kherge-unmaintained/Version.git", - "reference": "f07cf83f8ce533be8f93d2893d96d674bbeb7e30" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/kherge-unmaintained/Version/zipball/f07cf83f8ce533be8f93d2893d96d674bbeb7e30", - "reference": "f07cf83f8ce533be8f93d2893d96d674bbeb7e30", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "KevinGH\\Version": "src/lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kevin Herrera", - "email": "me@kevingh.com", - "homepage": "http://www.kevingh.com/" - } - ], - "description": "A parsing and comparison library for semantic versioning.", - "homepage": "http://github.com/kherge/Version", - "time": "2012-08-16 17:13:03" - }, - { - "name": "monolog/monolog", - "version": "1.14.0", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "b287fbbe1ca27847064beff2bad7fb6920bf08cc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/b287fbbe1ca27847064beff2bad7fb6920bf08cc", - "reference": "b287fbbe1ca27847064beff2bad7fb6920bf08cc", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9", - "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "php-console/php-console": "^3.1.3", - "phpunit/phpunit": "~4.5", - "phpunit/phpunit-mock-objects": "2.3.0", - "raven/raven": "~0.8", - "ruflin/elastica": ">=0.90 <3.0", - "swiftmailer/swiftmailer": "~5.3", - "videlalvaro/php-amqplib": "~2.4" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "php-console/php-console": "Allow sending log messages to Google Chrome", - "raven/raven": "Allow sending log messages to a Sentry server", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14.x-dev" - } - }, - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "time": "2015-06-19 13:29:54" - }, - { - "name": "nikic/php-parser", - "version": "v0.9.5", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ef70767475434bdb3615b43c327e2cae17ef12eb", - "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.9-dev" - } - }, - "autoload": { - "psr-0": { - "PHPParser": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2014-07-23 18:24:17" - }, - { - "name": "pdepend/pdepend", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/pdepend/pdepend.git", - "reference": "f58902a774449f73f1a1d9cd1a07aeac8fbee367" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/f58902a774449f73f1a1d9cd1a07aeac8fbee367", - "reference": "f58902a774449f73f1a1d9cd1a07aeac8fbee367", - "shasum": "" - }, - "require": { - "symfony/config": ">=2.4", - "symfony/dependency-injection": ">=2.4", - "symfony/filesystem": ">=2.4" - }, - "require-dev": { - "phpunit/phpunit": "4.*@stable", - "squizlabs/php_codesniffer": "@stable" - }, - "bin": [ - "src/bin/pdepend" - ], - "type": "library", - "autoload": { - "psr-0": { - "PDepend\\": "src/main/php/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Official version of pdepend to be handled with Composer", - "time": "2015-05-21 18:09:06" - }, - { - "name": "phenx/php-font-lib", - "version": "0.2.2", - "source": { - "type": "git", - "url": "https://github.com/PhenX/php-font-lib.git", - "reference": "c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82", - "reference": "c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "classes/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Fabien Ménager", - "email": "fabien.menager@gmail.com" - } - ], - "description": "A library to read, parse, export and make subsets of different types of font files.", - "homepage": "https://github.com/PhenX/php-font-lib", - "time": "2014-02-01 15:22:28" - }, - { - "name": "phpcollection/phpcollection", - "version": "0.4.0", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-collection.git", - "reference": "b8bf55a0a929ca43b01232b36719f176f86c7e83" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-collection/zipball/b8bf55a0a929ca43b01232b36719f176f86c7e83", - "reference": "b8bf55a0a929ca43b01232b36719f176f86c7e83", - "shasum": "" - }, - "require": { - "phpoption/phpoption": "1.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.3-dev" - } - }, - "autoload": { - "psr-0": { - "PhpCollection": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache2" - ], - "authors": [ - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" - } - ], - "description": "General-Purpose Collection Library for PHP", - "keywords": [ - "collection", - "list", - "map", - "sequence", - "set" - ], - "time": "2014-03-11 13:46:42" - }, - { - "name": "phpdocumentor/fileset", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/Fileset.git", - "reference": "bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/Fileset/zipball/bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0", - "reference": "bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/finder": "~2.1" - }, - "require-dev": { - "phpunit/phpunit": "~3.7" - }, - "type": "library", - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/", - "tests/unit/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Fileset component for collecting a set of files given directories and file paths", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "files", - "fileset", - "phpdoc" - ], - "time": "2013-08-06 21:07:42" - }, - { - "name": "phpdocumentor/graphviz", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/GraphViz.git", - "reference": "aa243118c8a055fc853c02802e8503c5435862f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/GraphViz/zipball/aa243118c8a055fc853c02802e8503c5435862f7", - "reference": "aa243118c8a055fc853c02802e8503c5435862f7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~3.7" - }, - "type": "library", - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/", - "tests/unit" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" - } - ], - "time": "2014-07-19 06:52:59" - }, - { - "name": "phpdocumentor/phpdocumentor", - "version": "v2.8.3", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/phpDocumentor2.git", - "reference": "0dd03c67db51771e312176d36194846d9006f28f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/phpDocumentor2/zipball/0dd03c67db51771e312176d36194846d9006f28f", - "reference": "0dd03c67db51771e312176d36194846d9006f28f", - "shasum": "" - }, - "require": { - "cilex/cilex": "~1.0", - "dompdf/dompdf": "~0.6", - "erusev/parsedown": "~1.0", - "herrera-io/phar-update": "1.0.3", - "jms/serializer": "~0.12", - "monolog/monolog": "~1.6", - "php": ">=5.3.3", - "phpdocumentor/fileset": "~1.0", - "phpdocumentor/graphviz": "~1.0", - "phpdocumentor/reflection": "~1.0", - "phpdocumentor/reflection-docblock": "~2.0", - "symfony/config": "~2.3", - "symfony/console": "~2.3", - "symfony/event-dispatcher": "~2.1", - "symfony/process": "~2.0", - "symfony/stopwatch": "~2.3", - "symfony/validator": "~2.2", - "twig/twig": "~1.3", - "zendframework/zend-cache": "~2.1", - "zendframework/zend-config": "~2.1", - "zendframework/zend-filter": "~2.1", - "zendframework/zend-i18n": "~2.1", - "zendframework/zend-serializer": "~2.1", - "zendframework/zend-servicemanager": "~2.1", - "zendframework/zend-stdlib": "~2.1", - "zetacomponents/document": ">=1.3.1" - }, - "require-dev": { - "behat/behat": "~3.0", - "mikey179/vfsstream": "~1.2", - "mockery/mockery": "~0.9@dev", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~1.4", - "symfony/expression-language": "~2.4" - }, - "suggest": { - "ext-twig": "Enabling the twig extension improves the generation of twig based templates.", - "ext-xslcache": "Enabling the XSLCache extension improves the generation of xml based templates." - }, - "bin": [ - "bin/phpdoc.php", - "bin/phpdoc" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "2.9-dev" - } - }, - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/", - "tests/unit/" - ], - "Cilex\\Provider": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Documentation Generator for PHP", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "api", - "application", - "dga", - "documentation", - "phpdoc" - ], - "time": "2015-06-15 19:08:33" - }, - { - "name": "phpdocumentor/reflection", - "version": "1.0.7", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/Reflection.git", - "reference": "fc40c3f604ac2287eb5c314174d5109b2c699372" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/Reflection/zipball/fc40c3f604ac2287eb5c314174d5109b2c699372", - "reference": "fc40c3f604ac2287eb5c314174d5109b2c699372", - "shasum": "" - }, - "require": { - "nikic/php-parser": "~0.9.4", - "php": ">=5.3.3", - "phpdocumentor/reflection-docblock": "~2.0", - "psr/log": "~1.0" - }, - "require-dev": { - "behat/behat": "~2.4", - "mockery/mockery": "~0.8", - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/", - "tests/unit/", - "tests/mocks/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Reflection library to do Static Analysis for PHP Projects", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2014-11-14 11:43:04" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" - } - ], - "time": "2015-02-03 12:10:50" - }, - { - "name": "phploc/phploc", - "version": "2.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phploc.git", - "reference": "ab893cbe5c4b63760b1560b370fedc001eb5717f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phploc/zipball/ab893cbe5c4b63760b1560b370fedc001eb5717f", - "reference": "ab893cbe5c4b63760b1560b370fedc001eb5717f", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/finder-facade": "~1.1", - "sebastian/git": "~2.0", - "sebastian/version": "~1.0.3", - "symfony/console": "~2.5" - }, - "require-dev": { - "phpunit/phpunit": "~4" - }, - "bin": [ - "phploc" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "A tool for quickly measuring the size of a PHP project.", - "homepage": "https://github.com/sebastianbergmann/phploc", - "time": "2015-06-04 13:18:14" - }, - { - "name": "phpmd/phpmd", - "version": "2.2.3", - "source": { - "type": "git", - "url": "https://github.com/phpmd/phpmd.git", - "reference": "5eeb5a4d39c8304910b33ae49f8813905346cc35" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/5eeb5a4d39c8304910b33ae49f8813905346cc35", - "reference": "5eeb5a4d39c8304910b33ae49f8813905346cc35", - "shasum": "" - }, - "require": { - "pdepend/pdepend": "~2.0", - "php": ">=5.3.0", - "symfony/config": ">=2.4", - "symfony/dependency-injection": ">=2.4", - "symfony/filesystem": ">=2.4" - }, - "require-dev": { - "phpunit/phpunit": "*", - "squizlabs/php_codesniffer": "*" - }, - "bin": [ - "src/bin/phpmd" - ], - "type": "project", - "autoload": { - "psr-0": { - "PHPMD\\": "src/main/php" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Manuel Pichler", - "email": "github@manuel-pichler.de", - "homepage": "https://github.com/manuelpichler", - "role": "Project founder" - }, - { - "name": "Other contributors", - "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", - "role": "Contributors" - } - ], - "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", - "homepage": "http://phpmd.org/", - "keywords": [ - "mess detection", - "mess detector", - "pdepend", - "phpmd", - "pmd" - ], - "time": "2015-05-27 18:16:57" - }, - { - "name": "phpoption/phpoption", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "5d099bcf0393908bf4ad69cc47dafb785d51f7f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/5d099bcf0393908bf4ad69cc47dafb785d51f7f5", - "reference": "5d099bcf0393908bf4ad69cc47dafb785d51f7f5", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-0": { - "PhpOption\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache2" - ], - "authors": [ - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" - } - ], - "description": "Option Type for PHP", - "keywords": [ - "language", - "option", - "php", - "type" - ], - "time": "2014-01-09 22:37:17" - }, - { - "name": "phpunit/php-code-coverage", - "version": "1.2.18", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", - "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": ">=1.3.0@stable", - "phpunit/php-text-template": ">=1.2.0@stable", - "phpunit/php-token-stream": ">=1.1.3,<1.3.0" - }, - "require-dev": { - "phpunit/phpunit": "3.7.*@dev" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.0.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "PHP/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2014-09-02 10:13:14" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2015-04-02 05:19:05" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21 13:50:34" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d", - "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2015-06-13 07:35:30" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32", - "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "classmap": [ - "PHP/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2014-03-03 05:10:30" - }, - { - "name": "phpunit/phpunit", - "version": "3.7.38", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/38709dc22d519a3d1be46849868aa2ddf822bcf6", - "reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpunit/php-code-coverage": "~1.2", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.1", - "phpunit/php-timer": "~1.0", - "phpunit/phpunit-mock-objects": "~1.2", - "symfony/yaml": "~2.0" - }, - "require-dev": { - "pear-pear.php.net/pear": "1.9.4" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "composer/bin/phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.7.x-dev" - } - }, - "autoload": { - "classmap": [ - "PHPUnit/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "", - "../../symfony/yaml/" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "http://www.phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2014-10-17 09:04:17" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "1.2.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", - "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-text-template": ">=1.1.1@stable" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "autoload": { - "classmap": [ - "PHPUnit/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2013-01-13 10:24:48" - }, - { - "name": "pimple/pimple", - "version": "v1.1.1", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Pimple.git", - "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d", - "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-0": { - "Pimple": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", - "homepage": "http://pimple.sensiolabs.org", - "keywords": [ - "container", - "dependency injection" - ], - "time": "2013-11-22 08:30:29" - }, - { - "name": "psr/log", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", - "shasum": "" - }, - "type": "library", - "autoload": { - "psr-0": { - "Psr\\Log\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2012-12-21 11:40:51" - }, - { - "name": "sebastian/finder-facade", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/finder-facade.git", - "reference": "a520dcc3dd39160eea480daa3426f4fd419a327b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/a520dcc3dd39160eea480daa3426f4fd419a327b", - "reference": "a520dcc3dd39160eea480daa3426f4fd419a327b", - "shasum": "" - }, - "require": { - "symfony/finder": "~2.3", - "theseer/fdomdocument": "~1.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", - "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2015-06-04 08:11:58" - }, - { - "name": "sebastian/git", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/git.git", - "reference": "2d5c139d0eedcb9e67e0e9ca08023be6e9b7b47b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/git/zipball/2d5c139d0eedcb9e67e0e9ca08023be6e9b7b47b", - "reference": "2d5c139d0eedcb9e67e0e9ca08023be6e9b7b47b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Simple wrapper for Git", - "homepage": "http://www.github.com/sebastianbergmann/git", - "keywords": [ - "git" - ], - "time": "2015-04-06 16:23:43" - }, - { - "name": "sebastian/phpcpd", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpcpd.git", - "reference": "d3ad100fdf15805495f6ff19f473f4314c99390c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpcpd/zipball/d3ad100fdf15805495f6ff19f473f4314c99390c", - "reference": "d3ad100fdf15805495f6ff19f473f4314c99390c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-timer": "~1.0", - "sebastian/finder-facade": "~1.1", - "sebastian/version": "~1.0", - "symfony/console": "~2.2", - "theseer/fdomdocument": "~1.4" - }, - "bin": [ - "phpcpd" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Copy/Paste Detector (CPD) for PHP code.", - "homepage": "https://github.com/sebastianbergmann/phpcpd", - "time": "2015-03-26 14:47:38" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" - }, - { - "name": "seld/jsonlint", - "version": "1.3.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/863ae85c6d3ef60ca49cb12bd051c4a0648c40c4", - "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "bin": [ - "bin/jsonlint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Seld\\JsonLint\\": "src/Seld/JsonLint/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "JSON Linter", - "keywords": [ - "json", - "linter", - "parser", - "validator" - ], - "time": "2015-01-04 21:18:15" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "2.3.3", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "c1a26c729508f73560c1a4f767f60b8ab6b4a666" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/c1a26c729508f73560c1a4f767f60b8ab6b4a666", - "reference": "c1a26c729508f73560c1a4f767f60b8ab6b4a666", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.1.2" - }, - "bin": [ - "scripts/phpcs", - "scripts/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2015-06-24 03:16:23" - }, - { - "name": "symfony/config", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/Config.git", - "reference": "58ded81f1f582a87c528ef3dae9a859f78b5f374" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/58ded81f1f582a87c528ef3dae9a859f78b5f374", - "reference": "58ded81f1f582a87c528ef3dae9a859f78b5f374", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/filesystem": "~2.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2015-06-11 14:06:56" - }, - { - "name": "symfony/console", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/Console.git", - "reference": "564398bc1f33faf92fc2ec86859983d30eb81806" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/564398bc1f33faf92fc2ec86859983d30eb81806", - "reference": "564398bc1f33faf92fc2ec86859983d30eb81806", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.1" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2015-06-10 15:30:22" - }, - { - "name": "symfony/dependency-injection", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "1a409e52a38ec891de0a7a61a191d1c62080b69d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/1a409e52a38ec891de0a7a61a191d1c62080b69d", - "reference": "1a409e52a38ec891de0a7a61a191d1c62080b69d", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "conflict": { - "symfony/expression-language": "<2.6" - }, - "require-dev": { - "symfony/config": "~2.2", - "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.1" - }, - "suggest": { - "symfony/config": "", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2015-06-11 19:13:11" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/be3c5ff8d503c46768aeb78ce6333051aa6f26d9", - "reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5", - "symfony/dependency-injection": "~2.6", - "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", - "symfony/stopwatch": "~2.3" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2015-06-08 09:37:21" - }, - { - "name": "symfony/filesystem", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/Filesystem.git", - "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a0d43eb3e17d4f4c6990289805a488a0482a07f3", - "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2015-06-08 09:37:21" - }, - { - "name": "symfony/finder", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/Finder.git", - "reference": "c13a40d638aeede1e8400f8c956c7f9246c05f75" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/c13a40d638aeede1e8400f8c956c7f9246c05f75", - "reference": "c13a40d638aeede1e8400f8c956c7f9246c05f75", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2015-06-04 20:11:48" - }, - { - "name": "symfony/process", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/Process.git", - "reference": "552d8efdc80980cbcca50b28d626ac8e36e3cdd1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/552d8efdc80980cbcca50b28d626ac8e36e3cdd1", - "reference": "552d8efdc80980cbcca50b28d626ac8e36e3cdd1", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2015-06-08 09:37:21" - }, - { - "name": "symfony/stopwatch", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/Stopwatch.git", - "reference": "c653f1985f6c2b7dbffd04d48b9c0a96aaef814b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/c653f1985f6c2b7dbffd04d48b9c0a96aaef814b", - "reference": "c653f1985f6c2b7dbffd04d48b9c0a96aaef814b", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Stopwatch Component", - "homepage": "https://symfony.com", - "time": "2015-06-04 20:11:48" - }, - { - "name": "symfony/translation", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/Translation.git", - "reference": "8349a2b0d11bd0311df9e8914408080912983a0b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/8349a2b0d11bd0311df9e8914408080912983a0b", - "reference": "8349a2b0d11bd0311df9e8914408080912983a0b", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "conflict": { - "symfony/config": "<2.7" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.7", - "symfony/intl": "~2.3", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.2" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com", - "time": "2015-06-11 17:26:34" - }, - { - "name": "symfony/validator", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/Validator.git", - "reference": "3c58b1ef26ab2114f8f84d1808937b9b76bad8f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/3c58b1ef26ab2114f8f84d1808937b9b76bad8f5", - "reference": "3c58b1ef26ab2114f8f84d1808937b9b76bad8f5", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/translation": "~2.4" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/cache": "~1.0", - "egulias/email-validator": "~1.2,>=1.2.1", - "symfony/config": "~2.2", - "symfony/expression-language": "~2.4", - "symfony/http-foundation": "~2.1", - "symfony/intl": "~2.3", - "symfony/phpunit-bridge": "~2.7", - "symfony/property-access": "~2.3", - "symfony/yaml": "~2.0,>=2.0.5" - }, - "suggest": { - "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", - "doctrine/cache": "For using the default cached annotation reader and metadata cache.", - "egulias/email-validator": "Strict (RFC compliant) email validation", - "symfony/config": "", - "symfony/expression-language": "For using the 2.4 Expression validator", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/property-access": "For using the 2.4 Validator API", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Validator\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Validator Component", - "homepage": "https://symfony.com", - "time": "2015-06-08 09:37:21" - }, - { - "name": "symfony/yaml", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/9808e75c609a14f6db02f70fccf4ca4aab53c160", - "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2015-06-10 15:30:22" - }, - { - "name": "theseer/fdomdocument", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/theseer/fDOMDocument.git", - "reference": "d9ad139d6c2e8edf5e313ffbe37ff13344cf0684" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/d9ad139d6c2e8edf5e313ffbe37ff13344cf0684", - "reference": "d9ad139d6c2e8edf5e313ffbe37ff13344cf0684", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "lib-libxml": "*", - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "lead" - } - ], - "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", - "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2015-05-27 22:58:02" - }, - { - "name": "twig/twig", - "version": "v1.18.2", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "e8e6575abf6102af53ec283f7f14b89e304fa602" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/e8e6575abf6102af53ec283f7f14b89e304fa602", - "reference": "e8e6575abf6102af53ec283f7f14b89e304fa602", - "shasum": "" - }, - "require": { - "php": ">=5.2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - } - }, - "autoload": { - "psr-0": { - "Twig_": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - }, - { - "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", - "role": "Contributors" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ], - "time": "2015-06-06 23:31:24" - }, - { - "name": "zendframework/zend-cache", - "version": "2.5.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-cache.git", - "reference": "5999e5a03f7dcf82abbbe67eea74da641f959684" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/5999e5a03f7dcf82abbbe67eea74da641f959684", - "reference": "5999e5a03f7dcf82abbbe67eea74da641f959684", - "shasum": "" - }, - "require": { - "php": ">=5.3.23", - "zendframework/zend-eventmanager": "~2.5", - "zendframework/zend-serializer": "~2.5", - "zendframework/zend-servicemanager": "~2.5", - "zendframework/zend-stdlib": "~2.5" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-session": "~2.5" - }, - "suggest": { - "ext-apc": "APC >= 3.1.6 to use the APC storage adapter", - "ext-dba": "DBA, to use the DBA storage adapter", - "ext-memcached": "Memcached >= 1.0.0 to use the Memcached storage adapter", - "ext-mongo": "Mongo, to use MongoDb storage adapter", - "ext-wincache": "WinCache, to use the WinCache storage adapter", - "mongofill/mongofill": "Alternative to ext-mongo - a pure PHP implementation designed as a drop in replacement", - "zendframework/zend-serializer": "Zend\\Serializer component", - "zendframework/zend-session": "Zend\\Session component" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "provides a generic way to cache any data", - "homepage": "https://github.com/zendframework/zend-cache", - "keywords": [ - "cache", - "zf2" - ], - "time": "2015-06-03 15:31:59" - }, - { - "name": "zendframework/zend-config", - "version": "2.5.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-config.git", - "reference": "ec49b1df1bdd9772df09dc2f612fbfc279bf4c27" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-config/zipball/ec49b1df1bdd9772df09dc2f612fbfc279bf4c27", - "reference": "ec49b1df1bdd9772df09dc2f612fbfc279bf4c27", - "shasum": "" - }, - "require": { - "php": ">=5.3.23", - "zendframework/zend-stdlib": "~2.5" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-filter": "~2.5", - "zendframework/zend-i18n": "~2.5", - "zendframework/zend-json": "~2.5", - "zendframework/zend-mvc": "~2.5", - "zendframework/zend-servicemanager": "~2.5" - }, - "suggest": { - "zendframework/zend-filter": "Zend\\Filter component", - "zendframework/zend-i18n": "Zend\\I18n component", - "zendframework/zend-json": "Zend\\Json to use the Json reader or writer classes", - "zendframework/zend-servicemanager": "Zend\\ServiceManager for use with the Config Factory to retrieve reader and writer instances" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Config\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "provides a nested object property based user interface for accessing this configuration data within application code", - "homepage": "https://github.com/zendframework/zend-config", - "keywords": [ - "config", - "zf2" - ], - "time": "2015-06-03 15:32:00" - }, - { - "name": "zendframework/zend-eventmanager", - "version": "2.5.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "d94a16039144936f107f906896349900fd634443" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/d94a16039144936f107f906896349900fd634443", - "reference": "d94a16039144936f107f906896349900fd634443", - "shasum": "" - }, - "require": { - "php": ">=5.3.23", - "zendframework/zend-stdlib": "~2.5" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\EventManager\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-eventmanager", - "keywords": [ - "eventmanager", - "zf2" - ], - "time": "2015-06-03 15:32:01" - }, - { - "name": "zendframework/zend-filter", - "version": "2.5.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-filter.git", - "reference": "93e6990a198e6cdd811064083acac4693f4b29ae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/93e6990a198e6cdd811064083acac4693f4b29ae", - "reference": "93e6990a198e6cdd811064083acac4693f4b29ae", - "shasum": "" - }, - "require": { - "php": ">=5.3.23", - "zendframework/zend-stdlib": "~2.5" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-config": "~2.5", - "zendframework/zend-crypt": "~2.5", - "zendframework/zend-i18n": "~2.5", - "zendframework/zend-loader": "~2.5", - "zendframework/zend-servicemanager": "~2.5", - "zendframework/zend-uri": "~2.5" - }, - "suggest": { - "zendframework/zend-crypt": "Zend\\Crypt component", - "zendframework/zend-i18n": "Zend\\I18n component", - "zendframework/zend-servicemanager": "Zend\\ServiceManager component", - "zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Filter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "provides a set of commonly needed data filters", - "homepage": "https://github.com/zendframework/zend-filter", - "keywords": [ - "filter", - "zf2" - ], - "time": "2015-06-03 15:32:01" - }, - { - "name": "zendframework/zend-i18n", - "version": "2.5.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-i18n.git", - "reference": "509271eb7947e4aabebfc376104179cffea42696" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/509271eb7947e4aabebfc376104179cffea42696", - "reference": "509271eb7947e4aabebfc376104179cffea42696", - "shasum": "" - }, - "require": { - "php": ">=5.3.23", - "zendframework/zend-stdlib": "~2.5" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-cache": "~2.5", - "zendframework/zend-config": "~2.5", - "zendframework/zend-eventmanager": "~2.5", - "zendframework/zend-filter": "~2.5", - "zendframework/zend-servicemanager": "~2.5", - "zendframework/zend-validator": "~2.5", - "zendframework/zend-view": "~2.5" - }, - "suggest": { - "ext-intl": "Required for most features of Zend\\I18n; included in default builds of PHP", - "zendframework/zend-cache": "Zend\\Cache component", - "zendframework/zend-config": "Zend\\Config component", - "zendframework/zend-eventmanager": "You should install this package to use the events in the translator", - "zendframework/zend-filter": "You should install this package to use the provided filters", - "zendframework/zend-resources": "Translation resources", - "zendframework/zend-servicemanager": "Zend\\ServiceManager component", - "zendframework/zend-validator": "You should install this package to use the provided validators", - "zendframework/zend-view": "You should install this package to use the provided view helpers" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\I18n\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-i18n", - "keywords": [ - "i18n", - "zf2" - ], - "time": "2015-06-03 15:32:01" - }, - { - "name": "zendframework/zend-json", - "version": "2.5.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-json.git", - "reference": "c74eaf17d2dd37dc1e964be8dfde05706a821ebc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-json/zipball/c74eaf17d2dd37dc1e964be8dfde05706a821ebc", - "reference": "c74eaf17d2dd37dc1e964be8dfde05706a821ebc", - "shasum": "" - }, - "require": { - "php": ">=5.3.23", - "zendframework/zend-stdlib": "~2.5" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-http": "~2.5", - "zendframework/zend-server": "~2.5", - "zendframework/zendxml": "~1.0" - }, - "suggest": { - "zendframework/zend-http": "Zend\\Http component", - "zendframework/zend-server": "Zend\\Server component", - "zendframework/zendxml": "To support Zend\\Json\\Json::fromXml() usage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Json\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP", - "homepage": "https://github.com/zendframework/zend-json", - "keywords": [ - "json", - "zf2" - ], - "time": "2015-06-03 15:32:01" - }, - { - "name": "zendframework/zend-math", - "version": "2.5.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-math.git", - "reference": "9f02a1ac4d3374d3332c80f9215deec9c71558fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-math/zipball/9f02a1ac4d3374d3332c80f9215deec9c71558fc", - "reference": "9f02a1ac4d3374d3332c80f9215deec9c71558fc", - "shasum": "" - }, - "require": { - "php": ">=5.3.23" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "ircmaxell/random-lib": "~1.1", - "phpunit/phpunit": "~4.0", - "zendframework/zend-servicemanager": "~2.5" - }, - "suggest": { - "ext-bcmath": "If using the bcmath functionality", - "ext-gmp": "If using the gmp functionality", - "ircmaxell/random-lib": "Fallback random byte generator for Zend\\Math\\Rand if OpenSSL/Mcrypt extensions are unavailable", - "zendframework/zend-servicemanager": ">= current version, if using the BigInteger::factory functionality" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Math\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-math", - "keywords": [ - "math", - "zf2" - ], - "time": "2015-06-03 15:32:02" - }, - { - "name": "zendframework/zend-serializer", - "version": "2.5.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-serializer.git", - "reference": "b7208eb17dc4a4fb3a660b85e6c4af035eeed40c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-serializer/zipball/b7208eb17dc4a4fb3a660b85e6c4af035eeed40c", - "reference": "b7208eb17dc4a4fb3a660b85e6c4af035eeed40c", - "shasum": "" - }, - "require": { - "php": ">=5.3.23", - "zendframework/zend-json": "~2.5", - "zendframework/zend-math": "~2.5", - "zendframework/zend-stdlib": "~2.5" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-servicemanager": "~2.5" - }, - "suggest": { - "zendframework/zend-servicemanager": "To support plugin manager support" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Serializer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "provides an adapter based interface to simply generate storable representation of PHP types by different facilities, and recover", - "homepage": "https://github.com/zendframework/zend-serializer", - "keywords": [ - "serializer", - "zf2" - ], - "time": "2015-06-03 15:32:02" - }, - { - "name": "zendframework/zend-servicemanager", - "version": "2.5.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-servicemanager.git", - "reference": "3b22c403e351d92526c642cba0bd810bc22e1c56" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/3b22c403e351d92526c642cba0bd810bc22e1c56", - "reference": "3b22c403e351d92526c642cba0bd810bc22e1c56", - "shasum": "" - }, - "require": { - "php": ">=5.3.23" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-di": "~2.5", - "zendframework/zend-mvc": "~2.5" - }, - "suggest": { - "ocramius/proxy-manager": "ProxyManager 0.5.* to handle lazy initialization of services", - "zendframework/zend-di": "Zend\\Di component" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\ServiceManager\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-servicemanager", - "keywords": [ - "servicemanager", - "zf2" - ], - "time": "2015-06-03 15:32:02" - }, - { - "name": "zendframework/zend-stdlib", - "version": "2.5.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cc8e90a60dd5d44b9730b77d07b97550091da1ae", - "reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae", - "shasum": "" - }, - "require": { - "php": ">=5.3.23" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-config": "~2.5", - "zendframework/zend-eventmanager": "~2.5", - "zendframework/zend-filter": "~2.5", - "zendframework/zend-inputfilter": "~2.5", - "zendframework/zend-serializer": "~2.5", - "zendframework/zend-servicemanager": "~2.5" - }, - "suggest": { - "zendframework/zend-eventmanager": "To support aggregate hydrator usage", - "zendframework/zend-filter": "To support naming strategy hydrator usage", - "zendframework/zend-serializer": "Zend\\Serializer component", - "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Stdlib\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-stdlib", - "keywords": [ - "stdlib", - "zf2" - ], - "time": "2015-06-03 15:32:03" - }, - { - "name": "zetacomponents/base", - "version": "1.9", - "source": { - "type": "git", - "url": "https://github.com/zetacomponents/Base.git", - "reference": "f20df24e8de3e48b6b69b2503f917e457281e687" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zetacomponents/Base/zipball/f20df24e8de3e48b6b69b2503f917e457281e687", - "reference": "f20df24e8de3e48b6b69b2503f917e457281e687", - "shasum": "" - }, - "require-dev": { - "zetacomponents/unit-test": "*" - }, - "type": "library", - "autoload": { - "classmap": [ - "src" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Sergey Alexeev" - }, - { - "name": "Sebastian Bergmann" - }, - { - "name": "Jan Borsodi" - }, - { - "name": "Raymond Bosman" - }, - { - "name": "Frederik Holljen" - }, - { - "name": "Kore Nordmann" - }, - { - "name": "Derick Rethans" - }, - { - "name": "Vadym Savchuk" - }, - { - "name": "Tobias Schlitt" - }, - { - "name": "Alexandru Stanoi" - } - ], - "description": "The Base package provides the basic infrastructure that all packages rely on. Therefore every component relies on this package.", - "homepage": "https://github.com/zetacomponents", - "time": "2014-09-19 03:28:34" - }, - { - "name": "zetacomponents/document", - "version": "1.3.1", - "source": { - "type": "git", - "url": "https://github.com/zetacomponents/Document.git", - "reference": "688abfde573cf3fe0730f82538fbd7aa9fc95bc8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zetacomponents/Document/zipball/688abfde573cf3fe0730f82538fbd7aa9fc95bc8", - "reference": "688abfde573cf3fe0730f82538fbd7aa9fc95bc8", - "shasum": "" - }, - "require": { - "zetacomponents/base": "*" - }, - "require-dev": { - "zetacomponents/unit-test": "dev-master" - }, - "type": "library", - "autoload": { - "classmap": [ - "src" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Sebastian Bergmann" - }, - { - "name": "Kore Nordmann" - }, - { - "name": "Derick Rethans" - }, - { - "name": "Tobias Schlitt" - }, - { - "name": "Alexandru Stanoi" - } - ], - "description": "The Document components provides a general conversion framework for different semantic document markup languages like XHTML, Docbook, RST and similar.", - "homepage": "https://github.com/zetacomponents", - "time": "2013-12-19 11:40:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.3.0", - "ext-xml": "*", - "ext-zip": "*" - }, - "platform-dev": [] -} From d32359ca292f3111811f9c79186757c3261a57ad Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 3 Jul 2015 13:20:16 +0200 Subject: [PATCH 108/115] PowerPoint2007 Writer : Visibility of the Title doesn't work - @Progi1984 GH-107 --- docs/shapes_chart.rst | 17 +++++ samples/Sample_05_Chart.php | 1 + .../Writer/ODPresentation/ObjectsChart.php | 69 ++++++++++--------- .../Writer/PowerPoint2007/Chart.php | 2 +- .../Writer/ODPresentation/ChartsTest.php | 24 +++++++ .../Tests/Writer/PowerPoint2007/ChartTest.php | 22 ++++++ 6 files changed, 102 insertions(+), 33 deletions(-) diff --git a/docs/shapes_chart.rst b/docs/shapes_chart.rst index 8f2d22fdf..d86e04b68 100644 --- a/docs/shapes_chart.rst +++ b/docs/shapes_chart.rst @@ -10,7 +10,24 @@ Example: .. code-block:: php $chartShape = $slide->createChartShape(); + +Parts +------- + +Title +^^^^^ + +By default, the title of a chart is displayed. +For hiding it, you define its visibility to false. +.. code-block:: php + + $chartShape = $slide->createChartShape(); + $oLine = new Line(); + $oShape->getPlotArea()->setType($oLine); + // Hide the title + $oShape->getTitle()->setVisible(false); + Types ------- diff --git a/samples/Sample_05_Chart.php b/samples/Sample_05_Chart.php index f3fb2a625..5ca0bb950 100644 --- a/samples/Sample_05_Chart.php +++ b/samples/Sample_05_Chart.php @@ -50,6 +50,7 @@ function fnSlide_Area(PhpPowerpoint $objPHPPowerPoint) { // Create a shape (chart) echo date('H:i:s') . ' Create a shape (chart)' . EOL; $shape = $currentSlide->createChartShape(); + $shape->getTitle()->setVisible(false); $shape->setName('PHPPowerPoint Daily Downloads')->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80); $shape->setShadow($oShadow); $shape->setFill($oFill); diff --git a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php index 6b9154dd0..5e78f9715 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/ObjectsChart.php @@ -22,6 +22,7 @@ use PhpOffice\Common\XMLWriter; use PhpOffice\PhpPowerpoint\PhpPowerpoint; use PhpOffice\PhpPowerpoint\Shape\Chart; +use PhpOffice\PhpPowerpoint\Shape\Chart\Title; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractTypeBar; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\AbstractTypePie; use PhpOffice\PhpPowerpoint\Shape\Chart\Type\Area; @@ -184,7 +185,7 @@ private function writeContentPart(Chart $chart) $this->writePlotAreaStyle($chart); // Title - $this->writeTitleStyle($chart); + $this->writeTitleStyle($chart->getTitle()); // Wall $this->writeWallStyle($chart); @@ -216,7 +217,7 @@ private function writeContentPart(Chart $chart) } //**** Title **** - $this->writeTitle($chart); + $this->writeTitle($chart->getTitle()); //**** Legend **** $this->writeLegend($chart); @@ -756,43 +757,47 @@ private function writeTable() } /** - * @param Chart $chart + * @param Title $oTitle */ - private function writeTitle(Chart $chart) + private function writeTitle(Title $oTitle) { - // chart:title - $this->xmlContent->startElement('chart:title'); - $this->xmlContent->writeAttribute('svg:x', String::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getTitle()->getOffsetX()), 3) . 'cm'); - $this->xmlContent->writeAttribute('svg:y', String::numberFormat(CommonDrawing::pixelsToCentimeters($chart->getTitle()->getOffsetY()), 3) . 'cm'); - $this->xmlContent->writeAttribute('chart:style-name', 'styleTitle'); - // > text:p - $this->xmlContent->startElement('text:p'); - $this->xmlContent->text($chart->getTitle()->getText()); - // > text:p - $this->xmlContent->endElement(); - // > chart:title - $this->xmlContent->endElement(); + if ($oTitle->isVisible()) { + // chart:title + $this->xmlContent->startElement('chart:title'); + $this->xmlContent->writeAttribute('svg:x', String::numberFormat(CommonDrawing::pixelsToCentimeters($oTitle->getOffsetX()), 3) . 'cm'); + $this->xmlContent->writeAttribute('svg:y', String::numberFormat(CommonDrawing::pixelsToCentimeters($oTitle->getOffsetY()), 3) . 'cm'); + $this->xmlContent->writeAttribute('chart:style-name', 'styleTitle'); + // > text:p + $this->xmlContent->startElement('text:p'); + $this->xmlContent->text($oTitle->getText()); + // > text:p + $this->xmlContent->endElement(); + // > chart:title + $this->xmlContent->endElement(); + } } /** - * @param Chart $chart + * @param Title $oTitle */ - private function writeTitleStyle(Chart $chart) + private function writeTitleStyle(Title $oTitle) { - // style:style - $this->xmlContent->startElement('style:style'); - $this->xmlContent->writeAttribute('style:name', 'styleTitle'); - $this->xmlContent->writeAttribute('style:family', 'chart'); - // style:text-properties - $this->xmlContent->startElement('style:text-properties'); - $this->xmlContent->writeAttribute('fo:color', '#'.$chart->getTitle()->getFont()->getColor()->getRGB()); - $this->xmlContent->writeAttribute('fo:font-family', $chart->getTitle()->getFont()->getName()); - $this->xmlContent->writeAttribute('fo:font-size', $chart->getTitle()->getFont()->getSize().'pt'); - $this->xmlContent->writeAttribute('fo:font-style', $chart->getTitle()->getFont()->isItalic() ? 'italic' : 'normal'); - // > style:text-properties - $this->xmlContent->endElement(); - // > style:style - $this->xmlContent->endElement(); + if ($oTitle->isVisible()) { + // style:style + $this->xmlContent->startElement('style:style'); + $this->xmlContent->writeAttribute('style:name', 'styleTitle'); + $this->xmlContent->writeAttribute('style:family', 'chart'); + // style:text-properties + $this->xmlContent->startElement('style:text-properties'); + $this->xmlContent->writeAttribute('fo:color', '#'.$oTitle->getFont()->getColor()->getRGB()); + $this->xmlContent->writeAttribute('fo:font-family', $oTitle->getFont()->getName()); + $this->xmlContent->writeAttribute('fo:font-size', $oTitle->getFont()->getSize().'pt'); + $this->xmlContent->writeAttribute('fo:font-style', $oTitle->getFont()->isItalic() ? 'italic' : 'normal'); + // > style:text-properties + $this->xmlContent->endElement(); + // > style:style + $this->xmlContent->endElement(); + } } private function writeWall() diff --git a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php index b09b521ad..0ccd8d565 100644 --- a/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php +++ b/src/PhpPowerpoint/Writer/PowerPoint2007/Chart.php @@ -87,7 +87,7 @@ public function writeChart(ShapeChart $chart = null) // c:autoTitleDeleted $objWriter->startElement('c:autoTitleDeleted'); - $objWriter->writeAttribute('val', '0'); + $objWriter->writeAttribute('val', $chart->getTitle()->isVisible() ? '0' : '1'); $objWriter->endElement(); // c:view3D diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php index 8e464627a..9fc5e55ff 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ChartsTest.php @@ -59,6 +59,30 @@ public function testNoChart() TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); } + + public function testTitleVisibility() + { + + $oPHPPowerPoint = new PhpPowerpoint(); + $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oShape = $oSlide->createChartShape(); + $oLine = new Line(); + $oShape->getPlotArea()->setType($oLine); + + $elementTitle = '/office:document-content/office:body/office:chart/chart:chart/chart:title'; + $elementStyle = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleTitle\']'; + + $this->assertTrue($oShape->getTitle()->isVisible()); + $this->assertInstanceOf('PhpOffice\PhpPowerpoint\Shape\Chart\Title', $oShape->getTitle()->setVisible(true)); + $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'ODPresentation'); + $this->assertTrue($oXMLDoc->elementExists($elementTitle, 'Object 1/content.xml')); + $this->assertTrue($oXMLDoc->elementExists($elementStyle, 'Object 1/content.xml')); + + $this->assertInstanceOf('PhpOffice\PhpPowerpoint\Shape\Chart\Title', $oShape->getTitle()->setVisible(false)); + $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'ODPresentation'); + $this->assertFalse($oXMLDoc->elementExists($elementTitle, 'Object 1/content.xml')); + $this->assertFalse($oXMLDoc->elementExists($elementStyle, 'Object 1/content.xml')); + } public function testChartBar3D() { diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php index 2bd5b713c..c83346bd3 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/ChartTest.php @@ -71,6 +71,28 @@ public function testPlotAreaBadType() TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); } + public function testTitleVisibility() + { + $element = '/c:chartSpace/c:chart/c:autoTitleDeleted'; + + $oPHPPowerPoint = new PhpPowerpoint(); + $oSlide = $oPHPPowerPoint->getActiveSlide(); + $oShape = $oSlide->createChartShape(); + $oLine = new Line(); + $oShape->getPlotArea()->setType($oLine); + + $this->assertTrue($oShape->getTitle()->isVisible()); + $this->assertInstanceOf('PhpOffice\PhpPowerpoint\Shape\Chart\Title', $oShape->getTitle()->setVisible(true)); + $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $this->assertEquals('0', $oXMLDoc->getElementAttribute($element, 'val', 'ppt/charts/'.$oShape->getIndexedFilename())); + + $this->assertInstanceOf('PhpOffice\PhpPowerpoint\Shape\Chart\Title', $oShape->getTitle()->setVisible(false)); + $oXMLDoc = TestHelperDOCX::getDocument($oPHPPowerPoint, 'PowerPoint2007'); + $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/charts/'.$oShape->getIndexedFilename())); + $this->assertEquals('1', $oXMLDoc->getElementAttribute($element, 'val', 'ppt/charts/'.$oShape->getIndexedFilename())); + } + public function testTypeBar3D() { $seriesData = array( From c8b57c02f3e8a25c175a1fb73eb20552e73881ab Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 3 Jul 2015 13:20:52 +0200 Subject: [PATCH 109/115] PowerPoint2007 Writer : Visibility of the Title doesn't work - @Progi1984 GH-107 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c105f6df..830026eae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ - PowerPoint2007 Writer : Hyperlink in table doesn't work - @Progi1984 GH-70 - PowerPoint2007 Writer : AutoFitNormal works with options (fontScale & lineSpacingReduction) - @Progi1984 @desigennaro GH-71 - PowerPoint2007 Writer : Shadow don't work for RichTextShapes - @Progi1984 GH-81 +- PowerPoint2007 Writer : Visibility of the Title doesn't work - @Progi1984 GH-107 - Refactor findLayoutIndex to findLayoutId where it assumes the slideLayout order was sorted. IMPROVED: unit tests - @kenliau GH-95 ### Miscellaneous From 9f73990565243cd926197ca37a7fc5e4738c7152 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 6 Jul 2015 14:12:39 +0200 Subject: [PATCH 110/115] IMPROVED : Unit Tests --- .../Writer/ODPresentation/Content.php | 3 - tests/PhpPowerpoint/Tests/Slide/NoteTest.php | 24 +++++ .../ODPresentation/AbstractPartTest.php | 29 ++++++ .../Writer/ODPresentation/ContentTest.php | 96 +++++++++++++++++-- .../Tests/Writer/ODPresentationTest.php | 13 +++ .../PowerPoint2007/AbstractPartTest.php | 18 ++++ 6 files changed, 172 insertions(+), 11 deletions(-) diff --git a/src/PhpPowerpoint/Writer/ODPresentation/Content.php b/src/PhpPowerpoint/Writer/ODPresentation/Content.php index 755ed0342..e5e82f3a2 100644 --- a/src/PhpPowerpoint/Writer/ODPresentation/Content.php +++ b/src/PhpPowerpoint/Writer/ODPresentation/Content.php @@ -719,9 +719,6 @@ public function writeGroupStyle(XMLWriter $objWriter, Group $group) if ($shape instanceof Table) { $this->writeTableStyle($objWriter, $shape); } - if ($shape instanceof Group) { - $this->writeGroupStyle($objWriter, $shape); - } } } diff --git a/tests/PhpPowerpoint/Tests/Slide/NoteTest.php b/tests/PhpPowerpoint/Tests/Slide/NoteTest.php index 2dd64e3e7..ede2bed16 100644 --- a/tests/PhpPowerpoint/Tests/Slide/NoteTest.php +++ b/tests/PhpPowerpoint/Tests/Slide/NoteTest.php @@ -39,6 +39,30 @@ public function testParent() $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Slide', $object->getParent()); } + public function testExtent() + { + $object = new Note(); + $this->assertNotNull($object->getExtentX()); + + $object = new Note(); + $this->assertNotNull($object->getExtentY()); + } + + public function testHashCode() + { + $object = new Note(); + $this->assertInternalType('string', $object->getHashCode()); + } + + public function testOffset() + { + $object = new Note(); + $this->assertNotNull($object->getOffsetX()); + + $object = new Note(); + $this->assertNotNull($object->getOffsetY()); + } + public function testShape() { $object = new Note(); diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php index dfef00833..1cf01d062 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php @@ -21,6 +21,7 @@ use PhpOffice\PhpPowerPoint\Shape\Group; use PhpOffice\PhpPowerpoint\Writer\ODPresentation\Drawing; use PhpOffice\PhpPowerpoint\Writer\ODPresentation\Manifest; +use PhpOffice\PhpPowerpoint\Writer\ODPresentation; use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; /** @@ -30,6 +31,13 @@ */ class AbstractPartTest extends \PHPUnit_Framework_TestCase { + protected function runProtectedMethod ($obj, $method, $args = array()) + { + $method = new \ReflectionMethod(get_class($obj), $method); + $method->setAccessible(true); + return $method->invokeArgs($obj, $args); + } + /** * Executed before each method of the class */ @@ -57,4 +65,25 @@ public function testWriterException() $oManifest->setParentWriter(new PowerPoint2007()); $oManifest->writePart(); } + + /** + * @expectedException \Exception + * @expectedExceptionMessage The $parentWriter is not an instance of \PhpOffice\PhpPowerpoint\Writer\ODPresentation + */ + public function testXMLWriterException() + { + $oManifest = new Manifest(); + $oManifest->setParentWriter(new PowerPoint2007()); + $this->runProtectedMethod($oManifest, 'getXMLWriter'); + } + + public function testXMLWriterWithDiskCaching() + { + $oODPresentation = new ODPresentation(); + $oODPresentation->setUseDiskCaching(true); + $oManifest = new Manifest(); + $oManifest->setParentWriter($oODPresentation); + + $this->assertNotEmpty(\PHPUnit_Framework_Assert::readAttribute($this->runProtectedMethod($oManifest, 'getXMLWriter'), 'tempFileName')); + } } diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index af703e3d4..623c93cba 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -27,6 +27,9 @@ use PhpOffice\PhpPowerpoint\Style\Color; use PhpOffice\PhpPowerpoint\Writer\ODPresentation; use PhpOffice\PhpPowerpoint\Tests\TestHelperDOCX; +use PhpOffice\Common\Drawing; +use PhpOffice\PhpPowerpoint\Style\Fill; +use PhpOffice\PhpPowerpoint\Style\PhpOffice\PhpPowerpoint\Style; /** * Test class for PhpOffice\PhpPowerpoint\Writer\ODPresentation\Manifest @@ -57,6 +60,23 @@ public function testDrawingWithHyperlink() $this->assertTrue($pres->elementExists($element, 'content.xml')); $this->assertEquals('https://github.com/PHPOffice/PHPPowerPoint/', $pres->getElementAttribute($element, 'xlink:href', 'content.xml')); } + + public function testGroup() + { + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShapeGroup = $oSlide->createGroup(); + $oShape = $oShapeGroup->createDrawingShape(); + $oShape->setPath(PHPPOWERPOINT_TESTS_BASE_DIR.'/resources/images/PHPPowerPointLogo.png'); + $oShape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/'); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + + $element = '/office:document-content/office:body/office:presentation/draw:page/draw:g'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $element = '/office:document-content/office:body/office:presentation/draw:page/draw:g/draw:frame/office:event-listeners/presentation:event-listener'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + } public function testList() { @@ -171,7 +191,7 @@ public function testNote() $this->assertTrue($pres->elementExists($element, 'content.xml')); } - public function testRichtextAutoShrink() + public function testRichTextAutoShrink() { $phpPowerPoint = new PhpPowerpoint(); $oSlide = $phpPowerPoint->getActiveSlide(); @@ -202,7 +222,7 @@ public function testRichtextAutoShrink() $this->assertEquals('true', $pres->getElementAttribute($element, 'draw:auto-grow-width', 'content.xml')); } - public function testRichtextBorder() + public function testRichTextBorder() { $phpPowerPoint = new PhpPowerpoint(); $oSlide = $phpPowerPoint->getActiveSlide(); @@ -241,18 +261,49 @@ public function testRichtextBorder() public function testRichTextShadow() { + $randAlpha = rand(0,100); $phpPowerPoint = new PhpPowerpoint(); $oSlide = $phpPowerPoint->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); $oRichText->createTextRun('AAA'); - $oRichText->getShadow()->setVisible(true)->setAlpha(75)->setBlurRadius(2)->setDirection(45); - - $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $oRichText->getShadow()->setVisible(true)->setAlpha($randAlpha)->setBlurRadius(2); $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties'; - $this->assertTrue($pres->elementExists($element, 'content.xml')); - $this->assertEquals('visible', $pres->getElementAttribute($element, 'draw:shadow', 'content.xml')); - $this->assertStringStartsWith('#', $pres->getElementAttribute($element, 'draw:shadow-color', 'content.xml')); + for ($inc = 0 ; $inc <= 360 ; $inc += 45) { + $randDistance = rand(0, 100); + $oRichText->getShadow()->setDirection($inc)->setDistance($randDistance); + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertEquals('visible', $pres->getElementAttribute($element, 'draw:shadow', 'content.xml')); + $this->assertEquals('none', $pres->getElementAttribute($element, 'style:mirror', 'content.xml')); + // Opacity + $this->assertStringStartsWith((string)(100 - $randAlpha), $pres->getElementAttribute($element, 'draw:shadow-opacity', 'content.xml')); + $this->assertStringEndsWith('%', $pres->getElementAttribute($element, 'draw:shadow-opacity', 'content.xml')); + // Color + $this->assertStringStartsWith('#', $pres->getElementAttribute($element, 'draw:shadow-color', 'content.xml')); + // X + $xOffset = $pres->getElementAttribute($element, 'draw:shadow-offset-x', 'content.xml'); + if ($inc == 90 || $inc == 270) { + $this->assertEquals('0cm', $xOffset); + } else { + if ($inc > 90 && $inc < 270) { + $this->assertEquals('-'.Drawing::pixelsToCentimeters($randDistance).'cm', $xOffset); + } else { + $this->assertEquals(Drawing::pixelsToCentimeters($randDistance).'cm', $xOffset); + } + } + // Y + $yOffset = $pres->getElementAttribute($element, 'draw:shadow-offset-y', 'content.xml'); + if ($inc == 0 || $inc == 180 || $inc == 360) { + $this->assertEquals('0cm', $yOffset); + } else { + if (($inc > 0 && $inc < 180) || $inc == 360) { + $this->assertEquals(Drawing::pixelsToCentimeters($randDistance).'cm', $yOffset); + } else { + $this->assertEquals('-'.Drawing::pixelsToCentimeters($randDistance).'cm', $yOffset); + } + } + } } public function testStyleAlignment() @@ -344,6 +395,32 @@ public function testTable() $this->assertTrue($pres->elementExists($element, 'content.xml')); } + public function testTableCellFill() + { + $oColor = new Color(); + $oColor->setRGB(Color::COLOR_BLUE); + + $oFill = new Fill(); + $oFill->setFillType(Fill::FILL_SOLID)->setStartColor($oColor); + + $phpPowerPoint = new PhpPowerpoint(); + $oSlide = $phpPowerPoint->getActiveSlide(); + $oShape = $oSlide->createTableShape(); + $oRow = $oShape->createRow(); + $oCell = $oRow->getCell(); + $oCell->setFill($oFill); + + $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1r0c0\']'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertEquals('table-cell', $pres->getElementAttribute($element, 'style:family', 'content.xml')); + $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1r0c0\']/style:graphic-properties'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); + $this->assertEquals('solid', $pres->getElementAttribute($element, 'draw:fill', 'content.xml')); + $this->assertStringStartsWith('#', $pres->getElementAttribute($element, 'draw:fill-color', 'content.xml')); + $this->assertStringEndsWith($oColor->getRGB(), $pres->getElementAttribute($element, 'draw:fill-color', 'content.xml')); + } + public function testTableWithColspan() { $value = rand(2, 100); @@ -394,11 +471,14 @@ public function testTableWithText() $oRow = $oShape->createRow(); $oCell = $oRow->getCell(); $oCell->addText($oRun); + $oCell->createBreak(); $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/table:table/table:table-row/table:table-cell/text:p/text:span'; $this->assertTrue($pres->elementExists($element, 'content.xml')); $this->assertEquals('Test', $pres->getElement($element, 'content.xml')->nodeValue); + $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/table:table/table:table-row/table:table-cell/text:p/text:span/text:line-break'; + $this->assertTrue($pres->elementExists($element, 'content.xml')); } public function testTransition() diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php index c13fac296..ba2998a34 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php @@ -78,6 +78,19 @@ public function testSave() unlink($filename); } + /** + * Test get PHPPowerPoint exception + * + * @expectedException Exception + * @expectedExceptionMessage Filename is empty + */ + public function testSaveEmpty() + { + $object = new ODPresentation(); + $phpPowerPoint = new PhpPowerpoint(); + $object->save(''); + } + /** * Test get writer part null */ diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php index fd3cee280..1feebd50b 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php @@ -21,6 +21,7 @@ use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Drawing; use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Rels; use PhpOffice\PhpPowerpoint\Writer\ODPresentation; +use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; /** * Test class for PhpOffice\PhpPowerpoint\Writer\ODPresentation @@ -29,6 +30,13 @@ */ class AbstractPartTest extends \PHPUnit_Framework_TestCase { + protected function runProtectedMethod ($obj, $method, $args = array()) + { + $method = new \ReflectionMethod(get_class($obj), $method); + $method->setAccessible(true); + return $method->invokeArgs($obj, $args); + } + /** * Executed before each method of the class */ @@ -56,4 +64,14 @@ public function testWriterException() $oManifest->setParentWriter(new ODPresentation()); $oManifest->writeRelationships(); } + + public function testXMLWriterWithDiskCaching() + { + $oPowerPoint2007 = new PowerPoint2007(); + $oPowerPoint2007->setUseDiskCaching(true); + $oRels = new Rels(); + $oRels->setParentWriter($oPowerPoint2007); + + $this->assertNotEmpty(\PHPUnit_Framework_Assert::readAttribute($this->runProtectedMethod($oRels, 'getXMLWriter'), 'tempFileName')); + } } From a1fd9f92ede390aaae1c48dc9dced31372c2f585 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 6 Jul 2015 14:18:56 +0200 Subject: [PATCH 111/115] IMPROVED : Unit Tests --- .../Tests/Writer/ODPresentation/AbstractPartTest.php | 2 +- .../PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php | 4 ++-- .../Tests/Writer/PowerPoint2007/AbstractPartTest.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php index 1cf01d062..c0f9ca7d0 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/AbstractPartTest.php @@ -31,7 +31,7 @@ */ class AbstractPartTest extends \PHPUnit_Framework_TestCase { - protected function runProtectedMethod ($obj, $method, $args = array()) + protected function runProtectedMethod($obj, $method, $args = array()) { $method = new \ReflectionMethod(get_class($obj), $method); $method->setAccessible(true); diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php index 623c93cba..4af9d7aca 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentation/ContentTest.php @@ -261,7 +261,7 @@ public function testRichTextBorder() public function testRichTextShadow() { - $randAlpha = rand(0,100); + $randAlpha = rand(0, 100); $phpPowerPoint = new PhpPowerpoint(); $oSlide = $phpPowerPoint->getActiveSlide(); $oRichText = $oSlide->createRichTextShape(); @@ -269,7 +269,7 @@ public function testRichTextShadow() $oRichText->getShadow()->setVisible(true)->setAlpha($randAlpha)->setBlurRadius(2); $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties'; - for ($inc = 0 ; $inc <= 360 ; $inc += 45) { + for ($inc = 0; $inc <= 360; $inc += 45) { $randDistance = rand(0, 100); $oRichText->getShadow()->setDirection($inc)->setDistance($randDistance); $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); diff --git a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php index 1feebd50b..73f251a29 100644 --- a/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/PowerPoint2007/AbstractPartTest.php @@ -30,7 +30,7 @@ */ class AbstractPartTest extends \PHPUnit_Framework_TestCase { - protected function runProtectedMethod ($obj, $method, $args = array()) + protected function runProtectedMethod($obj, $method, $args = array()) { $method = new \ReflectionMethod(get_class($obj), $method); $method->setAccessible(true); From 3689062b73afcad17e366d920a3282e09a0ffde0 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 6 Jul 2015 14:20:40 +0200 Subject: [PATCH 112/115] IMPROVED : Unit Tests (PHPMD fixes) --- tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php b/tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php index ba2998a34..62a25f7a5 100644 --- a/tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php +++ b/tests/PhpPowerpoint/Tests/Writer/ODPresentationTest.php @@ -87,7 +87,6 @@ public function testSave() public function testSaveEmpty() { $object = new ODPresentation(); - $phpPowerPoint = new PhpPowerpoint(); $object->save(''); } From 146479126a1c64cf92e24b7e4c2c31db2839b1e4 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 6 Jul 2015 14:33:52 +0200 Subject: [PATCH 113/115] Refactored the PowerPoint97 Reader for managing the group shape and improving evolutions - @Progi1984 GH-110 Fixes some Scrutinizer CI issues --- src/PhpPowerpoint/Reader/PowerPoint97.php | 26 ++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/PhpPowerpoint/Reader/PowerPoint97.php b/src/PhpPowerpoint/Reader/PowerPoint97.php index bcdf252a6..47fbe04bc 100644 --- a/src/PhpPowerpoint/Reader/PowerPoint97.php +++ b/src/PhpPowerpoint/Reader/PowerPoint97.php @@ -23,7 +23,6 @@ use PhpOffice\PhpPowerpoint\Shape\MemoryDrawing; use PhpOffice\PhpPowerpoint\Style\Alignment; use PhpOffice\PhpPowerpoint\Style\Color; -use PhpOffice\PhpPowerpoint\Shape\RichText\Paragraph; use PhpOffice\PhpPowerpoint\Shape\RichText; use PhpOffice\PhpPowerpoint\AbstractShape; use PhpOffice\PhpPowerpoint\Style\Bullet; @@ -1174,7 +1173,6 @@ private function readRecordOfficeArtClientAnchor($stream, $pos) break; case 0x00000010: throw new \Exception('PowerPoint97 Reader : record OfficeArtClientAnchor (0x00000010)'); - break; } } @@ -1405,10 +1403,10 @@ private function readRecordOfficeArtSpContainer($stream, $pos) if (is_object($this->oCurrentGroup)) { if (!$this->bFirstShapeGroup) { if ($clientAnchor['length'] > 0) { - $this->oCurrentGroup->setOffsetX($clientAnchor['left']); - $this->oCurrentGroup->setOffsetY($clientAnchor['top']); - $this->oCurrentGroup->setHeight($clientAnchor['height']); - $this->oCurrentGroup->setWidth($clientAnchor['width']); + // $this->oCurrentGroup->setOffsetX($clientAnchor['left']); + // $this->oCurrentGroup->setOffsetY($clientAnchor['top']); + // $this->oCurrentGroup->setHeight($clientAnchor['height']); + // $this->oCurrentGroup->setWidth($clientAnchor['width']); } $bIsGroup = true; $this->bFirstShapeGroup = true; @@ -2238,6 +2236,8 @@ private function readRecordOfficeArtClientData($stream, $pos) /** * An atom record that specifies a persist object directory. Each persist object identifier specified MUST be unique in that persist object directory. * @link http://msdn.microsoft.com/en-us/library/dd952680(v=office.12).aspx + * @param string $stream + * @param integer $pos * @throws \Exception */ private function readRecordPersistDirectoryAtom($stream, $pos) @@ -2735,6 +2735,8 @@ private function readRecordSlideShowSlideInfoAtom($stream, $pos) /** * UserEditAtom * @link http://msdn.microsoft.com/en-us/library/dd945746(v=office.12).aspx + * @param string $stream + * @param integer $pos * @throws \Exception */ private function readRecordUserEditAtom($stream, $pos) @@ -2860,15 +2862,15 @@ private function readStructureTextCFRun($stream, $pos, $strLenRT) $arrayReturn['fontName'] = isset($this->arrayFonts[$data]) ? $this->arrayFonts[$data] : ''; } if ($masksData['oldEATypeface'] == 1) { - $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 2; } if ($masksData['ansiTypeface'] == 1) { - $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 2; } if ($masksData['symbolTypeface'] == 1) { - $data = self::getInt2d($stream, $pos + $arrayReturn['length']); + // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 2; } if ($masksData['size'] == 1) { @@ -2903,7 +2905,7 @@ private function readStructureTextCFRun($stream, $pos, $strLenRT) /** * A structure that specifies the paragraph-level formatting of a run of text. * @param string $stream - * @param itn $pos + * @param integer $pos * @link https://msdn.microsoft.com/en-us/library/dd923535(v=office.12).aspx */ private function readStructureTextPFRun($stream, $pos, $strLenRT) @@ -3068,7 +3070,7 @@ private function readStructureTextPFRun($stream, $pos, $strLenRT) /** * A structure that specifies language and spelling information for a run of text. * @param string $stream - * @param itn $pos + * @param integer $pos * @link https://msdn.microsoft.com/en-us/library/dd909603(v=office.12).aspx */ private function readStructureTextSIRun($stream, $pos, $strLenRT) @@ -3127,7 +3129,7 @@ private function readStructureTextSIRun($stream, $pos, $strLenRT) /** * A structure that specifies tabbing, margins, and indentation for text. * @param string $stream - * @param int $pos + * @param integer $pos * @link https://msdn.microsoft.com/en-us/library/dd922749(v=office.12).aspx */ private function readStructureTextRuler($stream, $pos) From 39423f3fb4bad52efe3707586dff00425872f9f1 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 7 Jul 2015 10:38:15 +0200 Subject: [PATCH 114/115] Pre-Release 0.4.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 830026eae..a5d1f3a52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Changelog -## 0.4.0 - NOT RELEASED +## 0.4.0 - 2015-07-07 ### Features - Added support for grouping shapes together in a Group - @Pr0phet GH-68 From 31ab338840a63ed6d42b3d83718b672129180a00 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 7 Jul 2015 10:38:36 +0200 Subject: [PATCH 115/115] Pre-Release 0.4.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 341cf11fa..1d0ba9ea1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.0 \ No newline at end of file +0.4.0